refactor: enhance the Log widget (#339)

This commit is contained in:
Fine0830 2023-11-17 10:15:39 +08:00 committed by GitHub
parent 8f3ce7d371
commit c6d1c49569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 20 deletions

View File

@ -15,6 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
@use "element-plus/theme-chalk/src/dark/css-vars.scss" as *; @use "element-plus/theme-chalk/src/dark/css-vars.scss" as *;
:root {
--sw-green: #70c877;
--sw-orange: #e6a23c;
}
html { html {
--el-color-primary: #409eff; --el-color-primary: #409eff;
@ -58,7 +62,7 @@ html {
} }
html.dark { html.dark {
--el-color-primary: rgb(64, 158, 255); --el-color-primary: #409eff;
--theme-background: #212224; --theme-background: #212224;
--font-color: #fafbfc; --font-color: #fafbfc;
--disabled-color: #ccc; --disabled-color: #ccc;

View File

@ -88,7 +88,7 @@ limitations under the License. -->
border-bottom: 1px solid var(--sw-trace-list-border); border-bottom: 1px solid var(--sw-trace-list-border);
.traceId { .traceId {
width: 140px; width: 20px;
} }
.content { .content {
@ -96,7 +96,7 @@ limitations under the License. -->
} }
.tags { .tags {
width: 100px; width: 15px;
} }
.serviceName { .serviceName {
@ -107,7 +107,6 @@ limitations under the License. -->
.log-header div { .log-header div {
padding: 0 5px; padding: 0 5px;
border: 1px solid transparent; border: 1px solid transparent;
border-right: 1px dotted silver;
line-height: 30px; line-height: 30px;
background-color: var(--sw-table-header); background-color: var(--sw-table-header);
overflow: hidden; overflow: hidden;

View File

@ -73,5 +73,6 @@ limitations under the License. -->
outline: none; outline: none;
color: $font-color; color: $font-color;
overflow: auto; overflow: auto;
padding: 5px;
} }
</style> </style>

View File

@ -24,10 +24,12 @@ limitations under the License. -->
<span v-if="item.label === 'timestamp'"> <span v-if="item.label === 'timestamp'">
{{ dateFormat(data.timestamp) }} {{ dateFormat(data.timestamp) }}
</span> </span>
<span v-else-if="item.label === 'tags'"> <span v-else-if="item.label === 'tags'" :class="level.toLowerCase()"> > </span>
{{ level }} <el-tooltip v-else-if="item.label === 'traceId'" content="Trace Link">
</span> <span :class="noLink ? '' : 'blue'">
<span v-else-if="item.label === 'traceId' && !noLink" :class="noLink ? '' : 'blue'"> trace </span> <Icon v-if="!noLink" iconName="merge" />
</span>
</el-tooltip>
<span v-else>{{ data[item.label] }}</span> <span v-else>{{ data[item.label] }}</span>
</div> </div>
</div> </div>
@ -87,6 +89,9 @@ limitations under the License. -->
.traceId { .traceId {
cursor: pointer; cursor: pointer;
width: 20px;
text-align: center;
position: relative;
span { span {
display: inline-block; display: inline-block;
@ -94,12 +99,16 @@ limitations under the License. -->
} }
.blue { .blue {
color: #448dfe; color: var(--el-color-primary);
} }
} }
.tags { .tags {
width: 100px; width: 15px;
text-align: center;
color: var(--sw-green);
font-weight: 400;
font-size: 14px;
} }
.content { .content {
@ -112,15 +121,14 @@ limitations under the License. -->
} }
.log-item:hover { .log-item:hover {
background: rgb(0 0 0 / 4%); background: var(--sw-list-hover);
} }
.log-item > div { .log-item > div {
width: 140px; width: 60px;
padding: 0 5px; padding: 0 5px;
display: inline-block; display: inline-block;
border: 1px solid transparent; border: 1px solid transparent;
border-right: 1px dotted silver;
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
overflow: hidden; overflow: hidden;
@ -137,4 +145,12 @@ limitations under the License. -->
height: 100%; height: 100%;
padding: 3px 8px; padding: 3px 8px;
} }
.error {
color: var(--sw-orange);
}
.warning {
color: var(--sw-orange);
}
</style> </style>

View File

@ -16,18 +16,18 @@
*/ */
export const ServiceLogConstants = [ export const ServiceLogConstants = [
{
label: "content",
value: "content",
},
{ {
label: "tags", label: "tags",
value: "level", value: "",
}, },
{ {
label: "traceId", label: "traceId",
value: "", value: "",
}, },
{
label: "content",
value: "content",
},
]; ];
export const ServiceLogDetail = [ export const ServiceLogDetail = [
{ {

View File

@ -287,7 +287,6 @@ limitations under the License. -->
} }
.profiled { .profiled {
// background-color: #eee;
background-color: var(--sw-table-header); background-color: var(--sw-table-header);
position: relative; position: relative;
} }
@ -329,7 +328,6 @@ limitations under the License. -->
} }
.trace-item { .trace-item {
// display: flex;
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
cursor: pointer; cursor: pointer;