fix: update

This commit is contained in:
Fine 2023-06-12 13:21:08 +08:00
parent f28bca5db3
commit a6a5d744fa
4 changed files with 25 additions and 17 deletions

View File

@ -114,8 +114,6 @@ export const continousProfilingStore = defineStore({
});
this.setSelectedStrategy(this.strategyList[0] || {});
if (!this.strategyList.length) {
this.nodes = [];
this.calls = [];
this.taskList = [];
}
if (!this.selectedStrategy.type) {

View File

@ -16,7 +16,7 @@ limitations under the License. -->
<template>
<div class="policy-list">
<el-collapse v-model="activeNames">
<el-collapse-item v-for="(item, index) in policyList" :key="index" :name="String(index)">
<el-collapse-item v-for="(_, index) in policyList" :key="index" :name="String(index)">
<template #title>
<div>
<span class="title">{{ `Policy - ${index + 1}` }}</span>
@ -48,17 +48,22 @@ limitations under the License. -->
</template>
<script lang="ts" setup>
import { ref } from "vue";
import type { PropType } from "vue";
import { useI18n } from "vue-i18n";
import { useContinousProfilingStore } from "@/store/modules/continous-profiling";
import Policy from "./Policy.vue";
import type { StrategyItem, CheckItems } from "@/types/continous-profiling";
/* global defineEmits */
/* global defineEmits, defineProps */
const props = defineProps({
policyList: {
type: Array as PropType<StrategyItem[]>,
default: () => [],
},
});
const emits = defineEmits(["save"]);
const { t } = useI18n();
const continousProfilingStore = useContinousProfilingStore();
const activeNames = ref(["0"]);
const policyList = ref<StrategyItem[]>(continousProfilingStore.strategyList);
const policyList = ref<StrategyItem[]>([...props.policyList]);
function changePolicy(params: StrategyItem, order: number) {
policyList.value = policyList.value.map((d: StrategyItem, index: number) => {
@ -107,6 +112,7 @@ limitations under the License. -->
params.push(v);
}
}
emits("save", params);
}
</script>
@ -118,7 +124,7 @@ limitations under the License. -->
.save-btn {
width: 300px;
margin-top: 50px;
margin-top: 10px;
}
.title {

View File

@ -131,9 +131,8 @@ limitations under the License. -->
if (states.checkItems[index].uriRegex) {
return ElMessage.warning("UriList or UriRegex only be configured with one option.");
}
const params = event.target.textContent;
const regex = /http[^;]*;/g;
const arr = params.match(regex);
const params = (event.target.textContent || "").replace(/\s+/g, "");
const arr = params.splice(";");
states.checkItems[index].uriList = arr.length ? arr : null;
emits("edit", states, props.order);
}

View File

@ -45,7 +45,11 @@ limitations under the License. -->
</div>
<div class="grey ell sm" v-for="(item, index) in i.checkItems" :key="index">
<span class="sm">
{{ `${item.type} >= ${item.threshold}; ` }}
{{
`${item.type} >= ${item.threshold}${
[MonitorType[0].value, MonitorType[3].value].includes(item.type) ? "%" : ""
}; `
}}
</span>
</div>
</td>
@ -61,7 +65,7 @@ limitations under the License. -->
fullscreen
@closed="updateStrategies = false"
>
<EditPolicy @save="editStrategies" />
<EditPolicy :policyList="continousProfilingStore.strategyList" @save="editStrategies" />
</el-dialog>
</template>
<script lang="ts" setup>
@ -72,6 +76,7 @@ limitations under the License. -->
import type { StrategyItem, CheckItems } from "@/types/continous-profiling";
import { ElMessage } from "element-plus";
import EditPolicy from "./EditPolicy.vue";
import { MonitorType } from "../data";
const { t } = useI18n();
const selectorStore = useSelectorStore();
@ -141,7 +146,7 @@ limitations under the License. -->
width: 300px;
height: 98%;
overflow: auto;
border-right: 1px solid rgba(0, 0, 0, 0.1);
border-right: 1px solid rgb(0 0 0 / 10%);
}
.item span {
@ -150,7 +155,7 @@ limitations under the License. -->
.profile-td {
padding: 10px 5px 10px 10px;
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
border-bottom: 1px solid rgb(0 0 0 / 7%);
&.selected {
background-color: #ededed;
@ -178,13 +183,13 @@ limitations under the License. -->
.profile-tr {
&:hover {
background-color: rgba(0, 0, 0, 0.04);
background-color: rgb(0 0 0 / 4%);
}
}
.profile-t-tool {
padding: 10px 5px 10px 10px;
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
border-bottom: 1px solid rgb(0 0 0 / 7%);
background: #f3f4f9;
width: 100%;
font-weight: bold;