mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-16 18:45:23 +00:00
add group for service list
This commit is contained in:
parent
f691ffdf20
commit
cd31fb7a50
@ -109,6 +109,7 @@ const msg = {
|
|||||||
showXAxis: "Show X Axis",
|
showXAxis: "Show X Axis",
|
||||||
showYAxis: "Show Y Axis",
|
showYAxis: "Show Y Axis",
|
||||||
nameError: "The dashboard name cannot be duplicate",
|
nameError: "The dashboard name cannot be duplicate",
|
||||||
|
showGroup: "Show Group",
|
||||||
hourTip: "Select Hour",
|
hourTip: "Select Hour",
|
||||||
minuteTip: "Select Minute",
|
minuteTip: "Select Minute",
|
||||||
secondTip: "Select Second",
|
secondTip: "Select Second",
|
||||||
|
@ -109,6 +109,7 @@ const msg = {
|
|||||||
showXAxis: "显示X轴",
|
showXAxis: "显示X轴",
|
||||||
showYAxis: "显示Y轴",
|
showYAxis: "显示Y轴",
|
||||||
nameError: "仪表板名称不能重复",
|
nameError: "仪表板名称不能重复",
|
||||||
|
showGroup: "显示分组",
|
||||||
hourTip: "选择小时",
|
hourTip: "选择小时",
|
||||||
minuteTip: "选择分钟",
|
minuteTip: "选择分钟",
|
||||||
secondTip: "选择秒数",
|
secondTip: "选择秒数",
|
||||||
|
@ -107,6 +107,7 @@ export interface ServiceListConfig {
|
|||||||
type?: string;
|
type?: string;
|
||||||
dashboardName: string;
|
dashboardName: string;
|
||||||
fontSize: number;
|
fontSize: number;
|
||||||
|
showGroup: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InstanceListConfig {
|
export interface InstanceListConfig {
|
||||||
|
@ -13,6 +13,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
|
<span class="label">{{ t("showGroup") }}</span>
|
||||||
|
<el-switch
|
||||||
|
v-model="selectedGrid.graph.showGroup"
|
||||||
|
active-text="Yes"
|
||||||
|
inactive-text="No"
|
||||||
|
@change="updateConfig({ showGroup: selectedGrid.graph.showGroup })"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="label">{{ t("fontSize") }}</span>
|
<span class="label">{{ t("fontSize") }}</span>
|
||||||
<el-slider
|
<el-slider
|
||||||
@ -38,6 +47,7 @@ const { selectedGrid } = dashboardStore;
|
|||||||
const fontSize = ref(selectedGrid.graph.fontSize);
|
const fontSize = ref(selectedGrid.graph.fontSize);
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
|
const { selectedGrid } = dashboardStore;
|
||||||
const graph = {
|
const graph = {
|
||||||
...selectedGrid.graph,
|
...selectedGrid.graph,
|
||||||
...param,
|
...param,
|
||||||
|
@ -96,6 +96,7 @@ export const DefaultGraphConfig: { [key: string]: any } = {
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
showXAxis: false,
|
showXAxis: false,
|
||||||
showYAxis: false,
|
showYAxis: false,
|
||||||
|
showGroup: true,
|
||||||
},
|
},
|
||||||
HeatMap: {
|
HeatMap: {
|
||||||
type: "HeatMap",
|
type: "HeatMap",
|
||||||
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="table">
|
<div class="list">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="searchText"
|
v-model="searchText"
|
||||||
@ -29,41 +29,55 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<el-table v-loading="chartLoading" :data="services" style="width: 100%">
|
<div class="table">
|
||||||
<el-table-column label="Services">
|
<el-table
|
||||||
<template #default="scope">
|
v-loading="chartLoading"
|
||||||
<router-link
|
:data="services"
|
||||||
class="link"
|
style="width: 100%"
|
||||||
:to="`/dashboard/${dashboardStore.layerId}/${EntityType[0].value}/${scope.row.id}/${config.dashboardName}`"
|
:span-method="objectSpanMethod"
|
||||||
:key="1"
|
:border="true"
|
||||||
:style="{ fontSize: `${config.fontSize}px` }"
|
:style="{ fontSize: '14px' }"
|
||||||
>
|
|
||||||
{{ scope.row.label }}
|
|
||||||
</router-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
v-for="(metric, index) in config.metrics"
|
|
||||||
:label="metric"
|
|
||||||
:key="metric + index"
|
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<el-table-column label="Service Groups" v-if="config.showGroup">
|
||||||
<div class="chart">
|
<template #default="scope">
|
||||||
<Line
|
{{ scope.row.group }}
|
||||||
v-if="config.metricTypes[index] === 'readMetricsValues'"
|
</template>
|
||||||
:data="{ [metric]: scope.row[metric] }"
|
</el-table-column>
|
||||||
:intervalTime="intervalTime"
|
<el-table-column label="Service Names">
|
||||||
:config="{ showXAxis: false, showYAxis: false }"
|
<template #default="scope">
|
||||||
/>
|
<router-link
|
||||||
<Card
|
class="link"
|
||||||
v-else
|
:to="`/dashboard/${dashboardStore.layerId}/${EntityType[0].value}/${scope.row.id}/${config.dashboardName}`"
|
||||||
:data="{ [metric]: scope.row[metric] }"
|
:key="1"
|
||||||
:config="{ textAlign: 'left' }"
|
:style="{ fontSize: `${config.fontSize}px` }"
|
||||||
/>
|
>
|
||||||
</div>
|
{{ scope.row.label }}
|
||||||
</template>
|
</router-link>
|
||||||
</el-table-column>
|
</template>
|
||||||
</el-table>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
v-for="(metric, index) in config.metrics"
|
||||||
|
:label="metric"
|
||||||
|
:key="metric + index"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="chart">
|
||||||
|
<Line
|
||||||
|
v-if="config.metricTypes[index] === 'readMetricsValues'"
|
||||||
|
:data="{ [metric]: scope.row[metric] }"
|
||||||
|
:intervalTime="intervalTime"
|
||||||
|
:config="{ showXAxis: false, showYAxis: false }"
|
||||||
|
/>
|
||||||
|
<Card
|
||||||
|
v-else
|
||||||
|
:data="{ [metric]: scope.row[metric] }"
|
||||||
|
:config="{ textAlign: 'left' }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
class="pagination"
|
class="pagination"
|
||||||
background
|
background
|
||||||
@ -114,6 +128,7 @@ const pageSize = 5;
|
|||||||
const services = ref<Service[]>([]);
|
const services = ref<Service[]>([]);
|
||||||
const searchServices = ref<Service[]>([]);
|
const searchServices = ref<Service[]>([]);
|
||||||
const searchText = ref<string>("");
|
const searchText = ref<string>("");
|
||||||
|
const groups = ref<any>({});
|
||||||
|
|
||||||
queryServices();
|
queryServices();
|
||||||
|
|
||||||
@ -125,7 +140,32 @@ async function queryServices() {
|
|||||||
if (resp.errors) {
|
if (resp.errors) {
|
||||||
ElMessage.error(resp.errors);
|
ElMessage.error(resp.errors);
|
||||||
}
|
}
|
||||||
services.value = selectorStore.services.splice(0, pageSize);
|
const map: { [key: string]: any[] } = selectorStore.services.reduce(
|
||||||
|
(result: { [key: string]: any[] }, item: any) => {
|
||||||
|
item.group = item.group || "";
|
||||||
|
if (result[item.group]) {
|
||||||
|
item.merge = true;
|
||||||
|
} else {
|
||||||
|
item.merge = false;
|
||||||
|
result[item.group] = [];
|
||||||
|
}
|
||||||
|
result[item.group].push(item);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
services.value = Object.values(map).flat(1).splice(0, pageSize);
|
||||||
|
const obj = {} as any;
|
||||||
|
for (const s of services.value) {
|
||||||
|
s.group = s.group || "";
|
||||||
|
if (!obj[s.group]) {
|
||||||
|
obj[s.group] = 1;
|
||||||
|
} else {
|
||||||
|
obj[s.group]++;
|
||||||
|
}
|
||||||
|
groups.value[s.group] = obj[s.group];
|
||||||
|
}
|
||||||
|
|
||||||
queryServiceMetrics(services.value);
|
queryServiceMetrics(services.value);
|
||||||
}
|
}
|
||||||
async function queryServiceMetrics(currentServices: Service[]) {
|
async function queryServiceMetrics(currentServices: Service[]) {
|
||||||
@ -148,6 +188,22 @@ async function queryServiceMetrics(currentServices: Service[]) {
|
|||||||
}
|
}
|
||||||
services.value = currentServices;
|
services.value = currentServices;
|
||||||
}
|
}
|
||||||
|
function objectSpanMethod(param: any): any {
|
||||||
|
if (!props.config.showGroup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (param.columnIndex !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (param.row.merge) {
|
||||||
|
return {
|
||||||
|
rowspan: 0,
|
||||||
|
colspan: 0,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return { rowspan: groups.value[param.row.group], colspan: 1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
function changePage(pageIndex: number) {
|
function changePage(pageIndex: number) {
|
||||||
services.value = selectorStore.services.splice(pageIndex - 1, pageSize);
|
services.value = selectorStore.services.splice(pageIndex - 1, pageSize);
|
||||||
}
|
}
|
||||||
@ -176,4 +232,8 @@ watch(
|
|||||||
.inputs {
|
.inputs {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user