mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-20 01:21:21 +00:00
add pagination for process list
This commit is contained in:
parent
843adabd31
commit
e5b69ec276
@ -134,6 +134,7 @@ const msg = {
|
|||||||
taskId: "Task ID",
|
taskId: "Task ID",
|
||||||
triggerType: "Trigger Type",
|
triggerType: "Trigger Type",
|
||||||
targetType: "Target Type",
|
targetType: "Target Type",
|
||||||
|
processSelect: "Click to select processes",
|
||||||
hourTip: "Select Hour",
|
hourTip: "Select Hour",
|
||||||
minuteTip: "Select Minute",
|
minuteTip: "Select Minute",
|
||||||
secondTip: "Select Second",
|
secondTip: "Select Second",
|
||||||
|
@ -132,6 +132,7 @@ const msg = {
|
|||||||
taskId: "任务ID",
|
taskId: "任务ID",
|
||||||
triggerType: "触发类型",
|
triggerType: "触发类型",
|
||||||
targetType: "目标类型",
|
targetType: "目标类型",
|
||||||
|
processSelect: "点击选择进程",
|
||||||
hourTip: "选择小时",
|
hourTip: "选择小时",
|
||||||
minuteTip: "选择分钟",
|
minuteTip: "选择分钟",
|
||||||
secondTip: "选择秒数",
|
secondTip: "选择秒数",
|
||||||
|
@ -26,11 +26,24 @@ limitations under the License. -->
|
|||||||
<el-popover placement="bottom" :width="680" trigger="click">
|
<el-popover placement="bottom" :width="680" trigger="click">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button type="primary" size="small">
|
<el-button type="primary" size="small">
|
||||||
Click to select processes
|
{{ t("processSelect") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<el-input
|
||||||
|
v-model="searchText"
|
||||||
|
placeholder="Please input name"
|
||||||
|
class="input-with-search"
|
||||||
|
size="small"
|
||||||
|
@change="searchProcesses"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button size="small">
|
||||||
|
<Icon size="sm" iconName="search" />
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
<el-table
|
<el-table
|
||||||
:data="processes"
|
:data="currentProcesses"
|
||||||
ref="multipleTableRef"
|
ref="multipleTableRef"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
@ -44,10 +57,21 @@ limitations under the License. -->
|
|||||||
/>
|
/>
|
||||||
<el-table-column width="300" label="Attributes">
|
<el-table-column width="300" label="Attributes">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.attributes.map((d: any) => `${d.name}=${d.value}`).join("; ") }}
|
{{ scope.row.attributes.map((d: {name: string, value: string}) => `${d.name}=${d.value}`).join("; ") }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
class="pagination"
|
||||||
|
background
|
||||||
|
small
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="processes.length"
|
||||||
|
@current-change="changePage"
|
||||||
|
@prev-click="changePage"
|
||||||
|
@next-click="changePage"
|
||||||
|
/>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-button type="primary" size="small" @click="analyzeEBPF">
|
<el-button type="primary" size="small" @click="analyzeEBPF">
|
||||||
{{ t("analyze") }}
|
{{ t("analyze") }}
|
||||||
@ -69,6 +93,7 @@ import { ElMessage, ElTable } from "element-plus";
|
|||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const ebpfStore = useEbpfStore();
|
const ebpfStore = useEbpfStore();
|
||||||
|
const pageSize = 5;
|
||||||
/*global Nullable */
|
/*global Nullable */
|
||||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
|
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
|
||||||
const selectedProcesses = ref<string[]>([]);
|
const selectedProcesses = ref<string[]>([]);
|
||||||
@ -76,7 +101,9 @@ const timeline = ref<Nullable<HTMLDivElement>>(null);
|
|||||||
const visGraph = ref<Nullable<any>>(null);
|
const visGraph = ref<Nullable<any>>(null);
|
||||||
const labels = ref<Option[]>([{ label: "All", value: "0" }]);
|
const labels = ref<Option[]>([{ label: "All", value: "0" }]);
|
||||||
const processes = ref<Process[]>([]);
|
const processes = ref<Process[]>([]);
|
||||||
|
const currentProcesses = ref<Process[]>([]);
|
||||||
const selectedLabels = ref<string[]>(["0"]);
|
const selectedLabels = ref<string[]>(["0"]);
|
||||||
|
const searchText = ref<string>("");
|
||||||
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
||||||
new Date(dayjs(date).format(pattern));
|
new Date(dayjs(date).format(pattern));
|
||||||
|
|
||||||
@ -155,6 +182,7 @@ function visTimeline() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
searchProcesses();
|
||||||
const items: any = new DataSet(schedules);
|
const items: any = new DataSet(schedules);
|
||||||
const options = {
|
const options = {
|
||||||
height: 250,
|
height: 250,
|
||||||
@ -167,6 +195,20 @@ function visTimeline() {
|
|||||||
visGraph.value = new Timeline(timeline.value, items, options);
|
visGraph.value = new Timeline(timeline.value, items, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changePage(pageIndex: number) {
|
||||||
|
searchProcesses(pageIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchProcesses(pageIndex?: any) {
|
||||||
|
const arr = processes.value.filter((d: { name: string }) =>
|
||||||
|
d.name.includes(searchText.value)
|
||||||
|
);
|
||||||
|
currentProcesses.value = arr.splice(
|
||||||
|
(pageIndex - 1 || 0) * pageSize,
|
||||||
|
pageSize * (pageIndex || 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => ebpfStore.eBPFSchedules,
|
() => ebpfStore.eBPFSchedules,
|
||||||
() => {
|
() => {
|
||||||
@ -187,4 +229,13 @@ watch(
|
|||||||
.inputs {
|
.inputs {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-with-search {
|
||||||
|
width: 650px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user