making tab selection as determinant more dynamic

This commit is contained in:
Peter Olu 2022-05-10 04:57:51 +01:00
parent 5d4c80f558
commit edf2e0f307
3 changed files with 20 additions and 5 deletions

View File

@ -40,6 +40,7 @@ interface DashboardState {
showTopology: boolean; showTopology: boolean;
fullView: boolean; fullView: boolean;
currentTabItems: LayoutConfig[]; currentTabItems: LayoutConfig[];
currentTabName: string;
dashboards: DashboardItem[]; dashboards: DashboardItem[];
currentDashboard: Nullable<DashboardItem>; currentDashboard: Nullable<DashboardItem>;
editMode: boolean; editMode: boolean;
@ -59,6 +60,7 @@ export const dashboardStore = defineStore({
showTopology: false, showTopology: false,
fullView: false, fullView: false,
currentTabItems: [], currentTabItems: [],
currentTabName: '',
dashboards: [], dashboards: [],
currentDashboard: null, currentDashboard: null,
editMode: false, editMode: false,
@ -210,6 +212,9 @@ export const dashboardStore = defineStore({
setCurrentTabItems(items: LayoutConfig[]) { setCurrentTabItems(items: LayoutConfig[]) {
this.currentTabItems = items; this.currentTabItems = items;
}, },
setCurrentTabName(name: string) {
this.currentTabName = name
},
removeTab(item: LayoutConfig) { removeTab(item: LayoutConfig) {
if (this.selectedGrid && this.selectedGrid.i === item.i) { if (this.selectedGrid && this.selectedGrid.i === item.i) {
this.selectedGrid = null; this.selectedGrid = null;

View File

@ -19,7 +19,7 @@ limitations under the License. -->
v-for="(child, idx) in data.children || []" v-for="(child, idx) in data.children || []"
:key="idx" :key="idx"
:class="{ active: activeTabIndex === idx }" :class="{ active: activeTabIndex === idx }"
@click="clickTabs($event, idx)" @click="clickTabs($event, idx, child.name, child)"
> >
<input <input
@click="editTabName($event, idx)" @click="editTabName($event, idx)"
@ -266,8 +266,9 @@ export default defineComponent({
} }
); );
function clickTabs(e: Event, idx: number) { function clickTabs(e: Event, idx: number, currentTabName:string, extra:any) {
e.stopPropagation(); e.stopPropagation();
console.log(currentTabName, extra)
activeTabIndex.value = idx; activeTabIndex.value = idx;
dashboardStore.activeGridItem(props.data.i); dashboardStore.activeGridItem(props.data.i);
dashboardStore.selectWidget(props.data); dashboardStore.selectWidget(props.data);
@ -278,6 +279,7 @@ export default defineComponent({
dashboardStore.setCurrentTabItems( dashboardStore.setCurrentTabItems(
dashboardStore.layout[l].children[activeTabIndex.value].children dashboardStore.layout[l].children[activeTabIndex.value].children
); );
dashboardStore.setCurrentTabName(currentTabName)
needQuery.value = true; needQuery.value = true;
} }
function removeTab(e: Event) { function removeTab(e: Event) {
@ -484,7 +486,9 @@ export default defineComponent({
color: #409eff; color: #409eff;
} }
} }
.tab-header .tabs .span.active{
color: red !important;
}
.operations { .operations {
color: #aaa; color: #aaa;
cursor: pointer; cursor: pointer;

View File

@ -172,6 +172,9 @@ limitations under the License. -->
</div> </div>
</div> </div>
</div> </div>
<!-- <pre>
{{dashboardStore.layout[0]}}
</pre> -->
<Header v-if="showLogHeader" /> <Header v-if="showLogHeader" />
<TraceDetailsTools <TraceDetailsTools
v-if="showFilter && currentTraceView === 'traceDetails'" v-if="showFilter && currentTraceView === 'traceDetails'"
@ -183,11 +186,14 @@ limitations under the License. -->
import Filter from "../related/trace/Filter.vue"; import Filter from "../related/trace/Filter.vue";
import Header from "../related/log/Header.vue"; import Header from "../related/log/Header.vue";
import { reactive, ref, computed, watch } from "vue"; import { reactive, onMounted, ref, computed, watch } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { useTraceStore } from "@/store/modules/trace"; import { useTraceStore } from "@/store/modules/trace";
onMounted(() =>{
console.log(dashboardStore.layout,dashboardStore.currentDashboard)
})
import { import {
EntityType, EntityType,
AllTools, AllTools,