diff --git a/src/assets/icons/control.svg b/src/assets/icons/control.svg new file mode 100644 index 00000000..250d63bf --- /dev/null +++ b/src/assets/icons/control.svg @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts index b1ed0e9c..de90ab08 100644 --- a/src/hooks/useProcessor.ts +++ b/src/hooks/useProcessor.ts @@ -68,7 +68,7 @@ export function useQueryProcessor(config: any) { normal: selectorStore.currentService ? selectorStore.currentService.normal : true, - scope: config.catalog || dashboardStore.entity, + scope: config.catalog, topN: c.topN || 10, order: c.sortOrder || "DES", }; diff --git a/src/styles/reset.scss b/src/styles/reset.scss index e414df03..cbb3cacc 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -141,3 +141,15 @@ pre { .el-icon.menu-icons { margin-top: -3px !important; } + +.el-switch__label--left { + margin-right: 5px; +} + +.el-switch__label--right { + margin-left: 5px; +} + +.switch { + margin: 0 5px; +} diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 6e60c63c..ad7c7344 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -16,10 +16,12 @@ limitations under the License. -->
- {{ widget.title || "" }} + {{ decodeURIComponent(title) }}
- - + + + +
@@ -113,6 +115,8 @@ export default defineComponent({ const originConfig = dashboardStore.selectedGrid; const widget = computed(() => dashboardStore.selectedGrid.widget || {}); const graph = computed(() => dashboardStore.selectedGrid.graph || {}); + const title = computed(() => encodeURIComponent(widget.value.title || "")); + const tips = computed(() => encodeURIComponent(widget.value.tips || "")); function getSource(source: unknown) { states.source = source; @@ -152,6 +156,8 @@ export default defineComponent({ isEdit, widget, graph, + title, + tips, }; }, }); diff --git a/src/views/dashboard/configuration/widget/WidgetOptions.vue b/src/views/dashboard/configuration/widget/WidgetOptions.vue index b9d707ed..5372a649 100644 --- a/src/views/dashboard/configuration/widget/WidgetOptions.vue +++ b/src/views/dashboard/configuration/widget/WidgetOptions.vue @@ -20,7 +20,7 @@ limitations under the License. --> v-model="title" size="small" placeholder="Please input title" - @change="updateWidgetConfig({ title })" + @change="updateWidgetConfig({ title: encodeURIComponent(title) })" />
@@ -30,7 +30,7 @@ limitations under the License. --> v-model="tips" size="small" placeholder="Please input tips" - @change="updateWidgetConfig({ tips })" + @change="updateWidgetConfig({ tips: encodeURIComponent(tips) })" />
@@ -46,10 +46,14 @@ const widget = dashboardStore.selectedGrid.widget || {}; const title = ref(widget.title || ""); const tips = ref(widget.tips || ""); -function updateWidgetConfig(param: { [key: string]: unknown }) { +function updateWidgetConfig(param: { [key: string]: string }) { + const key = Object.keys(param)[0]; + if (!key) { + return; + } const widget = { ...dashboardStore.selectedGrid.widget, - ...param, + [key]: decodeURIComponent(param[key]), }; dashboardStore.selectWidget({ ...selectedGrid, widget }); } diff --git a/src/views/dashboard/configuration/widget/metric/Standard.vue b/src/views/dashboard/configuration/widget/metric/Standard.vue index 046a938f..47a3fbf6 100644 --- a/src/views/dashboard/configuration/widget/metric/Standard.vue +++ b/src/views/dashboard/configuration/widget/metric/Standard.vue @@ -21,7 +21,9 @@ limitations under the License. --> v-model="currentMetric.unit" size="small" placeholder="Please input unit" - @change="changeConfigs(index, { unit: currentMetric.unit })" + @change=" + updateConfig(index, { unit: encodeURIComponent(currentMetric.unit) }) + " />
@@ -31,7 +33,11 @@ limitations under the License. --> v-model="currentMetric.label" size="small" placeholder="Please input a name" - @change="changeConfigs(index, { label: currentMetric.label })" + @change=" + updateConfig(index, { + label: encodeURIComponent(currentMetric.label), + }) + " />
@@ -42,7 +48,9 @@ limitations under the License. --> size="small" placeholder="auto" @change=" - changeConfigs(index, { labelsIndex: currentMetric.labelsIndex }) + updateConfig(index, { + labelsIndex: encodeURIComponent(currentMetric.labelsIndex), + }) " />
@@ -108,13 +116,21 @@ const metricType = ref(metricTypes[props.index]); const isTopn = computed(() => ["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index]) ); +function updateConfig(index: number, param: { [key: string]: string }) { + const key = Object.keys(param)[0]; + if (!key) { + return; + } + changeConfigs(index, { key: decodeURIComponent(param[key]) }); +} function changeConfigs( index: number, param: { [key: string]: string | number } ) { const metricConfig = dashboardStore.selectedGrid.metricConfig || []; - metricConfig[index] = { ...metricConfig[index], ...param }; + metricConfig[index] = { ...metricConfig[index], ...param }; + currentMetric.value = metricConfig[index]; dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, metricConfig, diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts index e1b0d4f5..d5e578c0 100644 --- a/src/views/dashboard/data.ts +++ b/src/views/dashboard/data.ts @@ -174,17 +174,15 @@ export const AllTools = [ { name: "device_hub", content: "Add Topology", id: "addTopology" }, { name: "merge", content: "Add Trace", id: "addTrace" }, { name: "assignment", content: "Add Log", id: "addLog" }, - { name: "save", content: "Apply", id: "apply" }, ]; export const ServiceTools = [ - { name: "playlist_add", content: "Add Widget", id: "addWidget" }, - { name: "all_inbox", content: "Add Tab", id: "addTab" }, - { name: "library_books", content: "Add Text", id: "addText" }, - { name: "device_hub", content: "Add Topology", id: "addTopology" }, - { name: "merge", content: "Add Trace", id: "addTrace" }, - { name: "timeline", content: "Add Profile", id: "addProfile" }, - { name: "assignment", content: "Add Log", id: "addLog" }, - { name: "save", content: "Apply", id: "apply" }, + { name: "playlist_add", content: "Widget", id: "addWidget" }, + { name: "all_inbox", content: "Tab", id: "addTab" }, + { name: "library_books", content: "Text", id: "addText" }, + { name: "device_hub", content: "Topology", id: "addTopology" }, + { name: "merge", content: "Trace", id: "addTrace" }, + { name: "timeline", content: "Profile", id: "addProfile" }, + { name: "assignment", content: "Log", id: "addLog" }, ]; export const InstanceTools = [ { name: "playlist_add", content: "Add Widget", id: "addWidget" }, @@ -192,7 +190,6 @@ export const InstanceTools = [ { name: "library_books", content: "Add Text", id: "addText" }, { name: "merge", content: "Add Trace", id: "addTrace" }, { name: "assignment", content: "Add Log", id: "addLog" }, - { name: "save", content: "Apply", id: "apply" }, ]; export const EndpointTools = [ { name: "playlist_add", content: "Add Widget", id: "addWidget" }, @@ -201,28 +198,24 @@ export const EndpointTools = [ { name: "device_hub", content: "Add Topology", id: "addTopology" }, { name: "merge", content: "Add Trace", id: "addTrace" }, { name: "assignment", content: "Add Log", id: "addLog" }, - { name: "save", content: "Apply", id: "apply" }, ]; export const ServiceRelationTools = [ { name: "playlist_add", content: "Add Widget", id: "addWidget" }, { name: "all_inbox", content: "Add Tab", id: "addTab" }, { name: "library_books", content: "Add Text", id: "addText" }, { name: "device_hub", content: "Add Topology", id: "addTopology" }, - { name: "save", content: "Apply", id: "apply" }, ]; export const EndpointRelationTools = [ { name: "playlist_add", content: "Add Widget", id: "addWidget" }, { name: "all_inbox", content: "Add Tab", id: "addTab" }, { name: "library_books", content: "Add Text", id: "addText" }, - { name: "save", content: "Apply", id: "apply" }, ]; export const InstanceRelationTools = [ { name: "playlist_add", content: "Add Widget", id: "addWidget" }, { name: "all_inbox", content: "Add Tab", id: "addTab" }, { name: "library_books", content: "Add Text", id: "addText" }, { name: "device_hub", content: "Add Topology", id: "addTopology" }, - { name: "save", content: "Apply", id: "apply" }, ]; export const ScopeType = [ diff --git a/src/views/dashboard/graphs/Card.vue b/src/views/dashboard/graphs/Card.vue index 2c33eaf0..241dacc1 100644 --- a/src/views/dashboard/graphs/Card.vue +++ b/src/views/dashboard/graphs/Card.vue @@ -22,13 +22,14 @@ limitations under the License. --> > {{ singleVal.toFixed(2) }} - {{ metricConfig[0]?.unit }} + {{ decodeURIComponent(unit) }} -
No Data
+
{{ t("noData") }}