fix: update style

This commit is contained in:
Qiuxia Fan 2022-03-02 15:36:03 +08:00
parent ff9da5a379
commit db19a7f7fb
6 changed files with 38 additions and 37 deletions

View File

@ -166,11 +166,12 @@ export const traceStore = defineStore({
.params(params); .params(params);
if (res.data.errors) { if (res.data.errors) {
this.segmentSpans = []; this.analyzeTrees = [];
return res.data; return res.data;
} }
const { analyze, tip } = res.data.data; const { analyze, tip } = res.data.data;
if (tip) { if (tip) {
this.analyzeTrees = [];
return res.data; return res.data;
} }

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. --> limitations under the License. -->
<template> <template>
<div class="rk-profile-task"> <div class="profile-task">
<div> <div>
<div class="label">{{ t("endpointName") }}</div> <div class="label">{{ t("endpointName") }}</div>
<el-input v-model="endpointName" class="profile-input" /> <el-input v-model="endpointName" class="profile-input" />
@ -28,7 +28,7 @@ limitations under the License. -->
:options="InitTaskField.monitorTimeEn" :options="InitTaskField.monitorTimeEn"
@change="changeMonitorTime" @change="changeMonitorTime"
/> />
<span> <span class="date">
<TimePicker <TimePicker
:value="time" :value="time"
position="bottom" position="bottom"
@ -144,6 +144,15 @@ function changeTimeRange(val: Date) {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.profile-task {
margin: 0 auto;
width: 300px;
}
.date {
font-size: 12px;
}
.label { .label {
margin-top: 10px; margin-top: 10px;
font-size: 14px; font-size: 14px;
@ -157,14 +166,4 @@ function changeTimeRange(val: Date) {
width: 300px; width: 300px;
margin-top: 50px; margin-top: 50px;
} }
.message-tip {
font-size: 14px;
color: red;
margin-top: 10px;
}
.monitor-time-radio {
display: inline;
}
</style> </style>

View File

@ -27,7 +27,7 @@ limitations under the License. -->
Self Duration (ms) Self Duration (ms)
<a <a
class="profile-set-btn" class="profile-set-btn"
@click="updateHighlightTop()" @click="updateHighlightTop"
title="Highlight top 10 slow methods" title="Highlight top 10 slow methods"
:style="{ color: highlightTop ? '#448dfe' : '#484b55' }" :style="{ color: highlightTop ? '#448dfe' : '#484b55' }"
> >

View File

@ -128,7 +128,6 @@ const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
dayjs(date).format(pattern); dayjs(date).format(pattern);
async function getTaceLogs() { async function getTaceLogs() {
showRelatedLogs.value = true; showRelatedLogs.value = true;
console.log(props.currentSpan);
const res = await traceStore.getSpanLogs({ const res = await traceStore.getSpanLogs({
condition: { condition: {
relatedTrace: { relatedTrace: {

View File

@ -50,7 +50,7 @@ limitations under the License. -->
:key="'key' + index" :key="'key' + index"
:type="type" :type="type"
:headerType="headerType" :headerType="headerType"
@click="selectItem(item)" @select="selectItem"
/> />
<slot></slot> <slot></slot>
</div> </div>

View File

@ -55,7 +55,6 @@ limitations under the License. -->
'level' + (data.level - 1), 'level' + (data.level - 1),
{ 'trace-item-error': data.isError }, { 'trace-item-error': data.isError },
]" ]"
ref="traceItem"
> >
<div <div
:class="['method', 'level' + (data.level - 1)]" :class="['method', 'level' + (data.level - 1)]"
@ -121,6 +120,7 @@ limitations under the License. -->
:data="child" :data="child"
:type="type" :type="type"
:headerType="headerType" :headerType="headerType"
@select="selectedItem(child)"
/> />
</div> </div>
<el-dialog <el-dialog
@ -149,13 +149,13 @@ const props = {
export default defineComponent({ export default defineComponent({
name: "TableItem", name: "TableItem",
props, props,
emits: ["select"],
components: { SpanDetail }, components: { SpanDetail },
setup(props) { setup(props, { emit }) {
/* global Nullable */ /* global Nullable */
const displayChildren = ref<boolean>(true); const displayChildren = ref<boolean>(true);
const showDetail = ref<boolean>(false); const showDetail = ref<boolean>(false);
const { t } = useI18n(); const { t } = useI18n();
const traceItem = ref<Nullable<HTMLDivElement>>(null);
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") => const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
dayjs(date).format(pattern); dayjs(date).format(pattern);
const selfTime = computed(() => (props.data.dur ? props.data.dur : 0)); const selfTime = computed(() => (props.data.dur ? props.data.dur : 0));
@ -186,35 +186,36 @@ export default defineComponent({
function toggle() { function toggle() {
displayChildren.value = !displayChildren.value; displayChildren.value = !displayChildren.value;
} }
function showSelectSpan() { function showSelectSpan(dom: any) {
if (!dom) {
return;
}
const items: any = document.querySelectorAll(".trace-item"); const items: any = document.querySelectorAll(".trace-item");
for (const item of items) { for (const item of items) {
item.style.background = "#fff"; item.style.background = "#fff";
} }
if (!traceItem.value) { dom.style.background = "rgba(0, 0, 0, 0.1)";
return; }
} function selectSpan(event: any) {
const dom = event.path.find((d: any) =>
d.className.includes("trace-item")
);
traceItem.value.style.background = "rgba(0, 0, 0, 1)"; emit("select", props.data);
}
function selectSpan() {
if (props.headerType === "profile") { if (props.headerType === "profile") {
showSelectSpan(); showSelectSpan(dom);
return; return;
} }
viewSpanDetail(); viewSpanDetail(dom);
} }
function viewSpanDetail() {
showSelectSpan(); function selectedItem(data: any) {
emit("select", data);
}
function viewSpanDetail(dom: any) {
showSelectSpan(dom);
showDetail.value = true; showDetail.value = true;
} }
watch(
() => props.data,
() => {
showSelectSpan();
}
);
return { return {
displayChildren, displayChildren,
outterPercent, outterPercent,
@ -225,6 +226,7 @@ export default defineComponent({
showSelectSpan, showSelectSpan,
showDetail, showDetail,
selectSpan, selectSpan,
selectedItem,
t, t,
}; };
}, },