update style

This commit is contained in:
Qiuxia Fan 2022-04-24 11:24:09 +08:00
parent e5b69ec276
commit 659429ca18
5 changed files with 35 additions and 17 deletions

View File

@ -38,6 +38,7 @@ interface EbpfStore {
highlightTop: boolean; highlightTop: boolean;
labels: Option[]; labels: Option[];
couldProfiling: boolean; couldProfiling: boolean;
tip: string;
} }
export const ebpfStore = defineStore({ export const ebpfStore = defineStore({
@ -51,6 +52,7 @@ export const ebpfStore = defineStore({
highlightTop: true, highlightTop: true,
labels: [{ value: "", label: "" }], labels: [{ value: "", label: "" }],
couldProfiling: false, couldProfiling: false,
tip: "",
}), }),
actions: { actions: {
setCurrentSpan(span: Span) { setCurrentSpan(span: Span) {
@ -136,6 +138,7 @@ export const ebpfStore = defineStore({
return res.data; return res.data;
} }
const { analysisEBPFResult } = res.data.data; const { analysisEBPFResult } = res.data.data;
this.tip = analysisEBPFResult.tip;
if (!analysisEBPFResult) { if (!analysisEBPFResult) {
this.analyzeTrees = []; this.analyzeTrees = [];
return res.data; return res.data;

1
src/types/ebpf.d.ts vendored
View File

@ -66,4 +66,5 @@ export type StackElement = {
stackType: string; stackType: string;
value: number; value: number;
children?: StackElement[]; children?: StackElement[];
instanceName: string;
}; };

View File

@ -16,8 +16,10 @@ limitations under the License. -->
<div class="flex-h content"> <div class="flex-h content">
<TaskList /> <TaskList />
<div class="vis-graph ml-5"> <div class="vis-graph ml-5">
<div class="item">
<EBPFSchedules /> <EBPFSchedules />
<div class="stack"> </div>
<div class="item">
<EBPFStack /> <EBPFStack />
</div> </div>
</div> </div>
@ -39,8 +41,9 @@ import EBPFStack from "./components/EBPFStack.vue";
width: calc(100% - 300px); width: calc(100% - 300px);
} }
.stack { .item {
width: 100%; width: 100%;
overflow: auto; overflow: auto;
height: 50%;
} }
</style> </style>

View File

@ -157,9 +157,6 @@ async function analyzeEBPF() {
ElMessage.error(res.data.errors); ElMessage.error(res.data.errors);
return; return;
} }
if (res.data.analysisEBPFResult.tip) {
ElMessage.error(res.data.analysisEBPFResult.tip);
}
} }
function visTimeline() { function visTimeline() {
@ -183,15 +180,16 @@ function visTimeline() {
} }
); );
searchProcesses(); searchProcesses();
const items: any = new DataSet(schedules);
const options = {
height: 250,
width: "100%",
locale: "en",
};
if (!timeline.value) { if (!timeline.value) {
return; return;
} }
const h = timeline.value.getBoundingClientRect().height;
const items: any = new DataSet(schedules);
const options = {
height: h,
width: "100%",
locale: "en",
};
visGraph.value = new Timeline(timeline.value, items, options); visGraph.value = new Timeline(timeline.value, items, options);
} }
@ -200,8 +198,10 @@ function changePage(pageIndex: number) {
} }
function searchProcesses(pageIndex?: any) { function searchProcesses(pageIndex?: any) {
const arr = processes.value.filter((d: { name: string }) => const arr = processes.value.filter(
d.name.includes(searchText.value) (d: { name: string; instanceName: string }) =>
d.name.includes(searchText.value) ||
d.instanceName.includes(searchText.value)
); );
currentProcesses.value = arr.splice( currentProcesses.value = arr.splice(
(pageIndex - 1 || 0) * pageSize, (pageIndex - 1 || 0) * pageSize,
@ -222,8 +222,9 @@ watch(
} }
.schedules { .schedules {
width: 100%; width: calc(100% - 5px);
margin: 0 5px 5px 0; margin: 0 5px 5px 0;
height: calc(100% - 60px);
} }
.inputs { .inputs {

View File

@ -13,7 +13,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. --> limitations under the License. -->
<template> <template>
<div id="graph-stack" ref="graph"></div> <div id="graph-stack" ref="graph">
<span class="tip" v-show="ebpfStore.tip">{{ ebpfStore.tip }}</span>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from "vue"; import { ref, watch } from "vue";
@ -132,7 +134,15 @@ watch(
<style> <style>
#graph-stack { #graph-stack {
width: 100%; width: 100%;
height: 350px; height: 100%;
cursor: pointer; cursor: pointer;
} }
.tip {
display: inline-block;
width: 100%;
text-align: center;
color: red;
margin-top: 20px;
}
</style> </style>