diff --git a/packages/bbui/src/Icon/Icon.svelte b/packages/bbui/src/Icon/Icon.svelte
index 2f39fde0d9..fbaac7098c 100644
--- a/packages/bbui/src/Icon/Icon.svelte
+++ b/packages/bbui/src/Icon/Icon.svelte
@@ -9,6 +9,7 @@
export let size = "M"
export let hoverable = false
export let disabled = false
+ export let color
$: rotation = getRotation(direction)
@@ -25,7 +26,9 @@
focusable="false"
aria-hidden={hidden}
aria-label={name}
- style={`transform: rotate(${rotation}deg)`}
+ style={`transform: rotate(${rotation}deg); ${
+ color ? `color: ${color};` : ""
+ }`}
>
diff --git a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte
index 796f70b43b..18143c2071 100644
--- a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte
+++ b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte
@@ -8,6 +8,7 @@
import EditQueryPopover from "./popovers/EditQueryPopover.svelte"
import NavItem from "components/common/NavItem.svelte"
import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte"
+ import { customQueryIconText, customQueryIconColor } from "helpers/data/utils"
import ICONS from "./icons"
let openDataSources = []
@@ -129,6 +130,8 @@
- {#if icon}
+ {#if iconText}
+
+ {iconText}
+
+ {:else if icon}
-
+
{/if}
{text}
@@ -123,4 +129,9 @@
justify-content: center;
align-items: center;
}
+
+ .iconText {
+ margin-top: 1px;
+ font-size: var(--spectrum-global-dimension-font-size-50);
+ }
diff --git a/packages/builder/src/helpers/data/utils.js b/packages/builder/src/helpers/data/utils.js
index 03ee2bc602..62ae9e737e 100644
--- a/packages/builder/src/helpers/data/utils.js
+++ b/packages/builder/src/helpers/data/utils.js
@@ -1,3 +1,5 @@
+import { IntegrationTypes } from "constants/backend"
+
export function schemaToFields(schema) {
const response = {}
if (schema && typeof schema === "object") {
@@ -69,3 +71,40 @@ export function queryParametersToKeyValue(array) {
}
return obj
}
+
+export function customQueryIconText(datasource, query) {
+ if (datasource.source !== IntegrationTypes.REST) {
+ return
+ }
+ switch (query.queryVerb) {
+ case "create":
+ return "POST"
+ case "update":
+ return "PUT"
+ case "read":
+ return "GET"
+ case "delete":
+ return "DELETE"
+ case "patch":
+ return "PATCH"
+ }
+}
+
+export function customQueryIconColor(datasource, query) {
+ if (datasource.source !== IntegrationTypes.REST) {
+ return
+ }
+ switch (query.queryVerb) {
+ case "create":
+ return "#DCC339"
+ case "update":
+ return "#5197EC"
+ case "read":
+ return "#59B294"
+ case "delete":
+ return "#E16B71"
+ case "patch":
+ default:
+ return
+ }
+}
diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte
index 53a4b0bf41..e5bb02c796 100644
--- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte
@@ -41,6 +41,7 @@
import JSONPreview from "components/integration/JSONPreview.svelte"
import AccessLevelSelect from "components/integration/AccessLevelSelect.svelte"
import Placeholder from "assets/bb-spaceship.svg"
+ import { cloneDeep } from "lodash/fp"
let query, datasource
let breakQs = {},
@@ -61,7 +62,7 @@
response?.info?.code >= 200 && response?.info?.code <= 206
function getSelectedQuery() {
- return (
+ return cloneDeep(
$queries.list.find(q => q._id === $queries.selected) || {
datasourceId: $params.selectedDatasource,
parameters: [],