@things-factory/auth-ui 10.1.6 → 10.1.7
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/dist-client/components/role-privilege-picker.d.ts +37 -0
- package/dist-client/components/role-privilege-picker.js +58 -0
- package/dist-client/components/role-privilege-picker.js.map +1 -0
- package/dist-client/components/role-template-picker.d.ts +83 -0
- package/dist-client/components/role-template-picker.js +487 -0
- package/dist-client/components/role-template-picker.js.map +1 -0
- package/dist-client/pages/role/role-list-page.d.ts +104 -13
- package/dist-client/pages/role/role-list-page.js +396 -72
- package/dist-client/pages/role/role-list-page.js.map +1 -1
- package/dist-client/pages/role/role-privilege-page.d.ts +95 -37
- package/dist-client/pages/role/role-privilege-page.js +305 -126
- package/dist-client/pages/role/role-privilege-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/translations/en.json +27 -1
- package/translations/ja.json +14 -1
- package/translations/ko.json +26 -0
- package/translations/ms.json +15 -2
- package/translations/zh.json +14 -1
- package/dist-client/components/create-role.d.ts +0 -1
- package/dist-client/components/create-role.js +0 -117
- package/dist-client/components/create-role.js.map +0 -1
- package/dist-client/components/credential-manager.d.ts +0 -11
- package/dist-client/components/credential-manager.js +0 -64
- package/dist-client/components/credential-manager.js.map +0 -1
- package/dist-client/components/role-detail.d.ts +0 -144
- package/dist-client/components/role-detail.js +0 -698
- package/dist-client/components/role-detail.js.map +0 -1
- package/dist-client/components/role-edit-form.d.ts +0 -1
- package/dist-client/components/role-edit-form.js +0 -95
- package/dist-client/components/role-edit-form.js.map +0 -1
- package/dist-client/components/role-privilege-editor.d.ts +0 -1
- package/dist-client/components/role-privilege-editor.js +0 -368
- package/dist-client/components/role-privilege-editor.js.map +0 -1
- package/dist-client/pages/role/role-management.d.ts +0 -4
- package/dist-client/pages/role/role-management.js +0 -137
- package/dist-client/pages/role/role-management.js.map +0 -1
- package/dist-client/pages/user/user-management.d.ts +0 -35
- package/dist-client/pages/user/user-management.js +0 -223
- package/dist-client/pages/user/user-management.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@material/web/icon/icon.js';
|
|
3
|
-
import '@
|
|
4
|
-
import '@material/web/checkbox/checkbox.js';
|
|
3
|
+
import '@operato/input/ox-input-search.js';
|
|
5
4
|
import '@operato/oops/ox-oops-note.js';
|
|
6
5
|
import gql from 'graphql-tag';
|
|
7
6
|
import { css, html, nothing } from 'lit';
|
|
8
7
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
8
|
import { client, gqlContext } from '@operato/graphql';
|
|
10
9
|
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { openPopup } from '@operato/layout';
|
|
11
11
|
import { PageView } from '@operato/shell';
|
|
12
12
|
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
13
13
|
import { getDomain } from '@things-factory/auth-base/dist-client';
|
|
@@ -19,35 +19,33 @@ const AXIS_LABEL = {
|
|
|
19
19
|
execute: 'label.execute'
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
* 한 역할이 무엇을
|
|
22
|
+
* 한 역할이 무엇을 할 수 있나 — **켜진 것이 문장으로 본문에 선다.**
|
|
23
23
|
*
|
|
24
|
-
* ──
|
|
25
|
-
*
|
|
26
|
-
* 것으로 답했는데 그것이 증상 처리였다 — **모듈이 46개고 각 줄에 설명 문장이 붙으면 팝업에
|
|
27
|
-
* 안 들어간다.** 자리 자체가 틀렸다.
|
|
24
|
+
* ── 사용자 평가가 이 화면을 두 번 뒤집었다 ──────────────────────────────────
|
|
25
|
+
* **「화면으로부터 배울 수 있는 것이 없고, 혼란스럽고, 어렵고, 불편하다.」**
|
|
28
26
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* 처음에는 팝업 안의 `모듈 × 읽기·쓰기` 격자였다. 격자는 「이 모듈에서 무엇이 켜졌나」에
|
|
28
|
+
* 답하는데, 관리자가 묻는 것은 **「이 역할이 무엇을 하나」**다. 격자로 그걸 읽으려면 모듈
|
|
29
|
+
* 46개를 한 번씩 열어야 하고, 역할을 부여하는 사람은 부여하기 **전에** 그 답이 필요하다.
|
|
32
30
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* 옛 격자는 `board` 라고만 쓰고 「쓰기를 켜면 이 사람이 무엇을 할 수 있게 되나」를 어디에도 안
|
|
36
|
-
* 적었다. 설명을 체크박스 `title` 에 숨겨 놨는데 마우스를 올려야 나오고, 그건 배우는 길이 아니다.
|
|
31
|
+
* 그래서 뒤집었다(UX 레인 §2). 켜진 것을 문장으로 늘어놓는 것이 본문이고, 격자는 **더할 때
|
|
32
|
+
* 쓰는 도구**로 자리를 옮겼다(`renderAdd`). 버린 것은 없다.
|
|
37
33
|
*
|
|
38
|
-
*
|
|
34
|
+
* ── 문장은 어디서 오나 ──────────────────────────────────────────────────────
|
|
35
|
+
* ```
|
|
36
|
+
* 1 Privilege.description 서버가 채우면 그것이 이긴다 — 배포마다 다를 수 있는 사실은 서버가 안다
|
|
37
|
+
* 2 privilege.allows.<category>.<axis> UX 레인이 쓴 글 (57 모듈 · 104 문장, ko·en)
|
|
38
|
+
* 3 「아직 설명이 없습니다」 둘 다 없으면. 지어내지 않는다
|
|
39
|
+
* ```
|
|
39
40
|
*
|
|
40
|
-
*
|
|
41
|
-
* `
|
|
42
|
-
* (`auth-base/server/index.ts:34-36`) 그 mutation 을 부르는 화면이 없다 — 713개 선언이 전부
|
|
43
|
-
* 빈 설명이다. 그래서 이 화면은 **없으면 없다고 말한다.** 코드 낱말(`board mutation`)을 다시
|
|
44
|
-
* 보여 주지 않고, 지어내지도 않는다. 글은 UX 레인이 `privilege.category.*` 키로 채우는 중이다.
|
|
41
|
+
* 1번은 아직 **전부 비어 있다** — 부팅 동기화가 `{ category, name }` 둘만 저장한다
|
|
42
|
+
* (`auth-base/server/index.ts:34-36`). 그래서 지금 화면에 나오는 문장은 전부 2번이다.
|
|
45
43
|
*
|
|
46
44
|
* ── 저장 범위는 서버가 준 목록이다 ──────────────────────────────────────────
|
|
47
|
-
* 옛 편집기는 `querySelectorAll('input:checked')` 로 보냈다.
|
|
48
|
-
* 앞 모듈의 체크박스는 **DOM 에 없다** — 그 방식이면 모듈을 옮겨 다니는 것만으로
|
|
49
|
-
* 조용히 떨어진다. 여기서는 `rolePrivileges` 가 준 전체가
|
|
50
|
-
* 있다. 화면이 무엇을 그렸는지와 무관하다.
|
|
45
|
+
* 옛 편집기는 `querySelectorAll('input:checked')` 로 보냈다. 「더하기」 판에서 다른 모듈로
|
|
46
|
+
* 옮기면 앞 모듈의 체크박스는 **DOM 에 없다** — 그 방식이면 모듈을 옮겨 다니는 것만으로
|
|
47
|
+
* 권한이 조용히 떨어진다. 여기서는 `rolePrivileges` 가 준 전체가 범위이고 켠 것은
|
|
48
|
+
* `assigned` 에만 있다. 화면이 무엇을 그렸는지와 무관하다.
|
|
51
49
|
*/
|
|
52
50
|
let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageView) {
|
|
53
51
|
constructor() {
|
|
@@ -128,11 +126,19 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
/*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
걸러 보는 칸은 ox-input-search 다.
|
|
130
|
+
|
|
131
|
+
여기 md-filled-text-field 를 썼다가 사용자에게 「전체적인 스타일에 어울리지 않는다」를
|
|
132
|
+
들었다. 그것은 회색 채움 상자에 라벨이 떠 있는 **폼 칸**이고, 이 자리는 **찾는 칸**이다.
|
|
133
|
+
|
|
134
|
+
근거는 이 화면 자신에 있다 — 역할 목록의 검색 칸이 이 부품이다.
|
|
135
|
+
[읽었음] @operato/data-grist/dist/src/filters/filters-form.js:153
|
|
136
|
+
|
|
137
|
+
⚠ 폼 칸도 md-* 를 안 쓴다 — 사용자가 2026-09-11 에 역할 화면 전체로 못 박았다
|
|
138
|
+
(「너무 크고 스타일이 안 어울린다」). native input 에 FormFieldStyles 를 얹는다.
|
|
139
|
+
그 블록이 정확히 이 일을 하려고 있는 것이다(shadow 경계를 넘는 토큰 연결).
|
|
134
140
|
*/
|
|
135
|
-
|
|
141
|
+
ox-input-search {
|
|
136
142
|
margin: 8px 12px;
|
|
137
143
|
width: calc(100% - 24px);
|
|
138
144
|
}
|
|
@@ -257,6 +263,10 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
257
263
|
they cannot answer "what does this role do", because that reading needs 46 clicks.
|
|
258
264
|
*/
|
|
259
265
|
[granted] {
|
|
266
|
+
flex: 1;
|
|
267
|
+
min-height: 0;
|
|
268
|
+
display: flex;
|
|
269
|
+
flex-direction: column;
|
|
260
270
|
margin: var(--spacing-medium, 8px) var(--spacing-large, 12px) 0;
|
|
261
271
|
border: 1px solid var(--md-sys-color-outline-variant);
|
|
262
272
|
border-radius: var(--md-sys-shape-corner-medium, 10px);
|
|
@@ -276,43 +286,21 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
276
286
|
color: var(--md-sys-color-outline);
|
|
277
287
|
}
|
|
278
288
|
|
|
289
|
+
/*
|
|
290
|
+
⚠ 여기 display: flex 와 flex-wrap: wrap 이 있었다 — 칩으로 그리던 시절의 규칙이다.
|
|
291
|
+
마크업을 줄 목록으로 바꾼 뒤에도 남아서 **문장이 한 줄씩 서지 않고 칩처럼 옆으로
|
|
292
|
+
흘렀다.** 내 ul[lines] 는 display 를 선언하지 않으므로 맞설 것이 없었다.
|
|
293
|
+
마크업을 갈 때는 그 마크업만 쓰던 CSS 를 함께 지운다.
|
|
294
|
+
|
|
295
|
+
높이도 바뀐다. max-height: 22vh 는 격자 두 판이 늘 아래에 펼쳐져 있던 시절의 값이다.
|
|
296
|
+
지금은 **이 목록이 본문**이므로(§2) 남는 높이를 여기가 받고, 59줄은 여기서 흐른다.
|
|
297
|
+
*/
|
|
279
298
|
[granted] ul {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
gap: 4px 6px;
|
|
283
|
-
list-style: none;
|
|
284
|
-
margin: 0;
|
|
285
|
-
padding: 0 12px 10px;
|
|
286
|
-
/* Long-running roles reach every module; cap the block so the panels stay on screen. */
|
|
287
|
-
max-height: 22vh;
|
|
299
|
+
flex: 1;
|
|
300
|
+
min-height: 0;
|
|
288
301
|
overflow: auto;
|
|
289
302
|
}
|
|
290
303
|
|
|
291
|
-
[granted] li {
|
|
292
|
-
display: inline-flex;
|
|
293
|
-
align-items: baseline;
|
|
294
|
-
gap: 5px;
|
|
295
|
-
padding: 3px 9px;
|
|
296
|
-
border-radius: var(--md-sys-shape-corner-small, 6px);
|
|
297
|
-
background-color: var(--md-sys-color-surface-variant);
|
|
298
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
299
|
-
font-size: 0.82rem;
|
|
300
|
-
cursor: pointer;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
[granted] li:hover {
|
|
304
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
305
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
[granted] li [axes] {
|
|
309
|
-
color: var(--md-sys-color-primary);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
[granted] li:hover [axes] {
|
|
313
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
304
|
[granted] [empty] {
|
|
317
305
|
padding: 0 12px 10px;
|
|
318
306
|
}
|
|
@@ -332,6 +320,101 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
332
320
|
color: var(--md-sys-color-on-error-container);
|
|
333
321
|
}
|
|
334
322
|
|
|
323
|
+
/*
|
|
324
|
+
── 할 수 있는 일 (본문) ────────────────────────────────────────────────
|
|
325
|
+
읽는 것이 먼저이므로 글자를 본문 크기로 둔다. 격자의 0.85rem 보다 크다.
|
|
326
|
+
*/
|
|
327
|
+
ul[lines] {
|
|
328
|
+
list-style: none;
|
|
329
|
+
margin: 0;
|
|
330
|
+
padding: 0 12px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
ul[lines] li {
|
|
334
|
+
display: flex;
|
|
335
|
+
align-items: center;
|
|
336
|
+
gap: 10px;
|
|
337
|
+
padding: 9px 2px;
|
|
338
|
+
border-bottom: 1px solid var(--md-sys-color-surface-variant);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
ul[lines] li:last-child {
|
|
342
|
+
border-bottom: none;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
ul[lines] [line] {
|
|
346
|
+
flex: 1;
|
|
347
|
+
font-size: 0.95rem;
|
|
348
|
+
line-height: 1.5;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* 문장이 없어서 이름으로 지은 줄 — 문장과 구별되게 조용히 둔다. */
|
|
352
|
+
ul[lines] [named] {
|
|
353
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
ul[lines] li[ghost] [line] {
|
|
357
|
+
text-decoration: line-through;
|
|
358
|
+
color: var(--md-sys-color-outline);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
ul[lines] [tag] {
|
|
362
|
+
margin-left: 8px;
|
|
363
|
+
font-size: 0.78rem;
|
|
364
|
+
text-decoration: none;
|
|
365
|
+
color: var(--md-sys-color-outline);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* 떼기 — 줄마다 있으므로 조용하고, 그 줄에 머물 때 드러난다. */
|
|
369
|
+
button[drop] {
|
|
370
|
+
flex: none;
|
|
371
|
+
display: inline-flex;
|
|
372
|
+
padding: 3px;
|
|
373
|
+
color: var(--md-sys-color-outline);
|
|
374
|
+
background-color: transparent;
|
|
375
|
+
border: none;
|
|
376
|
+
border-radius: var(--md-sys-shape-corner-full, 999px);
|
|
377
|
+
cursor: pointer;
|
|
378
|
+
}
|
|
379
|
+
button[drop] md-icon {
|
|
380
|
+
--md-icon-size: 18px;
|
|
381
|
+
}
|
|
382
|
+
ul[lines] li:hover button[drop] {
|
|
383
|
+
color: var(--md-sys-color-error);
|
|
384
|
+
background-color: var(--md-sys-color-error-container);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
button[add] {
|
|
388
|
+
display: inline-flex;
|
|
389
|
+
align-items: center;
|
|
390
|
+
gap: 4px;
|
|
391
|
+
margin: 10px 12px 12px;
|
|
392
|
+
padding: 8px 14px 8px 10px;
|
|
393
|
+
font: var(--label-font, inherit);
|
|
394
|
+
font-size: 0.85rem;
|
|
395
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
396
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
397
|
+
border: none;
|
|
398
|
+
border-radius: var(--md-sys-shape-corner-full, 999px);
|
|
399
|
+
cursor: pointer;
|
|
400
|
+
}
|
|
401
|
+
button[add] md-icon {
|
|
402
|
+
--md-icon-size: 18px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
button[close] {
|
|
406
|
+
margin-left: auto;
|
|
407
|
+
display: inline-flex;
|
|
408
|
+
padding: 2px;
|
|
409
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
410
|
+
background-color: transparent;
|
|
411
|
+
border: none;
|
|
412
|
+
cursor: pointer;
|
|
413
|
+
}
|
|
414
|
+
button[close] md-icon {
|
|
415
|
+
--md-icon-size: 18px;
|
|
416
|
+
}
|
|
417
|
+
|
|
335
418
|
[empty] {
|
|
336
419
|
padding: var(--spacing-large, 12px);
|
|
337
420
|
color: var(--md-sys-color-on-surface-variant);
|
|
@@ -355,9 +438,21 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
355
438
|
const keyword = this.keyword.trim().toLowerCase();
|
|
356
439
|
return keyword ? this.modules.filter(m => m.category.toLowerCase().includes(keyword)) : this.modules;
|
|
357
440
|
}
|
|
441
|
+
/*
|
|
442
|
+
* The page is named after the screen, not after the role it happens to be showing.
|
|
443
|
+
*
|
|
444
|
+
* It used to carry `this.subject.name`, and the reader then saw "Administrator" three times
|
|
445
|
+
* on one screen: the tab, the page header, and the subject block in the body. Worse, the page
|
|
446
|
+
* had no name of its own - nothing said what this screen is for.
|
|
447
|
+
*
|
|
448
|
+
* A record-valued title does have precedent here (appliance, app-binding, application in this
|
|
449
|
+
* package, and board-ui's play list - 4 of the 6 object-form titles), but those pages are the
|
|
450
|
+
* record's own detail. This one is one facet of a role, and the role is already named in the
|
|
451
|
+
* body, where a description can sit beside it.
|
|
452
|
+
*/
|
|
358
453
|
get context() {
|
|
359
454
|
return {
|
|
360
|
-
title:
|
|
455
|
+
title: { icon: 'vpn_key', text: i18next.t('title.role privileges') },
|
|
361
456
|
help: 'auth/roles',
|
|
362
457
|
actions: this.inherited
|
|
363
458
|
? []
|
|
@@ -385,41 +480,16 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
385
480
|
})}
|
|
386
481
|
</div>`
|
|
387
482
|
: nothing}
|
|
388
|
-
${this.renderSubject()} ${this.
|
|
389
|
-
|
|
390
|
-
<div body>
|
|
391
|
-
<div panel>
|
|
392
|
-
<header>
|
|
393
|
-
${i18next.t('field.module')}
|
|
394
|
-
<span count>${this.modules.length}</span>
|
|
395
|
-
</header>
|
|
396
|
-
<md-filled-text-field
|
|
397
|
-
type="text"
|
|
398
|
-
label=${i18next.t('text.filter by module name')}
|
|
399
|
-
.value=${this.keyword}
|
|
400
|
-
@input=${(e) => (this.keyword = e.target.value)}
|
|
401
|
-
></md-filled-text-field>
|
|
402
|
-
<div scroll>${this.renderModules()}</div>
|
|
403
|
-
</div>
|
|
404
|
-
|
|
405
|
-
<div panel>
|
|
406
|
-
<header>
|
|
407
|
-
${this.selected ? moduleLabel(this.selected) : i18next.t('field.privileges')}
|
|
408
|
-
<span count>${i18next.t('text.x of y on', { x: this.assigned.size, y: this.cellCount() })}</span>
|
|
409
|
-
</header>
|
|
410
|
-
<div scroll>${this.renderAxes()}</div>
|
|
411
|
-
</div>
|
|
412
|
-
</div>
|
|
483
|
+
${this.renderSubject()} ${this.renderHolders()} ${this.renderGranted()}
|
|
413
484
|
`;
|
|
414
485
|
}
|
|
415
486
|
/**
|
|
416
|
-
*
|
|
487
|
+
* 어느 역할을 고치고 있나, 그리고 그것이 무엇을 위한 것인가.
|
|
417
488
|
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
* no way to tell "Administrator" from "PLANT-MANAGER" beyond the word itself.
|
|
489
|
+
* 머리말은 이름만 들고 있었고, **직무를 말하는 한 줄인 설명은 목록에만 있었다.** 링크로
|
|
490
|
+
* 들어온 사람은 `Administrator` 와 `PLANT-MANAGER` 를 낱말 말고는 구별할 방법이 없다.
|
|
421
491
|
*
|
|
422
|
-
*
|
|
492
|
+
* 설명이 없는 역할은 없다고 말한다. 다음에 할 일은 그것을 쓰는 것이고, 자리는 목록 격자다.
|
|
423
493
|
*/
|
|
424
494
|
renderSubject() {
|
|
425
495
|
if (this.fetchState !== 'loaded') {
|
|
@@ -435,44 +505,152 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
435
505
|
`;
|
|
436
506
|
}
|
|
437
507
|
/**
|
|
438
|
-
*
|
|
508
|
+
* **이 역할이 할 수 있는 일 — 이것이 본문이다.**
|
|
509
|
+
*
|
|
510
|
+
* ── 뒤집은 이유 (UX 레인 §2, 사용자 평가) ──────────────────────────────────
|
|
511
|
+
* 격자는 「이 모듈에서 무엇이 켜졌나」에 답한다. 관리자가 묻는 것은 **「이 역할이 무엇을
|
|
512
|
+
* 하나」**이고, 격자로 그것을 읽으려면 모듈 46개를 한 번씩 열어야 한다. 역할을 부여하는
|
|
513
|
+
* 사람은 부여하기 **전에** 그 답이 필요하다.
|
|
514
|
+
*
|
|
515
|
+
* 그래서 켜진 것을 문장으로 늘어놓는 것이 본문이 되고, 격자는 **더할 때 쓰는 도구**로
|
|
516
|
+
* 자리를 옮긴다(`renderAdd`). 문장이 줄마다 있으므로 배우는 일이 따로 없다.
|
|
439
517
|
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
* granting a role needs the whole answer before they grant it.
|
|
518
|
+
* ── 켜진 것만 낸다 ─────────────────────────────────────────────────────────
|
|
519
|
+
* 전체를 여기 또 그리면 같은 46 모듈이 화면에 두 번 선다. 전체는 「더하기」 판이 갖는다.
|
|
443
520
|
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
521
|
+
* ── 글이 없을 때 ───────────────────────────────────────────────────────────
|
|
522
|
+
* 「더하기」 판에서는 문장이 없으면 **없다고 말해도 된다** — 체크박스 옆에 「읽기」라는
|
|
523
|
+
* 라벨이 이미 있어서 무엇을 켜는지 알 수 있다.
|
|
446
524
|
*
|
|
447
|
-
*
|
|
525
|
+
* 여기서는 다르다. **이 줄이 곧 그 권한의 신분이다.** 없다고만 쓰면 무엇을 떼는지 모르는
|
|
526
|
+
* 줄이 되므로, 그때는 `모듈 · 축` 으로 이름을 짓는다. 그것은 코드 낱말이 아니다 —
|
|
527
|
+
* `privilege.category.*` 57개와 「읽기/쓰기」가 사람 말이다.
|
|
448
528
|
*/
|
|
449
529
|
renderGranted() {
|
|
450
|
-
if (this.fetchState !== 'loaded'
|
|
530
|
+
if (this.fetchState !== 'loaded') {
|
|
451
531
|
return nothing;
|
|
452
532
|
}
|
|
453
|
-
const
|
|
454
|
-
.
|
|
455
|
-
|
|
456
|
-
axes: module.cells.filter(cell => this.assigned.has(cell.id))
|
|
457
|
-
}))
|
|
458
|
-
.filter(entry => entry.axes.length);
|
|
533
|
+
const granted = this.modules
|
|
534
|
+
.flatMap(module => module.cells.map(cell => ({ category: module.category, cell })))
|
|
535
|
+
.filter(entry => this.assigned.has(entry.cell.id));
|
|
459
536
|
return html `
|
|
460
537
|
<div granted>
|
|
461
538
|
<header>
|
|
462
539
|
${i18next.t('field.granted privileges')}
|
|
463
|
-
<span count>${
|
|
540
|
+
<span count>${granted.length}</span>
|
|
464
541
|
</header>
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
@click=${() => (this.selected = entry.category)}
|
|
470
|
-
>
|
|
471
|
-
${moduleLabel(entry.category)}
|
|
472
|
-
<span axes>${entry.axes.map(cell => axisLabel(cell.axis)).join(' · ')}</span>
|
|
473
|
-
</li>`)}
|
|
542
|
+
|
|
543
|
+
${granted.length
|
|
544
|
+
? html `<ul lines>
|
|
545
|
+
${granted.map(({ category, cell }) => this.renderGrantedLine(category, cell))}
|
|
474
546
|
</ul>`
|
|
475
547
|
: html `<div empty>${i18next.t('text.nothing is on for this role yet')}</div>`}
|
|
548
|
+
${this.renderAdd()}
|
|
549
|
+
</div>
|
|
550
|
+
`;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* 한 줄 — 문장과 [떼기].
|
|
554
|
+
*
|
|
555
|
+
* 유령(이 배포의 어떤 코드도 요구하지 않는 권한)은 취소선으로 보이고 **떼는 것만** 된다.
|
|
556
|
+
* 이미 붙어 있으니 뗄 수 있어야 하고, 붙여도 아무 일이 없으니 다시 켤 이유가 없다.
|
|
557
|
+
*/
|
|
558
|
+
renderGrantedLine(category, cell) {
|
|
559
|
+
const written = axisText(category, cell);
|
|
560
|
+
return html `
|
|
561
|
+
<li ?ghost=${cell.deprecated}>
|
|
562
|
+
<div line>
|
|
563
|
+
${written || html `<span named>${moduleLabel(category)} · ${axisLabel(cell.axis)}</span>`}
|
|
564
|
+
${cell.deprecated ? html `<span tag>${i18next.t('text.privilege no longer declared')}</span>` : nothing}
|
|
565
|
+
</div>
|
|
566
|
+
|
|
567
|
+
${this.inherited
|
|
568
|
+
? nothing
|
|
569
|
+
: html `<button drop title=${i18next.t('button.drop')} @click=${() => this.onToggle(cell.id, false)}>
|
|
570
|
+
<md-icon>close</md-icon>
|
|
571
|
+
</button>`}
|
|
572
|
+
</li>
|
|
573
|
+
`;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* 「+ 할 수 있는 일 더하기」 — 격자가 여기 들어간다.
|
|
577
|
+
*
|
|
578
|
+
* 열어 두지 않는 이유는 하나다 — **처음 읽는 것이 「이 역할이 무엇을 하나」여야 한다.**
|
|
579
|
+
* 46 모듈이 늘 펼쳐져 있으면 그 답이 화면 아래로 밀린다.
|
|
580
|
+
*
|
|
581
|
+
* 상속 역할에는 내주지 않는다. 여기서 저장할 수 없으므로 켜 보게 하는 것이 헛수고다 —
|
|
582
|
+
* 대신 위쪽 안내가 어느 도메인에서 고치는지 말한다.
|
|
583
|
+
*/
|
|
584
|
+
renderAdd() {
|
|
585
|
+
if (this.inherited || this.fetchState !== 'loaded') {
|
|
586
|
+
return nothing;
|
|
587
|
+
}
|
|
588
|
+
if (!this.modules.length) {
|
|
589
|
+
return html `<div note attention>${i18next.t('text.no privilege declared in this deployment')}</div>`;
|
|
590
|
+
}
|
|
591
|
+
return html `
|
|
592
|
+
<button add @click=${() => this.openAdd()}>
|
|
593
|
+
<md-icon>add</md-icon>${i18next.t('button.add what it can do')}
|
|
594
|
+
</button>
|
|
595
|
+
`;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* 고르는 판을 **넓은 팝업**으로 연다.
|
|
599
|
+
*
|
|
600
|
+
* 사용자 말씀이다 — 「'할 수 있는 일 더하기' 작동을 팝업으로 넓게 할 수 있었으면 어떤가?
|
|
601
|
+
* 지금은 좁아보이고」. 페이지 안에 펼치면 본문(할 수 있는 일)이 아래로 밀리고, 남은 폭에서
|
|
602
|
+
* 모듈 46개와 축 목록을 함께 봐야 한다. 고르는 동안은 **고르는 것만** 보는 것이 맞다.
|
|
603
|
+
*
|
|
604
|
+
* ```
|
|
605
|
+
* [읽었음] ox-floating-overlay.ts:126-134 [size=large] width 100% · height 100%
|
|
606
|
+
* ```
|
|
607
|
+
*
|
|
608
|
+
* `escapable` 을 건드리지 않는다 — 켠 것은 팝업이 아니라 **이 페이지의 `assigned`** 에 바로
|
|
609
|
+
* 들어가므로 닫든 ESC 를 누르든 잃는 것이 없다. 물어볼 것이 없는 판에 물으면 그 물음이 값을
|
|
610
|
+
* 잃는다. 저장은 여전히 툴바가 한다.
|
|
611
|
+
*
|
|
612
|
+
* ⚠ 부품을 **동적으로 들인다.** 그 부품은 스타일 한 벌을 이 클래스에서 가져가므로, 위에서
|
|
613
|
+
* 정적으로 import 하면 순환이 된다. 여는 순간에 들이면 그 고리가 끊긴다.
|
|
614
|
+
*/
|
|
615
|
+
async openAdd() {
|
|
616
|
+
await import('../../components/role-privilege-picker.js');
|
|
617
|
+
const popup = openPopup(html `<role-privilege-picker .page=${this} @close=${() => popup.close()}></role-privilege-picker>`, {
|
|
618
|
+
backdrop: true,
|
|
619
|
+
size: 'large',
|
|
620
|
+
title: i18next.t('button.add what it can do')
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* 고르는 판의 몸체 — **팝업이 이것을 그린다.**
|
|
625
|
+
*
|
|
626
|
+
* 판을 부품 안으로 옮기지 않는다. 모듈 접기·축 줄·유령 규칙이 전부 이 페이지의 상태
|
|
627
|
+
* (`modules`·`assigned`·`selected`·`keyword`)를 보기 때문이고, 옮기면 **상태가 두 벌**이 된다.
|
|
628
|
+
* 두 벌이 되는 순간 어느 쪽이 저장 범위인지 흐려진다 — 옛 편집기가 `querySelectorAll` 로
|
|
629
|
+
* 범위를 만들던 결함이 정확히 그 모양이었다.
|
|
630
|
+
*/
|
|
631
|
+
renderPickerBody() {
|
|
632
|
+
return html `
|
|
633
|
+
<div body>
|
|
634
|
+
<div panel>
|
|
635
|
+
<header>
|
|
636
|
+
${i18next.t('field.module')}
|
|
637
|
+
<span count>${this.modules.length}</span>
|
|
638
|
+
</header>
|
|
639
|
+
<ox-input-search
|
|
640
|
+
.placeholder=${i18next.t('text.filter by module name')}
|
|
641
|
+
.value=${this.keyword}
|
|
642
|
+
@change=${(e) => (this.keyword = e.target.value ?? '')}
|
|
643
|
+
></ox-input-search>
|
|
644
|
+
<div scroll>${this.renderModules()}</div>
|
|
645
|
+
</div>
|
|
646
|
+
|
|
647
|
+
<div panel>
|
|
648
|
+
<header>
|
|
649
|
+
${this.selected ? moduleLabel(this.selected) : i18next.t('field.privileges')}
|
|
650
|
+
<span count>${i18next.t('text.x of y on', { x: this.assigned.size, y: this.cellCount() })}</span>
|
|
651
|
+
</header>
|
|
652
|
+
<div scroll>${this.renderAxes()}</div>
|
|
653
|
+
</div>
|
|
476
654
|
</div>
|
|
477
655
|
`;
|
|
478
656
|
}
|
|
@@ -534,17 +712,13 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
534
712
|
const on = this.assigned.has(cell.id);
|
|
535
713
|
return html `
|
|
536
714
|
<li ?ghost=${cell.deprecated}>
|
|
537
|
-
<
|
|
715
|
+
<input
|
|
716
|
+
type="checkbox"
|
|
538
717
|
id="cell-${cell.id}"
|
|
539
|
-
touch-target="wrapper"
|
|
540
718
|
.checked=${on}
|
|
541
719
|
?disabled=${this.inherited || (cell.deprecated && !on)}
|
|
542
720
|
@change=${(e) => this.onToggle(cell.id, e.target.checked)}
|
|
543
|
-
|
|
544
|
-
<!--
|
|
545
|
-
md-checkbox 는 native input 이 아니라서 label for 로는 안 눌린다.
|
|
546
|
-
글자를 눌러도 켜지는 것이 사람이 기대하는 것이므로 같은 처리기를 붙인다.
|
|
547
|
-
-->
|
|
721
|
+
/>
|
|
548
722
|
<label
|
|
549
723
|
for="cell-${cell.id}"
|
|
550
724
|
@click=${() => {
|
|
@@ -667,6 +841,8 @@ let RolePrivilegePage = class RolePrivilegePage extends localize(i18next)(PageVi
|
|
|
667
841
|
const next = new Set(this.assigned);
|
|
668
842
|
checked ? next.add(id) : next.delete(id);
|
|
669
843
|
this.assigned = next;
|
|
844
|
+
/* 팝업은 자기 상태를 안 들고 이 페이지를 본다 — 열려 있으면 다시 그리라고 알린다. */
|
|
845
|
+
this.picker?.requestUpdate();
|
|
670
846
|
}
|
|
671
847
|
/**
|
|
672
848
|
* 저장.
|
|
@@ -787,11 +963,14 @@ function axisLabel(axis) {
|
|
|
787
963
|
* 그대로** 돌려주므로 화면에 `privilege.allows.board.query` 가 찍힌다. 빈 문자열을 기본값으로
|
|
788
964
|
* 줘서 「없음」이 거짓으로 판정되게 한다.
|
|
789
965
|
*/
|
|
790
|
-
function
|
|
966
|
+
function axisText(category, cell) {
|
|
791
967
|
if (cell.description) {
|
|
792
|
-
return
|
|
968
|
+
return cell.description;
|
|
793
969
|
}
|
|
794
|
-
|
|
970
|
+
return i18next.t(`privilege.allows.${category}.${cell.axis}`, { defaultValue: '' });
|
|
971
|
+
}
|
|
972
|
+
function axisSays(category, cell) {
|
|
973
|
+
const written = axisText(category, cell);
|
|
795
974
|
return written ? html `<div says>${written}</div>` : null;
|
|
796
975
|
}
|
|
797
976
|
function axisOrder(axis) {
|