This is an automated email from the ASF dual-hosted git repository. qiuxiafan pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git
commit d659935773e9fb77032229dee7a64122b106938a Author: Qiuxia Fan <[email protected]> AuthorDate: Tue Dec 14 15:16:52 2021 +0800 feat: add dashboard list --- .../Dashboard.vue => assets/icons/search.svg} | 15 +-- src/layout/components/NavBar.vue | 2 +- src/locales/lang/en.ts | 2 +- src/router/dashboard.ts | 16 +-- src/router/database.ts | 2 +- src/router/generalService.ts | 2 +- src/router/infrastructure.ts | 4 +- src/router/serviceMesh.ts | 6 +- src/styles/lib.scss | 3 + src/views/dashboard/List.vue | 113 +++++++++++++++++++++ src/views/{Dashboard.vue => dashboard/New.vue} | 2 +- src/views/{ => infrastructure}/Infrastructure.vue | 2 +- src/views/{ => service}/Service.vue | 0 13 files changed, 140 insertions(+), 29 deletions(-) diff --git a/src/views/Dashboard.vue b/src/assets/icons/search.svg similarity index 57% copy from src/views/Dashboard.vue copy to src/assets/icons/search.svg index 6e121b2..c5af029 100644 --- a/src/views/Dashboard.vue +++ b/src/assets/icons/search.svg @@ -5,19 +5,14 @@ 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 + 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. --> -<template> - <div class="about">{{ props.msg }}</div> -</template> -<script lang="ts" setup> -import { defineProps } from "vue"; -const props = defineProps({ - msg: String, -}); -</script> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> +<title>search</title> +<path d="M9.516 14.016q1.875 0 3.188-1.313t1.313-3.188-1.313-3.188-3.188-1.313-3.188 1.313-1.313 3.188 1.313 3.188 3.188 1.313zM15.516 14.016l4.969 4.969-1.5 1.5-4.969-4.969v-0.797l-0.281-0.281q-1.781 1.547-4.219 1.547-2.719 0-4.617-1.875t-1.898-4.594 1.898-4.617 4.617-1.898 4.594 1.898 1.875 4.617q0 0.984-0.469 2.227t-1.078 1.992l0.281 0.281h0.797z"></path> +</svg> diff --git a/src/layout/components/NavBar.vue b/src/layout/components/NavBar.vue index 2b98c8b..59f1003 100644 --- a/src/layout/components/NavBar.vue +++ b/src/layout/components/NavBar.vue @@ -57,7 +57,7 @@ const utcHour = isNaN(Number(utcArr[0])) ? 0 : Number(utcArr[0]); const utcMin = isNaN(Number(utcArr[1])) ? 0 : Number(utcArr[1]); appStore.setUTC(utcHour, utcMin); -console.log(route); + const setConfig = (value: string) => { pageName.value = value || ""; theme.value = route.path.includes("/infrastructure/") ? "dark" : "light"; diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 789ada7..05fe3fc 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -23,7 +23,7 @@ const msg = { infrastructure: "Infrastructure", virtualMachine: "Virtual Machine", kubernetes: "Kubernetes", - dashboardHome: "Dashboard Home", + dashboardNew: "New Dashboard", dashboardList: "Dashboard List", logs: "Logs", events: "Events", diff --git a/src/router/dashboard.ts b/src/router/dashboard.ts index f6d2559..9082909 100644 --- a/src/router/dashboard.ts +++ b/src/router/dashboard.ts @@ -30,20 +30,20 @@ export const routesDashboard: Array<RouteRecordRaw> = [ }, children: [ { - path: "/dashboard/home", - component: () => import("@/views/Service.vue"), - name: "Home", + path: "/dashboard/list", + component: () => import("@/views/dashboard/List.vue"), + name: "List", meta: { - title: "dashboardHome", + title: "dashboardList", exact: false, }, }, { - path: "/dashboard/list", - component: () => import("@/views/Log.vue"), - name: "List", + path: "/dashboard/new", + component: () => import("@/views/dashboard/New.vue"), + name: "New", meta: { - title: "dashboardList", + title: "dashboardNew", exact: false, }, }, diff --git a/src/router/database.ts b/src/router/database.ts index 6eb5148..2b08c1f 100644 --- a/src/router/database.ts +++ b/src/router/database.ts @@ -36,7 +36,7 @@ export const routesDatabase: Array<RouteRecordRaw> = [ headPath: "/database", exact: true, }, - component: () => import("@/views/Service.vue"), + component: () => import("@/views/service/Service.vue"), }, { path: "/database/:id/:type", diff --git a/src/router/generalService.ts b/src/router/generalService.ts index a8b4d38..a88dbae 100644 --- a/src/router/generalService.ts +++ b/src/router/generalService.ts @@ -38,7 +38,7 @@ export const routesGen: Array<RouteRecordRaw> = [ headPath: "/generalService/service", exact: true, }, - component: () => import("@/views/Service.vue"), + component: () => import("@/views/service/Service.vue"), }, { path: "/generalService/service/:id/:type", diff --git a/src/router/infrastructure.ts b/src/router/infrastructure.ts index 8257df8..6ec33f2 100644 --- a/src/router/infrastructure.ts +++ b/src/router/infrastructure.ts @@ -35,7 +35,7 @@ export const routesInfra: Array<RouteRecordRaw> = [ meta: { title: "virtualMachine", }, - component: () => import("@/views/Infrastructure.vue"), + component: () => import("@/views/infrastructure/Infrastructure.vue"), }, { path: "/infrastructure/k8s", @@ -43,7 +43,7 @@ export const routesInfra: Array<RouteRecordRaw> = [ meta: { title: "kubernetes", }, - component: () => import("@/views/Infrastructure.vue"), + component: () => import("@/views/infrastructure/Infrastructure.vue"), }, ], }, diff --git a/src/router/serviceMesh.ts b/src/router/serviceMesh.ts index 81b2897..1f9e674 100644 --- a/src/router/serviceMesh.ts +++ b/src/router/serviceMesh.ts @@ -36,7 +36,7 @@ export const routesMesh: Array<RouteRecordRaw> = [ title: "services", headPath: "/mesh/services", }, - component: () => import("@/views/Service.vue"), + component: () => import("@/views/service/Service.vue"), }, { path: "/mesh/controlPanel", @@ -45,7 +45,7 @@ export const routesMesh: Array<RouteRecordRaw> = [ title: "controlPanel", headPath: "/mesh/controlPanel", }, - component: () => import("@/views/Service.vue"), + component: () => import("@/views/service/Service.vue"), }, { path: "/mesh/dataPanel", @@ -54,7 +54,7 @@ export const routesMesh: Array<RouteRecordRaw> = [ title: "dataPanel", headPath: "/mesh/dataPanel", }, - component: () => import("@/views/Service.vue"), + component: () => import("@/views/service/Service.vue"), }, { path: "/mesh/services/:id/:type", diff --git a/src/styles/lib.scss b/src/styles/lib.scss index 069c6f1..c783820 100644 --- a/src/styles/lib.scss +++ b/src/styles/lib.scss @@ -55,6 +55,9 @@ .grey { color: #a7aebb; } +.white { + color: #fff; +} .bg-green { background-color: #4caf50; } diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue new file mode 100644 index 0000000..01b5974 --- /dev/null +++ b/src/views/dashboard/List.vue @@ -0,0 +1,113 @@ +<!-- 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. --> +<template> + <div class="dashboard-list"> + <div class="flex-h header" style="margin: 10px 0"> + <el-input + v-model="searchText" + placeholder="Please input" + class="input-with-search" + size="small" + > + <template #append> + <el-button size="small"> + <Icon size="lg" iconName="search" /> + </el-button> + </template> + </el-input> + <router-link to="/dashboard/new"> + <el-button size="small" type="primary">+ New Dashboard</el-button> + </router-link> + </div> + <el-table :data="tableData" style="width: 100%" max-height="550"> + <el-table-column fixed prop="name" label="Name" /> + <el-table-column prop="type" label="type" /> + <el-table-column prop="date" label="Date" /> + <el-table-column label="Operations"> + <template #default="scope"> + <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"> + View + </el-button> + <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"> + Edit + </el-button> + <el-button + size="mini" + type="danger" + @click="handleDelete(scope.$index, scope.row)" + > + Delete + </el-button> + </template> + </el-table-column> + </el-table> + </div> +</template> +<script lang="ts" setup> +import { ref } from "vue"; +import { ElTable, ElTableColumn, ElButton, ElInput } from "element-plus"; +// # - os-linux +// # - k8s +// # - general(agent-installed) +// # - faas +// # - mesh +// # - mesh-cp +// # - mesh-dp +// # - database +// # - cache +// # - browser +// # - skywalking +const searchText = ref<string>(""); +const tableData = [ + { + date: "2016-05-03", + name: "xxx", + type: "general", + }, + { + date: "2016-05-02", + name: "xxx", + type: "k8s", + }, + { + date: "2016-05-04", + name: "xxx", + type: "database", + }, + { + date: "2016-05-01", + name: "Tom", + type: "mesh", + }, +]; +const handleEdit = (index: number, row: any) => { + console.log(index, row); +}; +const handleDelete = (index: number, row: any) => { + console.log(index, row); +}; +</script> +<style lang="scss" scoped> +.header { + flex-direction: row-reverse; +} +.dashboard-list { + padding: 20px; +} +.input-with-search { + width: 300px; + margin-left: 20px; +} +</style> diff --git a/src/views/Dashboard.vue b/src/views/dashboard/New.vue similarity index 94% rename from src/views/Dashboard.vue rename to src/views/dashboard/New.vue index 6e121b2..01ccb74 100644 --- a/src/views/Dashboard.vue +++ b/src/views/dashboard/New.vue @@ -13,7 +13,7 @@ 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. --> <template> - <div class="about">{{ props.msg }}</div> + <div class="new-dashboard">{{ props.msg }}</div> </template> <script lang="ts" setup> import { defineProps } from "vue"; diff --git a/src/views/Infrastructure.vue b/src/views/infrastructure/Infrastructure.vue similarity index 93% rename from src/views/Infrastructure.vue rename to src/views/infrastructure/Infrastructure.vue index 0cf858b..8312940 100644 --- a/src/views/Infrastructure.vue +++ b/src/views/infrastructure/Infrastructure.vue @@ -19,7 +19,7 @@ limitations under the License. --> </template> <script lang="ts" setup> -import InfrastructureMap from "./infrastructure/InfrastructureMap.vue"; +import InfrastructureMap from "./InfrastructureMap.vue"; </script> <style scoped> .Infrastructure { diff --git a/src/views/Service.vue b/src/views/service/Service.vue similarity index 100% rename from src/views/Service.vue rename to src/views/service/Service.vue
