watch list

This commit is contained in:
Qiuxia Fan 2022-03-22 18:52:13 +08:00
parent 583b8fca50
commit 0b27ff7aa2
3 changed files with 22 additions and 2 deletions

View File

@ -105,8 +105,9 @@ export default defineComponent({
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const isList = ListChartTypes.includes(props.data.graph.type || "");
if (props.needQuery || !dashboardStore.currentDashboard.id) { if ((props.needQuery || !dashboardStore.currentDashboard.id) && !isList) {
queryMetrics(); queryMetrics();
} }
@ -152,7 +153,10 @@ export default defineComponent({
if (props.data.i !== dashboardStore.selectedGrid.i) { if (props.data.i !== dashboardStore.selectedGrid.i) {
return; return;
} }
if (ListChartTypes.includes(dashboardStore.selectedGrid.graph.type)) { if (
ListChartTypes.includes(dashboardStore.selectedGrid.graph.type) ||
isList
) {
return; return;
} }
queryMetrics(); queryMetrics();
@ -161,6 +165,9 @@ export default defineComponent({
watch( watch(
() => [selectorStore.currentService, selectorStore.currentDestService], () => [selectorStore.currentService, selectorStore.currentDestService],
() => { () => {
if (isList) {
return;
}
if ( if (
dashboardStore.entity === EntityType[0].value || dashboardStore.entity === EntityType[0].value ||
dashboardStore.entity === EntityType[4].value dashboardStore.entity === EntityType[4].value

View File

@ -191,6 +191,12 @@ watch(
} }
} }
); );
watch(
() => [selectorStore.currentService],
() => {
queryEndpoints();
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; @import "./style.scss";

View File

@ -182,6 +182,7 @@ function clickInstance(scope: any) {
function changePage(pageIndex: number) { function changePage(pageIndex: number) {
instances.value = searchInstances.value.splice(pageIndex - 1, pageSize); instances.value = searchInstances.value.splice(pageIndex - 1, pageSize);
} }
function searchList() { function searchList() {
searchInstances.value = selectorStore.pods.filter((d: { label: string }) => searchInstances.value = selectorStore.pods.filter((d: { label: string }) =>
d.label.includes(searchText.value) d.label.includes(searchText.value)
@ -197,6 +198,12 @@ watch(
} }
} }
); );
watch(
() => [selectorStore.currentService],
() => {
queryInstance();
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; @import "./style.scss";