fix: bugs fix

This commit is contained in:
Qiuxia Fan 2022-02-18 12:03:49 +08:00
parent 21318c1b71
commit f8d4b60f2b
2 changed files with 51 additions and 38 deletions

View File

@ -29,7 +29,7 @@ limitations under the License. -->
<div class="selectors-item" v-if="states.key === 3 || states.key === 4"> <div class="selectors-item" v-if="states.key === 3 || states.key === 4">
<span class="label"> <span class="label">
{{ {{
dashboardStore.entity === "Endpoint" ["EndpointRelation", "Endpoint"].includes(dashboardStore.entity)
? "$Endpoint" ? "$Endpoint"
: "$ServiceInstance" : "$ServiceInstance"
}} }}

View File

@ -50,42 +50,53 @@ limitations under the License. -->
</div> </div>
<div class="node-settings"> <div class="node-settings">
<h5 class="title">{{ t("nodeSettings") }}</h5> <h5 class="title">{{ t("nodeSettings") }}</h5>
<span v-show="isServer"> <div class="label">{{ t("nodeDashboard") }}</div>
<div class="label">{{ t("nodeDashboard") }}</div> <el-input
<div v-for="(item, index) in items" :key="index" class="metric-item"> v-show="!isServer"
<Selector v-model="states.nodeDashboard"
:value="item.scope" placeholder="Please input a dashboard name for nodes"
:options="ScopeType" @change="updateSettings"
size="small" size="small"
placeholder="Select a scope" class="inputs"
@change="changeScope(index, $event)" />
class="item mr-5" <div
v-show="isServer"
v-for="(item, index) in items"
:key="index"
class="metric-item"
>
<Selector
:value="item.scope"
:options="ScopeType"
size="small"
placeholder="Select a scope"
@change="changeScope(index, $event)"
class="item mr-5"
/>
<el-input
v-model="item.dashboard"
placeholder="Please input a dashboard name for nodes"
@change="updateNodeDashboards(index, $event)"
size="small"
class="item mr-5"
/>
<span>
<Icon
class="cp mr-5"
v-show="items.length > 1"
iconName="remove_circle_outline"
size="middle"
@click="deleteItem(index)"
/> />
<el-input <Icon
v-model="item.dashboard" class="cp"
placeholder="Please input a dashboard name for nodes" v-show="index === items.length - 1 && items.length < 5"
@change="updateNodeDashboards(index, $event)" iconName="add_circle_outlinecontrol_point"
size="small" size="middle"
class="item mr-5" @click="addItem"
/> />
<span> </span>
<Icon </div>
class="cp mr-5"
v-show="items.length > 1"
iconName="remove_circle_outline"
size="middle"
@click="deleteItem(index)"
/>
<Icon
class="cp"
v-show="index === items.length - 1 && items.length < 5"
iconName="add_circle_outlinecontrol_point"
size="middle"
@click="addItem"
/>
</span>
</div>
</span>
<div class="label">{{ t("nodeMetrics") }}</div> <div class="label">{{ t("nodeMetrics") }}</div>
<Selector <Selector
class="inputs" class="inputs"
@ -228,6 +239,8 @@ async function getMetricList() {
const entity = const entity =
dashboardStore.entity === EntityType[1].value dashboardStore.entity === EntityType[1].value
? EntityType[0].value ? EntityType[0].value
: dashboardStore.entity === EntityType[4].value
? EntityType[3].value
: dashboardStore.entity; : dashboardStore.entity;
states.nodeMetricList = (json.data.metrics || []).filter( states.nodeMetricList = (json.data.metrics || []).filter(
(d: { catalog: string }) => entity === (MetricCatalog as any)[d.catalog] (d: { catalog: string }) => entity === (MetricCatalog as any)[d.catalog]
@ -291,9 +304,9 @@ function deleteItem(index: number) {
function updateSettings() { function updateSettings() {
emit("update", { emit("update", {
linkDashboard: states.linkDashboard, linkDashboard: states.linkDashboard,
nodeDashboard: items.filter( nodeDashboard: isServer
(d: { scope: string; dashboard: string }) => d.dashboard ? items.filter((d: { scope: string; dashboard: string }) => d.dashboard)
), : states.nodeDashboard,
linkServerMetrics: states.linkServerMetrics, linkServerMetrics: states.linkServerMetrics,
linkClientMetrics: states.linkClientMetrics, linkClientMetrics: states.linkClientMetrics,
nodeMetrics: states.nodeMetrics, nodeMetrics: states.nodeMetrics,