Skip to content

Commit 967e049

Browse files
青羽青羽
authored andcommitted
1.add admin model to global history;
2.tables in global history use handwritten plugins; 3.tables in workbench history use handwritten plugins;
1 parent 83997ca commit 967e049

File tree

14 files changed

+885
-364
lines changed

14 files changed

+885
-364
lines changed

src/js/component/editor/index.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,24 @@
44
height: 100%;
55
width: 100%;
66

7-
.monaco-editor {
7+
.monaco-editor.vs {
88
.overflow-guard {
99
.monaco-scrollable-element {
10-
left: 82px !important;
10+
.token {
11+
&.log-error {
12+
color: red;
13+
font-weight: bold;
14+
}
15+
&.log-warn {
16+
color: yellow;
17+
}
18+
&.log-info {
19+
color: blue;
20+
}
21+
&.log-date {
22+
color: green;
23+
}
24+
}
1125
}
1226
}
1327
}

src/js/module/globalHistory/table.vue renamed to src/js/component/table/historyTable.vue

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
:key="th.key"
1717
:style="{'min-width': th.width + 'px', 'text-align': th.align}"
1818
class="we-table-thead-cell">
19-
{{ th.title }}
19+
{{ th.title || '#' }}
2020
</th>
2121
</tr>
2222
</thead>
@@ -26,21 +26,24 @@
2626
:key="index"
2727
class="we-table-row">
2828
<td
29-
v-for="(th) in columns"
29+
v-for="(th, index) in columns"
3030
:key="th.key"
3131
:style="{'text-align': th.align}"
3232
class="we-table-row-cell">
3333
<div
3434
class="we-table-row-label"
35-
:style="{'width': th.width + 'px'}"
36-
:class="{'ellipsis': th.ellipsis}">
35+
:style="{'width': th.width ? th.width + 'px' : getComputedWidth(th)}"
36+
:class="{'ellipsis': th.ellipsis}"
37+
:title="th.ellipsis ? td[th.key] : ''">
3738
<table-expand
3839
v-if="th.renderType"
3940
:row="td"
4041
:column="th"
4142
:index="index"
4243
:render="renderComponent({type: th.renderType, cell: td, key: th.key, params: th.renderParams})"></table-expand>
43-
<span v-else>{{ td[th.key] }}</span>
44+
<span
45+
v-else
46+
:class="th.className">{{ td[th.key] }}</span>
4447
</div>
4548
</td>
4649
</tr>
@@ -52,6 +55,7 @@
5255
import moment from 'moment';
5356
import util from '@/js/util';
5457
import TableExpand from './expand';
58+
import elementResizeEvent from '@js/helper/elementResizeEvent';
5559
export default {
5660
components: {
5761
TableExpand,
@@ -69,9 +73,15 @@ export default {
6973
},
7074
data() {
7175
return {
72-
76+
offsetWidth: 0,
7377
};
7478
},
79+
mounted() {
80+
elementResizeEvent.bind(this.$el, this.resize);
81+
},
82+
beforeDestroy: function() {
83+
elementResizeEvent.unbind(this.$el);
84+
},
7585
methods: {
7686
renderComponent({ type, cell, key, params }) {
7787
const value = cell[key];
@@ -88,6 +98,10 @@ export default {
8898
return this.renderFormatTime(value);
8999
case 'convertTime':
90100
return this.renderConvertTime(value);
101+
case 'index':
102+
return this.renderIndex(cell);
103+
case 'a':
104+
return this.renderA(value, cell, params);
91105
default:
92106
return null;
93107
}
@@ -244,7 +258,44 @@ export default {
244258
return h('span', {}, util.convertTimestamp(value));
245259
};
246260
},
261+
renderIndex(cell) {
262+
const index = this.data.findIndex((item) => item.taskID === cell.taskID);
263+
return (h) => {
264+
return h('span', {}, index + 1);
265+
};
266+
},
267+
renderA(value, cell, params) {
268+
return (h) => {
269+
return h('div', {
270+
style: {
271+
cursor: 'pointer',
272+
color: '#ed4014',
273+
},
274+
on: {
275+
click: (ev) => {
276+
params.action({ row: cell });
277+
},
278+
},
279+
}, value);
280+
};
281+
},
282+
getComputedWidth(current) {
283+
this.offsetWidth = this.$el && this.$el.offsetWidth;
284+
let usedWidth = 0;
285+
const unHasWidthList = [];
286+
this.columns.forEach((item) => {
287+
const width = item.width || 0;
288+
usedWidth += width;
289+
if (!item.width) {
290+
unHasWidthList.push(item);
291+
}
292+
});
293+
return (this.offsetWidth - 30 - usedWidth) / unHasWidthList.length + 'px';
294+
},
295+
resize() {
296+
this.offsetWidth = this.$el && this.$el.offsetWidth;
297+
},
247298
},
248299
};
249300
</script>
250-
<style src="./index.scss" lang="scss"></style>
301+
<style src="./index.scss" lang="sass"></style>

src/js/module/globalHistory/expand.js

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 45 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
11
@import '../../../assets/styles/variables.scss';
2-
.render-btn {
3-
color: #515a6e;
4-
background-color: transparent;
5-
border-color: transparent;
6-
padding: 1px 7px 2px;
7-
font-size: 12px;
8-
border-radius: 3px;
9-
display: inline-block;
10-
margin-bottom: 0;
11-
font-weight: 400;
12-
text-align: center;
13-
cursor: pointer;
14-
background-image: none;
15-
border: 1px solid transparent;
16-
white-space: nowrap;
17-
border-radius: 4px;
18-
transition: color .2s linear,background-color .2s linear,border .2s linear,box-shadow .2s linear;
19-
&:hover {
20-
color: #57a3f3;
21-
background-color: #fff;
22-
border-color: transparent;
23-
text-decoration: none;
24-
}
25-
}
262
.progress-wrap {
273
position: $relative;
284
height: 20px;
@@ -45,6 +21,7 @@
4521
}
4622
.global-history {
4723
position: $relative;
24+
height: 100%;
4825
.ivu-form {
4926
display: flex;
5027
.ivu-form-item {
@@ -58,69 +35,11 @@
5835
display: flex;
5936
justify-content: center;
6037
align-items: center;
38+
margin-top: 16px;
6139
.ivu-table th {
6240
background-color: $table-thead-blue-bg;
6341
color: $body-background;
6442
}
65-
.we-table-wrap {
66-
overflow: auto;
67-
display: block;
68-
.we-table {
69-
border: $border-width-base $border-style-base $border-color-base;
70-
table-layout: fixed;
71-
.we-table-thead {
72-
background-color: $table-thead-blue-bg;
73-
color: $body-background;
74-
.we-table-thead-cell {
75-
border-right: 1px solid $border-color-base;
76-
border-bottom: 1px solid $border-color-base;
77-
min-width: 0;
78-
height: 48px;
79-
box-sizing: border-box;
80-
text-align: left;
81-
text-overflow: ellipsis;
82-
vertical-align: middle;
83-
}
84-
}
85-
.we-table-row {
86-
height: 40px;
87-
&:nth-child(2n) {
88-
background-color: #f8f8f9;
89-
}
90-
&:hover {
91-
background-color: #ebf7ff;
92-
}
93-
.we-table-row-cell {
94-
border-right: 1px solid $border-color-base;
95-
border-bottom: 1px solid $border-color-base;
96-
min-width: 0;
97-
height: 48px;
98-
box-sizing: border-box;
99-
text-align: left;
100-
text-overflow: ellipsis;
101-
vertical-align: middle;
102-
.we-table-row-label {
103-
line-height: 20px;
104-
padding-left: 18px;
105-
padding-right: 18px;
106-
overflow: hidden;
107-
text-overflow: ellipsis;
108-
white-space: normal;
109-
word-break: break-all;
110-
-webkit-box-sizing: border-box;
111-
box-sizing: border-box;
112-
&.ellipsis {
113-
text-align: left;
114-
word-break: keep-all;
115-
white-space: nowrap;
116-
overflow: hidden;
117-
text-overflow: ellipsis;
118-
}
119-
}
120-
}
121-
}
122-
}
123-
}
12443
}
12544
.global-history-loading {
12645
width: 100%;
@@ -140,4 +59,47 @@
14059
width: 100%;
14160
text-align: center;
14261
}
62+
63+
.log-editor-wrap {
64+
border: $border-width-base $border-style-base $border-color-base;
65+
box-shadow: $shadow-card;
66+
position: $absolute;
67+
left: 0;
68+
right: 0;
69+
top: 40px;
70+
bottom: 10px;
71+
72+
.log-tools {
73+
height: 36px;
74+
line-height: 36px;
75+
padding-left: 10px;
76+
background: $background-color-base;
77+
position: $relative;
78+
border-bottom: 2px solid $border-color-base;
79+
overflow: hidden;
80+
margin-bottom: -2px;
81+
.log-tools-control {
82+
display: inline-block;
83+
position: $absolute;
84+
top: 2px;
85+
.log-tabs {
86+
display: inline-block;
87+
position: $absolute;
88+
}
89+
.log-search {
90+
width: 100px;
91+
position: $absolute;
92+
left: 350px;
93+
top: 5px;
94+
font-size: $font-size-small;
95+
}
96+
.err-badge {
97+
background: $error-color !important;
98+
}
99+
.warn-badge {
100+
background: $yellow-color !important;
101+
}
102+
}
103+
}
104+
}
143105
}

0 commit comments

Comments
 (0)