@trismegisto/spine 3.3.0 → 3.3.1
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/README.md +19 -11
- package/fesm2022/trismegisto-spine-audit.mjs +16 -12
- package/fesm2022/trismegisto-spine-audit.mjs.map +1 -1
- package/fesm2022/{trismegisto-spine-auto-service-auto-service-audit.component-tfGcVR3i.mjs → trismegisto-spine-auto-service-auto-service-audit.component-D8HUpZtA.mjs} +4 -4
- package/fesm2022/{trismegisto-spine-auto-service-auto-service-audit.component-tfGcVR3i.mjs.map → trismegisto-spine-auto-service-auto-service-audit.component-D8HUpZtA.mjs.map} +1 -1
- package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-NawbfdLW.mjs +65 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-NawbfdLW.mjs.map +1 -0
- package/fesm2022/{trismegisto-spine-auto-service-auto-service-client.component-IATeedbr.mjs → trismegisto-spine-auto-service-auto-service-client.component-BAfeLyTB.mjs} +27 -19
- package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-BAfeLyTB.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-BYjIQ9ID.mjs +635 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-BYjIQ9ID.mjs.map +1 -0
- package/fesm2022/{trismegisto-spine-auto-service-auto-service-login-attempts.component-CRvxfSWD.mjs → trismegisto-spine-auto-service-auto-service-login-attempts.component-DoyhkSYc.mjs} +4 -4
- package/fesm2022/{trismegisto-spine-auto-service-auto-service-login-attempts.component-CRvxfSWD.mjs.map → trismegisto-spine-auto-service-auto-service-login-attempts.component-DoyhkSYc.mjs.map} +1 -1
- package/fesm2022/trismegisto-spine-auto-service-auto-service-news-page.component-CBemH4hr.mjs +432 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-news-page.component-CBemH4hr.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-ratings-page.component-C_THGTkw.mjs +769 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-ratings-page.component-C_THGTkw.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-suggestions-page.component-DIeunpQ9.mjs +2123 -0
- package/fesm2022/trismegisto-spine-auto-service-auto-service-suggestions-page.component-DIeunpQ9.mjs.map +1 -0
- package/fesm2022/{trismegisto-spine-auto-service-auto-service.component-DGrs_Jvw.mjs → trismegisto-spine-auto-service-auto-service.component-QsIQ61w2.mjs} +31 -23
- package/fesm2022/trismegisto-spine-auto-service-auto-service.component-QsIQ61w2.mjs.map +1 -0
- package/fesm2022/{trismegisto-spine-auto-service-client.usage-C_2zBCRN.mjs → trismegisto-spine-auto-service-client.usage-CJxn9Ysz.mjs} +5 -3
- package/fesm2022/trismegisto-spine-auto-service-client.usage-CJxn9Ysz.mjs.map +1 -0
- package/fesm2022/{trismegisto-spine-auto-service-groups.technical-9aPPulhy.mjs → trismegisto-spine-auto-service-groups.technical-_jQrg1Qh.mjs} +7 -5
- package/fesm2022/trismegisto-spine-auto-service-groups.technical-_jQrg1Qh.mjs.map +1 -0
- package/fesm2022/{trismegisto-spine-auto-service-groups.usage-CYh61LFL.mjs → trismegisto-spine-auto-service-groups.usage-OvWjNeeT.mjs} +7 -6
- package/fesm2022/{trismegisto-spine-auto-service-groups.usage-CYh61LFL.mjs.map → trismegisto-spine-auto-service-groups.usage-OvWjNeeT.mjs.map} +1 -1
- package/fesm2022/trismegisto-spine-auto-service-home.component-rQ3dIGIE.mjs +315 -0
- package/fesm2022/trismegisto-spine-auto-service-home.component-rQ3dIGIE.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-home.technical-Ce7oYRdg.mjs +46 -0
- package/fesm2022/trismegisto-spine-auto-service-home.technical-Ce7oYRdg.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-home.usage-D9R_ZMuU.mjs +48 -0
- package/fesm2022/trismegisto-spine-auto-service-home.usage-D9R_ZMuU.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-news.technical-DV9UpobG.mjs +38 -0
- package/fesm2022/trismegisto-spine-auto-service-news.technical-DV9UpobG.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-news.usage-CeuZnG0V.mjs +48 -0
- package/fesm2022/trismegisto-spine-auto-service-news.usage-CeuZnG0V.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-ratings.technical-QIVj6HBU.mjs +52 -0
- package/fesm2022/trismegisto-spine-auto-service-ratings.technical-QIVj6HBU.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-ratings.usage-BkteY8lz.mjs +45 -0
- package/fesm2022/trismegisto-spine-auto-service-ratings.usage-BkteY8lz.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-suggestions.technical-BtUK6sKD.mjs +69 -0
- package/fesm2022/trismegisto-spine-auto-service-suggestions.technical-BtUK6sKD.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service-suggestions.usage-BwO9Hjsx.mjs +72 -0
- package/fesm2022/trismegisto-spine-auto-service-suggestions.usage-BwO9Hjsx.mjs.map +1 -0
- package/fesm2022/trismegisto-spine-auto-service.mjs +49 -19
- package/fesm2022/trismegisto-spine-auto-service.mjs.map +1 -1
- package/fesm2022/trismegisto-spine-graphql.mjs +11 -2
- package/fesm2022/trismegisto-spine-graphql.mjs.map +1 -1
- package/fesm2022/trismegisto-spine-layout.mjs +3160 -1279
- package/fesm2022/trismegisto-spine-layout.mjs.map +1 -1
- package/fesm2022/trismegisto-spine-modal.mjs +7 -5
- package/fesm2022/trismegisto-spine-modal.mjs.map +1 -1
- package/fesm2022/trismegisto-spine-routing.mjs +12 -20
- package/fesm2022/trismegisto-spine-routing.mjs.map +1 -1
- package/fesm2022/trismegisto-spine-shell.mjs +15 -39
- package/fesm2022/trismegisto-spine-shell.mjs.map +1 -1
- package/fesm2022/trismegisto-spine-side-panel.mjs +7 -5
- package/fesm2022/trismegisto-spine-side-panel.mjs.map +1 -1
- package/fesm2022/trismegisto-spine.mjs +1969 -279
- package/fesm2022/trismegisto-spine.mjs.map +1 -1
- package/package.json +6 -6
- package/types/trismegisto-spine-audit.d.ts +2 -12
- package/types/trismegisto-spine-audit.d.ts.map +1 -1
- package/types/trismegisto-spine-auto-service.d.ts +22 -5
- package/types/trismegisto-spine-auto-service.d.ts.map +1 -1
- package/types/trismegisto-spine-layout.d.ts +1086 -283
- package/types/trismegisto-spine-layout.d.ts.map +1 -1
- package/types/trismegisto-spine-modal.d.ts +1 -0
- package/types/trismegisto-spine-modal.d.ts.map +1 -1
- package/types/trismegisto-spine-routing.d.ts +3 -12
- package/types/trismegisto-spine-routing.d.ts.map +1 -1
- package/types/trismegisto-spine-shell.d.ts +2 -15
- package/types/trismegisto-spine-shell.d.ts.map +1 -1
- package/types/trismegisto-spine-side-panel.d.ts +1 -0
- package/types/trismegisto-spine-side-panel.d.ts.map +1 -1
- package/types/trismegisto-spine.d.ts +739 -165
- package/types/trismegisto-spine.d.ts.map +1 -1
- package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-Cl7ahisu.mjs +0 -65
- package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-Cl7ahisu.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-IATeedbr.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-D6L0gTmd.mjs +0 -605
- package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-D6L0gTmd.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-auto-service.component-DGrs_Jvw.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-client.usage-C_2zBCRN.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-groups.technical-9aPPulhy.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-home.component-5_aji1hf.mjs +0 -239
- package/fesm2022/trismegisto-spine-auto-service-home.component-5_aji1hf.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-home.technical-BrVhcgDO.mjs +0 -35
- package/fesm2022/trismegisto-spine-auto-service-home.technical-BrVhcgDO.mjs.map +0 -1
- package/fesm2022/trismegisto-spine-auto-service-home.usage-DWYGtngX.mjs +0 -43
- package/fesm2022/trismegisto-spine-auto-service-home.usage-DWYGtngX.mjs.map +0 -1
|
@@ -1,605 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ChangeDetectorRef, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, computed } from '@angular/core';
|
|
3
|
-
import * as i2 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { AlertComponent, ButtonComponent, CheckboxComponent, ComboboxComponent, InputComponent, ModalComponent, TextareaComponent, TagComponent, AccountAvatarComponent, DataGridComponent, DataGridCellDirective, EMPTY_SELECTION, BadgeComponent, CardComponent, DividerComponent, IconButtonComponent, IconComponent, SelectComponent, HermesDialogService } from '@trismegisto/angular';
|
|
6
|
-
import { formatMessage } from '@trismegisto/primitives';
|
|
7
|
-
import { SPINE_MESSAGES } from '@trismegisto/spine';
|
|
8
|
-
import { a as autoServiceErrorText, A as AutoServiceDeleteFeedback } from './trismegisto-spine-auto-service-auto-service-delete-CV_t9vxm.mjs';
|
|
9
|
-
import { AutoServiceService } from './trismegisto-spine-auto-service.mjs';
|
|
10
|
-
import { A as AutoServiceClientPickerComponent } from './trismegisto-spine-auto-service-auto-service-client-picker.component-Cl7ahisu.mjs';
|
|
11
|
-
import * as i3 from '@angular/forms';
|
|
12
|
-
import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
13
|
-
import { o as optionalIdValidator, a as optionalIdBody } from './trismegisto-spine-auto-service-optional-id.validator-0JPeqhjm.mjs';
|
|
14
|
-
|
|
15
|
-
/** Limite do nome no servidor (1–100). */
|
|
16
|
-
const GROUP_NAME_MAX = 100;
|
|
17
|
-
/**
|
|
18
|
-
* Criar/editar grupo do projeto do client. Só os tipos `assignable` são oferecidos (o Administrador nunca é: é do grupo
|
|
19
|
-
* de administração, que é gerido só no painel central e não aparece no auto-serviço). Falha do servidor aparece no próprio modal, no idioma ativo.
|
|
20
|
-
* Mirror de admin/ui/.../groups/modals/groups-modal (argos-admin), sem o seletor de projeto.
|
|
21
|
-
*/
|
|
22
|
-
class AutoServiceGroupModalComponent {
|
|
23
|
-
constructor() {
|
|
24
|
-
this.text = inject(SPINE_MESSAGES).autoService;
|
|
25
|
-
/** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
|
|
26
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
27
|
-
this.service = inject(AutoServiceService);
|
|
28
|
-
/** Grupo em edição; `null` cria. */
|
|
29
|
-
this.group = null;
|
|
30
|
-
this.clientId = '';
|
|
31
|
-
this.groupTypes = [];
|
|
32
|
-
this.open = false;
|
|
33
|
-
this.openChange = new EventEmitter();
|
|
34
|
-
/** O grupo gravado (o servidor devolve o grupo criado/alterado). */
|
|
35
|
-
this.saved = new EventEmitter();
|
|
36
|
-
this.nameMax = GROUP_NAME_MAX;
|
|
37
|
-
this.name = new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.maxLength(GROUP_NAME_MAX)] });
|
|
38
|
-
this.typeId = new FormControl('', { nonNullable: true, validators: [Validators.required] });
|
|
39
|
-
this.description = new FormControl('', { nonNullable: true });
|
|
40
|
-
/** Id opcional só na criação (mesmo grupo com o mesmo id em homologação e produção). */
|
|
41
|
-
this.newId = new FormControl('', { nonNullable: true, validators: [optionalIdValidator] });
|
|
42
|
-
this.enabled = new FormControl(true, { nonNullable: true });
|
|
43
|
-
this.saving = false;
|
|
44
|
-
this.saveError = null;
|
|
45
|
-
/** Tipos que dá para escolher (`assignable`; o Administrador nunca). */
|
|
46
|
-
this.typeOptions = [];
|
|
47
|
-
}
|
|
48
|
-
get isEdit() { return !!this.group?.id; }
|
|
49
|
-
get canSave() {
|
|
50
|
-
if (this.saving)
|
|
51
|
-
return false;
|
|
52
|
-
return this.name.valid && !!this.name.value.trim() && this.typeId.valid && (this.isEdit || this.newId.valid);
|
|
53
|
-
}
|
|
54
|
-
ngOnChanges(changes) {
|
|
55
|
-
if (changes['groupTypes'] || changes['group']) {
|
|
56
|
-
this.typeOptions = this.groupTypes
|
|
57
|
-
.filter((t) => t.assignable !== false)
|
|
58
|
-
.map((t) => ({ value: t.id, label: t.name }));
|
|
59
|
-
}
|
|
60
|
-
if (changes['open'] && this.open)
|
|
61
|
-
this.resetForm();
|
|
62
|
-
}
|
|
63
|
-
resetForm() {
|
|
64
|
-
const g = this.isEdit ? this.group : null;
|
|
65
|
-
this.saveError = null;
|
|
66
|
-
this.name.reset(g?.name ?? '');
|
|
67
|
-
this.typeId.reset(g?.type?.id ?? '');
|
|
68
|
-
this.description.reset(g?.description ?? '');
|
|
69
|
-
this.newId.reset('');
|
|
70
|
-
this.enabled.reset(g ? !!g.enabled : true);
|
|
71
|
-
}
|
|
72
|
-
onModalOpenChange(value) { this.open = value; this.openChange.emit(value); }
|
|
73
|
-
close() { this.onModalOpenChange(false); }
|
|
74
|
-
async save() {
|
|
75
|
-
if (!this.canSave)
|
|
76
|
-
return;
|
|
77
|
-
this.saving = true;
|
|
78
|
-
this.saveError = null;
|
|
79
|
-
this.cdr.markForCheck();
|
|
80
|
-
// Descrição vazia vai como null na edição: o servidor só ignora campo ausente, e é assim que se apaga a descrição.
|
|
81
|
-
const description = this.description.value.trim();
|
|
82
|
-
try {
|
|
83
|
-
let saved;
|
|
84
|
-
if (this.isEdit && this.group) {
|
|
85
|
-
saved = await this.service.updateGroup(this.clientId, this.group.id, { name: this.name.value.trim(), type_id: this.typeId.value, description: description || null, enabled: this.enabled.value });
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
saved = await this.service.createGroup(this.clientId, {
|
|
89
|
-
...optionalIdBody('group_id', this.newId.value),
|
|
90
|
-
name: this.name.value.trim(), type_id: this.typeId.value, ...(description ? { description } : {}),
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
this.saved.emit(saved);
|
|
94
|
-
this.close();
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
this.saveError = autoServiceErrorText(err, this.text, this.text.groupSaveError);
|
|
98
|
-
}
|
|
99
|
-
finally {
|
|
100
|
-
this.saving = false;
|
|
101
|
-
this.cdr.markForCheck();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
105
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.24", type: AutoServiceGroupModalComponent, isStandalone: true, selector: "spine-auto-service-group-modal", inputs: { group: "group", clientId: "clientId", groupTypes: "groupTypes", open: "open" }, outputs: { openChange: "openChange", saved: "saved" }, usesOnChanges: true, ngImport: i0, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"isEdit ? text.editGroup : text.newGroup\" (closed)=\"close()\">\n <div class=\"form-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n @if (!isEdit) {\n <hm-input [formControl]=\"newId\" [label]=\"text.optionalId\" [placeholder]=\"text.optionalIdPlaceholder\" [hint]=\"text.optionalIdHint\" [messages]=\"{ optionalId: text.optionalIdInvalid }\" />\n }\n <hm-input [formControl]=\"name\" [label]=\"text.groupName\" [maxLength]=\"nameMax\" />\n <hm-combobox [formControl]=\"typeId\" [options]=\"typeOptions\" [label]=\"text.groupType\" [placeholder]=\"text.groupTypePlaceholder\" />\n <hm-textarea [formControl]=\"description\" [label]=\"text.groupDescription\" />\n <hm-checkbox *ngIf=\"isEdit\" [formControl]=\"enabled\" [label]=\"text.active\" />\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!canSave\" [loading]=\"saving\" (clicked)=\"save()\">{{ isEdit ? text.save : text.create }}</hm-button>\n </ng-container>\n</hm-modal>\n", styles: [".form-stack{display:flex;flex-direction:column;gap:var(--hm-space-sm)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: AlertComponent, selector: "hm-alert", inputs: ["variant", "appearance", "heading", "closable", "size", "showIcon", "link", "linkLabel", "linkTarget", "dismissKey", "duration"], outputs: ["closed"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: CheckboxComponent, selector: "hm-checkbox", inputs: ["label", "labelHidden", "checked", "indeterminate"], outputs: ["checkedChange"] }, { kind: "component", type: ComboboxComponent, selector: "hm-combobox", inputs: ["label", "options", "value", "placeholder", "icon", "hint", "help", "size", "labelHidden", "clearable", "requiredManual", "loading", "allowCustomValue"], outputs: ["valueChange"] }, { kind: "component", type: InputComponent, selector: "hm-input", inputs: ["value", "label", "type", "placeholder", "icon", "labelHidden", "hint", "prefix", "suffix", "prefixIcon", "mask", "maskValue", "min", "max", "step", "stepButtons", "maxLength", "autocomplete", "inputMode"], outputs: ["valueChange"] }, { kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }, { kind: "component", type: TextareaComponent, selector: "hm-textarea", inputs: ["value", "label", "hint", "help", "placeholder", "maxLength", "rows", "autoGrow", "labelHidden", "loading", "maxRows", "submitKey"], outputs: ["valueChange", "submitted"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
106
|
-
}
|
|
107
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupModalComponent, decorators: [{
|
|
108
|
-
type: Component,
|
|
109
|
-
args: [{ selector: 'spine-auto-service-group-modal', standalone: true, imports: [
|
|
110
|
-
CommonModule, ReactiveFormsModule, AlertComponent, ButtonComponent, CheckboxComponent, ComboboxComponent, InputComponent,
|
|
111
|
-
ModalComponent, TextareaComponent,
|
|
112
|
-
], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"isEdit ? text.editGroup : text.newGroup\" (closed)=\"close()\">\n <div class=\"form-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n @if (!isEdit) {\n <hm-input [formControl]=\"newId\" [label]=\"text.optionalId\" [placeholder]=\"text.optionalIdPlaceholder\" [hint]=\"text.optionalIdHint\" [messages]=\"{ optionalId: text.optionalIdInvalid }\" />\n }\n <hm-input [formControl]=\"name\" [label]=\"text.groupName\" [maxLength]=\"nameMax\" />\n <hm-combobox [formControl]=\"typeId\" [options]=\"typeOptions\" [label]=\"text.groupType\" [placeholder]=\"text.groupTypePlaceholder\" />\n <hm-textarea [formControl]=\"description\" [label]=\"text.groupDescription\" />\n <hm-checkbox *ngIf=\"isEdit\" [formControl]=\"enabled\" [label]=\"text.active\" />\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [disabled]=\"!canSave\" [loading]=\"saving\" (clicked)=\"save()\">{{ isEdit ? text.save : text.create }}</hm-button>\n </ng-container>\n</hm-modal>\n", styles: [".form-stack{display:flex;flex-direction:column;gap:var(--hm-space-sm)}\n"] }]
|
|
113
|
-
}], propDecorators: { group: [{
|
|
114
|
-
type: Input
|
|
115
|
-
}], clientId: [{
|
|
116
|
-
type: Input
|
|
117
|
-
}], groupTypes: [{
|
|
118
|
-
type: Input
|
|
119
|
-
}], open: [{
|
|
120
|
-
type: Input
|
|
121
|
-
}], openChange: [{
|
|
122
|
-
type: Output
|
|
123
|
-
}], saved: [{
|
|
124
|
-
type: Output
|
|
125
|
-
}] } });
|
|
126
|
-
|
|
127
|
-
// Mirror de admin/ui/.../groups/members/group-members.component.ts (argos-admin),
|
|
128
|
-
// adaptado pra falar com /auto-service/:clientId/groups/:groupId/members em vez de
|
|
129
|
-
// /admin/groups/:groupId/members.
|
|
130
|
-
class AutoServiceGroupMembersComponent {
|
|
131
|
-
/** Data e hora curtas no idioma ativo. */
|
|
132
|
-
formatDate(value) {
|
|
133
|
-
return value ? new Intl.DateTimeFormat(this.catalog.meta.locale, { dateStyle: 'short', timeStyle: 'short' }).format(new Date(value)) : '';
|
|
134
|
-
}
|
|
135
|
-
constructor(service) {
|
|
136
|
-
this.service = service;
|
|
137
|
-
this.catalog = inject(SPINE_MESSAGES);
|
|
138
|
-
this.text = inject(SPINE_MESSAGES).autoService;
|
|
139
|
-
/** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
|
|
140
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
141
|
-
this.clientId = '';
|
|
142
|
-
this.groupId = '';
|
|
143
|
-
this.refreshTrigger = 0;
|
|
144
|
-
this.countChange = new EventEmitter();
|
|
145
|
-
this.manageMembers = new EventEmitter();
|
|
146
|
-
this.members = [];
|
|
147
|
-
this.loading = false;
|
|
148
|
-
this.rowId = (m) => m.user_id;
|
|
149
|
-
this.columns = computed(() => [
|
|
150
|
-
{ key: 'username', title: this.text.colUser, value: (m) => m.name || m.username, sortable: true },
|
|
151
|
-
{
|
|
152
|
-
key: 'joined_at',
|
|
153
|
-
title: this.text.colMemberSince,
|
|
154
|
-
value: (m) => (m.joined_at ? this.formatDate(m.joined_at) : '—'),
|
|
155
|
-
sortable: true,
|
|
156
|
-
},
|
|
157
|
-
], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
158
|
-
}
|
|
159
|
-
ngOnChanges(changes) {
|
|
160
|
-
if (changes['groupId'] || changes['refreshTrigger']) {
|
|
161
|
-
this.load();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async load() {
|
|
165
|
-
if (!this.clientId || !this.groupId) {
|
|
166
|
-
this.members = [];
|
|
167
|
-
this.countChange.emit(0);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
this.loading = true;
|
|
171
|
-
try {
|
|
172
|
-
const res = await this.service.getGroupMembers(this.clientId, this.groupId);
|
|
173
|
-
this.members = res.members;
|
|
174
|
-
this.countChange.emit(this.members.length);
|
|
175
|
-
}
|
|
176
|
-
finally {
|
|
177
|
-
this.loading = false;
|
|
178
|
-
this.cdr.markForCheck();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
182
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupMembersComponent, isStandalone: true, selector: "spine-auto-service-group-members", inputs: { clientId: "clientId", groupId: "groupId", refreshTrigger: "refreshTrigger" }, outputs: { countChange: "countChange", manageMembers: "manageMembers" }, usesOnChanges: true, ngImport: i0, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"text.membersCaption\"\n [loading]=\"loading\"\n [emptyMessage]=\"text.noMembers\"\n>\n <hm-button dataGridActions icon=\"employee-group\" (clicked)=\"manageMembers.emit()\">{{ text.manageMembers }}</hm-button>\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag [name]=\"m.enabled ? text.active : text.inactive\" [color]=\"m.enabled ? 'success' : 'danger'\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n </ng-template>\n</hm-data-grid>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>hm-combobox{flex:1 1 16rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.as-empty{margin:var(--hm-space-xs) 0 0;font-size:var(--hm-font-size-sm)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }, { kind: "component", type: AccountAvatarComponent, selector: "hm-account-avatar", inputs: ["name", "imageUrl", "size", "loading"] }, { kind: "component", type: DataGridComponent, selector: "hm-data-grid", inputs: ["columns", "rows", "rowId", "caption", "rowActions", "loading", "error", "emptyMessage", "noResultsMessage", "filterable", "paginated", "pageState", "pagination", "totalItems", "sort", "selectable", "selectionMode", "selection", "rowSelectable", "rowSelectableReason", "rowDetailDisabled", "rowDetailHidden", "virtual", "rowHeight", "pinnedColumns", "columnState", "pageSizes", "fillHeight", "maxHeight", "bordered", "rowState", "rowClickable", "remoteSearch", "remoteSort", "itemsLabel", "pageSizeLabel", "exportable", "exportFileName", "groupBy", "aggregates", "aggregateFormatter", "persistKey", "persistStorage", "advancedFilter", "filterQuery", "columnManager", "columnOrder", "searchTerm"], outputs: ["pageStateChange", "sortChange", "selectionChange", "pinnedColumnsChange", "columnStateChange", "actionTriggered", "detailToggled", "rowClicked", "clearFiltersRequested", "filteredChange", "searchTermChanged", "groupByChange", "filterQueryChange", "columnOrderChange", "searchTermChange", "detailPaneToggled"] }, { kind: "directive", type: DataGridCellDirective, selector: "ng-template[hmCell]", inputs: ["hmCell"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
183
|
-
}
|
|
184
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersComponent, decorators: [{
|
|
185
|
-
type: Component,
|
|
186
|
-
args: [{ selector: 'spine-auto-service-group-members', standalone: true, imports: [CommonModule, ButtonComponent, TagComponent, AccountAvatarComponent, DataGridComponent, DataGridCellDirective], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"text.membersCaption\"\n [loading]=\"loading\"\n [emptyMessage]=\"text.noMembers\"\n>\n <hm-button dataGridActions icon=\"employee-group\" (clicked)=\"manageMembers.emit()\">{{ text.manageMembers }}</hm-button>\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag [name]=\"m.enabled ? text.active : text.inactive\" [color]=\"m.enabled ? 'success' : 'danger'\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n </ng-template>\n</hm-data-grid>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>hm-combobox{flex:1 1 16rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.as-empty{margin:var(--hm-space-xs) 0 0;font-size:var(--hm-font-size-sm)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}\n"] }]
|
|
187
|
-
}], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
|
|
188
|
-
type: Input
|
|
189
|
-
}], groupId: [{
|
|
190
|
-
type: Input
|
|
191
|
-
}], refreshTrigger: [{
|
|
192
|
-
type: Input
|
|
193
|
-
}], countChange: [{
|
|
194
|
-
type: Output
|
|
195
|
-
}], manageMembers: [{
|
|
196
|
-
type: Output
|
|
197
|
-
}] } });
|
|
198
|
-
|
|
199
|
-
// Funções do membro no grupo (auth.group_members.role); vazio = membro sem função, que só vê os outros.
|
|
200
|
-
const ROLE_OPTIONS = ['Administrador', 'Editor'];
|
|
201
|
-
let searchSequence = 0;
|
|
202
|
-
class AutoServiceGroupMembersModalComponent {
|
|
203
|
-
/** Data e hora curtas no idioma ativo. */
|
|
204
|
-
formatDate(value) {
|
|
205
|
-
return value ? new Intl.DateTimeFormat(this.catalog.meta.locale, { dateStyle: 'short', timeStyle: 'short' }).format(new Date(value)) : '';
|
|
206
|
-
}
|
|
207
|
-
constructor(service) {
|
|
208
|
-
this.service = service;
|
|
209
|
-
this.catalog = inject(SPINE_MESSAGES);
|
|
210
|
-
this.text = inject(SPINE_MESSAGES).autoService;
|
|
211
|
-
/** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
|
|
212
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
213
|
-
this.fmt = formatMessage;
|
|
214
|
-
this.clientId = '';
|
|
215
|
-
this.groupId = '';
|
|
216
|
-
this.groupName = '';
|
|
217
|
-
this.open = false;
|
|
218
|
-
this.openChange = new EventEmitter();
|
|
219
|
-
this.saved = new EventEmitter();
|
|
220
|
-
this.roleOptions = ROLE_OPTIONS;
|
|
221
|
-
/** Liga o rótulo "Adicionar usuário" ao campo de busca. */
|
|
222
|
-
this.searchId = `spine-members-search-${++searchSequence}`;
|
|
223
|
-
this.loading = false;
|
|
224
|
-
this.saving = false;
|
|
225
|
-
/** Falha ao gravar (no idioma ativo); o que já tinha sido gravado fica — a lista é recarregada. */
|
|
226
|
-
this.saveError = null;
|
|
227
|
-
this.members = [];
|
|
228
|
-
/** Ids marcados pra remoção — o grid seleciona por id (não por objeto, ver `GridSelection`). */
|
|
229
|
-
this.checkedForRemovalIds = EMPTY_SELECTION;
|
|
230
|
-
this.originalRoles = new Map();
|
|
231
|
-
this.addSearch = '';
|
|
232
|
-
this.addSearchResults = [];
|
|
233
|
-
this.selectedToAdd = null;
|
|
234
|
-
this.selectedRole = null;
|
|
235
|
-
this.suggestions = [];
|
|
236
|
-
this.suggestionsPool = [];
|
|
237
|
-
this.suggestionsVisibleCount = 3;
|
|
238
|
-
this.rowId = (m) => m.user_id;
|
|
239
|
-
this.columns = computed(() => [
|
|
240
|
-
{
|
|
241
|
-
key: 'username',
|
|
242
|
-
title: this.text.colUser,
|
|
243
|
-
value: (m) => [m.name, m.username, m.email].filter(Boolean).join(' '),
|
|
244
|
-
sortable: true,
|
|
245
|
-
},
|
|
246
|
-
{ key: 'role', title: this.text.colRole, value: (m) => m.role ?? '—' },
|
|
247
|
-
{
|
|
248
|
-
key: 'joined_at',
|
|
249
|
-
title: this.text.colAddedAt,
|
|
250
|
-
value: (m) => (m.joined_at ? this.formatDate(m.joined_at) : '—'),
|
|
251
|
-
sortable: true,
|
|
252
|
-
},
|
|
253
|
-
], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
254
|
-
}
|
|
255
|
-
ngOnChanges(changes) { if (changes['open'] && this.open) {
|
|
256
|
-
this.resetAndLoad();
|
|
257
|
-
} }
|
|
258
|
-
onModalOpenChange(value) { this.open = value; this.openChange.emit(value); }
|
|
259
|
-
close() { this.onModalOpenChange(false); }
|
|
260
|
-
get checkedForRemoval() {
|
|
261
|
-
return this.members.filter((m) => this.checkedForRemovalIds.has(m.user_id));
|
|
262
|
-
}
|
|
263
|
-
get removalCount() { return this.checkedForRemovalIds.size; }
|
|
264
|
-
get hasMoreSuggestions() { return this.suggestionsVisibleCount < this.suggestionsPool.length; }
|
|
265
|
-
async resetAndLoad() {
|
|
266
|
-
this.addSearch = '';
|
|
267
|
-
this.addSearchResults = [];
|
|
268
|
-
this.selectedToAdd = null;
|
|
269
|
-
this.selectedRole = null;
|
|
270
|
-
this.checkedForRemovalIds = EMPTY_SELECTION;
|
|
271
|
-
this.saveError = null;
|
|
272
|
-
this.loading = true;
|
|
273
|
-
try {
|
|
274
|
-
const res = await this.service.getGroupMembers(this.clientId, this.groupId);
|
|
275
|
-
this.members = (res.members ?? []).map((m) => ({
|
|
276
|
-
user_id: m.user_id, username: m.username, email: m.email, name: m.name ?? null,
|
|
277
|
-
picture: m.picture ?? null, enabled: m.enabled, role: m.role ?? null,
|
|
278
|
-
joined_at: m.joined_at, added_by_username: m.added_by_username ?? null,
|
|
279
|
-
}));
|
|
280
|
-
this.originalRoles = new Map(this.members.map(m => [m.user_id, m.role ?? null]));
|
|
281
|
-
this.cdr.markForCheck();
|
|
282
|
-
await this.loadSuggestions();
|
|
283
|
-
}
|
|
284
|
-
finally {
|
|
285
|
-
this.loading = false;
|
|
286
|
-
this.cdr.markForCheck();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
async loadSuggestions() {
|
|
290
|
-
if (!this.clientId) {
|
|
291
|
-
this.suggestionsPool = [];
|
|
292
|
-
this.suggestions = [];
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
const res = await this.service.searchUsers(this.clientId, { limit: 30 });
|
|
296
|
-
const existingIds = new Set(this.members.map(m => m.user_id));
|
|
297
|
-
this.suggestionsPool = (res.users ?? []).filter((u) => !existingIds.has(u.id));
|
|
298
|
-
this.suggestionsVisibleCount = 3;
|
|
299
|
-
this.suggestions = this.suggestionsPool.slice(0, this.suggestionsVisibleCount);
|
|
300
|
-
}
|
|
301
|
-
showMoreSuggestions() { this.suggestionsVisibleCount += 3; this.suggestions = this.suggestionsPool.slice(0, this.suggestionsVisibleCount); }
|
|
302
|
-
onAddSearchChange(value) {
|
|
303
|
-
this.addSearch = value;
|
|
304
|
-
this.selectedToAdd = null;
|
|
305
|
-
clearTimeout(this.addSearchTimer);
|
|
306
|
-
if (value.trim().length < 2) {
|
|
307
|
-
this.addSearchResults = [];
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
this.addSearchTimer = setTimeout(async () => {
|
|
311
|
-
const res = await this.service.searchUsers(this.clientId, { search: value.trim(), limit: 10 });
|
|
312
|
-
const existingIds = new Set(this.members.map(m => m.user_id));
|
|
313
|
-
this.addSearchResults = (res.users ?? []).filter((u) => !existingIds.has(u.id));
|
|
314
|
-
this.cdr.markForCheck();
|
|
315
|
-
}, 300);
|
|
316
|
-
}
|
|
317
|
-
selectCandidate(user) { this.selectedToAdd = user; this.addSearch = user.username; this.addSearchResults = []; }
|
|
318
|
-
clearSelectedToAdd() { this.selectedToAdd = null; this.addSearch = ''; this.addSearchResults = []; }
|
|
319
|
-
addSelectedMember() {
|
|
320
|
-
if (!this.selectedToAdd)
|
|
321
|
-
return;
|
|
322
|
-
const user = this.selectedToAdd;
|
|
323
|
-
this.members = [{
|
|
324
|
-
user_id: user.id, username: user.username, email: user.email, name: user.name ?? null, picture: user.picture ?? null, enabled: user.enabled,
|
|
325
|
-
role: this.selectedRole, joined_at: null, added_by_username: null, new: true,
|
|
326
|
-
}, ...this.members];
|
|
327
|
-
this.suggestionsPool = this.suggestionsPool.filter(u => u.id !== user.id);
|
|
328
|
-
this.suggestions = this.suggestionsPool.slice(0, this.suggestionsVisibleCount);
|
|
329
|
-
this.clearSelectedToAdd();
|
|
330
|
-
this.selectedRole = null;
|
|
331
|
-
}
|
|
332
|
-
removeStagedNew(member) { this.members = this.members.filter(m => m.user_id !== member.user_id); }
|
|
333
|
-
/** `[(selection)]` do grid: separa o que ainda é staged (nunca existiu no servidor — remove
|
|
334
|
-
* na hora, não "marca pra remover") do que já existe (fica marcado, removido só no Salvar). */
|
|
335
|
-
onSelectionChange(ids) {
|
|
336
|
-
const cleaned = this.members.filter((m) => ids.has(m.user_id));
|
|
337
|
-
const stillNew = cleaned.filter((m) => m.new);
|
|
338
|
-
for (const m of stillNew)
|
|
339
|
-
this.removeStagedNew(m);
|
|
340
|
-
this.checkedForRemovalIds = new Set([...ids].filter((id) => !stillNew.some((m) => m.user_id === id)));
|
|
341
|
-
}
|
|
342
|
-
isMarkedForRemoval(member) { return this.checkedForRemovalIds.has(member.user_id); }
|
|
343
|
-
undoRemoval(member) {
|
|
344
|
-
const next = new Set(this.checkedForRemovalIds);
|
|
345
|
-
next.delete(member.user_id);
|
|
346
|
-
this.checkedForRemovalIds = next;
|
|
347
|
-
}
|
|
348
|
-
async save() {
|
|
349
|
-
this.saving = true;
|
|
350
|
-
this.saveError = null;
|
|
351
|
-
try {
|
|
352
|
-
const toAdd = this.members.filter(m => m.new);
|
|
353
|
-
for (const m of toAdd) {
|
|
354
|
-
await this.service.addGroupMember(this.clientId, this.groupId, m.user_id, m.role ?? null);
|
|
355
|
-
}
|
|
356
|
-
for (const m of this.checkedForRemoval) {
|
|
357
|
-
await this.service.removeGroupMember(this.clientId, this.groupId, m.user_id);
|
|
358
|
-
}
|
|
359
|
-
const removedIds = this.checkedForRemovalIds;
|
|
360
|
-
const roleChanges = this.members.filter(m => !m.new && !removedIds.has(m.user_id) && (m.role ?? null) !== (this.originalRoles.get(m.user_id) ?? null));
|
|
361
|
-
for (const m of roleChanges) {
|
|
362
|
-
await this.service.updateGroupMemberRole(this.clientId, this.groupId, m.user_id, m.role ?? null);
|
|
363
|
-
}
|
|
364
|
-
this.saved.emit();
|
|
365
|
-
this.close();
|
|
366
|
-
}
|
|
367
|
-
catch (err) {
|
|
368
|
-
// Parte pode ter sido gravada (as chamadas são em sequência): recarrega para mostrar o estado real.
|
|
369
|
-
this.saveError = autoServiceErrorText(err, this.text, this.text.membersSaveError);
|
|
370
|
-
this.saved.emit();
|
|
371
|
-
const error = this.saveError;
|
|
372
|
-
await this.resetAndLoad().catch(() => undefined);
|
|
373
|
-
this.saveError = error;
|
|
374
|
-
}
|
|
375
|
-
finally {
|
|
376
|
-
this.saving = false;
|
|
377
|
-
this.cdr.markForCheck();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersModalComponent, deps: [{ token: AutoServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
381
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupMembersModalComponent, isStandalone: true, selector: "spine-auto-service-group-members-modal", inputs: { clientId: "clientId", groupId: "groupId", groupName: "groupName", open: "open" }, outputs: { openChange: "openChange", saved: "saved" }, usesOnChanges: true, ngImport: i0, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"fmt(text.membersHeading, { group: groupName })\" size=\"large\" (closed)=\"close()\">\n <div class=\"as-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n <hm-card>\n <div class=\"add-section__row\">\n <!-- Busca com lista de candidatos pr\u00F3pria (vem da API a cada tecla): o r\u00F3tulo \u00E9 o que antes era o\n t\u00EDtulo do card. -->\n <div class=\"add-field\">\n <label class=\"add-field__label\" [attr.for]=\"searchId\">{{ text.addUser }}</label>\n <div class=\"add-search\">\n <hm-icon shape=\"search\" size=\"16\"></hm-icon>\n <input type=\"text\" [id]=\"searchId\" [placeholder]=\"text.userSearch\"\n [ngModel]=\"addSearch\" (ngModelChange)=\"onAddSearchChange($event)\" />\n <hm-icon shape=\"times\" size=\"14\" *ngIf=\"addSearch\" class=\"add-search__clear\" (click)=\"clearSelectedToAdd()\"></hm-icon>\n\n <div class=\"add-search__results\" *ngIf=\"addSearchResults.length\">\n <button type=\"button\" class=\"add-search__result\" *ngFor=\"let u of addSearchResults\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <hm-select class=\"add-section__role\" [label]=\"text.role\" [value]=\"selectedRole ?? ''\" (valueChange)=\"selectedRole = $event || null\">\n <option value=\"\">{{ text.pickRole }}</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n\n <hm-button [disabled]=\"!selectedToAdd\" (clicked)=\"addSelectedMember()\">\n {{ text.add }}\n </hm-button>\n </div>\n\n <div class=\"suggestions\" *ngIf=\"suggestions.length\">\n <hm-divider [label]=\"text.suggestions\" />\n <div class=\"suggestions__row\">\n <button type=\"button\" class=\"suggestion-card\" *ngFor=\"let u of suggestions\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n <hm-button *ngIf=\"hasMoreSuggestions\" emphasis=\"minimal\" (clicked)=\"showMoreSuggestions()\">\n {{ text.moreSuggestions }}\n </hm-button>\n </div>\n </div>\n </hm-card>\n\n <div class=\"members-split\">\n <div class=\"members-split__grid\">\n <hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"fmt(text.membersOf, { group: groupName })\"\n [loading]=\"loading\"\n [selectable]=\"true\"\n [selection]=\"checkedForRemovalIds\"\n (selectionChange)=\"onSelectionChange($event)\"\n [emptyMessage]=\"text.noMembersShort\"\n >\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag *ngIf=\"m.new\" [name]=\"text.newMember\" color=\"info\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template hmCell=\"role\" let-m>\n <hm-select class=\"role-cell\" [label]=\"text.colRole\" labelHidden [disabled]=\"isMarkedForRemoval(m)\"\n [value]=\"m.role ?? ''\" (valueChange)=\"m.role = $event || null\">\n <option value=\"\">\u2014</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n </ng-template>\n\n <ng-template hmCell=\"joined_at\" let-m>\n <ng-container *ngIf=\"m.joined_at\">\n {{ formatDate(m.joined_at) }}\n <div class=\"muted\" *ngIf=\"m.added_by_username\">{{ fmt(text.addedBy, { user: m.added_by_username }) }}</div>\n </ng-container>\n <ng-container *ngIf=\"!m.joined_at\">\u2014</ng-container>\n </ng-template>\n </hm-data-grid>\n </div>\n\n <div class=\"members-split__removal\">\n <hm-card class=\"removal-card\">\n <div class=\"removal-header\">\n <hm-icon shape=\"trash\"></hm-icon> {{ text.removal }} <hm-badge [value]=\"removalCount\" intent=\"danger\" />\n </div>\n\n <div class=\"removal-empty\" *ngIf=\"removalCount === 0\">\n <hm-icon shape=\"employee-group\" size=\"xxl\"></hm-icon>\n <p class=\"muted\">{{ text.removalEmpty }}</p>\n </div>\n\n <div class=\"removal-item\" *ngFor=\"let m of checkedForRemoval\">\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <b>{{ m.name || m.username }}</b>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n <hm-icon-button emphasis=\"subtle\" icon=\"undo\" [label]=\"text.undoRemoval\" (clicked)=\"undoRemoval(m)\" />\n </div>\n </hm-card>\n </div>\n </div>\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [loading]=\"saving\" [disabled]=\"saving\" (clicked)=\"save()\" icon=\"floppy\">\n {{ text.saveChanges }}\n </hm-button>\n </ng-container>\n</hm-modal>\n", styles: ["@charset \"UTF-8\";.as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>hm-combobox{flex:1 1 16rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.as-empty{margin:var(--hm-space-xs) 0 0;font-size:var(--hm-font-size-sm)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:contents}.add-section__row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.add-section__role{flex:0 1 14rem}.add-field{display:flex;flex:1 1 20rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.add-field__label{color:var(--hm-text);font-size:var(--hm-font-size-sm);font-weight:var(--hm-font-weight-semibold)}.add-search{position:relative;display:flex;align-items:center;gap:var(--hm-space-xs);height:var(--hm-control-height);padding:0 var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface-raised);color:var(--hm-muted)}.add-search:focus-within{border-color:var(--hm-action);outline:2px solid var(--hm-focus-color);outline-offset:1px}.add-search input{flex:1;height:100%;border:none;outline:none;background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm)}.add-search input::placeholder{color:var(--hm-placeholder)}.add-search__clear{flex-shrink:0;cursor:pointer}.add-search__results{position:absolute;top:calc(100% + var(--hm-space-micro));right:0;left:0;z-index:20;max-height:14rem;overflow-y:auto;border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);box-shadow:var(--hm-shadow-overlay)}.add-search__result{display:flex;flex-direction:column;gap:var(--hm-space-micro);width:100%;padding:var(--hm-space-xs) var(--hm-space-sm);border:none;border-bottom:var(--hm-border-hairline) solid var(--hm-divider);background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.add-search__result:last-child{border-bottom:none}.add-search__result:hover{background:var(--hm-hover)}.suggestions{display:flex;flex-direction:column;gap:var(--hm-space-sm);margin-top:var(--hm-space-sm)}.suggestions__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.suggestion-card{display:flex;flex-direction:column;gap:var(--hm-space-micro);padding:var(--hm-space-xs) var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.suggestion-card:hover{border-color:var(--hm-action)}.members-split{display:flex;flex-wrap:wrap;align-items:stretch;gap:var(--hm-space-md)}.members-split__grid{flex:2 1 30rem;min-width:0}.members-split__removal{flex:1 1 17rem;min-width:0}.role-cell{display:block;min-inline-size:10rem}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.removal-card{display:block;height:100%}.removal-header{display:flex;align-items:center;gap:var(--hm-space-xs);margin-bottom:var(--hm-space-sm);color:var(--hm-danger);font-weight:var(--hm-font-weight-semibold)}.removal-empty{display:flex;flex-direction:column;align-items:center;gap:var(--hm-space-sm);padding:var(--hm-space-xl) var(--hm-space-sm);color:var(--hm-muted);text-align:center}.removal-empty p{max-width:16rem;margin:0}.removal-item{display:flex;align-items:center;justify-content:space-between;gap:var(--hm-space-xs);padding:var(--hm-space-xs) 0;border-bottom:var(--hm-border-hairline) solid var(--hm-divider)}.removal-item:last-child{border-bottom:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AccountAvatarComponent, selector: "hm-account-avatar", inputs: ["name", "imageUrl", "size", "loading"] }, { kind: "component", type: AlertComponent, selector: "hm-alert", inputs: ["variant", "appearance", "heading", "closable", "size", "showIcon", "link", "linkLabel", "linkTarget", "dismissKey", "duration"], outputs: ["closed"] }, { kind: "component", type: BadgeComponent, selector: "hm-badge", inputs: ["value", "max", "dot", "intent", "label"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: CardComponent, selector: "hm-card", inputs: ["heading", "icon", "selected", "fill", "media", "mediaAlt", "mediaDecorative", "mediaPosition"] }, { kind: "component", type: DataGridComponent, selector: "hm-data-grid", inputs: ["columns", "rows", "rowId", "caption", "rowActions", "loading", "error", "emptyMessage", "noResultsMessage", "filterable", "paginated", "pageState", "pagination", "totalItems", "sort", "selectable", "selectionMode", "selection", "rowSelectable", "rowSelectableReason", "rowDetailDisabled", "rowDetailHidden", "virtual", "rowHeight", "pinnedColumns", "columnState", "pageSizes", "fillHeight", "maxHeight", "bordered", "rowState", "rowClickable", "remoteSearch", "remoteSort", "itemsLabel", "pageSizeLabel", "exportable", "exportFileName", "groupBy", "aggregates", "aggregateFormatter", "persistKey", "persistStorage", "advancedFilter", "filterQuery", "columnManager", "columnOrder", "searchTerm"], outputs: ["pageStateChange", "sortChange", "selectionChange", "pinnedColumnsChange", "columnStateChange", "actionTriggered", "detailToggled", "rowClicked", "clearFiltersRequested", "filteredChange", "searchTermChanged", "groupByChange", "filterQueryChange", "columnOrderChange", "searchTermChange", "detailPaneToggled"] }, { kind: "directive", type: DataGridCellDirective, selector: "ng-template[hmCell]", inputs: ["hmCell"] }, { kind: "component", type: DividerComponent, selector: "hm-divider", inputs: ["orientation", "label", "labelAlign", "emphasis", "thickness", "spacing", "decorative"] }, { kind: "component", type: IconButtonComponent, selector: "hm-icon-button", inputs: ["label", "icon", "solid", "iconDirection", "emphasis", "intent", "size", "disabled", "toggle", "pressed", "keyShortcuts"], outputs: ["pressedChange", "clicked"] }, { kind: "component", type: IconComponent, selector: "hm-icon", inputs: ["shape", "direction", "size", "solid", "badge", "status", "flip", "inverse", "label"] }, { kind: "component", type: ModalComponent, selector: "hm-modal", inputs: ["open", "heading", "size", "closeLabel", "closable", "beforeClose"], outputs: ["openChange", "closed"] }, { kind: "component", type: SelectComponent, selector: "hm-select", inputs: ["value", "label", "labelHidden", "hint"], outputs: ["valueChange"] }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
382
|
-
}
|
|
383
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupMembersModalComponent, decorators: [{
|
|
384
|
-
type: Component,
|
|
385
|
-
args: [{ selector: 'spine-auto-service-group-members-modal', standalone: true, imports: [
|
|
386
|
-
CommonModule, FormsModule, AccountAvatarComponent, AlertComponent, BadgeComponent, ButtonComponent, CardComponent, DataGridComponent,
|
|
387
|
-
DataGridCellDirective, DividerComponent, IconButtonComponent, IconComponent, ModalComponent, SelectComponent, TagComponent,
|
|
388
|
-
], changeDetection: ChangeDetectionStrategy.Eager, template: "<hm-modal [open]=\"open\" (openChange)=\"onModalOpenChange($event)\" [heading]=\"fmt(text.membersHeading, { group: groupName })\" size=\"large\" (closed)=\"close()\">\n <div class=\"as-stack\">\n <hm-alert *ngIf=\"saveError\" variant=\"error\">{{ saveError }}</hm-alert>\n <hm-card>\n <div class=\"add-section__row\">\n <!-- Busca com lista de candidatos pr\u00F3pria (vem da API a cada tecla): o r\u00F3tulo \u00E9 o que antes era o\n t\u00EDtulo do card. -->\n <div class=\"add-field\">\n <label class=\"add-field__label\" [attr.for]=\"searchId\">{{ text.addUser }}</label>\n <div class=\"add-search\">\n <hm-icon shape=\"search\" size=\"16\"></hm-icon>\n <input type=\"text\" [id]=\"searchId\" [placeholder]=\"text.userSearch\"\n [ngModel]=\"addSearch\" (ngModelChange)=\"onAddSearchChange($event)\" />\n <hm-icon shape=\"times\" size=\"14\" *ngIf=\"addSearch\" class=\"add-search__clear\" (click)=\"clearSelectedToAdd()\"></hm-icon>\n\n <div class=\"add-search__results\" *ngIf=\"addSearchResults.length\">\n <button type=\"button\" class=\"add-search__result\" *ngFor=\"let u of addSearchResults\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <hm-select class=\"add-section__role\" [label]=\"text.role\" [value]=\"selectedRole ?? ''\" (valueChange)=\"selectedRole = $event || null\">\n <option value=\"\">{{ text.pickRole }}</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n\n <hm-button [disabled]=\"!selectedToAdd\" (clicked)=\"addSelectedMember()\">\n {{ text.add }}\n </hm-button>\n </div>\n\n <div class=\"suggestions\" *ngIf=\"suggestions.length\">\n <hm-divider [label]=\"text.suggestions\" />\n <div class=\"suggestions__row\">\n <button type=\"button\" class=\"suggestion-card\" *ngFor=\"let u of suggestions\" (click)=\"selectCandidate(u)\">\n <b>{{ u.name || u.username }}</b>\n <span class=\"muted\"><ng-container *ngIf=\"u.name\">{{ u.username }} \u00B7 </ng-container>{{ u.email }}</span>\n </button>\n <hm-button *ngIf=\"hasMoreSuggestions\" emphasis=\"minimal\" (clicked)=\"showMoreSuggestions()\">\n {{ text.moreSuggestions }}\n </hm-button>\n </div>\n </div>\n </hm-card>\n\n <div class=\"members-split\">\n <div class=\"members-split__grid\">\n <hm-data-grid\n [columns]=\"columns()\"\n [rows]=\"members\"\n [rowId]=\"rowId\"\n [caption]=\"fmt(text.membersOf, { group: groupName })\"\n [loading]=\"loading\"\n [selectable]=\"true\"\n [selection]=\"checkedForRemovalIds\"\n (selectionChange)=\"onSelectionChange($event)\"\n [emptyMessage]=\"text.noMembersShort\"\n >\n <ng-template hmCell=\"username\" let-m>\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\" [imageUrl]=\"m.picture\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <div class=\"user-cell__name\">\n <b>{{ m.name || m.username }}</b>\n <hm-tag *ngIf=\"m.new\" [name]=\"text.newMember\" color=\"info\" />\n </div>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template hmCell=\"role\" let-m>\n <hm-select class=\"role-cell\" [label]=\"text.colRole\" labelHidden [disabled]=\"isMarkedForRemoval(m)\"\n [value]=\"m.role ?? ''\" (valueChange)=\"m.role = $event || null\">\n <option value=\"\">\u2014</option>\n <option *ngFor=\"let r of roleOptions\" [value]=\"r\">{{ r }}</option>\n </hm-select>\n </ng-template>\n\n <ng-template hmCell=\"joined_at\" let-m>\n <ng-container *ngIf=\"m.joined_at\">\n {{ formatDate(m.joined_at) }}\n <div class=\"muted\" *ngIf=\"m.added_by_username\">{{ fmt(text.addedBy, { user: m.added_by_username }) }}</div>\n </ng-container>\n <ng-container *ngIf=\"!m.joined_at\">\u2014</ng-container>\n </ng-template>\n </hm-data-grid>\n </div>\n\n <div class=\"members-split__removal\">\n <hm-card class=\"removal-card\">\n <div class=\"removal-header\">\n <hm-icon shape=\"trash\"></hm-icon> {{ text.removal }} <hm-badge [value]=\"removalCount\" intent=\"danger\" />\n </div>\n\n <div class=\"removal-empty\" *ngIf=\"removalCount === 0\">\n <hm-icon shape=\"employee-group\" size=\"xxl\"></hm-icon>\n <p class=\"muted\">{{ text.removalEmpty }}</p>\n </div>\n\n <div class=\"removal-item\" *ngFor=\"let m of checkedForRemoval\">\n <div class=\"user-cell\">\n <hm-account-avatar class=\"user-cell__avatar\" [name]=\"m.name || m.username\"></hm-account-avatar>\n <div class=\"user-cell__body\">\n <b>{{ m.name || m.username }}</b>\n <div class=\"user-cell__email\">\n <ng-container *ngIf=\"m.name\">{{ m.username }} \u00B7 </ng-container>{{ m.email }}\n </div>\n </div>\n </div>\n <hm-icon-button emphasis=\"subtle\" icon=\"undo\" [label]=\"text.undoRemoval\" (clicked)=\"undoRemoval(m)\" />\n </div>\n </hm-card>\n </div>\n </div>\n </div>\n\n <ng-container footer>\n <hm-button emphasis=\"medium\" (clicked)=\"close()\">{{ text.cancel }}</hm-button>\n <hm-button [loading]=\"saving\" [disabled]=\"saving\" (clicked)=\"save()\" icon=\"floppy\">\n {{ text.saveChanges }}\n </hm-button>\n </ng-container>\n</hm-modal>\n", styles: ["@charset \"UTF-8\";.as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>hm-combobox{flex:1 1 16rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.as-empty{margin:var(--hm-space-xs) 0 0;font-size:var(--hm-font-size-sm)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:contents}.add-section__row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.add-section__role{flex:0 1 14rem}.add-field{display:flex;flex:1 1 20rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.add-field__label{color:var(--hm-text);font-size:var(--hm-font-size-sm);font-weight:var(--hm-font-weight-semibold)}.add-search{position:relative;display:flex;align-items:center;gap:var(--hm-space-xs);height:var(--hm-control-height);padding:0 var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface-raised);color:var(--hm-muted)}.add-search:focus-within{border-color:var(--hm-action);outline:2px solid var(--hm-focus-color);outline-offset:1px}.add-search input{flex:1;height:100%;border:none;outline:none;background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm)}.add-search input::placeholder{color:var(--hm-placeholder)}.add-search__clear{flex-shrink:0;cursor:pointer}.add-search__results{position:absolute;top:calc(100% + var(--hm-space-micro));right:0;left:0;z-index:20;max-height:14rem;overflow-y:auto;border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);box-shadow:var(--hm-shadow-overlay)}.add-search__result{display:flex;flex-direction:column;gap:var(--hm-space-micro);width:100%;padding:var(--hm-space-xs) var(--hm-space-sm);border:none;border-bottom:var(--hm-border-hairline) solid var(--hm-divider);background:transparent;color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.add-search__result:last-child{border-bottom:none}.add-search__result:hover{background:var(--hm-hover)}.suggestions{display:flex;flex-direction:column;gap:var(--hm-space-sm);margin-top:var(--hm-space-sm)}.suggestions__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.suggestion-card{display:flex;flex-direction:column;gap:var(--hm-space-micro);padding:var(--hm-space-xs) var(--hm-space-sm);border:var(--hm-border-hairline) solid var(--hm-border);border-radius:var(--hm-radius-control);background:var(--hm-surface);color:var(--hm-text);font:inherit;font-size:var(--hm-font-size-sm);text-align:start;cursor:pointer}.suggestion-card:hover{border-color:var(--hm-action)}.members-split{display:flex;flex-wrap:wrap;align-items:stretch;gap:var(--hm-space-md)}.members-split__grid{flex:2 1 30rem;min-width:0}.members-split__removal{flex:1 1 17rem;min-width:0}.role-cell{display:block;min-inline-size:10rem}.user-cell{display:flex;align-items:center;gap:var(--hm-space-xs)}.user-cell__avatar{flex-shrink:0}.user-cell__body{min-width:0}.user-cell__name{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.user-cell__email{margin-top:var(--hm-space-micro);color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.removal-card{display:block;height:100%}.removal-header{display:flex;align-items:center;gap:var(--hm-space-xs);margin-bottom:var(--hm-space-sm);color:var(--hm-danger);font-weight:var(--hm-font-weight-semibold)}.removal-empty{display:flex;flex-direction:column;align-items:center;gap:var(--hm-space-sm);padding:var(--hm-space-xl) var(--hm-space-sm);color:var(--hm-muted);text-align:center}.removal-empty p{max-width:16rem;margin:0}.removal-item{display:flex;align-items:center;justify-content:space-between;gap:var(--hm-space-xs);padding:var(--hm-space-xs) 0;border-bottom:var(--hm-border-hairline) solid var(--hm-divider)}.removal-item:last-child{border-bottom:none}\n"] }]
|
|
389
|
-
}], ctorParameters: () => [{ type: AutoServiceService }], propDecorators: { clientId: [{
|
|
390
|
-
type: Input
|
|
391
|
-
}], groupId: [{
|
|
392
|
-
type: Input
|
|
393
|
-
}], groupName: [{
|
|
394
|
-
type: Input
|
|
395
|
-
}], open: [{
|
|
396
|
-
type: Input
|
|
397
|
-
}], openChange: [{
|
|
398
|
-
type: Output
|
|
399
|
-
}], saved: [{
|
|
400
|
-
type: Output
|
|
401
|
-
}] } });
|
|
402
|
-
|
|
403
|
-
/** Valor do seletor de nível para os grupos sem tipo (servidor antigo). */
|
|
404
|
-
const NO_LEVEL = '__sem-nivel__';
|
|
405
|
-
/**
|
|
406
|
-
* Grupos do projeto do client: Novo grupo e um cartão com dois seletores, o nível de acesso (tipo do grupo, do mais alto
|
|
407
|
-
* para o mais baixo) e o grupo daquele nível, mais Consultar; o grupo consultado mostra o resumo (Editar/Excluir) e os
|
|
408
|
-
* membros. O grupo de administração do projeto (`is_admin`) é gerido só no painel central (Argos): o
|
|
409
|
-
* servidor não o devolve no auto-serviço e, se um servidor antigo devolver, a tela descarta. Mirror de admin/ui/.../features/admin/groups (argos-admin), escopado em `/auto-service/:clientId`.
|
|
410
|
-
*/
|
|
411
|
-
class AutoServiceGroupsComponent {
|
|
412
|
-
constructor() {
|
|
413
|
-
this.text = inject(SPINE_MESSAGES).autoService;
|
|
414
|
-
/** Telas com estado em campo comum, preenchido depois de `await`: marca a view ao terminar (app sem zone.js). */
|
|
415
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
416
|
-
this.dialogs = inject(HermesDialogService);
|
|
417
|
-
this.deletion = inject(AutoServiceDeleteFeedback);
|
|
418
|
-
this.service = inject(AutoServiceService);
|
|
419
|
-
this.client = null;
|
|
420
|
-
this.groups = [];
|
|
421
|
-
this.groupTypes = [];
|
|
422
|
-
this.loading = false;
|
|
423
|
-
/** Nível escolhido no primeiro seletor (id do tipo, ou `NO_LEVEL`). */
|
|
424
|
-
this.selectedLevel = '';
|
|
425
|
-
/** Grupo escolhido no segundo seletor (só abre ao Consultar). */
|
|
426
|
-
this.selectedGroupId = '';
|
|
427
|
-
/** Grupo aberto (resumo + membros embaixo do seletor). */
|
|
428
|
-
this.group = null;
|
|
429
|
-
this.memberCount = 0;
|
|
430
|
-
this.showMembersModal = false;
|
|
431
|
-
this.membersVersion = 0;
|
|
432
|
-
/** Grupo do modal de criar/editar; `null` cria. */
|
|
433
|
-
this.modalGroup = null;
|
|
434
|
-
this.showGroupModal = false;
|
|
435
|
-
/**
|
|
436
|
-
* Níveis do primeiro seletor: os tipos de `group-types` que se pode atribuir ou que já têm grupo na lista (o
|
|
437
|
-
* Administrador, só do grupo de administração, fica de fora), mais os tipos que só aparecem nos grupos (sem a rota de
|
|
438
|
-
* tipos) e "Sem nível" se algum grupo não tiver tipo. Do nível mais alto para o mais baixo. Recalculado na carga
|
|
439
|
-
* (`refreshOptions`), não a cada checagem: o `hm-combobox` recebe sempre o mesmo array.
|
|
440
|
-
*/
|
|
441
|
-
this.levelOptions = [];
|
|
442
|
-
/** Grupos do nível escolhido, em ordem alfabética. */
|
|
443
|
-
this.groupOptions = [];
|
|
444
|
-
}
|
|
445
|
-
buildLevelOptions() {
|
|
446
|
-
const used = new Set(this.groups.map((g) => g.type?.id).filter((id) => !!id));
|
|
447
|
-
const levels = new Map();
|
|
448
|
-
for (const t of this.groupTypes) {
|
|
449
|
-
if (t.assignable !== false || used.has(t.id))
|
|
450
|
-
levels.set(t.id, { name: t.name, level: t.level ?? 0 });
|
|
451
|
-
}
|
|
452
|
-
for (const g of this.groups) {
|
|
453
|
-
if (g.type?.id && !levels.has(g.type.id))
|
|
454
|
-
levels.set(g.type.id, { name: g.type.name ?? g.type.id, level: g.type.level ?? 0 });
|
|
455
|
-
}
|
|
456
|
-
const options = [...levels.entries()]
|
|
457
|
-
.sort((a, b) => b[1].level - a[1].level)
|
|
458
|
-
.map(([id, t]) => ({ value: id, label: t.name }));
|
|
459
|
-
if (this.groups.some((g) => !g.type?.id))
|
|
460
|
-
options.push({ value: NO_LEVEL, label: this.text.noLevel });
|
|
461
|
-
return options;
|
|
462
|
-
}
|
|
463
|
-
buildGroupOptions() {
|
|
464
|
-
if (!this.selectedLevel)
|
|
465
|
-
return [];
|
|
466
|
-
return this.groups
|
|
467
|
-
.filter((g) => this.levelOf(g) === this.selectedLevel)
|
|
468
|
-
.map((g) => ({ value: g.id, label: g.name }))
|
|
469
|
-
.sort((a, b) => a.label.localeCompare(b.label));
|
|
470
|
-
}
|
|
471
|
-
onClientChange(c) {
|
|
472
|
-
this.client = c;
|
|
473
|
-
this.group = null;
|
|
474
|
-
this.selectedLevel = '';
|
|
475
|
-
this.selectedGroupId = '';
|
|
476
|
-
this.groups = [];
|
|
477
|
-
this.refreshOptions();
|
|
478
|
-
void this.load();
|
|
479
|
-
}
|
|
480
|
-
/** Cor do selo do tipo de grupo (`hm-tag`): quanto mais alto o nível, mais "quente". O texto do
|
|
481
|
-
* selo é o nome do tipo — a cor só reforça (WCAG 1.4.1). */
|
|
482
|
-
levelTagColor(level) {
|
|
483
|
-
if (!level)
|
|
484
|
-
return 'neutral';
|
|
485
|
-
if (level >= 50)
|
|
486
|
-
return 'danger';
|
|
487
|
-
if (level >= 40)
|
|
488
|
-
return 'warning';
|
|
489
|
-
if (level >= 30)
|
|
490
|
-
return 'info';
|
|
491
|
-
if (level >= 20)
|
|
492
|
-
return 'success';
|
|
493
|
-
return 'neutral';
|
|
494
|
-
}
|
|
495
|
-
levelOf(g) { return g.type?.id || NO_LEVEL; }
|
|
496
|
-
refreshOptions() {
|
|
497
|
-
this.levelOptions = this.buildLevelOptions();
|
|
498
|
-
this.groupOptions = this.buildGroupOptions();
|
|
499
|
-
}
|
|
500
|
-
/** Trocar de nível limpa o grupo escolhido (ele é de outro nível). */
|
|
501
|
-
selectLevel(level) {
|
|
502
|
-
if (level !== this.selectedLevel)
|
|
503
|
-
this.selectedGroupId = '';
|
|
504
|
-
this.selectedLevel = level;
|
|
505
|
-
this.groupOptions = this.buildGroupOptions();
|
|
506
|
-
this.cdr.markForCheck();
|
|
507
|
-
}
|
|
508
|
-
/** Consultar: abre o grupo escolhido no segundo seletor. */
|
|
509
|
-
searchGroup() {
|
|
510
|
-
const g = this.groups.find((x) => x.id === this.selectedGroupId);
|
|
511
|
-
if (g)
|
|
512
|
-
this.openGroup(g);
|
|
513
|
-
}
|
|
514
|
-
/** Grupos (do tipo de nível mais alto para o mais baixo) e os tipos do realm, juntos. */
|
|
515
|
-
async load() {
|
|
516
|
-
const client = this.client;
|
|
517
|
-
if (!client) {
|
|
518
|
-
this.groups = [];
|
|
519
|
-
this.groupTypes = [];
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
this.loading = true;
|
|
523
|
-
this.cdr.markForCheck();
|
|
524
|
-
try {
|
|
525
|
-
// Sem os tipos (admin-server sem `group-types`) a lista abre igual; só o modal fica sem tipo para escolher.
|
|
526
|
-
const [groups, types] = await Promise.all([
|
|
527
|
-
this.service.getGroups(client.id),
|
|
528
|
-
this.service.getGroupTypes(client.id).catch(() => ({ group_types: [] })),
|
|
529
|
-
]);
|
|
530
|
-
if (this.client?.id !== client.id)
|
|
531
|
-
return;
|
|
532
|
-
// O grupo de administração não é do auto-serviço; servidor antigo ainda o devolve.
|
|
533
|
-
this.groups = (groups.groups ?? []).filter((g) => !g.is_admin).sort((a, b) => (b.type?.level ?? 0) - (a.type?.level ?? 0));
|
|
534
|
-
this.groupTypes = types.group_types ?? [];
|
|
535
|
-
// O grupo aberto acompanha o que o servidor devolveu (nome/descrição/nível novos) ou fecha se sumiu.
|
|
536
|
-
if (this.group)
|
|
537
|
-
this.group = this.groups.find((g) => g.id === this.group.id) ?? null;
|
|
538
|
-
if (this.group)
|
|
539
|
-
this.openGroup(this.group);
|
|
540
|
-
else if (this.selectedGroupId && !this.groups.some((g) => g.id === this.selectedGroupId))
|
|
541
|
-
this.selectedGroupId = '';
|
|
542
|
-
this.refreshOptions();
|
|
543
|
-
}
|
|
544
|
-
finally {
|
|
545
|
-
this.loading = false;
|
|
546
|
-
this.cdr.markForCheck();
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
/** Abre o grupo e deixa os dois seletores apontando para ele (nível e grupo). */
|
|
550
|
-
openGroup(g) {
|
|
551
|
-
if (this.group?.id !== g.id)
|
|
552
|
-
this.memberCount = 0;
|
|
553
|
-
this.group = g;
|
|
554
|
-
this.selectedLevel = this.levelOf(g);
|
|
555
|
-
this.selectedGroupId = g.id;
|
|
556
|
-
this.groupOptions = this.buildGroupOptions();
|
|
557
|
-
this.cdr.markForCheck();
|
|
558
|
-
}
|
|
559
|
-
openCreate() { this.modalGroup = null; this.showGroupModal = true; this.cdr.markForCheck(); }
|
|
560
|
-
openEdit(g) { this.modalGroup = g; this.showGroupModal = true; this.cdr.markForCheck(); }
|
|
561
|
-
async onGroupSaved(saved) {
|
|
562
|
-
await this.load();
|
|
563
|
-
// Recém-criado já abre, para incluir os membros em seguida.
|
|
564
|
-
const fresh = this.groups.find((g) => g.id === saved?.id);
|
|
565
|
-
if (fresh)
|
|
566
|
-
this.openGroup(fresh);
|
|
567
|
-
this.cdr.markForCheck();
|
|
568
|
-
}
|
|
569
|
-
/** Botão Excluir do resumo: confirma e exclui. */
|
|
570
|
-
async confirmDelete(g) {
|
|
571
|
-
const ok = await this.dialogs.confirm({
|
|
572
|
-
heading: this.text.confirmDeleteGroupHeading,
|
|
573
|
-
message: formatMessage(this.text.confirmDeleteGroup, { name: g.name }),
|
|
574
|
-
confirmLabel: this.text.delete,
|
|
575
|
-
danger: true,
|
|
576
|
-
});
|
|
577
|
-
if (ok)
|
|
578
|
-
await this.deleteGroup(g);
|
|
579
|
-
}
|
|
580
|
-
async deleteGroup(g) {
|
|
581
|
-
if (!this.client)
|
|
582
|
-
return;
|
|
583
|
-
if (!(await this.deletion.run(() => this.service.deleteGroup(this.client.id, g.id))))
|
|
584
|
-
return;
|
|
585
|
-
if (this.group?.id === g.id)
|
|
586
|
-
this.group = null;
|
|
587
|
-
if (this.selectedGroupId === g.id)
|
|
588
|
-
this.selectedGroupId = '';
|
|
589
|
-
await this.load();
|
|
590
|
-
}
|
|
591
|
-
openMembers() { this.showMembersModal = true; }
|
|
592
|
-
onMembersSaved() { this.membersVersion++; }
|
|
593
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
594
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.24", type: AutoServiceGroupsComponent, isStandalone: true, selector: "spine-auto-service-groups", ngImport: i0, template: "<!-- T\u00EDtulo e descri\u00E7\u00E3o da tela v\u00EAm da barra da p\u00E1gina (nome + description do router). -->\n<div class=\"as-stack\">\n <spine-auto-service-client-picker (clientChange)=\"onClientChange($event)\"></spine-auto-service-client-picker>\n\n <ng-container *ngIf=\"client\">\n <div class=\"as-actions\">\n <hm-button icon=\"plus\" (clicked)=\"openCreate()\">{{ text.newGroup }}</hm-button>\n </div>\n\n <!-- Primeiro o n\u00EDvel de acesso (tipo do grupo), depois o grupo daquele n\u00EDvel; Consultar abre o grupo embaixo. -->\n <hm-card>\n <div class=\"as-field-row\">\n <hm-combobox [label]=\"text.accessLevel\" [placeholder]=\"text.pickAccessLevel\" [options]=\"levelOptions\"\n [value]=\"selectedLevel\" (valueChange)=\"selectLevel($event)\" [disabled]=\"loading\">\n </hm-combobox>\n <hm-combobox [label]=\"text.group\" [placeholder]=\"text.pickGroup\" [options]=\"groupOptions\"\n [value]=\"selectedGroupId\" (valueChange)=\"selectedGroupId = $event\" [disabled]=\"loading || !selectedLevel\">\n </hm-combobox>\n <hm-button [disabled]=\"!selectedGroupId\" (clicked)=\"searchGroup()\" icon=\"search\">{{ text.search }}</hm-button>\n </div>\n <p class=\"as-empty muted\" *ngIf=\"!loading && groups.length === 0\">{{ text.noGroups }}</p>\n <p class=\"as-empty muted\" *ngIf=\"!loading && selectedLevel && groups.length > 0 && groupOptions.length === 0\">{{ text.noGroupsOfLevel }}</p>\n </hm-card>\n\n <ng-container *ngIf=\"group as g\">\n <hm-card>\n <div class=\"as-summary\">\n <div class=\"as-summary__info\">\n <p class=\"as-summary__title group-title\">\n {{ g.name }}\n <hm-tag *ngIf=\"g.type?.name\" [name]=\"g.type!.name\" [color]=\"levelTagColor(g.type?.level)\" />\n <hm-tag [name]=\"g.enabled ? text.active : text.inactive\" [color]=\"g.enabled ? 'success' : 'danger'\" />\n </p>\n <p class=\"as-summary__detail\">{{ g.description || text.noDescription }}</p>\n </div>\n <div class=\"as-actions\">\n <hm-button emphasis=\"medium\" icon=\"pencil\" (clicked)=\"openEdit(g)\">{{ text.edit }}</hm-button>\n <hm-button intent=\"danger\" emphasis=\"medium\" icon=\"trash\" (clicked)=\"confirmDelete(g)\">{{ text.delete }}</hm-button>\n </div>\n </div>\n </hm-card>\n\n <spine-auto-service-group-members [clientId]=\"client.id\" [groupId]=\"g.id\" [refreshTrigger]=\"membersVersion\"\n (countChange)=\"memberCount = $event\" (manageMembers)=\"openMembers()\"></spine-auto-service-group-members>\n\n <spine-auto-service-group-members-modal [clientId]=\"client.id\" [groupId]=\"g.id\" [groupName]=\"g.name\"\n [open]=\"showMembersModal\" (openChange)=\"showMembersModal = $event\" (saved)=\"onMembersSaved()\">\n </spine-auto-service-group-members-modal>\n </ng-container>\n\n <spine-auto-service-group-modal [clientId]=\"client.id\" [group]=\"modalGroup\" [groupTypes]=\"groupTypes\"\n [open]=\"showGroupModal\" (openChange)=\"showGroupModal = $event\" (saved)=\"onGroupSaved($event)\">\n </spine-auto-service-group-modal>\n </ng-container>\n</div>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>hm-combobox{flex:1 1 16rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.as-empty{margin:var(--hm-space-xs) 0 0;font-size:var(--hm-font-size-sm)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "hm-button", inputs: ["emphasis", "intent", "size", "type", "icon", "iconDirection", "iconEnd", "disabled", "loading", "busy", "loadingState", "block", "link", "newTab", "caret", "inMenu", "toggle", "pressed"], outputs: ["loadingStateChange", "pressedChange", "clicked"] }, { kind: "component", type: CardComponent, selector: "hm-card", inputs: ["heading", "icon", "selected", "fill", "media", "mediaAlt", "mediaDecorative", "mediaPosition"] }, { kind: "component", type: ComboboxComponent, selector: "hm-combobox", inputs: ["label", "options", "value", "placeholder", "icon", "hint", "help", "size", "labelHidden", "clearable", "requiredManual", "loading", "allowCustomValue"], outputs: ["valueChange"] }, { kind: "component", type: TagComponent, selector: "hm-tag", inputs: ["name", "color", "compact"] }, { kind: "component", type: AutoServiceClientPickerComponent, selector: "spine-auto-service-client-picker", outputs: ["clientChange"] }, { kind: "component", type: AutoServiceGroupModalComponent, selector: "spine-auto-service-group-modal", inputs: ["group", "clientId", "groupTypes", "open"], outputs: ["openChange", "saved"] }, { kind: "component", type: AutoServiceGroupMembersComponent, selector: "spine-auto-service-group-members", inputs: ["clientId", "groupId", "refreshTrigger"], outputs: ["countChange", "manageMembers"] }, { kind: "component", type: AutoServiceGroupMembersModalComponent, selector: "spine-auto-service-group-members-modal", inputs: ["clientId", "groupId", "groupName", "open"], outputs: ["openChange", "saved"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
595
|
-
}
|
|
596
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImport: i0, type: AutoServiceGroupsComponent, decorators: [{
|
|
597
|
-
type: Component,
|
|
598
|
-
args: [{ selector: 'spine-auto-service-groups', standalone: true, imports: [
|
|
599
|
-
CommonModule, ButtonComponent, CardComponent, ComboboxComponent, TagComponent,
|
|
600
|
-
AutoServiceClientPickerComponent, AutoServiceGroupModalComponent, AutoServiceGroupMembersComponent, AutoServiceGroupMembersModalComponent,
|
|
601
|
-
], changeDetection: ChangeDetectionStrategy.Eager, template: "<!-- T\u00EDtulo e descri\u00E7\u00E3o da tela v\u00EAm da barra da p\u00E1gina (nome + description do router). -->\n<div class=\"as-stack\">\n <spine-auto-service-client-picker (clientChange)=\"onClientChange($event)\"></spine-auto-service-client-picker>\n\n <ng-container *ngIf=\"client\">\n <div class=\"as-actions\">\n <hm-button icon=\"plus\" (clicked)=\"openCreate()\">{{ text.newGroup }}</hm-button>\n </div>\n\n <!-- Primeiro o n\u00EDvel de acesso (tipo do grupo), depois o grupo daquele n\u00EDvel; Consultar abre o grupo embaixo. -->\n <hm-card>\n <div class=\"as-field-row\">\n <hm-combobox [label]=\"text.accessLevel\" [placeholder]=\"text.pickAccessLevel\" [options]=\"levelOptions\"\n [value]=\"selectedLevel\" (valueChange)=\"selectLevel($event)\" [disabled]=\"loading\">\n </hm-combobox>\n <hm-combobox [label]=\"text.group\" [placeholder]=\"text.pickGroup\" [options]=\"groupOptions\"\n [value]=\"selectedGroupId\" (valueChange)=\"selectedGroupId = $event\" [disabled]=\"loading || !selectedLevel\">\n </hm-combobox>\n <hm-button [disabled]=\"!selectedGroupId\" (clicked)=\"searchGroup()\" icon=\"search\">{{ text.search }}</hm-button>\n </div>\n <p class=\"as-empty muted\" *ngIf=\"!loading && groups.length === 0\">{{ text.noGroups }}</p>\n <p class=\"as-empty muted\" *ngIf=\"!loading && selectedLevel && groups.length > 0 && groupOptions.length === 0\">{{ text.noGroupsOfLevel }}</p>\n </hm-card>\n\n <ng-container *ngIf=\"group as g\">\n <hm-card>\n <div class=\"as-summary\">\n <div class=\"as-summary__info\">\n <p class=\"as-summary__title group-title\">\n {{ g.name }}\n <hm-tag *ngIf=\"g.type?.name\" [name]=\"g.type!.name\" [color]=\"levelTagColor(g.type?.level)\" />\n <hm-tag [name]=\"g.enabled ? text.active : text.inactive\" [color]=\"g.enabled ? 'success' : 'danger'\" />\n </p>\n <p class=\"as-summary__detail\">{{ g.description || text.noDescription }}</p>\n </div>\n <div class=\"as-actions\">\n <hm-button emphasis=\"medium\" icon=\"pencil\" (clicked)=\"openEdit(g)\">{{ text.edit }}</hm-button>\n <hm-button intent=\"danger\" emphasis=\"medium\" icon=\"trash\" (clicked)=\"confirmDelete(g)\">{{ text.delete }}</hm-button>\n </div>\n </div>\n </hm-card>\n\n <spine-auto-service-group-members [clientId]=\"client.id\" [groupId]=\"g.id\" [refreshTrigger]=\"membersVersion\"\n (countChange)=\"memberCount = $event\" (manageMembers)=\"openMembers()\"></spine-auto-service-group-members>\n\n <spine-auto-service-group-members-modal [clientId]=\"client.id\" [groupId]=\"g.id\" [groupName]=\"g.name\"\n [open]=\"showMembersModal\" (openChange)=\"showMembersModal = $event\" (saved)=\"onMembersSaved()\">\n </spine-auto-service-group-members-modal>\n </ng-container>\n\n <spine-auto-service-group-modal [clientId]=\"client.id\" [group]=\"modalGroup\" [groupTypes]=\"groupTypes\"\n [open]=\"showGroupModal\" (openChange)=\"showGroupModal = $event\" (saved)=\"onGroupSaved($event)\">\n </spine-auto-service-group-modal>\n </ng-container>\n</div>\n", styles: [".as-stack{display:flex;flex-direction:column;gap:var(--hm-space-md);min-inline-size:0}.as-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--hm-space-xs)}.as-field-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--hm-space-sm)}.as-field-row>hm-combobox{flex:1 1 16rem;min-inline-size:0}.as-summary{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-sm)}.as-summary__info{display:flex;flex:1 1 16rem;flex-direction:column;gap:var(--hm-space-micro);min-inline-size:0}.as-summary__title{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs);margin:0;color:var(--hm-text);font-size:var(--hm-font-size-md);font-weight:var(--hm-font-weight-semibold)}.as-summary__detail{margin:0;color:var(--hm-muted);font-size:var(--hm-font-size-sm)}.muted{color:var(--hm-muted)}.as-empty{margin:var(--hm-space-xs) 0 0;font-size:var(--hm-font-size-sm)}.as-secret{display:grid;gap:var(--hm-space-micro)}.as-secret__label{color:var(--hm-muted);font-size:var(--hm-font-size-xs)}.as-secret__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hm-space-xs)}.as-secret__value{flex:1 1 240px;min-width:0;border:var(--hm-border-hairline) solid var(--hm-divider);border-radius:var(--hm-radius-control);padding:var(--hm-space-xs) var(--hm-space-sm);background:var(--hm-surface);color:var(--hm-text);font-family:var(--hm-font-mono);font-size:var(--hm-font-size-sm);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}:host{display:block}\n"] }]
|
|
602
|
-
}] });
|
|
603
|
-
|
|
604
|
-
export { AutoServiceGroupsComponent, NO_LEVEL };
|
|
605
|
-
//# sourceMappingURL=trismegisto-spine-auto-service-auto-service-groups.component-D6L0gTmd.mjs.map
|