feat: add a calculation and update selectors param (#53)

This commit is contained in:
Fine0830
2022-04-01 23:28:39 +08:00
committed by GitHub
parent fce818aebe
commit f57fdf9312
10 changed files with 91 additions and 33 deletions

View File

@@ -38,12 +38,17 @@ limitations under the License. -->
class="body"
:style="{
backgroundColor: TextColors[graph.backgroundColor],
color: TextColors[graph.fontColor],
fontSize: graph.fontSize + 'px',
textAlign: graph.textAlign,
}"
>
<a :href="graph.url" target="_blank">
<a
:href="graph.url"
target="_blank"
:style="{
color: TextColors[graph.fontColor],
fontSize: graph.fontSize + 'px',
}"
>
{{ graph.content }}
</a>
</div>

View File

@@ -109,11 +109,14 @@ export default defineComponent({
const selectorStore = useSelectorStore();
const graph = computed(() => props.data.graph || {});
const widget = computed(() => props.data.widget || {});
const isList = ListChartTypes.includes(
(props.data.graph && props.data.graph.type) || ""
const isList = computed(() =>
ListChartTypes.includes((props.data.graph && props.data.graph.type) || "")
);
if ((props.needQuery || !dashboardStore.currentDashboard.id) && !isList) {
if (
(props.needQuery || !dashboardStore.currentDashboard.id) &&
!isList.value
) {
queryMetrics();
}
@@ -162,11 +165,8 @@ export default defineComponent({
if (props.data.i !== dashboardStore.selectedGrid.i) {
return;
}
const isList = ListChartTypes.includes(
(props.data.graph && props.data.graph.type) || ""
);
const chart = dashboardStore.selectedGrid.graph || {};
if (ListChartTypes.includes(chart.type) || isList) {
if (ListChartTypes.includes(chart.type) || isList.value) {
return;
}
queryMetrics();
@@ -175,10 +175,7 @@ export default defineComponent({
watch(
() => [selectorStore.currentService, selectorStore.currentDestService],
() => {
const isList = ListChartTypes.includes(
(props.data.graph && props.data.graph.type) || ""
);
if (isList) {
if (isList.value) {
return;
}
if (
@@ -195,12 +192,18 @@ export default defineComponent({
if (dashboardStore.entity === EntityType[0].value) {
return;
}
if (isList.value) {
return;
}
queryMetrics();
}
);
watch(
() => appStore.durationTime,
() => {
if (isList.value) {
return;
}
if (dashboardStore.entity === EntityType[1].value) {
queryMetrics();
}