dynamic tab type

This commit is contained in:
Peter Olu 2022-05-10 05:19:05 +01:00
parent edf2e0f307
commit 4127378f84
3 changed files with 16 additions and 17 deletions

View File

@ -212,7 +212,7 @@ export const dashboardStore = defineStore({
setCurrentTabItems(items: LayoutConfig[]) {
this.currentTabItems = items;
},
setCurrentTabName(name: string) {
setCurrentTabType(name: string) {
this.currentTabName = name
},
removeTab(item: LayoutConfig) {

View File

@ -19,7 +19,7 @@ limitations under the License. -->
v-for="(child, idx) in data.children || []"
:key="idx"
:class="{ active: activeTabIndex === idx }"
@click="clickTabs($event, idx, child.name, child)"
@click="clickTabs($event, idx, child)"
>
<input
@click="editTabName($event, idx)"
@ -266,9 +266,9 @@ export default defineComponent({
}
);
function clickTabs(e: Event, idx: number, currentTabName:string, extra:any) {
function clickTabs(e: Event, idx: number, extra:any) {
e.stopPropagation();
console.log(currentTabName, extra)
console.log(extra.children[0].type)
activeTabIndex.value = idx;
dashboardStore.activeGridItem(props.data.i);
dashboardStore.selectWidget(props.data);
@ -279,7 +279,7 @@ export default defineComponent({
dashboardStore.setCurrentTabItems(
dashboardStore.layout[l].children[activeTabIndex.value].children
);
dashboardStore.setCurrentTabName(currentTabName)
dashboardStore.setCurrentTabType(extra.children[0].type)
needQuery.value = true;
}
function removeTab(e: Event) {

View File

@ -56,7 +56,10 @@ limitations under the License. -->
<Icon iconSize="sm" iconName="cancel" />
</el-button>
</div>
<div class="selectors-item" v-if="(key === 3 || key === 4 ) && currentTraceView === 'traceList' " >
<div
class="selectors-item"
v-if="(key === 3 || key === 4) && currentTraceView === 'traceList'"
>
<el-tooltip
v-if="!selectedSelector.length || selectedSelector === '$endpoint'"
class="box-item"
@ -192,8 +195,8 @@ import { useDashboardStore } from "@/store/modules/dashboard";
import { useAppStoreWithOut } from "@/store/modules/app";
import { useTraceStore } from "@/store/modules/trace";
onMounted(() => {
console.log(dashboardStore.layout,dashboardStore.currentDashboard)
})
console.log(dashboardStore.layout, dashboardStore.currentDashboard);
});
import {
EntityType,
AllTools,
@ -217,13 +220,9 @@ const appStore = useAppStoreWithOut();
const traceStore = useTraceStore();
const params = useRoute().params;
const selectedSelector = ref<string>("");
const showFilter = computed(
() => dashboardStore.layout[0]?.activedTabIndex === 2
);
const showLogHeader = computed(
() => dashboardStore.layout[0]?.activedTabIndex === 3
);
const currentTraceView = computed(() => traceStore.currentView)
const showFilter = computed(() => dashboardStore.currentTabName === "Trace");
const showLogHeader = computed(() => dashboardStore.currentTabName === "Log");
const currentTraceView = computed(() => traceStore.currentView);
const { query } = useRoute();
dashboardStore.setViewMode(query["fullview"] === "true");