mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 06:24:05 +00:00
feat: add list components config
This commit is contained in:
parent
db8338ffa5
commit
2e82d52e71
@ -73,6 +73,7 @@ const msg = {
|
|||||||
showBackground: "Show Background",
|
showBackground: "Show Background",
|
||||||
areaOpacity: "Area Opacity",
|
areaOpacity: "Area Opacity",
|
||||||
editGraph: "Edit Graph Options",
|
editGraph: "Edit Graph Options",
|
||||||
|
dashboardName: "Select Dashboard Name",
|
||||||
hourTip: "Select Hour",
|
hourTip: "Select Hour",
|
||||||
minuteTip: "Select Minute",
|
minuteTip: "Select Minute",
|
||||||
secondTip: "Select Second",
|
secondTip: "Select Second",
|
||||||
|
@ -71,6 +71,7 @@ const msg = {
|
|||||||
showBackground: "显示背景",
|
showBackground: "显示背景",
|
||||||
areaOpacity: "透明度",
|
areaOpacity: "透明度",
|
||||||
editGraph: "编辑图表选项",
|
editGraph: "编辑图表选项",
|
||||||
|
dashboardName: "选择仪表板名称",
|
||||||
hourTip: "选择小时",
|
hourTip: "选择小时",
|
||||||
minuteTip: "选择分钟",
|
minuteTip: "选择分钟",
|
||||||
secondTip: "选择秒数",
|
secondTip: "选择秒数",
|
||||||
|
@ -47,7 +47,14 @@ export interface StandardConfig {
|
|||||||
seconds?: string;
|
seconds?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GraphConfig = BarConfig | LineConfig | CardConfig | TableConfig;
|
export type GraphConfig =
|
||||||
|
| BarConfig
|
||||||
|
| LineConfig
|
||||||
|
| CardConfig
|
||||||
|
| TableConfig
|
||||||
|
| EndpointListConfig
|
||||||
|
| ServiceListConfig
|
||||||
|
| InstanceListConfig;
|
||||||
export interface BarConfig {
|
export interface BarConfig {
|
||||||
type?: string;
|
type?: string;
|
||||||
showBackground?: boolean;
|
showBackground?: boolean;
|
||||||
@ -81,3 +88,21 @@ export interface TopListConfig {
|
|||||||
type?: string;
|
type?: string;
|
||||||
topN: number;
|
topN: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ServiceListConfig {
|
||||||
|
type?: string;
|
||||||
|
dashboardName: string;
|
||||||
|
fontSize: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InstanceListConfig {
|
||||||
|
type?: string;
|
||||||
|
dashboardName: string;
|
||||||
|
fontSize: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EndpointListConfig {
|
||||||
|
type?: string;
|
||||||
|
dashboardName: string;
|
||||||
|
fontSize: number;
|
||||||
|
}
|
||||||
|
@ -50,8 +50,21 @@ limitations under the License. -->
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="t('metricName')" name="2">
|
<el-collapse-item
|
||||||
<div>
|
:title="t(states.isTable ? 'dashboardName' : 'metricName')"
|
||||||
|
name="2"
|
||||||
|
>
|
||||||
|
<div v-if="states.isTable">
|
||||||
|
<Selector
|
||||||
|
:value="states.graph.dashboardName"
|
||||||
|
:options="metricOpts"
|
||||||
|
size="mini"
|
||||||
|
placeholder="Select a dashboard"
|
||||||
|
@change="changeDashboard"
|
||||||
|
class="selectors"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
<Selector
|
<Selector
|
||||||
:value="states.metrics"
|
:value="states.metrics"
|
||||||
:options="metricOpts"
|
:options="metricOpts"
|
||||||
@ -66,7 +79,6 @@ limitations under the License. -->
|
|||||||
:value="states.valueType"
|
:value="states.valueType"
|
||||||
:options="states.valueTypes"
|
:options="states.valueTypes"
|
||||||
size="mini"
|
size="mini"
|
||||||
placeholder="Select a metric"
|
|
||||||
@change="changeValueType"
|
@change="changeValueType"
|
||||||
class="selectors"
|
class="selectors"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
@ -117,6 +129,7 @@ import {
|
|||||||
ChartTypes,
|
ChartTypes,
|
||||||
DefaultGraphConfig,
|
DefaultGraphConfig,
|
||||||
PodsChartTypes,
|
PodsChartTypes,
|
||||||
|
TableChartTypes,
|
||||||
} from "../data";
|
} from "../data";
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
import { WidgetConfig, GraphConfig, StandardConfig } from "@/types/dashboard";
|
import { WidgetConfig, GraphConfig, StandardConfig } from "@/types/dashboard";
|
||||||
@ -148,10 +161,11 @@ export default defineComponent({
|
|||||||
activeNames: string;
|
activeNames: string;
|
||||||
source: any;
|
source: any;
|
||||||
index: string;
|
index: string;
|
||||||
graph: GraphConfig;
|
graph: GraphConfig | any;
|
||||||
widget: WidgetConfig | any;
|
widget: WidgetConfig | any;
|
||||||
standard: StandardConfig;
|
standard: StandardConfig;
|
||||||
visType: Option[];
|
visType: Option[];
|
||||||
|
isTable: boolean;
|
||||||
}>({
|
}>({
|
||||||
metrics: selectedGrid.metrics || [],
|
metrics: selectedGrid.metrics || [],
|
||||||
valueTypes: [],
|
valueTypes: [],
|
||||||
@ -164,17 +178,27 @@ export default defineComponent({
|
|||||||
widget: selectedGrid.widget,
|
widget: selectedGrid.widget,
|
||||||
standard: selectedGrid.standard,
|
standard: selectedGrid.standard,
|
||||||
visType: [],
|
visType: [],
|
||||||
|
isTable: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
states.isTable = TableChartTypes.includes(states.graph.type || "");
|
||||||
|
|
||||||
if (states.metrics[0]) {
|
if (states.metrics[0]) {
|
||||||
queryMetricType(states.metrics[0]);
|
queryMetricType(states.metrics[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.entity === "service") {
|
if (params.entity === "service") {
|
||||||
states.visType = ChartTypes;
|
states.visType = ChartTypes.filter(
|
||||||
} else {
|
(d: Option) => d.value !== "serviceList"
|
||||||
|
);
|
||||||
|
} else if (params.entity === "all") {
|
||||||
states.visType = ChartTypes.filter(
|
states.visType = ChartTypes.filter(
|
||||||
(d: Option) => !PodsChartTypes.includes(d.value)
|
(d: Option) => !PodsChartTypes.includes(d.value)
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
states.visType = ChartTypes.filter(
|
||||||
|
(d: Option) => !TableChartTypes.includes(d.value)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeMetrics(arr: Option[]) {
|
async function changeMetrics(arr: Option[]) {
|
||||||
@ -213,6 +237,11 @@ export default defineComponent({
|
|||||||
states.graph = {
|
states.graph = {
|
||||||
...DefaultGraphConfig[item.value],
|
...DefaultGraphConfig[item.value],
|
||||||
};
|
};
|
||||||
|
states.isTable = TableChartTypes.includes(states.graph.type || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeDashboard(item: Option[]) {
|
||||||
|
states.graph.dashboardName = item[0].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const metricOpts = [
|
const metricOpts = [
|
||||||
@ -302,6 +331,7 @@ export default defineComponent({
|
|||||||
updateGraphOptions,
|
updateGraphOptions,
|
||||||
updateStandardOptions,
|
updateStandardOptions,
|
||||||
applyConfig,
|
applyConfig,
|
||||||
|
changeDashboard,
|
||||||
loading,
|
loading,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
<!-- 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>
|
||||||
|
<span class="label">{{ t("fontSize") }}</span>
|
||||||
|
<el-slider
|
||||||
|
class="slider"
|
||||||
|
v-model="fontSize"
|
||||||
|
show-input
|
||||||
|
input-size="small"
|
||||||
|
:min="10"
|
||||||
|
:max="20"
|
||||||
|
:step="1"
|
||||||
|
@change="updateConfig({ fontSize })"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { defineProps, ref, defineEmits } from "vue";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
import { EndpointListConfig } from "@/types/dashboard";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object as PropType<EndpointListConfig>,
|
||||||
|
default: () => ({ fontSize: 12 }),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emits = defineEmits(["update"]);
|
||||||
|
const fontSize = ref(props.config.fontSize);
|
||||||
|
|
||||||
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
|
emits("update", param);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.slider {
|
||||||
|
width: 500px;
|
||||||
|
margin-top: -13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,63 @@
|
|||||||
|
<!-- 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>
|
||||||
|
<span class="label">{{ t("fontSize") }}</span>
|
||||||
|
<el-slider
|
||||||
|
class="slider"
|
||||||
|
v-model="fontSize"
|
||||||
|
show-input
|
||||||
|
input-size="small"
|
||||||
|
:min="10"
|
||||||
|
:max="20"
|
||||||
|
:step="1"
|
||||||
|
@change="updateConfig({ fontSize })"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { defineProps, ref, defineEmits } from "vue";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
import { InstanceListConfig } from "@/types/dashboard";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object as PropType<InstanceListConfig>,
|
||||||
|
default: () => ({ fontSize: 12 }),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emits = defineEmits(["update"]);
|
||||||
|
const fontSize = ref(props.config.fontSize);
|
||||||
|
|
||||||
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
|
emits("update", param);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.slider {
|
||||||
|
width: 500px;
|
||||||
|
margin-top: -13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,63 @@
|
|||||||
|
<!-- 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>
|
||||||
|
<span class="label">{{ t("fontSize") }}</span>
|
||||||
|
<el-slider
|
||||||
|
class="slider"
|
||||||
|
v-model="fontSize"
|
||||||
|
show-input
|
||||||
|
input-size="small"
|
||||||
|
:min="10"
|
||||||
|
:max="20"
|
||||||
|
:step="1"
|
||||||
|
@change="updateConfig({ fontSize })"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { defineProps, ref, defineEmits } from "vue";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
import { ServiceListConfig } from "@/types/dashboard";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object as PropType<ServiceListConfig>,
|
||||||
|
default: () => ({ fontSize: 12 }),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emits = defineEmits(["update"]);
|
||||||
|
const fontSize = ref(props.config.fontSize);
|
||||||
|
|
||||||
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
|
emits("update", param);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.slider {
|
||||||
|
width: 500px;
|
||||||
|
margin-top: -13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -18,9 +18,15 @@
|
|||||||
import AreaConfig from "./Area.vue";
|
import AreaConfig from "./Area.vue";
|
||||||
import LineConfig from "./Line.vue";
|
import LineConfig from "./Line.vue";
|
||||||
import BarConfig from "./Bar.vue";
|
import BarConfig from "./Bar.vue";
|
||||||
|
import InstanceListConfig from "./InstanceList.vue";
|
||||||
|
import EndpointListConfig from "./EndpointList.vue";
|
||||||
|
import ServiceListConfig from "./ServiceList.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
AreaConfig,
|
AreaConfig,
|
||||||
LineConfig,
|
LineConfig,
|
||||||
BarConfig,
|
BarConfig,
|
||||||
|
InstanceListConfig,
|
||||||
|
EndpointListConfig,
|
||||||
|
ServiceListConfig,
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
export const PodsChartTypes = ["EndpointList", "InstanceList"];
|
export const PodsChartTypes = ["EndpointList", "InstanceList"];
|
||||||
|
|
||||||
|
export const TableChartTypes = ["EndpointList", "InstanceList", "ServiceList"];
|
||||||
|
|
||||||
export const ChartTypes = [
|
export const ChartTypes = [
|
||||||
{ label: "Bar", value: "Bar" },
|
{ label: "Bar", value: "Bar" },
|
||||||
{ label: "Line", value: "Line" },
|
{ label: "Line", value: "Line" },
|
||||||
@ -60,9 +62,18 @@ export const DefaultGraphConfig: { [key: string]: any } = {
|
|||||||
},
|
},
|
||||||
InstanceList: {
|
InstanceList: {
|
||||||
type: "InstanceList",
|
type: "InstanceList",
|
||||||
|
dashboardName: "",
|
||||||
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
EndpointList: {
|
EndpointList: {
|
||||||
type: "EndpointList",
|
type: "EndpointList",
|
||||||
|
dashboardName: "",
|
||||||
|
fontSize: 12,
|
||||||
|
},
|
||||||
|
ServiceList: {
|
||||||
|
type: "ServiceList",
|
||||||
|
dashboardName: "",
|
||||||
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,46 +14,52 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="chartLoading"
|
||||||
:data="selectorStore.endpoints"
|
:data="selectorStore.endpoints"
|
||||||
style="width: 100%; height: 100%; overflow: auto"
|
style="width: 100%; height: 100%; overflow: auto"
|
||||||
>
|
>
|
||||||
<el-table-column label="Endpoints">
|
<el-table-column label="Endpoints">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="link" @click="linkInstance(scope.row)">
|
<router-link
|
||||||
|
target="_blank"
|
||||||
|
class="link"
|
||||||
|
:to="`/dashboard/${scope.row.layer}/endpoint/${selectorStore.currentService}/${scope.row.value}/${config.dashboardName}`"
|
||||||
|
:style="{ fontSize: `${config.fontSize}px` }"
|
||||||
|
>
|
||||||
{{ scope.row.label }}
|
{{ scope.row.label }}
|
||||||
</span>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineProps, onBeforeMount } from "vue";
|
import { defineProps, onBeforeMount, ref } from "vue";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import router from "@/router";
|
import type { PropType } from "vue";
|
||||||
|
import { EndpointListConfig } from "@/types/dashboard";
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object as PropType<EndpointListConfig>,
|
||||||
default: () => ({}),
|
default: () => ({ dashboardName: "", fontSize: 12 }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
|
const chartLoading = ref<boolean>(false);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
chartLoading.value = true;
|
||||||
const resp = await selectorStore.getEndpoints();
|
const resp = await selectorStore.getEndpoints();
|
||||||
|
|
||||||
|
chartLoading.value = false;
|
||||||
if (resp.errors) {
|
if (resp.errors) {
|
||||||
ElMessage.error(resp.errors);
|
ElMessage.error(resp.errors);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
function linkInstance(row: any) {
|
|
||||||
const path = `/dashboard/view/${row.layer}/endpoint/${selectorStore.currentService}/${row.value}`;
|
|
||||||
router.push(path);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.link {
|
.link {
|
||||||
|
@ -14,46 +14,52 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="chartLoading"
|
||||||
:data="selectorStore.instances"
|
:data="selectorStore.instances"
|
||||||
style="width: 100%; height: 100%; overflow: auto"
|
style="width: 100%; height: 100%; overflow: auto"
|
||||||
>
|
>
|
||||||
<el-table-column label="Service Instances">
|
<el-table-column label="Service Instances">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="link" @click="linkInstance(scope.row)">
|
<router-link
|
||||||
|
target="_blank"
|
||||||
|
class="link"
|
||||||
|
:to="`/dashboard/${scope.row.layer}/serviceInstance/${selectorStore.currentService}/${scope.row.value}/${config.dashboardName}`"
|
||||||
|
:style="{ fontSize: `${config.fontSize}px` }"
|
||||||
|
>
|
||||||
{{ scope.row.label }}
|
{{ scope.row.label }}
|
||||||
</span>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineProps, onBeforeMount } from "vue";
|
import { defineProps, onBeforeMount, ref } from "vue";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import router from "@/router";
|
import type { PropType } from "vue";
|
||||||
|
import { InstanceListConfig } from "@/types/dashboard";
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object as PropType<InstanceListConfig>,
|
||||||
default: () => ({}),
|
default: () => ({ dashboardName: "", fontSize: 12 }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
|
const chartLoading = ref<boolean>(false);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
chartLoading.value = true;
|
||||||
const resp = await selectorStore.getServiceInstances();
|
const resp = await selectorStore.getServiceInstances();
|
||||||
|
|
||||||
|
chartLoading.value = false;
|
||||||
if (resp.errors) {
|
if (resp.errors) {
|
||||||
ElMessage.error(resp.errors);
|
ElMessage.error(resp.errors);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
function linkInstance(row: any) {
|
|
||||||
const path = `/dashboard/${row.layer}/serviceInstance/${selectorStore.currentService}/${row.value}/test`;
|
|
||||||
router.push(path);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.link {
|
.link {
|
||||||
|
@ -14,46 +14,52 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="chartLoading"
|
||||||
:data="selectorStore.services"
|
:data="selectorStore.services"
|
||||||
style="width: 100%; height: 100%; overflow: auto"
|
style="width: 100%; height: 100%; overflow: auto"
|
||||||
>
|
>
|
||||||
<el-table-column label="Services">
|
<el-table-column label="Services">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="link" @click="linkService(scope.row)">
|
<router-link
|
||||||
|
target="_blank"
|
||||||
|
class="link"
|
||||||
|
:to="`/dashboard/${scope.row.layer}/service/${selectorStore.currentService}/${config.dashboardName}`"
|
||||||
|
:style="{ fontSize: `${config.fontSize}px` }"
|
||||||
|
>
|
||||||
{{ scope.row.label }}
|
{{ scope.row.label }}
|
||||||
</span>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineProps, onBeforeMount } from "vue";
|
import { defineProps, onBeforeMount, ref } from "vue";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import router from "@/router";
|
import type { PropType } from "vue";
|
||||||
|
import { ServiceListConfig } from "@/types/dashboard";
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object as PropType<ServiceListConfig>,
|
||||||
default: () => ({}),
|
default: () => ({ dashboardName: "", fontSize: 12 }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
|
const chartLoading = ref<boolean>(false);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
chartLoading.value = true;
|
||||||
const resp = await selectorStore.fetchServices();
|
const resp = await selectorStore.fetchServices();
|
||||||
|
|
||||||
|
chartLoading.value = false;
|
||||||
if (resp.errors) {
|
if (resp.errors) {
|
||||||
ElMessage.error(resp.errors);
|
ElMessage.error(resp.errors);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
function linkService(row: { layer: string }) {
|
|
||||||
const path = `/dashboard/${row.layer}/service/${selectorStore.currentService}/test`;
|
|
||||||
router.push(path);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.link {
|
.link {
|
||||||
|
Loading…
Reference in New Issue
Block a user