@memberjunction/ng-credentials 0.0.1 → 3.4.0
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/lib/credentials.module.d.ts +21 -0
- package/dist/lib/credentials.module.d.ts.map +1 -0
- package/dist/lib/credentials.module.js +86 -0
- package/dist/lib/credentials.module.js.map +1 -0
- package/dist/lib/dialogs/credential-dialog.component.d.ts +68 -0
- package/dist/lib/dialogs/credential-dialog.component.d.ts.map +1 -0
- package/dist/lib/dialogs/credential-dialog.component.js +188 -0
- package/dist/lib/dialogs/credential-dialog.component.js.map +1 -0
- package/dist/lib/panels/credential-category-edit-panel/credential-category-edit-panel.component.d.ts +44 -0
- package/dist/lib/panels/credential-category-edit-panel/credential-category-edit-panel.component.d.ts.map +1 -0
- package/dist/lib/panels/credential-category-edit-panel/credential-category-edit-panel.component.js +237 -0
- package/dist/lib/panels/credential-category-edit-panel/credential-category-edit-panel.component.js.map +1 -0
- package/dist/lib/panels/credential-edit-panel/credential-edit-panel.component.d.ts +96 -0
- package/dist/lib/panels/credential-edit-panel/credential-edit-panel.component.d.ts.map +1 -0
- package/dist/lib/panels/credential-edit-panel/credential-edit-panel.component.js +533 -0
- package/dist/lib/panels/credential-edit-panel/credential-edit-panel.component.js.map +1 -0
- package/dist/lib/panels/credential-type-edit-panel/credential-type-edit-panel.component.d.ts +56 -0
- package/dist/lib/panels/credential-type-edit-panel/credential-type-edit-panel.component.d.ts.map +1 -0
- package/dist/lib/panels/credential-type-edit-panel/credential-type-edit-panel.component.js +278 -0
- package/dist/lib/panels/credential-type-edit-panel/credential-type-edit-panel.component.js.map +1 -0
- package/dist/lib/services/credential-dialog.service.d.ts +89 -0
- package/dist/lib/services/credential-dialog.service.d.ts.map +1 -0
- package/dist/lib/services/credential-dialog.service.js +166 -0
- package/dist/lib/services/credential-dialog.service.js.map +1 -0
- package/dist/public-api.d.ts +15 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +19 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +43 -6
- package/README.md +0 -45
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, HostListener } from '@angular/core';
|
|
2
|
+
import { Metadata, RunView } from '@memberjunction/core';
|
|
3
|
+
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
import * as i2 from "@angular/forms";
|
|
7
|
+
import * as i3 from "@memberjunction/ng-shared-generic";
|
|
8
|
+
export function LoadCredentialEditPanel() {
|
|
9
|
+
// Prevents tree-shaking
|
|
10
|
+
}
|
|
11
|
+
export class CredentialEditPanelComponent {
|
|
12
|
+
cdr;
|
|
13
|
+
credential = null;
|
|
14
|
+
credentialTypes = [];
|
|
15
|
+
isOpen = false;
|
|
16
|
+
close = new EventEmitter();
|
|
17
|
+
saved = new EventEmitter();
|
|
18
|
+
deleted = new EventEmitter();
|
|
19
|
+
isLoading = false;
|
|
20
|
+
isSaving = false;
|
|
21
|
+
isNew = false;
|
|
22
|
+
categories = [];
|
|
23
|
+
// Form fields
|
|
24
|
+
name = '';
|
|
25
|
+
description = '';
|
|
26
|
+
selectedTypeId = '';
|
|
27
|
+
selectedCategoryId = '';
|
|
28
|
+
isActive = true;
|
|
29
|
+
isDefault = false;
|
|
30
|
+
expiresAt = null;
|
|
31
|
+
// Dynamic credential values based on type schema
|
|
32
|
+
credentialValues = {};
|
|
33
|
+
schemaFields = [];
|
|
34
|
+
showSecretFields = new Set();
|
|
35
|
+
_metadata = new Metadata();
|
|
36
|
+
constructor(cdr) {
|
|
37
|
+
this.cdr = cdr;
|
|
38
|
+
}
|
|
39
|
+
ngOnInit() {
|
|
40
|
+
this.loadCategories();
|
|
41
|
+
}
|
|
42
|
+
ngOnDestroy() {
|
|
43
|
+
// Cleanup
|
|
44
|
+
}
|
|
45
|
+
get selectedType() {
|
|
46
|
+
return this.credentialTypes.find(t => t.ID === this.selectedTypeId) || null;
|
|
47
|
+
}
|
|
48
|
+
get panelTitle() {
|
|
49
|
+
return this.isNew ? 'Create Credential' : 'Edit Credential';
|
|
50
|
+
}
|
|
51
|
+
get canSave() {
|
|
52
|
+
if (!this.name.trim() || !this.selectedTypeId) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// Check required fields
|
|
56
|
+
for (const field of this.schemaFields) {
|
|
57
|
+
if (field.required && !this.credentialValues[field.name]) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
async open(credential, preselectedTypeId, preselectedCategoryId) {
|
|
64
|
+
this.isLoading = true;
|
|
65
|
+
this.isOpen = true;
|
|
66
|
+
this.credential = credential;
|
|
67
|
+
this.isNew = !credential || !credential.ID;
|
|
68
|
+
this.cdr.markForCheck();
|
|
69
|
+
// Reset form
|
|
70
|
+
this.resetForm();
|
|
71
|
+
if (credential && credential.ID) {
|
|
72
|
+
// Edit mode - populate from existing credential
|
|
73
|
+
this.populateFromCredential(credential);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// Create mode with optional preselections
|
|
77
|
+
if (preselectedTypeId) {
|
|
78
|
+
this.selectedTypeId = preselectedTypeId;
|
|
79
|
+
this.onTypeChange();
|
|
80
|
+
}
|
|
81
|
+
if (preselectedCategoryId) {
|
|
82
|
+
this.selectedCategoryId = preselectedCategoryId;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.isLoading = false;
|
|
86
|
+
this.cdr.markForCheck();
|
|
87
|
+
}
|
|
88
|
+
resetForm() {
|
|
89
|
+
this.name = '';
|
|
90
|
+
this.description = '';
|
|
91
|
+
this.selectedTypeId = '';
|
|
92
|
+
this.selectedCategoryId = '';
|
|
93
|
+
this.isActive = true;
|
|
94
|
+
this.isDefault = false;
|
|
95
|
+
this.expiresAt = null;
|
|
96
|
+
this.credentialValues = {};
|
|
97
|
+
this.schemaFields = [];
|
|
98
|
+
this.showSecretFields.clear();
|
|
99
|
+
}
|
|
100
|
+
populateFromCredential(credential) {
|
|
101
|
+
this.name = credential.Name || '';
|
|
102
|
+
this.description = credential.Description || '';
|
|
103
|
+
this.selectedTypeId = credential.CredentialTypeID || '';
|
|
104
|
+
this.selectedCategoryId = credential.CategoryID || '';
|
|
105
|
+
this.isActive = credential.IsActive;
|
|
106
|
+
this.isDefault = credential.IsDefault;
|
|
107
|
+
this.expiresAt = credential.ExpiresAt ? new Date(credential.ExpiresAt) : null;
|
|
108
|
+
// Parse the type schema
|
|
109
|
+
this.onTypeChange();
|
|
110
|
+
// Parse stored values and filter out "undefined" strings
|
|
111
|
+
try {
|
|
112
|
+
if (credential.Values) {
|
|
113
|
+
const parsedValues = JSON.parse(credential.Values);
|
|
114
|
+
// Filter out "undefined" string values that may have been stored
|
|
115
|
+
this.credentialValues = {};
|
|
116
|
+
for (const [key, value] of Object.entries(parsedValues)) {
|
|
117
|
+
if (value !== 'undefined' && value !== undefined && value !== null) {
|
|
118
|
+
this.credentialValues[key] = value;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
console.error('Error parsing credential values:', e);
|
|
125
|
+
this.credentialValues = {};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async loadCategories() {
|
|
129
|
+
try {
|
|
130
|
+
const rv = new RunView();
|
|
131
|
+
const result = await rv.RunView({
|
|
132
|
+
EntityName: 'MJ: Credential Categories',
|
|
133
|
+
OrderBy: 'Name',
|
|
134
|
+
ResultType: 'entity_object'
|
|
135
|
+
});
|
|
136
|
+
if (result.Success) {
|
|
137
|
+
this.categories = result.Results;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error('Error loading categories:', error);
|
|
142
|
+
}
|
|
143
|
+
this.cdr.markForCheck();
|
|
144
|
+
}
|
|
145
|
+
onTypeChange() {
|
|
146
|
+
const type = this.selectedType;
|
|
147
|
+
if (!type || !type.FieldSchema) {
|
|
148
|
+
this.schemaFields = [];
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const schema = JSON.parse(type.FieldSchema);
|
|
153
|
+
const properties = schema.properties || {};
|
|
154
|
+
const required = schema.required || [];
|
|
155
|
+
this.schemaFields = Object.entries(properties).map(([name, prop]) => {
|
|
156
|
+
const field = {
|
|
157
|
+
name,
|
|
158
|
+
type: prop.type || 'string',
|
|
159
|
+
title: prop.title || name,
|
|
160
|
+
description: prop.description || '',
|
|
161
|
+
isSecret: prop.isSecret === true,
|
|
162
|
+
required: required.includes(name),
|
|
163
|
+
order: typeof prop.order === 'number' ? prop.order : 999
|
|
164
|
+
};
|
|
165
|
+
// Extract JSON Schema constraint properties
|
|
166
|
+
if ('enum' in prop && Array.isArray(prop.enum)) {
|
|
167
|
+
field.enum = prop.enum;
|
|
168
|
+
}
|
|
169
|
+
if ('const' in prop) {
|
|
170
|
+
field.const = prop.const;
|
|
171
|
+
}
|
|
172
|
+
if ('default' in prop) {
|
|
173
|
+
field.default = prop.default;
|
|
174
|
+
}
|
|
175
|
+
if ('format' in prop) {
|
|
176
|
+
field.format = prop.format;
|
|
177
|
+
}
|
|
178
|
+
if ('pattern' in prop) {
|
|
179
|
+
field.pattern = prop.pattern;
|
|
180
|
+
}
|
|
181
|
+
if ('minLength' in prop) {
|
|
182
|
+
field.minLength = prop.minLength;
|
|
183
|
+
}
|
|
184
|
+
if ('maxLength' in prop) {
|
|
185
|
+
field.maxLength = prop.maxLength;
|
|
186
|
+
}
|
|
187
|
+
if ('minimum' in prop) {
|
|
188
|
+
field.minimum = prop.minimum;
|
|
189
|
+
}
|
|
190
|
+
if ('maximum' in prop) {
|
|
191
|
+
field.maximum = prop.maximum;
|
|
192
|
+
}
|
|
193
|
+
return field;
|
|
194
|
+
});
|
|
195
|
+
// Sort by order
|
|
196
|
+
this.schemaFields.sort((a, b) => a.order - b.order);
|
|
197
|
+
// Initialize any missing values with defaults or const values
|
|
198
|
+
for (const field of this.schemaFields) {
|
|
199
|
+
if (!(field.name in this.credentialValues)) {
|
|
200
|
+
// Priority: const > default > empty
|
|
201
|
+
if (field.const !== undefined) {
|
|
202
|
+
this.credentialValues[field.name] = String(field.const);
|
|
203
|
+
}
|
|
204
|
+
else if (field.default !== undefined) {
|
|
205
|
+
this.credentialValues[field.name] = String(field.default);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.credentialValues[field.name] = '';
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
console.error('Error parsing field schema:', e);
|
|
215
|
+
this.schemaFields = [];
|
|
216
|
+
}
|
|
217
|
+
this.cdr.markForCheck();
|
|
218
|
+
}
|
|
219
|
+
toggleSecretVisibility(fieldName) {
|
|
220
|
+
if (this.showSecretFields.has(fieldName)) {
|
|
221
|
+
this.showSecretFields.delete(fieldName);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this.showSecretFields.add(fieldName);
|
|
225
|
+
}
|
|
226
|
+
this.cdr.markForCheck();
|
|
227
|
+
}
|
|
228
|
+
isSecretVisible(fieldName) {
|
|
229
|
+
return this.showSecretFields.has(fieldName);
|
|
230
|
+
}
|
|
231
|
+
async save() {
|
|
232
|
+
if (!this.canSave) {
|
|
233
|
+
MJNotificationService.Instance.CreateSimpleNotification('Please fill in all required fields', 'warning', 3000);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
// Validate all fields against schema constraints
|
|
237
|
+
const validationErrors = this.validateAllFields();
|
|
238
|
+
if (validationErrors.length > 0) {
|
|
239
|
+
const errorMessage = validationErrors.length === 1
|
|
240
|
+
? validationErrors[0]
|
|
241
|
+
: `Validation errors:\n${validationErrors.map(e => `• ${e}`).join('\n')}`;
|
|
242
|
+
MJNotificationService.Instance.CreateSimpleNotification(errorMessage, 'error', 5000);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
this.isSaving = true;
|
|
246
|
+
this.cdr.markForCheck();
|
|
247
|
+
try {
|
|
248
|
+
let entity;
|
|
249
|
+
if (this.isNew) {
|
|
250
|
+
// Create new credential
|
|
251
|
+
entity = await this._metadata.GetEntityObject('MJ: Credentials');
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
entity = this.credential;
|
|
255
|
+
}
|
|
256
|
+
// Set all fields
|
|
257
|
+
entity.Name = this.name.trim();
|
|
258
|
+
entity.Description = this.description.trim() || null;
|
|
259
|
+
entity.CredentialTypeID = this.selectedTypeId;
|
|
260
|
+
entity.CategoryID = this.selectedCategoryId || null;
|
|
261
|
+
entity.IsActive = this.isActive;
|
|
262
|
+
entity.IsDefault = this.isDefault;
|
|
263
|
+
entity.ExpiresAt = this.expiresAt;
|
|
264
|
+
// Clean credential values before saving (remove "undefined" strings and empty non-required fields)
|
|
265
|
+
const cleanedValues = this.cleanCredentialValues();
|
|
266
|
+
entity.Values = JSON.stringify(cleanedValues);
|
|
267
|
+
const success = await entity.Save();
|
|
268
|
+
if (success) {
|
|
269
|
+
const action = this.isNew ? 'created' : 'updated';
|
|
270
|
+
MJNotificationService.Instance.CreateSimpleNotification(`Credential "${entity.Name}" ${action} successfully`, 'success', 3000);
|
|
271
|
+
this.saved.emit(entity);
|
|
272
|
+
this.closePanel();
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
// Use CompleteMessage for full error details, fall back to Message
|
|
276
|
+
const errorMessage = entity.LatestResult?.CompleteMessage || entity.LatestResult?.Message || 'Unknown error';
|
|
277
|
+
console.error('Credential save failed:', errorMessage, entity.LatestResult);
|
|
278
|
+
MJNotificationService.Instance.CreateSimpleNotification(`Failed to save credential: ${errorMessage}`, 'error', 8000);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
console.error('Error saving credential:', error);
|
|
283
|
+
MJNotificationService.Instance.CreateSimpleNotification('Error saving credential', 'error', 3000);
|
|
284
|
+
}
|
|
285
|
+
finally {
|
|
286
|
+
this.isSaving = false;
|
|
287
|
+
this.cdr.markForCheck();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async deleteCredential() {
|
|
291
|
+
if (this.isNew || !this.credential)
|
|
292
|
+
return;
|
|
293
|
+
const confirmed = confirm(`Are you sure you want to delete "${this.credential.Name}"? This action cannot be undone.`);
|
|
294
|
+
if (!confirmed)
|
|
295
|
+
return;
|
|
296
|
+
this.isSaving = true;
|
|
297
|
+
this.cdr.markForCheck();
|
|
298
|
+
try {
|
|
299
|
+
const success = await this.credential.Delete();
|
|
300
|
+
if (success) {
|
|
301
|
+
MJNotificationService.Instance.CreateSimpleNotification(`Credential "${this.credential.Name}" deleted successfully`, 'success', 3000);
|
|
302
|
+
this.deleted.emit(this.credential.ID);
|
|
303
|
+
this.closePanel();
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
// Use CompleteMessage for full error details, fall back to Message
|
|
307
|
+
const errorMessage = this.credential.LatestResult?.CompleteMessage || this.credential.LatestResult?.Message || 'Unknown error';
|
|
308
|
+
console.error('Credential delete failed:', errorMessage, this.credential.LatestResult);
|
|
309
|
+
MJNotificationService.Instance.CreateSimpleNotification(`Failed to delete credential: ${errorMessage}`, 'error', 8000);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
console.error('Error deleting credential:', error);
|
|
314
|
+
MJNotificationService.Instance.CreateSimpleNotification('Error deleting credential', 'error', 3000);
|
|
315
|
+
}
|
|
316
|
+
finally {
|
|
317
|
+
this.isSaving = false;
|
|
318
|
+
this.cdr.markForCheck();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
closePanel() {
|
|
322
|
+
this.isOpen = false;
|
|
323
|
+
this.credential = null;
|
|
324
|
+
this.resetForm();
|
|
325
|
+
this.close.emit();
|
|
326
|
+
this.cdr.markForCheck();
|
|
327
|
+
}
|
|
328
|
+
onBackdropClick() {
|
|
329
|
+
// Backdrop click disabled - panel only closeable via Cancel button or ESC key
|
|
330
|
+
// This prevents accidental closes when clicking outside the panel
|
|
331
|
+
}
|
|
332
|
+
onEscapeKey(event) {
|
|
333
|
+
if (this.isOpen && !this.isSaving) {
|
|
334
|
+
event.preventDefault();
|
|
335
|
+
this.closePanel();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
get groupedCredentialTypes() {
|
|
339
|
+
const grouped = new Map();
|
|
340
|
+
for (const type of this.credentialTypes) {
|
|
341
|
+
const category = type.Category || 'Other';
|
|
342
|
+
if (!grouped.has(category)) {
|
|
343
|
+
grouped.set(category, []);
|
|
344
|
+
}
|
|
345
|
+
grouped.get(category).push(type);
|
|
346
|
+
}
|
|
347
|
+
return Array.from(grouped.entries()).map(([category, types]) => ({ category, types }));
|
|
348
|
+
}
|
|
349
|
+
getTypeIcon(type) {
|
|
350
|
+
const iconMap = {
|
|
351
|
+
'AI': 'fa-solid fa-brain',
|
|
352
|
+
'Communication': 'fa-solid fa-envelope',
|
|
353
|
+
'Storage': 'fa-solid fa-cloud',
|
|
354
|
+
'Database': 'fa-solid fa-database',
|
|
355
|
+
'Authentication': 'fa-solid fa-shield-halved',
|
|
356
|
+
'Integration': 'fa-solid fa-plug'
|
|
357
|
+
};
|
|
358
|
+
return type.IconClass || iconMap[type.Category] || 'fa-solid fa-key';
|
|
359
|
+
}
|
|
360
|
+
getTypeColor(type) {
|
|
361
|
+
const colorMap = {
|
|
362
|
+
'AI': '#8b5cf6',
|
|
363
|
+
'Communication': '#3b82f6',
|
|
364
|
+
'Storage': '#06b6d4',
|
|
365
|
+
'Database': '#f59e0b',
|
|
366
|
+
'Authentication': '#10b981',
|
|
367
|
+
'Integration': '#ec4899'
|
|
368
|
+
};
|
|
369
|
+
return colorMap[type.Category] || '#6366f1';
|
|
370
|
+
}
|
|
371
|
+
onValueChange(fieldName, value) {
|
|
372
|
+
this.credentialValues[fieldName] = value;
|
|
373
|
+
this.cdr.markForCheck();
|
|
374
|
+
}
|
|
375
|
+
formatDateForInput(date) {
|
|
376
|
+
if (!date)
|
|
377
|
+
return '';
|
|
378
|
+
const d = new Date(date);
|
|
379
|
+
return d.toISOString().split('T')[0];
|
|
380
|
+
}
|
|
381
|
+
onExpiresAtChange(value) {
|
|
382
|
+
this.expiresAt = value ? new Date(value) : null;
|
|
383
|
+
this.cdr.markForCheck();
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Validates a field value against format constraints.
|
|
387
|
+
*/
|
|
388
|
+
validateFormat(fieldTitle, value, format) {
|
|
389
|
+
if (!value || !format)
|
|
390
|
+
return null;
|
|
391
|
+
switch (format) {
|
|
392
|
+
case 'uri':
|
|
393
|
+
case 'url':
|
|
394
|
+
try {
|
|
395
|
+
new URL(value);
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
catch {
|
|
399
|
+
return `${fieldTitle} must be a valid URL`;
|
|
400
|
+
}
|
|
401
|
+
case 'email':
|
|
402
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
403
|
+
return emailRegex.test(value) ? null : `${fieldTitle} must be a valid email`;
|
|
404
|
+
case 'date':
|
|
405
|
+
return isNaN(Date.parse(value)) ? `${fieldTitle} must be a valid date` : null;
|
|
406
|
+
case 'date-time':
|
|
407
|
+
return isNaN(Date.parse(value)) ? `${fieldTitle} must be a valid date-time` : null;
|
|
408
|
+
case 'uuid':
|
|
409
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
410
|
+
return uuidRegex.test(value) ? null : `${fieldTitle} must be a valid UUID`;
|
|
411
|
+
default:
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Validates all credential fields against their schema constraints.
|
|
417
|
+
* Returns array of error messages (empty if all valid).
|
|
418
|
+
*/
|
|
419
|
+
validateAllFields() {
|
|
420
|
+
const errors = [];
|
|
421
|
+
for (const field of this.schemaFields) {
|
|
422
|
+
const value = this.credentialValues[field.name];
|
|
423
|
+
const stringValue = String(value || '');
|
|
424
|
+
// Skip validation for const fields (they're auto-populated and read-only)
|
|
425
|
+
if (field.const !== undefined) {
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
// Required field validation (already handled by canSave, but included for completeness)
|
|
429
|
+
if (field.required && !stringValue) {
|
|
430
|
+
errors.push(`${field.title} is required`);
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
// Skip further validation if field is empty and not required
|
|
434
|
+
if (!stringValue) {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
// Enum validation
|
|
438
|
+
if (field.enum && field.enum.length > 0) {
|
|
439
|
+
if (!field.enum.includes(stringValue)) {
|
|
440
|
+
errors.push(`${field.title} must be one of: ${field.enum.join(', ')}`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// Format validation
|
|
444
|
+
if (field.format) {
|
|
445
|
+
const formatError = this.validateFormat(field.title, stringValue, field.format);
|
|
446
|
+
if (formatError) {
|
|
447
|
+
errors.push(formatError);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// Pattern validation
|
|
451
|
+
if (field.pattern) {
|
|
452
|
+
try {
|
|
453
|
+
const regex = new RegExp(field.pattern);
|
|
454
|
+
if (!regex.test(stringValue)) {
|
|
455
|
+
errors.push(`${field.title} does not match required pattern`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
catch (e) {
|
|
459
|
+
console.error(`Invalid regex pattern for ${field.name}:`, e);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// Length validation
|
|
463
|
+
if (field.minLength !== undefined && stringValue.length < field.minLength) {
|
|
464
|
+
errors.push(`${field.title} must be at least ${field.minLength} characters`);
|
|
465
|
+
}
|
|
466
|
+
if (field.maxLength !== undefined && stringValue.length > field.maxLength) {
|
|
467
|
+
errors.push(`${field.title} must be no more than ${field.maxLength} characters`);
|
|
468
|
+
}
|
|
469
|
+
// Numeric range validation (if type is number)
|
|
470
|
+
if (field.type === 'number') {
|
|
471
|
+
const numValue = Number(value);
|
|
472
|
+
if (!isNaN(numValue)) {
|
|
473
|
+
if (field.minimum !== undefined && numValue < field.minimum) {
|
|
474
|
+
errors.push(`${field.title} must be at least ${field.minimum}`);
|
|
475
|
+
}
|
|
476
|
+
if (field.maximum !== undefined && numValue > field.maximum) {
|
|
477
|
+
errors.push(`${field.title} must be no more than ${field.maximum}`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return errors;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Cleans credential values before saving by removing:
|
|
486
|
+
* - "undefined" string values
|
|
487
|
+
* - Empty strings for non-required fields
|
|
488
|
+
* - null and undefined values
|
|
489
|
+
*/
|
|
490
|
+
cleanCredentialValues() {
|
|
491
|
+
const cleaned = {};
|
|
492
|
+
for (const field of this.schemaFields) {
|
|
493
|
+
const value = this.credentialValues[field.name];
|
|
494
|
+
// Skip "undefined" strings
|
|
495
|
+
if (value === 'undefined') {
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
// Skip null and undefined
|
|
499
|
+
if (value === null || value === undefined) {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
// Skip empty strings for non-required fields (but keep empty strings for required fields)
|
|
503
|
+
if (value === '' && !field.required) {
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
// Keep all other values
|
|
507
|
+
cleaned[field.name] = value;
|
|
508
|
+
}
|
|
509
|
+
return cleaned;
|
|
510
|
+
}
|
|
511
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CredentialEditPanelComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
512
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: CredentialEditPanelComponent, selector: "mj-credential-edit-panel", inputs: { credential: "credential", credentialTypes: "credentialTypes", isOpen: "isOpen" }, outputs: { close: "close", saved: "saved", deleted: "deleted" }, host: { listeners: { "document:keydown.escape": "onEscapeKey($event)" } }, ngImport: i0, template: "<div class=\"panel-backdrop\" *ngIf=\"isOpen\" (click)=\"onBackdropClick()\">\n <div class=\"edit-panel\" [class.open]=\"isOpen\">\n <!-- Panel Header -->\n <div class=\"panel-header\">\n <div class=\"header-content\">\n <div class=\"header-icon\" *ngIf=\"selectedType\" [style.backgroundColor]=\"getTypeColor(selectedType) + '15'\" [style.color]=\"getTypeColor(selectedType)\">\n <i [class]=\"getTypeIcon(selectedType)\"></i>\n </div>\n <div class=\"header-icon default\" *ngIf=\"!selectedType\">\n <i class=\"fa-solid fa-key\"></i>\n </div>\n <div class=\"header-text\">\n <h2>{{panelTitle}}</h2>\n <span class=\"header-subtitle\" *ngIf=\"selectedType\">{{selectedType.Name}}</span>\n <span class=\"header-subtitle\" *ngIf=\"!selectedType\">Select a credential type</span>\n </div>\n </div>\n <button class=\"close-btn\" (click)=\"closePanel()\" [disabled]=\"isSaving\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n\n <!-- Panel Body -->\n <div class=\"panel-body\">\n <mj-loading *ngIf=\"isLoading\" text=\"Loading...\"></mj-loading>\n\n <form *ngIf=\"!isLoading\" class=\"credential-form\" (submit)=\"$event.preventDefault(); save()\">\n <!-- Basic Info Section -->\n <div class=\"form-section\">\n <h3 class=\"section-title\">\n <i class=\"fa-solid fa-info-circle\"></i>\n Basic Information\n </h3>\n\n <div class=\"form-group\">\n <label for=\"credentialName\" class=\"required\">Name</label>\n <input\n type=\"text\"\n id=\"credentialName\"\n name=\"credentialName\"\n [(ngModel)]=\"name\"\n placeholder=\"e.g., Production OpenAI Key\"\n [disabled]=\"isSaving\"\n required\n />\n </div>\n\n <div class=\"form-group\">\n <label for=\"credentialType\" class=\"required\">Credential Type</label>\n <select\n id=\"credentialType\"\n name=\"credentialType\"\n [(ngModel)]=\"selectedTypeId\"\n (ngModelChange)=\"onTypeChange()\"\n [disabled]=\"isSaving || !isNew\"\n required\n >\n <option [ngValue]=\"''\">Select a type...</option>\n <optgroup *ngFor=\"let group of groupedCredentialTypes\" [label]=\"group.category\">\n <option *ngFor=\"let type of group.types\" [ngValue]=\"type.ID\">\n {{type.Name}}\n </option>\n </optgroup>\n </select>\n <span class=\"field-hint\" *ngIf=\"!isNew\">Type cannot be changed after creation</span>\n </div>\n\n <div class=\"form-group\">\n <label for=\"credentialCategory\">Category</label>\n <select\n id=\"credentialCategory\"\n name=\"credentialCategory\"\n [(ngModel)]=\"selectedCategoryId\"\n [disabled]=\"isSaving\"\n >\n <option [ngValue]=\"''\">No category</option>\n <option *ngFor=\"let cat of categories\" [ngValue]=\"cat.ID\">{{cat.Name}}</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"credentialDescription\">Description</label>\n <textarea\n id=\"credentialDescription\"\n name=\"credentialDescription\"\n [(ngModel)]=\"description\"\n placeholder=\"Optional description...\"\n rows=\"3\"\n [disabled]=\"isSaving\"\n ></textarea>\n </div>\n </div>\n\n <!-- Credential Values Section -->\n <div class=\"form-section\" *ngIf=\"schemaFields.length > 0\">\n <h3 class=\"section-title\">\n <i class=\"fa-solid fa-key\"></i>\n Credential Values\n <span class=\"encrypted-badge\">\n <i class=\"fa-solid fa-lock\"></i>\n Encrypted\n </span>\n </h3>\n\n <div class=\"form-group\" *ngFor=\"let field of schemaFields\">\n <label [for]=\"'field-' + field.name\" [class.required]=\"field.required\">\n {{field.title}}\n </label>\n\n <div class=\"secret-field-wrapper\" *ngIf=\"field.isSecret; else regularField\">\n <input\n [type]=\"isSecretVisible(field.name) ? 'text' : 'password'\"\n [id]=\"'field-' + field.name\"\n [name]=\"'field-' + field.name\"\n [value]=\"credentialValues[field.name] || ''\"\n (input)=\"onValueChange(field.name, $any($event.target).value)\"\n [placeholder]=\"field.description || 'Enter ' + field.title\"\n [disabled]=\"isSaving\"\n [required]=\"field.required\"\n autocomplete=\"off\"\n />\n <button\n type=\"button\"\n class=\"toggle-visibility-btn\"\n (click)=\"toggleSecretVisibility(field.name)\"\n [title]=\"isSecretVisible(field.name) ? 'Hide' : 'Show'\"\n >\n <i [class]=\"isSecretVisible(field.name) ? 'fa-solid fa-eye-slash' : 'fa-solid fa-eye'\"></i>\n </button>\n </div>\n\n <ng-template #regularField>\n <!-- Const fields: Read-only display -->\n <div *ngIf=\"field.const !== undefined\" class=\"const-field-display\">\n <div class=\"const-value-container\">\n <span class=\"const-value\">{{credentialValues[field.name] || ''}}</span>\n <i class=\"fa-solid fa-lock const-lock-icon\" title=\"This value is fixed and cannot be changed\"></i>\n </div>\n <span class=\"field-hint const-hint\">This field is automatically configured</span>\n </div>\n\n <!-- Enum fields: Dropdown/select -->\n <select\n *ngIf=\"field.const === undefined && field.enum && field.enum.length > 0\"\n [id]=\"'field-' + field.name\"\n [name]=\"'field-' + field.name\"\n [ngModel]=\"credentialValues[field.name] || ''\"\n (ngModelChange)=\"onValueChange(field.name, $event)\"\n [disabled]=\"isSaving\"\n [required]=\"field.required\"\n >\n <option [ngValue]=\"''\">Select {{field.title}}...</option>\n <option *ngFor=\"let option of field.enum\" [ngValue]=\"option\">{{option}}</option>\n </select>\n\n <!-- Regular text/number input -->\n <input\n *ngIf=\"field.const === undefined && !field.enum && (field.type === 'string' || field.type === 'number')\"\n [type]=\"field.type === 'number' ? 'number' : 'text'\"\n [id]=\"'field-' + field.name\"\n [name]=\"'field-' + field.name\"\n [value]=\"credentialValues[field.name] || ''\"\n (input)=\"onValueChange(field.name, $any($event.target).value)\"\n [placeholder]=\"field.description || 'Enter ' + field.title\"\n [disabled]=\"isSaving\"\n [required]=\"field.required\"\n [attr.minlength]=\"field.minLength\"\n [attr.maxlength]=\"field.maxLength\"\n [attr.min]=\"field.minimum\"\n [attr.max]=\"field.maximum\"\n [attr.pattern]=\"field.pattern\"\n />\n </ng-template>\n\n <span class=\"field-hint\" *ngIf=\"field.description && !field.isSecret\">{{field.description}}</span>\n </div>\n </div>\n\n <!-- No Type Selected Message -->\n <div class=\"no-type-message\" *ngIf=\"isNew && !selectedTypeId\">\n <div class=\"message-icon\">\n <i class=\"fa-solid fa-hand-pointer\"></i>\n </div>\n <p>Select a credential type above to configure the credential values.</p>\n </div>\n\n <!-- Settings Section -->\n <div class=\"form-section\">\n <h3 class=\"section-title\">\n <i class=\"fa-solid fa-cog\"></i>\n Settings\n </h3>\n\n <div class=\"toggle-group\">\n <label class=\"toggle-label\">\n <span class=\"toggle-wrapper\">\n <input\n type=\"checkbox\"\n name=\"isActive\"\n [(ngModel)]=\"isActive\"\n [disabled]=\"isSaving\"\n />\n <span class=\"toggle-slider\"></span>\n </span>\n <span class=\"toggle-text\">\n <span class=\"toggle-title\">Active</span>\n <span class=\"toggle-description\">Enable this credential for use</span>\n </span>\n </label>\n </div>\n\n <div class=\"toggle-group\">\n <label class=\"toggle-label\">\n <span class=\"toggle-wrapper\">\n <input\n type=\"checkbox\"\n name=\"isDefault\"\n [(ngModel)]=\"isDefault\"\n [disabled]=\"isSaving\"\n />\n <span class=\"toggle-slider\"></span>\n </span>\n <span class=\"toggle-text\">\n <span class=\"toggle-title\">Default</span>\n <span class=\"toggle-description\">Use as default for this credential type</span>\n </span>\n </label>\n </div>\n\n <div class=\"form-group\">\n <label for=\"expiresAt\">Expiration Date</label>\n <input\n type=\"date\"\n id=\"expiresAt\"\n name=\"expiresAt\"\n [value]=\"formatDateForInput(expiresAt)\"\n (change)=\"onExpiresAtChange($any($event.target).value)\"\n [disabled]=\"isSaving\"\n />\n <span class=\"field-hint\">Leave empty for no expiration</span>\n </div>\n </div>\n </form>\n </div>\n\n <!-- Panel Footer -->\n <div class=\"panel-footer\">\n <div class=\"footer-left\">\n <button\n class=\"btn-delete\"\n *ngIf=\"!isNew\"\n (click)=\"deleteCredential()\"\n [disabled]=\"isSaving\"\n >\n <i class=\"fa-solid fa-trash\"></i>\n <span>Delete</span>\n </button>\n </div>\n <div class=\"footer-right\">\n <button\n class=\"btn-secondary\"\n (click)=\"closePanel()\"\n [disabled]=\"isSaving\"\n >\n Cancel\n </button>\n <button\n class=\"btn-primary\"\n (click)=\"save()\"\n [disabled]=\"isSaving || !canSave\"\n >\n <i class=\"fa-solid fa-spinner fa-spin\" *ngIf=\"isSaving\"></i>\n <i class=\"fa-solid fa-check\" *ngIf=\"!isSaving\"></i>\n <span>{{isNew ? 'Create' : 'Save'}}</span>\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: ["/* Panel Backdrop */\n.panel-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1000;\n display: flex;\n justify-content: flex-end;\n animation: fadeIn 0.2s ease-out;\n}\n\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Slide-in Panel */\n.edit-panel {\n width: 100%;\n max-width: 520px;\n height: 100%;\n background: #ffffff;\n display: flex;\n flex-direction: column;\n box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);\n transform: translateX(100%);\n animation: slideIn 0.3s ease-out forwards;\n}\n\n@keyframes slideIn {\n from { transform: translateX(100%); }\n to { transform: translateX(0); }\n}\n\n/* Panel Header */\n.panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px;\n border-bottom: 1px solid #e5e7eb;\n background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);\n}\n\n.header-content {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n\n.header-icon {\n width: 48px;\n height: 48px;\n border-radius: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n flex-shrink: 0;\n}\n\n.header-icon.default {\n background: #f1f5f9;\n color: #64748b;\n}\n\n.header-text h2 {\n font-size: 18px;\n font-weight: 600;\n color: #1e293b;\n margin: 0 0 4px 0;\n}\n\n.header-subtitle {\n font-size: 13px;\n color: #64748b;\n}\n\n.close-btn {\n width: 36px;\n height: 36px;\n border: none;\n background: #f1f5f9;\n border-radius: 8px;\n cursor: pointer;\n color: #64748b;\n font-size: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.15s ease;\n}\n\n.close-btn:hover:not(:disabled) {\n background: #e2e8f0;\n color: #334155;\n}\n\n.close-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Panel Body */\n.panel-body {\n flex: 1;\n overflow-y: auto;\n padding: 24px;\n}\n\n/* Form Sections */\n.form-section {\n margin-bottom: 28px;\n}\n\n.form-section:last-child {\n margin-bottom: 0;\n}\n\n.section-title {\n display: flex;\n align-items: center;\n gap: 10px;\n font-size: 14px;\n font-weight: 600;\n color: #334155;\n margin: 0 0 16px 0;\n padding-bottom: 10px;\n border-bottom: 1px solid #f1f5f9;\n}\n\n.section-title i {\n color: #6366f1;\n font-size: 14px;\n}\n\n.encrypted-badge {\n margin-left: auto;\n background: #dcfce7;\n color: #166534;\n padding: 4px 10px;\n border-radius: 20px;\n font-size: 11px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 5px;\n}\n\n.encrypted-badge i {\n color: #16a34a;\n font-size: 10px;\n}\n\n/* Form Groups */\n.form-group {\n margin-bottom: 18px;\n}\n\n.form-group:last-child {\n margin-bottom: 0;\n}\n\n.form-group label {\n display: block;\n font-size: 13px;\n font-weight: 500;\n color: #475569;\n margin-bottom: 6px;\n}\n\n.form-group label.required::after {\n content: '*';\n color: #ef4444;\n margin-left: 4px;\n}\n\n.form-group input[type=\"text\"],\n.form-group input[type=\"password\"],\n.form-group input[type=\"number\"],\n.form-group input[type=\"date\"],\n.form-group select,\n.form-group textarea {\n width: 100%;\n padding: 10px 14px;\n border: 1px solid #d1d5db;\n border-radius: 8px;\n font-size: 14px;\n color: #1e293b;\n background: #ffffff;\n transition: all 0.15s ease;\n box-sizing: border-box;\n}\n\n.form-group input:focus,\n.form-group select:focus,\n.form-group textarea:focus {\n outline: none;\n border-color: #6366f1;\n box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);\n}\n\n.form-group input:disabled,\n.form-group select:disabled,\n.form-group textarea:disabled {\n background: #f8fafc;\n color: #94a3b8;\n cursor: not-allowed;\n}\n\n.form-group textarea {\n resize: vertical;\n min-height: 80px;\n}\n\n.form-group select {\n cursor: pointer;\n}\n\n.field-hint {\n display: block;\n font-size: 12px;\n color: #94a3b8;\n margin-top: 5px;\n}\n\n/* Secret Field Wrapper */\n.secret-field-wrapper {\n position: relative;\n display: flex;\n}\n\n.secret-field-wrapper input {\n flex: 1;\n padding-right: 44px;\n}\n\n.toggle-visibility-btn {\n position: absolute;\n right: 4px;\n top: 50%;\n transform: translateY(-50%);\n width: 36px;\n height: 36px;\n border: none;\n background: transparent;\n color: #94a3b8;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 6px;\n transition: all 0.15s ease;\n}\n\n.toggle-visibility-btn:hover {\n background: #f1f5f9;\n color: #6366f1;\n}\n\n/* Toggle Groups */\n.toggle-group {\n margin-bottom: 16px;\n}\n\n.toggle-group:last-child {\n margin-bottom: 0;\n}\n\n.toggle-label {\n display: flex;\n align-items: flex-start;\n gap: 14px;\n cursor: pointer;\n}\n\n.toggle-wrapper {\n position: relative;\n width: 44px;\n height: 24px;\n flex-shrink: 0;\n}\n\n.toggle-wrapper input {\n position: absolute;\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.toggle-slider {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: #d1d5db;\n border-radius: 12px;\n transition: all 0.2s ease;\n}\n\n.toggle-slider::before {\n content: '';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: #ffffff;\n border-radius: 50%;\n transition: all 0.2s ease;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n}\n\n.toggle-wrapper input:checked + .toggle-slider {\n background: #6366f1;\n}\n\n.toggle-wrapper input:checked + .toggle-slider::before {\n transform: translateX(20px);\n}\n\n.toggle-wrapper input:disabled + .toggle-slider {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.toggle-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.toggle-title {\n font-size: 14px;\n font-weight: 500;\n color: #334155;\n}\n\n.toggle-description {\n font-size: 12px;\n color: #94a3b8;\n}\n\n/* No Type Message */\n.no-type-message {\n text-align: center;\n padding: 32px 20px;\n background: #f8fafc;\n border-radius: 12px;\n border: 2px dashed #e2e8f0;\n}\n\n.message-icon {\n width: 56px;\n height: 56px;\n background: #e2e8f0;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 auto 16px;\n font-size: 24px;\n color: #94a3b8;\n}\n\n.no-type-message p {\n margin: 0;\n color: #64748b;\n font-size: 14px;\n}\n\n/* Panel Footer */\n.panel-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 24px;\n border-top: 1px solid #e5e7eb;\n background: #f8fafc;\n}\n\n.footer-left,\n.footer-right {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.btn-primary,\n.btn-secondary,\n.btn-delete {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 20px;\n border: none;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.btn-primary {\n background: #6366f1;\n color: #ffffff;\n}\n\n.btn-primary:hover:not(:disabled) {\n background: #4f46e5;\n}\n\n.btn-primary:disabled {\n background: #c7d2fe;\n cursor: not-allowed;\n}\n\n.btn-secondary {\n background: #ffffff;\n color: #475569;\n border: 1px solid #d1d5db;\n}\n\n.btn-secondary:hover:not(:disabled) {\n background: #f1f5f9;\n border-color: #94a3b8;\n}\n\n.btn-secondary:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.btn-delete {\n background: transparent;\n color: #dc2626;\n padding: 10px 16px;\n}\n\n.btn-delete:hover:not(:disabled) {\n background: #fef2f2;\n}\n\n.btn-delete:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Mobile Responsiveness */\n@media (max-width: 768px) {\n .edit-panel {\n max-width: 100%;\n }\n\n .panel-header {\n padding: 16px 20px;\n }\n\n .header-icon {\n width: 40px;\n height: 40px;\n font-size: 18px;\n }\n\n .header-text h2 {\n font-size: 16px;\n }\n\n .panel-body {\n padding: 20px;\n }\n\n .form-section {\n margin-bottom: 24px;\n }\n\n .section-title {\n font-size: 13px;\n }\n\n .form-group input,\n .form-group select,\n .form-group textarea {\n padding: 12px 14px;\n font-size: 16px; /* Prevents iOS zoom on focus */\n }\n\n .panel-footer {\n padding: 14px 20px;\n flex-direction: column-reverse;\n gap: 12px;\n }\n\n .footer-left,\n .footer-right {\n width: 100%;\n }\n\n .footer-right {\n flex-direction: row;\n }\n\n .footer-right .btn-primary,\n .footer-right .btn-secondary {\n flex: 1;\n justify-content: center;\n }\n\n .btn-delete {\n width: 100%;\n justify-content: center;\n background: #fef2f2;\n }\n\n .toggle-label {\n gap: 12px;\n }\n\n .encrypted-badge {\n display: none;\n }\n}\n\n@media (max-width: 480px) {\n .panel-header {\n padding: 14px 16px;\n }\n\n .header-content {\n gap: 12px;\n }\n\n .header-icon {\n width: 36px;\n height: 36px;\n font-size: 16px;\n border-radius: 10px;\n }\n\n .header-text h2 {\n font-size: 15px;\n }\n\n .header-subtitle {\n font-size: 12px;\n }\n\n .panel-body {\n padding: 16px;\n }\n\n .section-title {\n font-size: 12px;\n gap: 8px;\n }\n\n .form-group label {\n font-size: 12px;\n }\n\n .toggle-title {\n font-size: 13px;\n }\n\n .toggle-description {\n font-size: 11px;\n }\n\n .no-type-message {\n padding: 24px 16px;\n }\n\n .message-icon {\n width: 48px;\n height: 48px;\n font-size: 20px;\n }\n\n .panel-footer {\n padding: 12px 16px;\n }\n\n .btn-primary,\n .btn-secondary {\n padding: 10px 16px;\n font-size: 13px;\n }\n}\n\n/* Animations for saving state */\n@keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n\n.fa-spin {\n animation: spin 1s linear infinite;\n}\n\n/* Smooth scrolling */\n.panel-body {\n scroll-behavior: smooth;\n -webkit-overflow-scrolling: touch;\n}\n\n/* Custom scrollbar */\n.panel-body::-webkit-scrollbar {\n width: 6px;\n}\n\n.panel-body::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.panel-body::-webkit-scrollbar-thumb {\n background: #d1d5db;\n border-radius: 3px;\n}\n\n.panel-body::-webkit-scrollbar-thumb:hover {\n background: #94a3b8;\n}\n\n/* Const Field Display */\n.const-field-display {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.const-value-container {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: #f8fafc;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n}\n\n.const-value {\n flex: 1;\n font-family: 'Monaco', 'Menlo', 'Consolas', monospace;\n font-size: 13px;\n color: #475569;\n word-break: break-all;\n}\n\n.const-lock-icon {\n color: #94a3b8;\n font-size: 14px;\n flex-shrink: 0;\n}\n\n.const-hint {\n color: #94a3b8;\n font-style: italic;\n}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.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: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.LoadingComponent, selector: "mj-loading", inputs: ["text", "showText", "animationDuration", "size", "textColor", "logoColor", "logoGradient", "animation"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
513
|
+
}
|
|
514
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CredentialEditPanelComponent, decorators: [{
|
|
515
|
+
type: Component,
|
|
516
|
+
args: [{ selector: 'mj-credential-edit-panel', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"panel-backdrop\" *ngIf=\"isOpen\" (click)=\"onBackdropClick()\">\n <div class=\"edit-panel\" [class.open]=\"isOpen\">\n <!-- Panel Header -->\n <div class=\"panel-header\">\n <div class=\"header-content\">\n <div class=\"header-icon\" *ngIf=\"selectedType\" [style.backgroundColor]=\"getTypeColor(selectedType) + '15'\" [style.color]=\"getTypeColor(selectedType)\">\n <i [class]=\"getTypeIcon(selectedType)\"></i>\n </div>\n <div class=\"header-icon default\" *ngIf=\"!selectedType\">\n <i class=\"fa-solid fa-key\"></i>\n </div>\n <div class=\"header-text\">\n <h2>{{panelTitle}}</h2>\n <span class=\"header-subtitle\" *ngIf=\"selectedType\">{{selectedType.Name}}</span>\n <span class=\"header-subtitle\" *ngIf=\"!selectedType\">Select a credential type</span>\n </div>\n </div>\n <button class=\"close-btn\" (click)=\"closePanel()\" [disabled]=\"isSaving\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n\n <!-- Panel Body -->\n <div class=\"panel-body\">\n <mj-loading *ngIf=\"isLoading\" text=\"Loading...\"></mj-loading>\n\n <form *ngIf=\"!isLoading\" class=\"credential-form\" (submit)=\"$event.preventDefault(); save()\">\n <!-- Basic Info Section -->\n <div class=\"form-section\">\n <h3 class=\"section-title\">\n <i class=\"fa-solid fa-info-circle\"></i>\n Basic Information\n </h3>\n\n <div class=\"form-group\">\n <label for=\"credentialName\" class=\"required\">Name</label>\n <input\n type=\"text\"\n id=\"credentialName\"\n name=\"credentialName\"\n [(ngModel)]=\"name\"\n placeholder=\"e.g., Production OpenAI Key\"\n [disabled]=\"isSaving\"\n required\n />\n </div>\n\n <div class=\"form-group\">\n <label for=\"credentialType\" class=\"required\">Credential Type</label>\n <select\n id=\"credentialType\"\n name=\"credentialType\"\n [(ngModel)]=\"selectedTypeId\"\n (ngModelChange)=\"onTypeChange()\"\n [disabled]=\"isSaving || !isNew\"\n required\n >\n <option [ngValue]=\"''\">Select a type...</option>\n <optgroup *ngFor=\"let group of groupedCredentialTypes\" [label]=\"group.category\">\n <option *ngFor=\"let type of group.types\" [ngValue]=\"type.ID\">\n {{type.Name}}\n </option>\n </optgroup>\n </select>\n <span class=\"field-hint\" *ngIf=\"!isNew\">Type cannot be changed after creation</span>\n </div>\n\n <div class=\"form-group\">\n <label for=\"credentialCategory\">Category</label>\n <select\n id=\"credentialCategory\"\n name=\"credentialCategory\"\n [(ngModel)]=\"selectedCategoryId\"\n [disabled]=\"isSaving\"\n >\n <option [ngValue]=\"''\">No category</option>\n <option *ngFor=\"let cat of categories\" [ngValue]=\"cat.ID\">{{cat.Name}}</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"credentialDescription\">Description</label>\n <textarea\n id=\"credentialDescription\"\n name=\"credentialDescription\"\n [(ngModel)]=\"description\"\n placeholder=\"Optional description...\"\n rows=\"3\"\n [disabled]=\"isSaving\"\n ></textarea>\n </div>\n </div>\n\n <!-- Credential Values Section -->\n <div class=\"form-section\" *ngIf=\"schemaFields.length > 0\">\n <h3 class=\"section-title\">\n <i class=\"fa-solid fa-key\"></i>\n Credential Values\n <span class=\"encrypted-badge\">\n <i class=\"fa-solid fa-lock\"></i>\n Encrypted\n </span>\n </h3>\n\n <div class=\"form-group\" *ngFor=\"let field of schemaFields\">\n <label [for]=\"'field-' + field.name\" [class.required]=\"field.required\">\n {{field.title}}\n </label>\n\n <div class=\"secret-field-wrapper\" *ngIf=\"field.isSecret; else regularField\">\n <input\n [type]=\"isSecretVisible(field.name) ? 'text' : 'password'\"\n [id]=\"'field-' + field.name\"\n [name]=\"'field-' + field.name\"\n [value]=\"credentialValues[field.name] || ''\"\n (input)=\"onValueChange(field.name, $any($event.target).value)\"\n [placeholder]=\"field.description || 'Enter ' + field.title\"\n [disabled]=\"isSaving\"\n [required]=\"field.required\"\n autocomplete=\"off\"\n />\n <button\n type=\"button\"\n class=\"toggle-visibility-btn\"\n (click)=\"toggleSecretVisibility(field.name)\"\n [title]=\"isSecretVisible(field.name) ? 'Hide' : 'Show'\"\n >\n <i [class]=\"isSecretVisible(field.name) ? 'fa-solid fa-eye-slash' : 'fa-solid fa-eye'\"></i>\n </button>\n </div>\n\n <ng-template #regularField>\n <!-- Const fields: Read-only display -->\n <div *ngIf=\"field.const !== undefined\" class=\"const-field-display\">\n <div class=\"const-value-container\">\n <span class=\"const-value\">{{credentialValues[field.name] || ''}}</span>\n <i class=\"fa-solid fa-lock const-lock-icon\" title=\"This value is fixed and cannot be changed\"></i>\n </div>\n <span class=\"field-hint const-hint\">This field is automatically configured</span>\n </div>\n\n <!-- Enum fields: Dropdown/select -->\n <select\n *ngIf=\"field.const === undefined && field.enum && field.enum.length > 0\"\n [id]=\"'field-' + field.name\"\n [name]=\"'field-' + field.name\"\n [ngModel]=\"credentialValues[field.name] || ''\"\n (ngModelChange)=\"onValueChange(field.name, $event)\"\n [disabled]=\"isSaving\"\n [required]=\"field.required\"\n >\n <option [ngValue]=\"''\">Select {{field.title}}...</option>\n <option *ngFor=\"let option of field.enum\" [ngValue]=\"option\">{{option}}</option>\n </select>\n\n <!-- Regular text/number input -->\n <input\n *ngIf=\"field.const === undefined && !field.enum && (field.type === 'string' || field.type === 'number')\"\n [type]=\"field.type === 'number' ? 'number' : 'text'\"\n [id]=\"'field-' + field.name\"\n [name]=\"'field-' + field.name\"\n [value]=\"credentialValues[field.name] || ''\"\n (input)=\"onValueChange(field.name, $any($event.target).value)\"\n [placeholder]=\"field.description || 'Enter ' + field.title\"\n [disabled]=\"isSaving\"\n [required]=\"field.required\"\n [attr.minlength]=\"field.minLength\"\n [attr.maxlength]=\"field.maxLength\"\n [attr.min]=\"field.minimum\"\n [attr.max]=\"field.maximum\"\n [attr.pattern]=\"field.pattern\"\n />\n </ng-template>\n\n <span class=\"field-hint\" *ngIf=\"field.description && !field.isSecret\">{{field.description}}</span>\n </div>\n </div>\n\n <!-- No Type Selected Message -->\n <div class=\"no-type-message\" *ngIf=\"isNew && !selectedTypeId\">\n <div class=\"message-icon\">\n <i class=\"fa-solid fa-hand-pointer\"></i>\n </div>\n <p>Select a credential type above to configure the credential values.</p>\n </div>\n\n <!-- Settings Section -->\n <div class=\"form-section\">\n <h3 class=\"section-title\">\n <i class=\"fa-solid fa-cog\"></i>\n Settings\n </h3>\n\n <div class=\"toggle-group\">\n <label class=\"toggle-label\">\n <span class=\"toggle-wrapper\">\n <input\n type=\"checkbox\"\n name=\"isActive\"\n [(ngModel)]=\"isActive\"\n [disabled]=\"isSaving\"\n />\n <span class=\"toggle-slider\"></span>\n </span>\n <span class=\"toggle-text\">\n <span class=\"toggle-title\">Active</span>\n <span class=\"toggle-description\">Enable this credential for use</span>\n </span>\n </label>\n </div>\n\n <div class=\"toggle-group\">\n <label class=\"toggle-label\">\n <span class=\"toggle-wrapper\">\n <input\n type=\"checkbox\"\n name=\"isDefault\"\n [(ngModel)]=\"isDefault\"\n [disabled]=\"isSaving\"\n />\n <span class=\"toggle-slider\"></span>\n </span>\n <span class=\"toggle-text\">\n <span class=\"toggle-title\">Default</span>\n <span class=\"toggle-description\">Use as default for this credential type</span>\n </span>\n </label>\n </div>\n\n <div class=\"form-group\">\n <label for=\"expiresAt\">Expiration Date</label>\n <input\n type=\"date\"\n id=\"expiresAt\"\n name=\"expiresAt\"\n [value]=\"formatDateForInput(expiresAt)\"\n (change)=\"onExpiresAtChange($any($event.target).value)\"\n [disabled]=\"isSaving\"\n />\n <span class=\"field-hint\">Leave empty for no expiration</span>\n </div>\n </div>\n </form>\n </div>\n\n <!-- Panel Footer -->\n <div class=\"panel-footer\">\n <div class=\"footer-left\">\n <button\n class=\"btn-delete\"\n *ngIf=\"!isNew\"\n (click)=\"deleteCredential()\"\n [disabled]=\"isSaving\"\n >\n <i class=\"fa-solid fa-trash\"></i>\n <span>Delete</span>\n </button>\n </div>\n <div class=\"footer-right\">\n <button\n class=\"btn-secondary\"\n (click)=\"closePanel()\"\n [disabled]=\"isSaving\"\n >\n Cancel\n </button>\n <button\n class=\"btn-primary\"\n (click)=\"save()\"\n [disabled]=\"isSaving || !canSave\"\n >\n <i class=\"fa-solid fa-spinner fa-spin\" *ngIf=\"isSaving\"></i>\n <i class=\"fa-solid fa-check\" *ngIf=\"!isSaving\"></i>\n <span>{{isNew ? 'Create' : 'Save'}}</span>\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: ["/* Panel Backdrop */\n.panel-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1000;\n display: flex;\n justify-content: flex-end;\n animation: fadeIn 0.2s ease-out;\n}\n\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Slide-in Panel */\n.edit-panel {\n width: 100%;\n max-width: 520px;\n height: 100%;\n background: #ffffff;\n display: flex;\n flex-direction: column;\n box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);\n transform: translateX(100%);\n animation: slideIn 0.3s ease-out forwards;\n}\n\n@keyframes slideIn {\n from { transform: translateX(100%); }\n to { transform: translateX(0); }\n}\n\n/* Panel Header */\n.panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px;\n border-bottom: 1px solid #e5e7eb;\n background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);\n}\n\n.header-content {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n\n.header-icon {\n width: 48px;\n height: 48px;\n border-radius: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n flex-shrink: 0;\n}\n\n.header-icon.default {\n background: #f1f5f9;\n color: #64748b;\n}\n\n.header-text h2 {\n font-size: 18px;\n font-weight: 600;\n color: #1e293b;\n margin: 0 0 4px 0;\n}\n\n.header-subtitle {\n font-size: 13px;\n color: #64748b;\n}\n\n.close-btn {\n width: 36px;\n height: 36px;\n border: none;\n background: #f1f5f9;\n border-radius: 8px;\n cursor: pointer;\n color: #64748b;\n font-size: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.15s ease;\n}\n\n.close-btn:hover:not(:disabled) {\n background: #e2e8f0;\n color: #334155;\n}\n\n.close-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Panel Body */\n.panel-body {\n flex: 1;\n overflow-y: auto;\n padding: 24px;\n}\n\n/* Form Sections */\n.form-section {\n margin-bottom: 28px;\n}\n\n.form-section:last-child {\n margin-bottom: 0;\n}\n\n.section-title {\n display: flex;\n align-items: center;\n gap: 10px;\n font-size: 14px;\n font-weight: 600;\n color: #334155;\n margin: 0 0 16px 0;\n padding-bottom: 10px;\n border-bottom: 1px solid #f1f5f9;\n}\n\n.section-title i {\n color: #6366f1;\n font-size: 14px;\n}\n\n.encrypted-badge {\n margin-left: auto;\n background: #dcfce7;\n color: #166534;\n padding: 4px 10px;\n border-radius: 20px;\n font-size: 11px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 5px;\n}\n\n.encrypted-badge i {\n color: #16a34a;\n font-size: 10px;\n}\n\n/* Form Groups */\n.form-group {\n margin-bottom: 18px;\n}\n\n.form-group:last-child {\n margin-bottom: 0;\n}\n\n.form-group label {\n display: block;\n font-size: 13px;\n font-weight: 500;\n color: #475569;\n margin-bottom: 6px;\n}\n\n.form-group label.required::after {\n content: '*';\n color: #ef4444;\n margin-left: 4px;\n}\n\n.form-group input[type=\"text\"],\n.form-group input[type=\"password\"],\n.form-group input[type=\"number\"],\n.form-group input[type=\"date\"],\n.form-group select,\n.form-group textarea {\n width: 100%;\n padding: 10px 14px;\n border: 1px solid #d1d5db;\n border-radius: 8px;\n font-size: 14px;\n color: #1e293b;\n background: #ffffff;\n transition: all 0.15s ease;\n box-sizing: border-box;\n}\n\n.form-group input:focus,\n.form-group select:focus,\n.form-group textarea:focus {\n outline: none;\n border-color: #6366f1;\n box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);\n}\n\n.form-group input:disabled,\n.form-group select:disabled,\n.form-group textarea:disabled {\n background: #f8fafc;\n color: #94a3b8;\n cursor: not-allowed;\n}\n\n.form-group textarea {\n resize: vertical;\n min-height: 80px;\n}\n\n.form-group select {\n cursor: pointer;\n}\n\n.field-hint {\n display: block;\n font-size: 12px;\n color: #94a3b8;\n margin-top: 5px;\n}\n\n/* Secret Field Wrapper */\n.secret-field-wrapper {\n position: relative;\n display: flex;\n}\n\n.secret-field-wrapper input {\n flex: 1;\n padding-right: 44px;\n}\n\n.toggle-visibility-btn {\n position: absolute;\n right: 4px;\n top: 50%;\n transform: translateY(-50%);\n width: 36px;\n height: 36px;\n border: none;\n background: transparent;\n color: #94a3b8;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 6px;\n transition: all 0.15s ease;\n}\n\n.toggle-visibility-btn:hover {\n background: #f1f5f9;\n color: #6366f1;\n}\n\n/* Toggle Groups */\n.toggle-group {\n margin-bottom: 16px;\n}\n\n.toggle-group:last-child {\n margin-bottom: 0;\n}\n\n.toggle-label {\n display: flex;\n align-items: flex-start;\n gap: 14px;\n cursor: pointer;\n}\n\n.toggle-wrapper {\n position: relative;\n width: 44px;\n height: 24px;\n flex-shrink: 0;\n}\n\n.toggle-wrapper input {\n position: absolute;\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.toggle-slider {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: #d1d5db;\n border-radius: 12px;\n transition: all 0.2s ease;\n}\n\n.toggle-slider::before {\n content: '';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: #ffffff;\n border-radius: 50%;\n transition: all 0.2s ease;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n}\n\n.toggle-wrapper input:checked + .toggle-slider {\n background: #6366f1;\n}\n\n.toggle-wrapper input:checked + .toggle-slider::before {\n transform: translateX(20px);\n}\n\n.toggle-wrapper input:disabled + .toggle-slider {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.toggle-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.toggle-title {\n font-size: 14px;\n font-weight: 500;\n color: #334155;\n}\n\n.toggle-description {\n font-size: 12px;\n color: #94a3b8;\n}\n\n/* No Type Message */\n.no-type-message {\n text-align: center;\n padding: 32px 20px;\n background: #f8fafc;\n border-radius: 12px;\n border: 2px dashed #e2e8f0;\n}\n\n.message-icon {\n width: 56px;\n height: 56px;\n background: #e2e8f0;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 auto 16px;\n font-size: 24px;\n color: #94a3b8;\n}\n\n.no-type-message p {\n margin: 0;\n color: #64748b;\n font-size: 14px;\n}\n\n/* Panel Footer */\n.panel-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 24px;\n border-top: 1px solid #e5e7eb;\n background: #f8fafc;\n}\n\n.footer-left,\n.footer-right {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.btn-primary,\n.btn-secondary,\n.btn-delete {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 20px;\n border: none;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.btn-primary {\n background: #6366f1;\n color: #ffffff;\n}\n\n.btn-primary:hover:not(:disabled) {\n background: #4f46e5;\n}\n\n.btn-primary:disabled {\n background: #c7d2fe;\n cursor: not-allowed;\n}\n\n.btn-secondary {\n background: #ffffff;\n color: #475569;\n border: 1px solid #d1d5db;\n}\n\n.btn-secondary:hover:not(:disabled) {\n background: #f1f5f9;\n border-color: #94a3b8;\n}\n\n.btn-secondary:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.btn-delete {\n background: transparent;\n color: #dc2626;\n padding: 10px 16px;\n}\n\n.btn-delete:hover:not(:disabled) {\n background: #fef2f2;\n}\n\n.btn-delete:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Mobile Responsiveness */\n@media (max-width: 768px) {\n .edit-panel {\n max-width: 100%;\n }\n\n .panel-header {\n padding: 16px 20px;\n }\n\n .header-icon {\n width: 40px;\n height: 40px;\n font-size: 18px;\n }\n\n .header-text h2 {\n font-size: 16px;\n }\n\n .panel-body {\n padding: 20px;\n }\n\n .form-section {\n margin-bottom: 24px;\n }\n\n .section-title {\n font-size: 13px;\n }\n\n .form-group input,\n .form-group select,\n .form-group textarea {\n padding: 12px 14px;\n font-size: 16px; /* Prevents iOS zoom on focus */\n }\n\n .panel-footer {\n padding: 14px 20px;\n flex-direction: column-reverse;\n gap: 12px;\n }\n\n .footer-left,\n .footer-right {\n width: 100%;\n }\n\n .footer-right {\n flex-direction: row;\n }\n\n .footer-right .btn-primary,\n .footer-right .btn-secondary {\n flex: 1;\n justify-content: center;\n }\n\n .btn-delete {\n width: 100%;\n justify-content: center;\n background: #fef2f2;\n }\n\n .toggle-label {\n gap: 12px;\n }\n\n .encrypted-badge {\n display: none;\n }\n}\n\n@media (max-width: 480px) {\n .panel-header {\n padding: 14px 16px;\n }\n\n .header-content {\n gap: 12px;\n }\n\n .header-icon {\n width: 36px;\n height: 36px;\n font-size: 16px;\n border-radius: 10px;\n }\n\n .header-text h2 {\n font-size: 15px;\n }\n\n .header-subtitle {\n font-size: 12px;\n }\n\n .panel-body {\n padding: 16px;\n }\n\n .section-title {\n font-size: 12px;\n gap: 8px;\n }\n\n .form-group label {\n font-size: 12px;\n }\n\n .toggle-title {\n font-size: 13px;\n }\n\n .toggle-description {\n font-size: 11px;\n }\n\n .no-type-message {\n padding: 24px 16px;\n }\n\n .message-icon {\n width: 48px;\n height: 48px;\n font-size: 20px;\n }\n\n .panel-footer {\n padding: 12px 16px;\n }\n\n .btn-primary,\n .btn-secondary {\n padding: 10px 16px;\n font-size: 13px;\n }\n}\n\n/* Animations for saving state */\n@keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n\n.fa-spin {\n animation: spin 1s linear infinite;\n}\n\n/* Smooth scrolling */\n.panel-body {\n scroll-behavior: smooth;\n -webkit-overflow-scrolling: touch;\n}\n\n/* Custom scrollbar */\n.panel-body::-webkit-scrollbar {\n width: 6px;\n}\n\n.panel-body::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.panel-body::-webkit-scrollbar-thumb {\n background: #d1d5db;\n border-radius: 3px;\n}\n\n.panel-body::-webkit-scrollbar-thumb:hover {\n background: #94a3b8;\n}\n\n/* Const Field Display */\n.const-field-display {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.const-value-container {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: #f8fafc;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n}\n\n.const-value {\n flex: 1;\n font-family: 'Monaco', 'Menlo', 'Consolas', monospace;\n font-size: 13px;\n color: #475569;\n word-break: break-all;\n}\n\n.const-lock-icon {\n color: #94a3b8;\n font-size: 14px;\n flex-shrink: 0;\n}\n\n.const-hint {\n color: #94a3b8;\n font-style: italic;\n}\n"] }]
|
|
517
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { credential: [{
|
|
518
|
+
type: Input
|
|
519
|
+
}], credentialTypes: [{
|
|
520
|
+
type: Input
|
|
521
|
+
}], isOpen: [{
|
|
522
|
+
type: Input
|
|
523
|
+
}], close: [{
|
|
524
|
+
type: Output
|
|
525
|
+
}], saved: [{
|
|
526
|
+
type: Output
|
|
527
|
+
}], deleted: [{
|
|
528
|
+
type: Output
|
|
529
|
+
}], onEscapeKey: [{
|
|
530
|
+
type: HostListener,
|
|
531
|
+
args: ['document:keydown.escape', ['$event']]
|
|
532
|
+
}] } });
|
|
533
|
+
//# sourceMappingURL=credential-edit-panel.component.js.map
|