@things-factory/figure-ui 10.1.4 → 10.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/graphql/index.ts +122 -15
- package/client/modeller/figure-ask.ts +5 -5
- package/client/modeller/figure-canvas.ts +1 -1
- package/client/modeller/figure-capabilities.ts +372 -0
- package/client/modeller/figure-history-panel.ts +477 -0
- package/client/modeller/figure-inspector.ts +392 -76
- package/client/modeller/figure-parts.ts +15 -15
- package/client/modeller/figure-preview.ts +2 -2
- package/client/modeller/figure-report.ts +102 -37
- package/client/modeller/figure-settings.ts +20 -20
- package/client/modeller/figure-side.ts +54 -8
- package/client/modeller/figure-source.test.ts +15 -1
- package/client/modeller/figure-source.ts +31 -15
- package/client/modeller/figure-thumbnail.ts +49 -4
- package/client/modeller/maturity.ts +10 -10
- package/client/pages/figure-list-page.ts +450 -227
- package/client/pages/figure-modeller-page.ts +282 -43
- package/client/types.ts +42 -0
- package/client/viewparts/figure-thumb.ts +172 -0
- package/dist-client/graphql/index.d.ts +31 -4
- package/dist-client/graphql/index.js +102 -12
- package/dist-client/graphql/index.js.map +1 -1
- package/dist-client/modeller/figure-ask.js +5 -5
- package/dist-client/modeller/figure-ask.js.map +1 -1
- package/dist-client/modeller/figure-canvas.js +1 -1
- package/dist-client/modeller/figure-canvas.js.map +1 -1
- package/dist-client/modeller/figure-capabilities.d.ts +42 -0
- package/dist-client/modeller/figure-capabilities.js +344 -0
- package/dist-client/modeller/figure-capabilities.js.map +1 -0
- package/dist-client/modeller/figure-history-panel.d.ts +56 -0
- package/dist-client/modeller/figure-history-panel.js +490 -0
- package/dist-client/modeller/figure-history-panel.js.map +1 -0
- package/dist-client/modeller/figure-inspector.d.ts +84 -0
- package/dist-client/modeller/figure-inspector.js +379 -75
- package/dist-client/modeller/figure-inspector.js.map +1 -1
- package/dist-client/modeller/figure-parts.js +15 -15
- package/dist-client/modeller/figure-parts.js.map +1 -1
- package/dist-client/modeller/figure-preview.js +2 -2
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/modeller/figure-report.d.ts +18 -1
- package/dist-client/modeller/figure-report.js +105 -37
- package/dist-client/modeller/figure-report.js.map +1 -1
- package/dist-client/modeller/figure-settings.js +19 -19
- package/dist-client/modeller/figure-settings.js.map +1 -1
- package/dist-client/modeller/figure-side.d.ts +7 -0
- package/dist-client/modeller/figure-side.js +66 -7
- package/dist-client/modeller/figure-side.js.map +1 -1
- package/dist-client/modeller/figure-source.d.ts +15 -8
- package/dist-client/modeller/figure-source.js +16 -7
- package/dist-client/modeller/figure-source.js.map +1 -1
- package/dist-client/modeller/figure-thumbnail.js +40 -4
- package/dist-client/modeller/figure-thumbnail.js.map +1 -1
- package/dist-client/modeller/maturity.js +10 -10
- package/dist-client/modeller/maturity.js.map +1 -1
- package/dist-client/pages/figure-list-page.d.ts +45 -25
- package/dist-client/pages/figure-list-page.js +439 -247
- package/dist-client/pages/figure-list-page.js.map +1 -1
- package/dist-client/pages/figure-modeller-page.d.ts +54 -0
- package/dist-client/pages/figure-modeller-page.js +279 -43
- package/dist-client/pages/figure-modeller-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types.d.ts +42 -0
- package/dist-client/types.js.map +1 -1
- package/dist-client/viewparts/figure-thumb.d.ts +29 -0
- package/dist-client/viewparts/figure-thumb.js +168 -0
- package/dist-client/viewparts/figure-thumb.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -5
- package/test/i18n-prefix-guard.test.ts +129 -0
- package/test/korean-register-guard.test.ts +83 -0
- package/translations/en.json +307 -249
- package/translations/ja.json +275 -249
- package/translations/ko.json +307 -249
- package/translations/ms.json +275 -249
- package/translations/zh.json +275 -249
- package/client/viewparts/figure-card.ts +0 -226
- package/dist-client/viewparts/figure-card.d.ts +0 -24
- package/dist-client/viewparts/figure-card.js +0 -221
- package/dist-client/viewparts/figure-card.js.map +0 -1
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement, nothing } from 'lit'
|
|
4
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { i18next, localize } from '@operato/i18n'
|
|
7
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
8
|
+
|
|
9
|
+
import { fetchFigureVersions, inspectFigure, releaseFigure, revertFigureVersion } from '../graphql/index.js'
|
|
10
|
+
import type { FigureGateFinding, FigureInspection, FigureVersion } from '../types.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 이력 — **발행하는 자리이자, 발행된 판들을 보는 자리.**
|
|
14
|
+
*
|
|
15
|
+
* ## 왜 저장 옆이 아니라 여기인가
|
|
16
|
+
*
|
|
17
|
+
* 저장은 하루에 수십 번이고 발행은 드물다. 두 단추를 나란히 두면 저장하려다 발행을 누른다.
|
|
18
|
+
* 그리고 발행은 **소비처에게 하는 약속**이라, 무엇을 약속하는지(지금 몇 판인가 · 저장 안 한 것이
|
|
19
|
+
* 있나 · 지난 판이 무엇이었나)를 함께 보여 주는 자리에 있어야 한다.
|
|
20
|
+
*
|
|
21
|
+
* ## 저장하지 않은 것이 있으면 발행하지 않는다
|
|
22
|
+
*
|
|
23
|
+
* 발행은 **저장된 것**을 내보낸다. 화면에 고친 것이 남아 있는 채로 발행하면, 저작자가 보고 있는
|
|
24
|
+
* 것과 약속한 것이 다르다. 그래서 막고, 왜 막혔는지 적는다.
|
|
25
|
+
*
|
|
26
|
+
* ## 되돌리기는 초안으로 돌아온다
|
|
27
|
+
*
|
|
28
|
+
* 옛 판의 정본·속성·그림이 돌아오고 이름·설명은 그대로다. 되살렸다고 그 판이 다시 발행되지는
|
|
29
|
+
* 않는다 — 다시 내보내려면 발행을 한 번 더 하고, 그때 번호는 이미 쓴 다음 번호를 받는다.
|
|
30
|
+
*/
|
|
31
|
+
@customElement('figure-history-panel')
|
|
32
|
+
export class FigureHistoryPanel extends localize(i18next)(LitElement) {
|
|
33
|
+
static styles = [
|
|
34
|
+
ScrollbarStyles,
|
|
35
|
+
css`
|
|
36
|
+
:host {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
min-height: 0;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
42
|
+
color: var(--md-sys-color-on-surface);
|
|
43
|
+
font: var(--label-font, inherit);
|
|
44
|
+
font-size: 0.76rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([off]) {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
section {
|
|
52
|
+
padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);
|
|
53
|
+
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
h3 {
|
|
57
|
+
margin: 0 0 6px 0;
|
|
58
|
+
font-size: var(--ui-t-micro, 11px);
|
|
59
|
+
font-weight: 700;
|
|
60
|
+
letter-spacing: 0.04em;
|
|
61
|
+
text-transform: uppercase;
|
|
62
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* 지금 무엇인가 — 발행을 누르기 전에 읽는 한 줄 */
|
|
66
|
+
div[now] {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 6px;
|
|
70
|
+
margin-bottom: 8px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
span[state] {
|
|
74
|
+
padding: 2px 8px;
|
|
75
|
+
border-radius: 10px;
|
|
76
|
+
font-size: 0.7rem;
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
79
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
span[state][released] {
|
|
83
|
+
color: var(--md-sys-color-on-primary);
|
|
84
|
+
background-color: var(--md-sys-color-primary);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
span[ver] {
|
|
88
|
+
font-family: var(--mono-font, monospace);
|
|
89
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
input,
|
|
93
|
+
button {
|
|
94
|
+
font: var(--input-field-font, inherit);
|
|
95
|
+
font-size: 0.76rem;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
input[note] {
|
|
99
|
+
width: 100%;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
padding: 5px 8px;
|
|
102
|
+
color: var(--md-sys-color-on-surface);
|
|
103
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
104
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
105
|
+
border-radius: 6px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
button[release] {
|
|
109
|
+
width: 100%;
|
|
110
|
+
margin-top: 6px;
|
|
111
|
+
padding: 6px 0;
|
|
112
|
+
font-weight: 700;
|
|
113
|
+
color: var(--ui-on-accent, #fff);
|
|
114
|
+
background-color: var(--md-sys-color-primary);
|
|
115
|
+
border: 0;
|
|
116
|
+
border-radius: 6px;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
button[release][disabled] {
|
|
121
|
+
opacity: 0.45;
|
|
122
|
+
cursor: default;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* 왜 못 누르는지 — 눌러 보고 알게 하지 않는다 */
|
|
126
|
+
p[why] {
|
|
127
|
+
margin: 6px 0 0 0;
|
|
128
|
+
font-size: 0.7rem;
|
|
129
|
+
line-height: 1.5;
|
|
130
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
p[failed] {
|
|
134
|
+
margin: 6px 0 0 0;
|
|
135
|
+
font-size: 0.7rem;
|
|
136
|
+
line-height: 1.5;
|
|
137
|
+
color: var(--md-sys-color-error);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ul {
|
|
141
|
+
margin: 0;
|
|
142
|
+
padding: 0;
|
|
143
|
+
list-style: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
li {
|
|
147
|
+
display: grid;
|
|
148
|
+
grid-template-columns: auto 1fr auto;
|
|
149
|
+
gap: 4px 8px;
|
|
150
|
+
align-items: baseline;
|
|
151
|
+
padding: 7px 0;
|
|
152
|
+
border-bottom: 1px dashed var(--md-sys-color-outline-variant);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
li:last-child {
|
|
156
|
+
border-bottom: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
li span[no] {
|
|
160
|
+
font-family: var(--mono-font, monospace);
|
|
161
|
+
font-weight: 700;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
li span[when] {
|
|
165
|
+
grid-column: 2 / 4;
|
|
166
|
+
font-size: 0.7rem;
|
|
167
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
li span[comment] {
|
|
171
|
+
grid-column: 1 / 4;
|
|
172
|
+
line-height: 1.5;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
li button[revert] {
|
|
176
|
+
padding: 2px 8px;
|
|
177
|
+
color: var(--md-sys-color-on-surface);
|
|
178
|
+
background: none;
|
|
179
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
180
|
+
border-radius: 6px;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
li button[revert]:hover {
|
|
185
|
+
color: var(--md-sys-color-on-primary-container);
|
|
186
|
+
background-color: var(--md-sys-color-primary-container);
|
|
187
|
+
border-color: transparent;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/*
|
|
191
|
+
게이트 사유. 막는 것은 색으로도 말하고, 알리는 것은 조용히 둔다 — 둘을 같은 톤으로 두면
|
|
192
|
+
「이 중 어느 것이 발행을 막았나」를 사람이 다시 세어야 한다.
|
|
193
|
+
*/
|
|
194
|
+
ul[gate] {
|
|
195
|
+
margin: var(--spacing-small, 6px) 0 0;
|
|
196
|
+
padding: 0;
|
|
197
|
+
list-style: none;
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: 3px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
li[head] {
|
|
204
|
+
font: var(--label-font, inherit);
|
|
205
|
+
font-size: 0.72rem;
|
|
206
|
+
color: var(--md-sys-color-error);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
li[head][quiet] {
|
|
210
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
li[finding] {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
align-items: flex-start;
|
|
217
|
+
gap: 3px;
|
|
218
|
+
padding: 3px 6px;
|
|
219
|
+
font-size: 0.72rem;
|
|
220
|
+
line-height: 1.5;
|
|
221
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
222
|
+
background-color: var(--md-sys-color-surface-container);
|
|
223
|
+
border-radius: 4px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
li[finding][blocking] {
|
|
227
|
+
color: var(--md-sys-color-on-error-container, var(--md-sys-color-on-surface));
|
|
228
|
+
background-color: var(--md-sys-color-error-container);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
li[finding] code[where] {
|
|
232
|
+
font-family: var(--mono-font, monospace);
|
|
233
|
+
font-size: 0.68rem;
|
|
234
|
+
opacity: 0.85;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* 왜 나쁜지는 곁글로 — 읽어야 하지만 잰 것보다 먼저 눈에 들 필요는 없다 */
|
|
238
|
+
li[finding] span[why-line] {
|
|
239
|
+
opacity: 0.8;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* 무엇을 바꾸면 되나 — 이 줄이 실제로 사람이 할 일이다. 연장 표를 달아 눈에 걸리게 한다 */
|
|
243
|
+
li[finding] span[how-line] {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: flex-start;
|
|
246
|
+
gap: 4px;
|
|
247
|
+
padding-top: 2px;
|
|
248
|
+
font-weight: 600;
|
|
249
|
+
}
|
|
250
|
+
li[finding] span[how-line] md-icon {
|
|
251
|
+
--md-icon-size: 13px;
|
|
252
|
+
flex: none;
|
|
253
|
+
margin-top: 1px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
p[quiet] {
|
|
257
|
+
margin: 0;
|
|
258
|
+
line-height: 1.6;
|
|
259
|
+
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
260
|
+
}
|
|
261
|
+
`
|
|
262
|
+
]
|
|
263
|
+
|
|
264
|
+
/** 지금 열려 있는 도형. 없으면(새로 만드는 중) 발행할 것이 없다. */
|
|
265
|
+
@property({ type: String }) figureId?: string
|
|
266
|
+
@property({ type: String }) figureState?: 'draft' | 'released'
|
|
267
|
+
@property({ type: Number }) figureVersion = 0
|
|
268
|
+
/** 저장하지 않은 것이 있나 — 있으면 발행을 막는다. */
|
|
269
|
+
@property({ type: Boolean }) dirty = false
|
|
270
|
+
|
|
271
|
+
@state() private versions: FigureVersion[] = []
|
|
272
|
+
@state() private busy = false
|
|
273
|
+
@state() private failure = ''
|
|
274
|
+
/**
|
|
275
|
+
* 발행 판정. **저장된 정본에 대한 것**이라 저장할 때마다 다시 묻는다(`figureVersion` 이 아니라
|
|
276
|
+
* `dirty` 가 풀리는 순간이 그때다).
|
|
277
|
+
*/
|
|
278
|
+
@state() private inspection?: FigureInspection
|
|
279
|
+
|
|
280
|
+
updated(changes: Map<string, unknown>) {
|
|
281
|
+
if (changes.has('figureId') || changes.has('figureVersion')) {
|
|
282
|
+
void this.reload()
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/*
|
|
286
|
+
저장이 끝난 순간(dirty 가 풀림) 정본이 바뀌었으니 판정을 다시 묻는다. 저작 중(dirty)에는
|
|
287
|
+
묻지 않는다 — 서버에 있는 것은 저장 전 정본이라, 그 답은 화면에 있는 것과 다른 것을 말한다.
|
|
288
|
+
*/
|
|
289
|
+
if (changes.has('figureId') || changes.has('dirty')) {
|
|
290
|
+
void this.inspect()
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
private async inspect() {
|
|
295
|
+
if (!this.figureId || this.dirty) {
|
|
296
|
+
this.inspection = undefined
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
try {
|
|
301
|
+
this.inspection = await inspectFigure(this.figureId)
|
|
302
|
+
} catch (e) {
|
|
303
|
+
/* 판정을 못 받은 것을 「통과」로 두지 않는다 — 모르는 것이다. 단추는 서버가 막는다. */
|
|
304
|
+
this.inspection = undefined
|
|
305
|
+
this.failure = (e as Error).message
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
private async reload() {
|
|
310
|
+
if (!this.figureId) {
|
|
311
|
+
this.versions = []
|
|
312
|
+
return
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
try {
|
|
316
|
+
this.versions = await fetchFigureVersions(this.figureId)
|
|
317
|
+
this.failure = ''
|
|
318
|
+
} catch (e) {
|
|
319
|
+
this.failure = (e as Error).message
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
render() {
|
|
324
|
+
return html`
|
|
325
|
+
<section>
|
|
326
|
+
<h3>${i18next.t('figure.label.release')}</h3>
|
|
327
|
+
${this.figureId ? this.renderRelease() : html`<p quiet>${i18next.t('figure.text.save-the-figure-before-releasing')}</p>`}
|
|
328
|
+
</section>
|
|
329
|
+
|
|
330
|
+
<section>
|
|
331
|
+
<h3>${i18next.t('figure.label.released-versions')}</h3>
|
|
332
|
+
${this.versions.length
|
|
333
|
+
? html`<ul>
|
|
334
|
+
${this.versions.map(version => this.renderVersion(version))}
|
|
335
|
+
</ul>`
|
|
336
|
+
: html`<p quiet>${i18next.t('figure.text.nothing-released-yet')}</p>`}
|
|
337
|
+
</section>
|
|
338
|
+
`
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
private renderRelease() {
|
|
342
|
+
const released = this.figureState === 'released'
|
|
343
|
+
|
|
344
|
+
/*
|
|
345
|
+
게이트가 막는 것과 알리는 것을 함께 낸다. **막는 것은 단추를 잠근다** — 눌러 보고 서버에게
|
|
346
|
+
거절당하는 것으로 알게 하지 않는다. 알리는 것은 잠그지 않고 그대로 보여 준다.
|
|
347
|
+
*/
|
|
348
|
+
const blocking = (this.inspection?.findings ?? []).filter(finding => finding.blocking)
|
|
349
|
+
const advisory = (this.inspection?.findings ?? []).filter(finding => !finding.blocking)
|
|
350
|
+
|
|
351
|
+
/*
|
|
352
|
+
── 「발행되나」에 **한 번만** 답한다 ─────────────────────────────────────
|
|
353
|
+
전에는 막는 목록의 머리가 「이것들이 발행을 막습니다」, 알리는 목록의 머리가 「발행은 되지만
|
|
354
|
+
확인해 보십시오」였다. 두 줄이 나란히 서서 화면이 「막힌다」와 「된다」를 함께 말했고, 사람이
|
|
355
|
+
「그래서 되는 건가」를 되물었다.
|
|
356
|
+
|
|
357
|
+
답은 이 한 줄이 하고, 아래 목록들은 **이유**일 뿐이다 — 그래서 목록 머리는 문장이 아니라
|
|
358
|
+
이름씨다(「고쳐야 하는 것」·「막지는 않는 것」).
|
|
359
|
+
*/
|
|
360
|
+
const why = this.dirty
|
|
361
|
+
? i18next.t('figure.text.release-needs-a-save-first')
|
|
362
|
+
: released
|
|
363
|
+
? i18next.t('figure.text.already-released-edit-to-release-again')
|
|
364
|
+
: blocking.length
|
|
365
|
+
? i18next.t('figure.text.cannot-release-now')
|
|
366
|
+
: ''
|
|
367
|
+
|
|
368
|
+
return html`
|
|
369
|
+
<div now>
|
|
370
|
+
<span state ?released=${released}>${i18next.t(released ? 'figure.label.figure-released' : 'figure.label.draft')}</span>
|
|
371
|
+
<span ver>${i18next.t('figure.text.version-number', { version: this.figureVersion ?? 0 })}</span>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<input note placeholder=${i18next.t('figure.text.what-changed-in-this-release')} ?disabled=${!!why || this.busy} />
|
|
375
|
+
|
|
376
|
+
<button release ?disabled=${!!why || this.busy} @click=${() => this.release()}>
|
|
377
|
+
${this.busy ? i18next.t('figure.text.releasing') : i18next.t('figure.button.release-figure')}
|
|
378
|
+
</button>
|
|
379
|
+
|
|
380
|
+
${why ? html`<p why>${why}</p>` : nothing}
|
|
381
|
+
${blocking.length
|
|
382
|
+
? html`<ul gate>
|
|
383
|
+
<li head>${i18next.t('figure.text.must-fix-to-release')}</li>
|
|
384
|
+
${blocking.map(finding => this.renderFinding(finding, true))}
|
|
385
|
+
</ul>`
|
|
386
|
+
: nothing}
|
|
387
|
+
${advisory.length
|
|
388
|
+
? html`<ul gate>
|
|
389
|
+
<li head quiet>${i18next.t('figure.text.does-not-block')}</li>
|
|
390
|
+
${advisory.map(finding => this.renderFinding(finding, false))}
|
|
391
|
+
</ul>`
|
|
392
|
+
: nothing}
|
|
393
|
+
${this.failure ? html`<p failed>${this.failure}</p>` : nothing}
|
|
394
|
+
`
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* 사유 한 줄 — **잰 것 · 왜 · 어떻게** 셋을 함께 말한다.
|
|
399
|
+
*
|
|
400
|
+
* 잰 것만 보여 줬더니 「1 조각이 2 조각으로 갈라진다」에서 사람이 멈췄다. 왜 나쁜지도, 무엇을
|
|
401
|
+
* 바꾸면 되는지도 알 수 없었다. 그 셋은 형식(`figure-model` 의 gate)이 만들고 여기서는 자리만
|
|
402
|
+
* 준다 — 화면이 문장을 지으면 서버가 거절할 때와 다른 말을 하게 된다.
|
|
403
|
+
*/
|
|
404
|
+
private renderFinding(finding: FigureGateFinding, blocking: boolean) {
|
|
405
|
+
return html`
|
|
406
|
+
<li finding ?blocking=${blocking}>
|
|
407
|
+
<span msg>${finding.message}</span>
|
|
408
|
+
${finding.at ? html`<code where>${finding.at}</code>` : nothing}
|
|
409
|
+
${finding.why ? html`<span why-line>${finding.why}</span>` : nothing}
|
|
410
|
+
${finding.how ? html`<span how-line><md-icon>build</md-icon>${finding.how}</span>` : nothing}
|
|
411
|
+
</li>
|
|
412
|
+
`
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
private renderVersion(version: FigureVersion) {
|
|
416
|
+
return html`
|
|
417
|
+
<li>
|
|
418
|
+
<span no>${i18next.t('figure.text.version-number', { version: version.version })}</span>
|
|
419
|
+
<span when>
|
|
420
|
+
${version.updatedAt ? new Date(version.updatedAt).toLocaleString() : ''}
|
|
421
|
+
${version.updater?.name ? ` · ${version.updater.name}` : ''}
|
|
422
|
+
</span>
|
|
423
|
+
<button revert ?disabled=${this.busy} @click=${() => this.revert(version.version)}>
|
|
424
|
+
${i18next.t('figure.button.revert')}
|
|
425
|
+
</button>
|
|
426
|
+
${version.comment ? html`<span comment>${version.comment}</span>` : nothing}
|
|
427
|
+
</li>
|
|
428
|
+
`
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
private async release() {
|
|
432
|
+
const input = this.renderRoot.querySelector('input[note]') as HTMLInputElement
|
|
433
|
+
const comment = input?.value?.trim()
|
|
434
|
+
|
|
435
|
+
this.busy = true
|
|
436
|
+
this.failure = ''
|
|
437
|
+
|
|
438
|
+
try {
|
|
439
|
+
const figure = await releaseFigure(this.figureId!, comment || undefined)
|
|
440
|
+
if (input) input.value = ''
|
|
441
|
+
/* 정본을 든 자리가 갱신한다 — 여기서 페이지 상태를 고쳐 쓰지 않는다. */
|
|
442
|
+
this.dispatchEvent(new CustomEvent('figure-released', { detail: { figure }, bubbles: true, composed: true }))
|
|
443
|
+
await this.reload()
|
|
444
|
+
await this.inspect()
|
|
445
|
+
} catch (e) {
|
|
446
|
+
this.failure = (e as Error).message
|
|
447
|
+
} finally {
|
|
448
|
+
this.busy = false
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
private async revert(version: number) {
|
|
453
|
+
/* 되돌아갈 수 없는 조작은 아니지만(판본은 남는다), 지금 화면의 것이 덮인다 — 이름으로 확인한다. */
|
|
454
|
+
if (!confirm(i18next.t('figure.text.revert-to-version-confirm', { version }))) {
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
this.busy = true
|
|
459
|
+
this.failure = ''
|
|
460
|
+
|
|
461
|
+
try {
|
|
462
|
+
const result = await revertFigureVersion(this.figureId!, version)
|
|
463
|
+
this.dispatchEvent(new CustomEvent('figure-reverted', { detail: result, bubbles: true, composed: true }))
|
|
464
|
+
await this.reload()
|
|
465
|
+
/*
|
|
466
|
+
**되돌리면 정본이 바뀌므로 판정도 바뀐다.** 이것을 안 하면 옛 판의 사유가 새 정본 위에
|
|
467
|
+
남아 화면이 거짓말한다 — 되돌리기는 `dirty` 도 `figureVersion` 도 건드리지 않으므로
|
|
468
|
+
`updated` 의 감시로는 다시 묻지 않는다.
|
|
469
|
+
*/
|
|
470
|
+
await this.inspect()
|
|
471
|
+
} catch (e) {
|
|
472
|
+
this.failure = (e as Error).message
|
|
473
|
+
} finally {
|
|
474
|
+
this.busy = false
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|