mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 01:15:23 +00:00
feat: edit tab name
This commit is contained in:
parent
f33255fa48
commit
acf8830a28
@ -95,6 +95,7 @@ const msg = {
|
|||||||
topChildren: "Top 5 of children",
|
topChildren: "Top 5 of children",
|
||||||
taskList: "Task List",
|
taskList: "Task List",
|
||||||
sampledTraces: "Sampled Traces",
|
sampledTraces: "Sampled Traces",
|
||||||
|
editTab: "Enable editing tab names",
|
||||||
hourTip: "Select Hour",
|
hourTip: "Select Hour",
|
||||||
minuteTip: "Select Minute",
|
minuteTip: "Select Minute",
|
||||||
secondTip: "Select Second",
|
secondTip: "Select Second",
|
||||||
|
@ -95,6 +95,7 @@ const msg = {
|
|||||||
showDepth: "展示深度选择器",
|
showDepth: "展示深度选择器",
|
||||||
taskList: "任务列表",
|
taskList: "任务列表",
|
||||||
sampledTraces: "采样的追踪",
|
sampledTraces: "采样的追踪",
|
||||||
|
editTab: "开启编辑Tab的名称",
|
||||||
hourTip: "选择小时",
|
hourTip: "选择小时",
|
||||||
minuteTip: "选择分钟",
|
minuteTip: "选择分钟",
|
||||||
secondTip: "选择秒数",
|
secondTip: "选择秒数",
|
||||||
|
@ -45,10 +45,38 @@ limitations under the License. -->
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="operations">
|
<div class="operations">
|
||||||
<Icon size="sm" iconName="clearclose" @click="removeTab" />
|
<el-popover
|
||||||
|
placement="bottom"
|
||||||
|
trigger="click"
|
||||||
|
:width="200"
|
||||||
|
v-model:visible="showTools"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<span>
|
||||||
|
<Icon
|
||||||
|
iconName="ellipsis_v"
|
||||||
|
size="middle"
|
||||||
|
class="operation"
|
||||||
|
@click="showTools = true"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<div
|
||||||
|
class="tools"
|
||||||
|
@click="
|
||||||
|
canEditTabName = true;
|
||||||
|
showTools = false;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<span class="edit-tab">{{ t("editTab") }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="tools" @click="removeTab">
|
||||||
|
<span>{{ t("delete") }}</span>
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-layout">
|
<div class="tab-layout" @click="handleClick">
|
||||||
<grid-layout
|
<grid-layout
|
||||||
v-if="dashboardStore.currentTabItems.length"
|
v-if="dashboardStore.currentTabItems.length"
|
||||||
v-model:layout="dashboardStore.currentTabItems"
|
v-model:layout="dashboardStore.currentTabItems"
|
||||||
@ -83,6 +111,7 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, watch, defineComponent, toRefs } from "vue";
|
import { ref, watch, defineComponent, toRefs } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { LayoutConfig } from "@/types/dashboard";
|
import { LayoutConfig } from "@/types/dashboard";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
@ -103,11 +132,14 @@ export default defineComponent({
|
|||||||
components: { Topology, Widget, Trace, Profile },
|
components: { Topology, Widget, Trace, Profile },
|
||||||
props,
|
props,
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
const { t } = useI18n();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const activeTabIndex = ref<number>(0);
|
const activeTabIndex = ref<number>(0);
|
||||||
const activeTabWidget = ref<string>("");
|
const activeTabWidget = ref<string>("");
|
||||||
const editTabIndex = ref<number>(NaN); // edit tab item name
|
const editTabIndex = ref<number>(NaN); // edit tab item name
|
||||||
|
const canEditTabName = ref<boolean>(false);
|
||||||
const needQuery = ref<boolean>(false);
|
const needQuery = ref<boolean>(false);
|
||||||
|
const showTools = ref<boolean>(false);
|
||||||
const l = dashboardStore.layout.findIndex(
|
const l = dashboardStore.layout.findIndex(
|
||||||
(d: LayoutConfig) => d.i === props.data.i
|
(d: LayoutConfig) => d.i === props.data.i
|
||||||
);
|
);
|
||||||
@ -141,13 +173,17 @@ export default defineComponent({
|
|||||||
dashboardStore.addTabItem(props.data);
|
dashboardStore.addTabItem(props.data);
|
||||||
}
|
}
|
||||||
function editTabName(el: Event, index: number) {
|
function editTabName(el: Event, index: number) {
|
||||||
el.stopPropagation();
|
if (!canEditTabName.value) {
|
||||||
|
editTabIndex.value = NaN;
|
||||||
|
return;
|
||||||
|
}
|
||||||
editTabIndex.value = index;
|
editTabIndex.value = index;
|
||||||
}
|
}
|
||||||
function handleClick(el: any) {
|
function handleClick(el: any) {
|
||||||
if (el.target.className === "tab-name") {
|
if (["tab-name", "edit-tab"].includes(el.target.className)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
canEditTabName.value = false;
|
||||||
editTabIndex.value = NaN;
|
editTabIndex.value = NaN;
|
||||||
}
|
}
|
||||||
function clickTabGrid(e: Event, item: LayoutConfig) {
|
function clickTabGrid(e: Event, item: LayoutConfig) {
|
||||||
@ -156,6 +192,7 @@ export default defineComponent({
|
|||||||
dashboardStore.activeGridItem(
|
dashboardStore.activeGridItem(
|
||||||
`${props.data.i}-${activeTabIndex.value}-${item.i}`
|
`${props.data.i}-${activeTabIndex.value}-${item.i}`
|
||||||
);
|
);
|
||||||
|
handleClick(e);
|
||||||
}
|
}
|
||||||
function layoutUpdatedEvent() {
|
function layoutUpdatedEvent() {
|
||||||
const l = dashboardStore.layout.findIndex(
|
const l = dashboardStore.layout.findIndex(
|
||||||
@ -182,6 +219,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
|
handleClick,
|
||||||
layoutUpdatedEvent,
|
layoutUpdatedEvent,
|
||||||
clickTabGrid,
|
clickTabGrid,
|
||||||
editTabName,
|
editTabName,
|
||||||
@ -195,6 +233,9 @@ export default defineComponent({
|
|||||||
activeTabIndex,
|
activeTabIndex,
|
||||||
editTabIndex,
|
editTabIndex,
|
||||||
needQuery,
|
needQuery,
|
||||||
|
canEditTabName,
|
||||||
|
showTools,
|
||||||
|
t,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -206,7 +247,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
span {
|
span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0 20px;
|
padding: 0 10px;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
@ -286,4 +327,17 @@ export default defineComponent({
|
|||||||
padding-top: 30px;
|
padding-top: 30px;
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tools {
|
||||||
|
padding: 5px 0;
|
||||||
|
color: #999;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #409eff;
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user