From 9cb8e2b64d9b6ccb3e5a875a119437a823f9e02a Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 15 Dec 2021 15:43:38 +0800 Subject: [PATCH 1/6] feat: add selector module --- src/App.vue | 1 - src/components/TimePicker.vue | 2 +- src/graph/fragments/{global.ts => app.ts} | 0 src/graph/fragments/selector.ts | 32 ++++++ src/graph/index.ts | 5 +- src/graph/query/{global.ts => app.ts} | 2 +- src/graph/query/selector.ts | 20 ++++ src/locales/lang/en.ts | 1 + src/locales/lang/zh.ts | 1 + src/store/modules/{app/index.ts => app.ts} | 0 src/store/modules/selectors.ts | 54 +++++++++ src/styles/reset.scss | 2 +- src/utils/cancelToken.ts | 4 +- src/views/dashboard/List.vue | 6 +- src/views/dashboard/New.vue | 122 ++++++++++++++++++++- 15 files changed, 238 insertions(+), 14 deletions(-) rename src/graph/fragments/{global.ts => app.ts} (100%) create mode 100644 src/graph/fragments/selector.ts rename src/graph/query/{global.ts => app.ts} (93%) create mode 100644 src/graph/query/selector.ts rename src/store/modules/{app/index.ts => app.ts} (100%) create mode 100644 src/store/modules/selectors.ts diff --git a/src/App.vue b/src/App.vue index 823d6cea..74859ffc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -18,7 +18,6 @@ limitations under the License. --> From 1b30216545546ff1df5f3e7416ad5ada308c9e10 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 15 Dec 2021 16:57:00 +0800 Subject: [PATCH 2/6] feat: add new dashboard --- src/components/TimePicker.vue | 2 +- src/layout/components/NavBar.vue | 1 + src/views/dashboard/New.vue | 133 +++++++++---- src/views/dashboard/data.ts | 315 +++++++++++++++++++++++++++++++ 4 files changed, 415 insertions(+), 36 deletions(-) create mode 100644 src/views/dashboard/data.ts diff --git a/src/components/TimePicker.vue b/src/components/TimePicker.vue index 2e271955..17625d9f 100755 --- a/src/components/TimePicker.vue +++ b/src/components/TimePicker.vue @@ -492,7 +492,7 @@ watch( } .datepicker-range { - min-width: 260px; + min-width: 238px; } .datepicker-range .datepicker-popup { diff --git a/src/layout/components/NavBar.vue b/src/layout/components/NavBar.vue index 59f10033..27501d0a 100644 --- a/src/layout/components/NavBar.vue +++ b/src/layout/components/NavBar.vue @@ -91,6 +91,7 @@ watch( background-color: #fafbfc; border-bottom: 1px solid #dfe4e8; color: #222; + font-size: 12px; } .nav-bar.dark { background-color: #333840; diff --git a/src/views/dashboard/New.vue b/src/views/dashboard/New.vue index 141042bb..45d55f49 100644 --- a/src/views/dashboard/New.vue +++ b/src/views/dashboard/New.vue @@ -15,16 +15,24 @@ limitations under the License. --> diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts new file mode 100644 index 00000000..9e521e81 --- /dev/null +++ b/src/views/dashboard/data.ts @@ -0,0 +1,315 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +export const EntityType = [ + { value: "Service", label: "Service" }, + { value: "All", label: "All" }, + { value: "Endpoint", label: "Service Endpoint" }, + { value: "ServiceInstance", label: "Service Instance" }, + { value: "ServiceRelation", label: "Service Relation" }, + { value: "ServiceInstanceRelation", label: "Service Instance Relation" }, + { value: "EndpointRelation", label: "Endpoint Relation" }, +]; +export const SelectOpt = [ + { + value: "guide", + label: "Guide", + children: [ + { + value: "disciplines", + label: "Disciplines", + children: [ + { + value: "consistency", + label: "Consistency", + }, + { + value: "feedback", + label: "Feedback", + }, + { + value: "efficiency", + label: "Efficiency", + }, + { + value: "controllability", + label: "Controllability", + }, + ], + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "side nav", + label: "Side Navigation", + }, + { + value: "top nav", + label: "Top Navigation", + }, + ], + }, + ], + }, + { + value: "component", + label: "Component", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout", + }, + { + value: "color", + label: "Color", + }, + { + value: "typography", + label: "Typography", + }, + { + value: "icon", + label: "Icon", + }, + { + value: "button", + label: "Button", + }, + ], + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio", + }, + { + value: "checkbox", + label: "Checkbox", + }, + { + value: "input", + label: "Input", + }, + { + value: "input-number", + label: "InputNumber", + }, + { + value: "select", + label: "Select", + }, + { + value: "cascader", + label: "Cascader", + }, + { + value: "switch", + label: "Switch", + }, + { + value: "slider", + label: "Slider", + }, + { + value: "time-picker", + label: "TimePicker", + }, + { + value: "date-picker", + label: "DatePicker", + }, + { + value: "datetime-picker", + label: "DateTimePicker", + }, + { + value: "upload", + label: "Upload", + }, + { + value: "rate", + label: "Rate", + }, + { + value: "form", + label: "Form", + }, + ], + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table", + }, + { + value: "tag", + label: "Tag", + }, + { + value: "progress", + label: "Progress", + }, + { + value: "tree", + label: "Tree", + }, + { + value: "pagination", + label: "Pagination", + }, + { + value: "badge", + label: "Badge", + }, + ], + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert", + }, + { + value: "loading", + label: "Loading", + }, + { + value: "message", + label: "Message", + }, + { + value: "message-box", + label: "MessageBox", + }, + { + value: "notification", + label: "Notification", + }, + ], + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "Menu", + }, + { + value: "tabs", + label: "Tabs", + }, + { + value: "breadcrumb", + label: "Breadcrumb", + }, + { + value: "dropdown", + label: "Dropdown", + }, + { + value: "steps", + label: "Steps", + }, + ], + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog", + }, + { + value: "tooltip", + label: "Tooltip", + }, + { + value: "popover", + label: "Popover", + }, + { + value: "card", + label: "Card", + }, + { + value: "carousel", + label: "Carousel", + }, + { + value: "collapse", + label: "Collapse", + }, + ], + }, + ], + }, + { + value: "resource", + label: "Resource", + children: [ + { + value: "axure", + label: "Axure Components", + }, + { + value: "sketch", + label: "Sketch Templates", + }, + { + value: "docs", + label: "Design Documentation", + }, + ], + }, +]; +export const Options = [ + { + value: "Option1", + label: "Option1", + }, + { + value: "Option2", + label: "Option2", + }, + { + value: "Option3", + label: "Option3", + }, + { + value: "Option4", + label: "Option4", + }, + { + value: "Option5", + label: "Option5", + }, +]; From b0f6194f0c9e3562d7471f9dee4e350ccacb947c Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 15 Dec 2021 17:39:56 +0800 Subject: [PATCH 3/6] feat: add axiosCancel --- src/router/index.ts | 12 ++++++++++++ src/shims-vue.d.ts | 8 ++++++++ src/views/dashboard/New.vue | 14 ++++++-------- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 71c22d0c..95a2080f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -43,4 +43,16 @@ const router = createRouter({ routes, }); +(window as any).axiosCancel = []; + +router.beforeEach((to, from, next) => { + const token = window.localStorage.getItem("skywalking-authority"); + if ((window as any).axiosCancel.length !== 0) { + for (const func of (window as any).axiosCancel) { + setTimeout(func(), 0); + } + (window as any).axiosCancel = []; + } + next(); +}); export default router; diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 81a9eb4c..a65cf341 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -19,3 +19,11 @@ declare module "*.vue" { const Component: ReturnType; export default Component; } +declare global { + namespace JSX {} + interface Window { + Promise: any; + moment: any; + axiosCancel: any; + } +} diff --git a/src/views/dashboard/New.vue b/src/views/dashboard/New.vue index 45d55f49..f104bb27 100644 --- a/src/views/dashboard/New.vue +++ b/src/views/dashboard/New.vue @@ -149,10 +149,10 @@ import { ElInput, ElButton, } from "element-plus"; -// import { useSelectorStore } from "@/store/modules/selectors"; +import { useSelectorStore } from "@/store/modules/selectors"; import { EntityType, SelectOpt, Options } from "./data"; -// const selectorStore = useSelectorStore(); +const selectorStore = useSelectorStore(); const props = { expandTrigger: "hover", }; @@ -173,24 +173,22 @@ const handleChange = (value: any) => { const onCreate = () => { console.log(state); }; -// selectorStore.fetchServices("general"); +selectorStore.fetchServices("general");