From 597e98e2915d778a3680ccfdcd6977c557aa08fe Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Sat, 19 Mar 2022 12:11:35 +0800 Subject: [PATCH] feat: Implement templates for dashboards (#28) --- src/App.vue | 1 - src/components/Graph.vue | 6 +- src/graphql/fragments/dashboard.ts | 46 ++- src/graphql/query/dashboard.ts | 15 +- src/hooks/data.ts | 8 - src/hooks/useProcessor.ts | 73 +++- src/layout/components/AppMain.vue | 16 +- src/layout/components/NavBar.vue | 15 +- src/locales/lang/en.ts | 22 +- src/locales/lang/zh.ts | 22 +- src/router/database.ts | 12 +- src/router/{generalService.ts => general.ts} | 22 +- src/router/index.ts | 6 +- src/router/serviceMesh.ts | 39 +- src/store/data.ts | 158 ------- src/store/modules/app.ts | 24 +- src/store/modules/dashboard.ts | 197 +++++++-- src/store/modules/log.ts | 4 +- src/store/modules/profile.ts | 4 +- src/types/dashboard.ts | 13 +- src/utils/{dateTime.ts => file.ts} | 50 +-- src/utils/localtime.ts | 30 -- src/views/Layer.vue | 101 +++++ src/views/Settings.vue | 1 - src/views/components/ConditionTags.vue | 1 - src/views/dashboard/Edit.vue | 71 ++-- src/views/dashboard/List.vue | 389 +++++++++++++++--- src/views/dashboard/New.vue | 30 +- src/views/dashboard/configuration/Widget.vue | 14 +- .../configuration/widget/MetricOptions.vue | 162 ++++++-- .../configuration/widget/StandardOptions.vue | 104 +++-- .../widget/graph-styles/Card.vue | 4 +- .../widget/graph-styles/Line.vue | 18 + .../widget/graph-styles/ServiceList.vue | 16 +- .../widget/graph-styles/Table.vue | 4 + src/views/dashboard/controls/Log.vue | 9 +- src/views/dashboard/controls/Profile.vue | 9 +- src/views/dashboard/controls/Tab.vue | 27 +- src/views/dashboard/controls/Topology.vue | 9 +- src/views/dashboard/controls/Trace.vue | 4 +- src/views/dashboard/controls/Widget.vue | 57 ++- src/views/dashboard/data.ts | 54 ++- src/views/dashboard/graphs/Card.vue | 8 +- src/views/dashboard/graphs/EndpointList.vue | 91 ++-- src/views/dashboard/graphs/InstanceList.vue | 91 ++-- src/views/dashboard/graphs/Line.vue | 6 +- src/views/dashboard/graphs/ServiceList.vue | 148 +++++-- src/views/dashboard/graphs/Table.vue | 39 +- src/views/dashboard/graphs/style.scss | 5 + src/views/dashboard/panel/Layout.vue | 23 +- src/views/dashboard/panel/Tool.vue | 72 ++-- src/views/dashboard/related/log/Header.vue | 2 +- .../dashboard/related/profile/Header.vue | 3 +- src/views/service/Endpoints.vue | 23 -- src/views/service/Metrics.vue | 24 -- src/views/service/Panel.vue | 110 ----- src/views/service/Profiles.vue | 31 -- src/views/service/Service.vue | 131 ------ src/views/service/Topology.vue | 30 -- src/views/service/Traces.vue | 31 -- src/views/service/data.ts | 41 -- 61 files changed, 1583 insertions(+), 1193 deletions(-) rename src/router/{generalService.ts => general.ts} (69%) rename src/utils/{dateTime.ts => file.ts} (50%) create mode 100644 src/views/Layer.vue delete mode 100644 src/views/service/Endpoints.vue delete mode 100644 src/views/service/Metrics.vue delete mode 100644 src/views/service/Panel.vue delete mode 100644 src/views/service/Profiles.vue delete mode 100644 src/views/service/Service.vue delete mode 100644 src/views/service/Topology.vue delete mode 100644 src/views/service/Traces.vue delete mode 100644 src/views/service/data.ts diff --git a/src/App.vue b/src/App.vue index 93fd29d8..3f4af22a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,7 +15,6 @@ limitations under the License. --> - diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 60a75850..947e89a4 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -76,7 +76,6 @@ import { ref, reactive } from "vue"; import { useI18n } from "vue-i18n"; import { useAppStoreWithOut } from "@/store/modules/app"; import timeFormat from "@/utils/timeFormat"; -import { ElSwitch } from "element-plus"; const { t, locale } = useI18n(); const state = reactive<{ timer: ReturnType | null }>({ diff --git a/src/views/components/ConditionTags.vue b/src/views/components/ConditionTags.vue index 4fb39719..f85bae98 100644 --- a/src/views/components/ConditionTags.vue +++ b/src/views/components/ConditionTags.vue @@ -65,7 +65,6 @@ const tagsList = ref([]); function removeTags(index: number) { tagsList.value.splice(index, 1); updateTags(); - localStorage.setItem("traceTags", JSON.stringify(this.tagsList)); } function addLabels() { if (!tags.value) { diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index d6b3e24a..3da6c974 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -13,8 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue index fe56d192..08f03777 100644 --- a/src/views/dashboard/List.vue +++ b/src/views/dashboard/List.vue @@ -17,13 +17,14 @@ limitations under the License. -->
@@ -33,38 +34,106 @@ limitations under the License. -->
- - - - - - - - +
+ + + + + + + + + + + + +
+ + + {{ t("export") }} + + + + + +
+
diff --git a/src/views/dashboard/New.vue b/src/views/dashboard/New.vue index 286db407..1ba4e5bb 100644 --- a/src/views/dashboard/New.vue +++ b/src/views/dashboard/New.vue @@ -51,15 +51,17 @@ limitations under the License. --> diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 045fd802..28ada4ce 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -17,6 +17,9 @@ limitations under the License. -->
{{ dashboardStore.selectedGrid.widget.title }} + + ({{ dashboardStore.selectedGrid.standard.unit }}) +
@@ -33,6 +36,8 @@ limitations under the License. --> i: dashboardStore.selectedGrid.i, metrics: dashboardStore.selectedGrid.metrics, metricTypes: dashboardStore.selectedGrid.metricTypes, + standard: dashboardStore.selectedGrid.standard, + isEdit: true, }" />
@@ -55,7 +60,7 @@ limitations under the License. --> - +
@@ -98,7 +103,7 @@ export default defineComponent({ const loading = ref(false); const states = reactive<{ activeNames: string; - source: any; + source: unknown; index: string; visType: Option[]; }>({ @@ -209,4 +214,9 @@ export default defineComponent({ .ds-name { margin-bottom: 10px; } + +.unit { + display: inline-block; + margin-left: 5px; +} diff --git a/src/views/dashboard/configuration/widget/MetricOptions.vue b/src/views/dashboard/configuration/widget/MetricOptions.vue index 3e9ef323..8682dae3 100644 --- a/src/views/dashboard/configuration/widget/MetricOptions.vue +++ b/src/views/dashboard/configuration/widget/MetricOptions.vue @@ -13,14 +13,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->