fix: selectors

This commit is contained in:
Fine 2023-06-01 15:00:08 +08:00
parent 1c0f7780d7
commit b2cbc4f9f8
2 changed files with 39 additions and 30 deletions

View File

@ -20,7 +20,7 @@ limitations under the License. -->
<Selector <Selector
class="selector mr-10" class="selector mr-10"
size="small" size="small"
:value="instanceId" :value="instance.label"
:options="continousProfilingStore.instances" :options="continousProfilingStore.instances"
placeholder="Select a instance" placeholder="Select a instance"
@change="changeInstance" @change="changeInstance"
@ -29,18 +29,15 @@ limitations under the License. -->
<Selector <Selector
class="selector mr-10" class="selector mr-10"
size="small" size="small"
:value="processId" :value="process.label"
:options="continousProfilingStore.processes" :options="continousProfilingStore.processes"
placeholder="Select a process" placeholder="Select a process"
@change="changeProcess" @change="changeProcess"
/> />
<!-- <el-button type="primary" size="small" @click="analyzeTask">
{{ t("analysis") }}
</el-button> -->
</div> </div>
<div v-if="continousProfilingStore.selectedStrategy.type"> <div v-if="continousProfilingStore.selectedStrategy.type" class="vis-graph">
<div <div
class="vis-graph-topology ml-5" class="graph-topology ml-5"
v-loading="networkProfilingStore.loadNodes" v-loading="networkProfilingStore.loadNodes"
v-if="continousProfilingStore.selectedStrategy.type === TargetTypes[2].value" v-if="continousProfilingStore.selectedStrategy.type === TargetTypes[2].value"
> >
@ -49,7 +46,7 @@ limitations under the License. -->
{{ t("noData") }} {{ t("noData") }}
</div> </div>
</div> </div>
<div class="vis-graph ml-5" v-else> <div class="graph-flame ml-5" v-else>
<div class="schedules"> <div class="schedules">
<EBPFSchedules :type="ComponentType" /> <EBPFSchedules :type="ComponentType" />
</div> </div>
@ -71,8 +68,9 @@ limitations under the License. -->
import EBPFSchedules from "@/views/dashboard/related/ebpf/components/EBPFSchedules.vue"; import EBPFSchedules from "@/views/dashboard/related/ebpf/components/EBPFSchedules.vue";
import EBPFStack from "@/views/dashboard/related/ebpf/components/EBPFStack.vue"; import EBPFStack from "@/views/dashboard/related/ebpf/components/EBPFStack.vue";
import { TargetTypes, ComponentType } from "../data"; import { TargetTypes, ComponentType } from "../data";
import type { Instance, Process } from "@/types/selector";
/*global defineProps */ /*global defineProps, Recordable */
defineProps({ defineProps({
config: { config: {
type: Object as PropType<any>, type: Object as PropType<any>,
@ -83,24 +81,25 @@ limitations under the License. -->
const networkProfilingStore = useNetworkProfilingStore(); const networkProfilingStore = useNetworkProfilingStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const { t } = useI18n(); const { t } = useI18n();
const processId = ref<string>(""); const process = ref<Recordable<Process>>({});
const instanceId = ref<string>(""); const instance = ref<Recordable<Instance>>({});
function changeInstance(opt: { id: string }[]) { function changeInstance(opt: Recordable<Instance>[]) {
instanceId.value = opt[0].id; instance.value = opt[0];
continousProfilingStore.setCurrentInstance(instance.value);
} }
function changeProcess(opt: { id: string }[]) { function changeProcess(opt: Recordable<Process>[]) {
processId.value = opt[0].id; process.value = opt[0];
} }
async function getSelectors() { async function getSelectors() {
const serviceId = (selectorStore.currentService && selectorStore.currentService.id) || ""; const serviceId = (selectorStore.currentService && selectorStore.currentService.id) || "";
await continousProfilingStore.getServiceInstances(serviceId); await continousProfilingStore.getServiceInstances(serviceId);
instanceId.value = (continousProfilingStore.instances[0] || {}).id || ""; instance.value = continousProfilingStore.instances[0] || {};
await continousProfilingStore.getProcesses(instanceId.value); await continousProfilingStore.getProcesses(instance.value.id);
processId.value = (continousProfilingStore.processes[0] || {}).id || ""; process.value = continousProfilingStore.processes[0] || {};
} }
getSelectors(); getSelectors();
@ -125,24 +124,34 @@ limitations under the License. -->
} }
.vis-graph { .vis-graph {
height: 100%;
flex-grow: 2;
min-width: 700px;
overflow: auto;
}
.vis-graph-topology {
height: calc(100% - 20px); height: calc(100% - 20px);
flex-grow: 2; flex-grow: 2;
min-width: 700px; min-width: 700px;
overflow: auto;
width: 100%;
}
.graph-topology,
.graph-flame {
height: 100%;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: calc(100% - 330px); width: calc(100% - 5px);
}
.graph-flame {
overflow: auto;
} }
.policy-graph { .policy-graph {
height: calc(100% - 20px); height: 100%;
flex-grow: 2; flex-grow: 2;
overflow: auto; overflow: auto;
} }
.text {
height: 100%;
text-align: center;
margin-top: 100px;
}
</style> </style>

View File

@ -19,7 +19,7 @@ limitations under the License. -->
<g class="hex-polygon"> <g class="hex-polygon">
<path :d="getHexPolygonVertices()" stroke="#D5DDF6" stroke-width="2" fill="none" /> <path :d="getHexPolygonVertices()" stroke="#D5DDF6" stroke-width="2" fill="none" />
<text :x="0" :y="radius - 15" fill="#000" text-anchor="middle"> <text :x="0" :y="radius - 15" fill="#000" text-anchor="middle">
{{ selectorStore.currentPod.label }} {{ selectorStore.currentPod && selectorStore.currentPod.label }}
</text> </text>
</g> </g>
<g class="nodes"> <g class="nodes">
@ -530,11 +530,11 @@ limitations under the License. -->
border-radius: 3px; border-radius: 3px;
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 10px; right: 20px;
} }
.range { .range {
right: 50px; right: 60px;
} }
.topo-call { .topo-call {