toggle trace filters

This commit is contained in:
Peter Olu 2022-05-03 12:12:05 +01:00
parent 7cf5648042
commit b1fd8923ca
3 changed files with 131 additions and 142 deletions

View File

@ -279,6 +279,7 @@ export default defineComponent({
dashboardStore.layout[l].children[activeTabIndex.value].children
);
needQuery.value = true;
console.log(dashboardStore.layout[0])
}
function removeTab(e: Event) {
e.stopPropagation();

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<div class="dashboard-tool">
<div class="dashboard-tool flex-h">
<div class="flex-h">
<div class="selectors-item" v-if="key !== 10">
@ -42,9 +43,7 @@ limitations under the License. -->
@change="changePods"
@query="searchPods"
class="selectorPod"
:isRemote="
['EndpointRelation', 'Endpoint'].includes(dashboardStore.entity)
"
:isRemote="['EndpointRelation', 'Endpoint'].includes(dashboardStore.entity)"
/>
</div>
<div class="selectors-item" v-if="key === 2 || key === 4">
@ -78,7 +77,11 @@ limitations under the License. -->
/>
</div>
</div>
<div class="flex-h tools" v-loading="loading" v-if="$route.query['portal'] !== 'true'">
<div
class="flex-h tools"
v-loading="loading"
v-if="$route.query['portal'] !== 'true'"
>
<div class="tool-icons flex-h" v-if="dashboardStore.editMode">
<el-dropdown content="Controls" placement="bottom">
<i>
@ -118,7 +121,8 @@ limitations under the License. -->
</div>
</div>
</div>
<Filter />
<Filter v-if="showFilter" />
</div>
</template>
<script lang="ts" setup>
import Filter from "../related/trace/Filter.vue";
@ -146,6 +150,10 @@ const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore();
const appStore = useAppStoreWithOut();
const params = useRoute().params;
const showFilter = computed(
() => dashboardStore.layout[0].activedTabIndex === 2
);
const { query } = useRoute();
dashboardStore.setViewMode(query["fullview"] === "true");
@ -172,9 +180,7 @@ const states = reactive<{
currentDestPod: "",
});
const key = computed(() => {
const type = EntityType.find(
(d: Option) => d.value === dashboardStore.entity
);
const type = EntityType.find((d: Option) => d.value === dashboardStore.entity);
return (type && type.key) || 0;
});
@ -208,9 +214,7 @@ async function setSelector() {
].includes(String(params.entity))
) {
setSourceSelector();
if (
[EntityType[2].value, EntityType[3].value].includes(String(params.entity))
) {
if ([EntityType[2].value, EntityType[3].value].includes(String(params.entity))) {
return;
}
setDestSelector();
@ -278,11 +282,7 @@ async function setSourceSelector() {
async function setDestSelector() {
await selectorStore.getService(String(params.destServiceId), true);
states.currentDestService = selectorStore.currentDestService.value;
await fetchPods(
String(params.entity),
selectorStore.currentDestService.id,
false
);
await fetchPods(String(params.entity), selectorStore.currentDestService.id, false);
if (!(selectorStore.destPods.length && selectorStore.destPods[0])) {
selectorStore.setCurrentDestPod(null);
states.currentDestPod = "";
@ -295,9 +295,7 @@ async function setDestSelector() {
(d: { label: string }) => d.label === states.currentDestPod
);
} else {
currentDestPod = selectorStore.destPods.find(
(d: { id: string }) => d.id === destPod
);
currentDestPod = selectorStore.destPods.find((d: { id: string }) => d.id === destPod);
}
if (currentDestPod) {
selectorStore.setCurrentDestPod(currentDestPod);
@ -326,9 +324,7 @@ async function getServices() {
(d: { label: string }) => d.label === states.currentService
);
} else {
s = (selectorStore.services || []).find(
(d: unknown, index: number) => index === 0
);
s = (selectorStore.services || []).find((d: unknown, index: number) => index === 0);
}
selectorStore.setCurrentService(s || null);
let d;
@ -337,9 +333,7 @@ async function getServices() {
(d: { label: string }) => d.label === states.currentDestService
);
} else {
d = (selectorStore.services || []).find(
(d: unknown, index: number) => index === 1
);
d = (selectorStore.services || []).find((d: unknown, index: number) => index === 1);
}
selectorStore.setCurrentDestService(d || null);
if (!selectorStore.currentService) {
@ -347,18 +341,14 @@ async function getServices() {
}
states.currentService = selectorStore.currentService.value;
const e = dashboardStore.entity.split("Relation")[0];
if (
[EntityType[2].value, EntityType[3].value].includes(dashboardStore.entity)
) {
if ([EntityType[2].value, EntityType[3].value].includes(dashboardStore.entity)) {
fetchPods(e, selectorStore.currentService.id, true);
}
if (!selectorStore.currentDestService) {
return;
}
states.currentDestService = selectorStore.currentDestService.value;
if (
[EntityType[5].value, EntityType[6].value].includes(dashboardStore.entity)
) {
if ([EntityType[5].value, EntityType[6].value].includes(dashboardStore.entity)) {
fetchPods(dashboardStore.entity, selectorStore.currentDestService.id, true);
}
}
@ -413,10 +403,7 @@ async function applyDashboard() {
}
async function clickIcons(t: { id: string; content: string; name: string }) {
if (
dashboardStore.selectedGrid &&
dashboardStore.selectedGrid.type === "Tab"
) {
if (dashboardStore.selectedGrid && dashboardStore.selectedGrid.type === "Tab") {
setTabControls(t.id);
return;
}
@ -504,9 +491,7 @@ async function fetchPods(
(d: { label: unknown }) => d.label === states.currentPod
);
} else {
p = selectorStore.pods.find(
(d: unknown, index: number) => index === 0
);
p = selectorStore.pods.find((d: unknown, index: number) => index === 0);
}
selectorStore.setCurrentPod(p || null);
states.currentPod = selectorStore.currentPod.label;
@ -614,12 +599,7 @@ function searchDestPods(query: string) {
const param = {
keyword: query,
};
fetchPods(
EntityType[6].value,
selectorStore.currentDestService.id,
false,
param
);
fetchPods(EntityType[6].value, selectorStore.currentDestService.id, false, param);
}
watch(
() => dashboardStore.entity,

View File

@ -14,6 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<div class="flex-h row">
<div class="flex-h">
<el-button type="secondary"> Instance </el-button>
<el-button type="secondary"> Status </el-button>
<el-button type="secondary">
<!-- <Icon size="sm" iconName="duration" /> -->
Duration
</el-button>
</div>
<div class="mr-5" v-if="dashboardStore.entity === EntityType[1].value">
<span class="grey mr-5">{{ t("service") }}:</span>
<Selector