Skip to content

Commit fe965fe

Browse files
authored
fix(PersonalWorkbench): 修复itsm单据可以批量审批、多租户审批人、申请人未获取displayname
fix(PersonalWorkbench): 修复itsm单据可以批量审批、多租户审批人、申请人未获取displayname
2 parents a9bc527 + d6db9a8 commit fe965fe

18 files changed

Lines changed: 267 additions & 120 deletions

File tree

src/dashboard-front/src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<BkConfigProvider :locale="bkuiLocale">
2020
<div
2121
id="app"
22+
class="app"
2223
:class="[
2324
systemCls,
2425
{ 'show-notice-wrapper': enableShowNotice && showNoticeAlert}

src/dashboard-front/src/components/ag-mcp-trace-chain/info/Index.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
{{ t('总耗时') }}:
4949
</div>
5050
<div class="value">
51-
{{ `${traceChainDetail?.total_latency_ms ?? 0 }ms` }}
51+
{{ formattedLatency }}
5252
</div>
5353
</div>
5454
<div class="item">
@@ -94,8 +94,9 @@
9494

9595
<script lang="ts" setup>
9696
import dayjs from 'dayjs';
97+
import { isNumber } from 'lodash-es';
9798
import { t } from '@/locales';
98-
import type { ITraceDetail } from '@/services/source/observability';
99+
import type { ILatencyDistribution, ITraceDetail } from '@/services/source/observability';
99100
import AgStatusDot from '@/components/ag-status-dot/Index.vue';
100101
101102
interface IProps { traceChainDetail?: ITraceDetail }
@@ -107,6 +108,16 @@ const isSuccessStatus = computed(() => {
107108
&& ((Number(traceChainDetail.status) >= 200
108109
&& Number(traceChainDetail.status) < 300) || ['success'].includes(traceChainDetail.status));
109110
});
111+
const formattedLatency = computed(() => {
112+
const totalLatency = traceChainDetail?.total_latency_ms ?? 0;
113+
const results = isNumber(totalLatency)
114+
? totalLatency % 1 === 0 || totalLatency.toString().split('.')[1]?.length <= 2
115+
? totalLatency
116+
: totalLatency.toFixed(3)
117+
: 0;
118+
119+
return `${results}ms`;
120+
});
110121
111122
const renderStatusDot = () => {
112123
return {
@@ -119,7 +130,7 @@ const renderLatencyDistribution = () => {
119130
const latencyDistribution = traceChainDetail?.latency_distribution;
120131
121132
if (latencyDistribution?.length) {
122-
return latencyDistribution.map((item: any) => `${item?.latency_ms}ms`)?.join(' - ');
133+
return latencyDistribution.map((item: ILatencyDistribution) => `${item?.latency_ms}ms`)?.join(' - ');
123134
}
124135
125136
return '0ms';

src/dashboard-front/src/components/render-tag-overflow/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class="render-row-item flex-1 truncate"
2525
:title="visibleData[0]"
2626
>
27-
{{ visibleData[0] }}
27+
{{ renderDisplayName(visibleData[0]) }}
2828
</BkTag>
2929
</template>
3030

src/dashboard-front/src/components/trace-view/trace-timeline-viewer/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface IState {
2929
resizeObserver: any
3030
}
3131

32-
const DEFAULT_MIN_VALUE = 240;
32+
const DEFAULT_MIN_VALUE = 198;
3333

3434
const TProps = {
3535
updateViewRangeTime: Function as PropType<TUpdateViewRangeTimeFunction>,
@@ -47,8 +47,8 @@ export default defineComponent({
4747

4848
const wrapperRef = ref<HTMLDivElement>();
4949
const virtualizedTraceViewRef = ref<InstanceType<typeof VirtualizedTraceView>>();
50-
const spanNameColumnWidth = ref<number>(0.25);
51-
const minSpanNameColumnWidth = ref<number>(0.25);
50+
const spanNameColumnWidth = ref<number>(0.20);
51+
const minSpanNameColumnWidth = ref<number>(0.20);
5252
const childrenHiddenIds = ref(new Set());
5353

5454
const state = reactive<IState>({
@@ -177,9 +177,8 @@ export default defineComponent({
177177
const getSpanNameColumnWidth = () => {
178178
const elemWidth = wrapperRef.value?.getBoundingClientRect()?.width || 0;
179179
const minReact = Number((DEFAULT_MIN_VALUE / elemWidth).toFixed(2));
180-
minSpanNameColumnWidth.value = minReact > 0.25 ? minReact : 0.25;
180+
minSpanNameColumnWidth.value = minReact > 0.20 ? minReact : 0.20;
181181
if (minReact < spanNameColumnWidth.value) return;
182-
183182
spanNameColumnWidth.value = Number(minReact);
184183
};
185184

src/dashboard-front/src/components/trace-view/trace-timeline-viewer/span-bar-row.tsx

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
* to the current version of the project delivered to anyone in the future.
1717
*/
1818

19+
import type { SetupContext } from 'vue';
1920
import { Divider, PopConfirm, Popover } from 'bkui-vue';
2021
import { bkTooltips } from 'bkui-vue/lib/directives';
22+
import { debounce } from 'lodash-es';
2123
import {
2224
type ViewedBoundsFunctionType,
2325
createViewedBoundsFunc,
@@ -86,15 +88,23 @@ const SpanBarRowProps = {
8688
type: Number,
8789
required: true,
8890
},
89-
};
91+
} as const;
92+
93+
type SpanBarRowPropsType = ExtractPropTypes<typeof SpanBarRowProps>;
9094

9195
export default defineComponent({
9296
name: 'SpanBarRow',
9397
directives: { bkTooltips },
9498
props: SpanBarRowProps,
9599
emits: ['toggleCollapse'],
96100

97-
setup(props: any, { emit }: any) {
101+
setup(props: SpanBarRowPropsType, { emit }: SetupContext<['toggleCollapse']>) {
102+
// 自动更新溢出状态
103+
let resizeObserver: ResizeObserver | null = null;
104+
// 服务名称文本溢出判断
105+
const svcNameEl = ref<HTMLElement | null>(null);
106+
const isSvcNameOverflow = ref(false);
107+
98108
const traceStore = useTrace();
99109
const spanBarCurrentStore = useSpanBarCurrentInject();
100110
const childrenHiddenStore = useChildrenHiddenInject();
@@ -150,6 +160,15 @@ export default defineComponent({
150160
}) as ViewedBoundsFunctionType;
151161
};
152162

163+
// 服务名称是否溢出判断
164+
const updateOverflow = debounce(() => {
165+
if (!svcNameEl.value) return;
166+
167+
// 核心判断:文本是否溢出
168+
isSvcNameOverflow.value
169+
= svcNameEl.value.scrollWidth > svcNameEl.value.clientWidth;
170+
}, 100);
171+
153172
const detailToggle = () => {
154173
props.onDetailToggled?.(props.span?.span_id as string);
155174
};
@@ -177,7 +196,30 @@ export default defineComponent({
177196
emit('toggleCollapse', groupID, status);
178197
};
179198

199+
onMounted(() => {
200+
nextTick(() => {
201+
if (!svcNameEl.value) return;
202+
203+
resizeObserver = new ResizeObserver(() => {
204+
updateOverflow();
205+
});
206+
resizeObserver.observe(svcNameEl.value);
207+
208+
updateOverflow();
209+
});
210+
});
211+
212+
onBeforeUnmount(() => {
213+
if (resizeObserver && svcNameEl.value) {
214+
resizeObserver.unobserve(svcNameEl.value);
215+
resizeObserver.disconnect();
216+
resizeObserver = null;
217+
}
218+
});
219+
180220
return {
221+
svcNameEl,
222+
isSvcNameOverflow,
181223
activeSpan,
182224
showDuration,
183225
crossRelationInfo,
@@ -255,14 +297,6 @@ export default defineComponent({
255297
: ebpfTapPortName
256298
: operation;
257299
const labelDetail = `${displayServiceName}::${displayOperationName}`;
258-
let errorDescription = '';
259-
if (showErrorIcon) {
260-
const item = attributes?.find?.(
261-
(attr: { key: string }) => attr.key === 'span.status_message',
262-
);
263-
errorDescription = item?.value || '';
264-
}
265-
266300
const longLabel = `${label ? `${label} | ` : ''}${labelDetail}`;
267301

268302
const kindIcons: Record<KindType, string> = {
@@ -346,9 +380,11 @@ export default defineComponent({
346380
/>
347381
)}
348382
<span
383+
ref="svcNameEl"
349384
v-bk-tooltips={{
350385
content: `${displayServiceName} ${displayOperationName} | ${label}`,
351386
placement: 'top',
387+
disabled: !this.isSvcNameOverflow,
352388
}}
353389
class={[
354390
'span-svc-name',
@@ -528,13 +564,13 @@ export default defineComponent({
528564
? (
529565
<i
530566
class="icon-monitor icon-mc-fold-menu icon-collapsed"
531-
onClick={(e: any) => this.handleToggleCollapse(e, groupInfo.id, 'collpase')}
567+
onClick={(e: MouseEvent) => this.handleToggleCollapse(e, groupInfo.id, 'collpase')}
532568
/>
533569
)
534570
: (
535571
<span
536572
class="collapsed-mark"
537-
onClick={(e: any) => this.handleToggleCollapse(e, groupInfo.id, 'expand')}
573+
onClick={(e: MouseEvent) => this.handleToggleCollapse(e, groupInfo.id, 'expand')}
538574
>
539575
{groupInfo.members.length}
540576
</span>

0 commit comments

Comments
 (0)