mirror of https://github.com/certd/certd
perf: 优化日志颜色
parent
09847ce074
commit
1291e98e82
|
@ -8,7 +8,11 @@
|
||||||
<pi-status-show :status="item.node.status?.result" type="icon"></pi-status-show>
|
<pi-status-show :status="item.node.status?.result" type="icon"></pi-status-show>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<pre class="pi-task-view-logs" style="overflow: auto"><template v-for="(text, index) of item.logs" :key="index">{{ text }}</template></pre>
|
<div class="pi-task-view-logs" style="overflow: auto">
|
||||||
|
<template v-for="(logItem, index) of item.logs" :key="index">
|
||||||
|
<span :class="logItem.color"> {{ logItem.time }}</span> <span>{{ logItem.content }}</span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
@ -57,7 +61,20 @@ export default {
|
||||||
if (currentHistory?.value?.logs != null) {
|
if (currentHistory?.value?.logs != null) {
|
||||||
node.logs = computed(() => {
|
node.logs = computed(() => {
|
||||||
if (currentHistory?.value?.logs && currentHistory.value?.logs[node.node.id] != null) {
|
if (currentHistory?.value?.logs && currentHistory.value?.logs[node.node.id] != null) {
|
||||||
return currentHistory.value?.logs[node.node.id];
|
const logs = currentHistory.value?.logs[node.node.id];
|
||||||
|
const list = [];
|
||||||
|
for (let log of logs) {
|
||||||
|
const index = log.indexOf("]", 27) + 1;
|
||||||
|
const time = log.substring(0, index);
|
||||||
|
const content = log.substring(index);
|
||||||
|
const color = time.includes("ERROR") ? "red" : time.includes("WARN") ? "yellow" : "green";
|
||||||
|
list.push({
|
||||||
|
time,
|
||||||
|
content,
|
||||||
|
color
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
@ -92,6 +109,7 @@ export default {
|
||||||
.pi-task-view {
|
.pi-task-view {
|
||||||
.tab-title {
|
.tab-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.tab-title-text {
|
.tab-title-text {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 180px;
|
width: 180px;
|
||||||
|
@ -104,11 +122,26 @@ export default {
|
||||||
|
|
||||||
.pi-task-view-logs {
|
.pi-task-view-logs {
|
||||||
background-color: #000c17;
|
background-color: #000c17;
|
||||||
color: #fafafa;
|
color: #e9e9e9;
|
||||||
|
font-family: monospace;
|
||||||
|
padding: 5px;
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
max-height: 580px;
|
max-height: 580px;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
> div {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.green {
|
||||||
|
color: rgba(0, 255, 0, 0.8);
|
||||||
|
}
|
||||||
|
.yellow {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
.red {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue