fix: update

This commit is contained in:
Fine 2023-08-15 18:20:44 +08:00
parent 41d4a42960
commit ac7b4963e9

View File

@ -52,7 +52,7 @@ limitations under the License. -->
:tags="states.linkServerExpressions" :tags="states.linkServerExpressions"
:vertical="true" :vertical="true"
:text="t('addExpressions')" :text="t('addExpressions')"
@change="(param) => changeLinkServerExpressions({ linkServerExpressions: param })" @change="(param) => changeLinkServerExpressions(param)"
/> />
</div> </div>
<Selector <Selector
@ -82,7 +82,7 @@ limitations under the License. -->
:tags="states.linkClientExpressions" :tags="states.linkClientExpressions"
:vertical="true" :vertical="true"
:text="t('addExpressions')" :text="t('addExpressions')"
@change="(param) => changeLinkClientExpressions({ linkClientExpressions: param })" @change="(param) => changeLinkClientExpressions(param)"
/> />
</div> </div>
<Selector <Selector
@ -153,7 +153,7 @@ limitations under the License. -->
:tags="states.nodeExpressions" :tags="states.nodeExpressions"
:vertical="true" :vertical="true"
:text="t('addExpressions')" :text="t('addExpressions')"
@change="(param) => changeNodeExpressions({ nodeExpressions: param })" @change="(param) => changeNodeExpressions(param)"
/> />
</div> </div>
<Selector <Selector
@ -279,9 +279,9 @@ limitations under the License. -->
linkMetricList: [], linkMetricList: [],
linkDashboards: [], linkDashboards: [],
nodeDashboards: [], nodeDashboards: [],
linkServerExpressions: [], linkServerExpressions: selectedGrid.linkServerExpressions || [],
linkClientExpressions: [], linkClientExpressions: selectedGrid.linkClientExpressions || [],
nodeExpressions: [], nodeExpressions: selectedGrid.nodeExpressions || [],
}); });
const l = selectedGrid.legend && selectedGrid.legend.length; const l = selectedGrid.legend && selectedGrid.legend.length;
const legend = reactive<{ const legend = reactive<{
@ -434,11 +434,11 @@ limitations under the License. -->
} }
topologyStore.getLinkServerMetrics(states.linkServerMetrics); topologyStore.getLinkServerMetrics(states.linkServerMetrics);
} }
function changeLinkServerExpressions(params: { [key: string]: string[] }) { function changeLinkServerExpressions(param: string[]) {
if (!isExpression.value) { if (!isExpression.value) {
return; return;
} }
states.linkServerExpressions = params.linkServerExpressions; states.linkServerExpressions = param;
updateSettings(); updateSettings();
if (!states.linkServerExpressions.length) { if (!states.linkServerExpressions.length) {
topologyStore.setLinkServerMetrics({}); topologyStore.setLinkServerMetrics({});
@ -446,11 +446,11 @@ limitations under the License. -->
} }
topologyStore.getLinkExpressions(states.linkServerExpressions, "SERVER"); topologyStore.getLinkExpressions(states.linkServerExpressions, "SERVER");
} }
function changeLinkClientExpressions(params: { [key: string]: string[] }) { function changeLinkClientExpressions(param: string[]) {
if (!isExpression.value) { if (!isExpression.value) {
return; return;
} }
states.linkClientExpressions = params.linkClientExpressions; states.linkClientExpressions = param;
updateSettings(); updateSettings();
if (!states.linkClientExpressions.length) { if (!states.linkClientExpressions.length) {
topologyStore.changeLinkClientMetrics({}); topologyStore.changeLinkClientMetrics({});
@ -511,16 +511,11 @@ limitations under the License. -->
function setConfigType(type: string) { function setConfigType(type: string) {
configType.value = type; configType.value = type;
} }
function changeExpressions(params: { [key: string]: string[] }) { function changeNodeExpressions(param: string[]) {
const key: string = Object.keys(params || {})[0];
(states as any)[key] = params && params[key];
updateSettings();
}
function changeNodeExpressions(params: { [key: string]: string[] }) {
if (!isExpression.value) { if (!isExpression.value) {
return; return;
} }
states.nodeExpressions = params.nodeExpressions; states.nodeExpressions = param;
updateSettings(); updateSettings();
if (!states.nodeExpressions.length) { if (!states.nodeExpressions.length) {
topologyStore.setNodeMetricValue({}); topologyStore.setNodeMetricValue({});
@ -529,6 +524,15 @@ limitations under the License. -->
topologyStore.queryNodeExpressions(states.nodeExpressions); topologyStore.queryNodeExpressions(states.nodeExpressions);
} }
function changeMetricMode() { function changeMetricMode() {
if (isExpression.value) {
states.linkServerMetrics = [];
states.linkClientMetrics = [];
states.nodeMetrics = [];
} else {
states.linkServerExpressions = [];
states.linkClientExpressions = [];
states.nodeExpressions = [];
}
updateSettings(); updateSettings();
} }
</script> </script>