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] || {}); this.setSelectedStrategy(this.strategyList[0] || {});
if (!this.strategyList.length) { if (!this.strategyList.length) {
this.nodes = [];
this.calls = [];
this.taskList = []; this.taskList = [];
} }
if (!this.selectedStrategy.type) { if (!this.selectedStrategy.type) {

View File

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

View File

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

View File

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