@perses-dev/plugin-system 0.42.1 → 0.43.0-rc1
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/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +7 -9
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +217 -147
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
- package/dist/cjs/validation/index.js +1 -0
- package/dist/cjs/validation/role.js +4 -4
- package/dist/cjs/validation/rolebinding.js +7 -7
- package/dist/cjs/validation/secret.js +176 -0
- package/dist/cjs/validation/variable.js +23 -4
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +7 -9
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +218 -148
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +8 -21
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +3 -3
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/role.d.ts +24 -24
- package/dist/validation/role.js +1 -1
- package/dist/validation/role.js.map +1 -1
- package/dist/validation/rolebinding.js +1 -1
- package/dist/validation/rolebinding.js.map +1 -1
- package/dist/validation/secret.d.ts +964 -0
- package/dist/validation/secret.d.ts.map +1 -0
- package/dist/validation/secret.js +157 -0
- package/dist/validation/secret.js.map +1 -0
- package/dist/validation/variable.d.ts +82 -5
- package/dist/validation/variable.d.ts.map +1 -1
- package/dist/validation/variable.js +21 -2
- package/dist/validation/variable.js.map +1 -1
- package/package.json +4 -4
|
@@ -68,16 +68,14 @@ function DatasourceEditorForm(props) {
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
const processForm = ()=>{
|
|
71
|
-
var _state_spec_display;
|
|
72
|
-
// reset display
|
|
73
|
-
const name = (_state_spec_display = state.spec.display) === null || _state_spec_display === void 0 ? void 0 : _state_spec_display.name;
|
|
74
|
-
const finalDisplay = {
|
|
75
|
-
...state.spec.display,
|
|
76
|
-
name: name ? name : undefined
|
|
77
|
-
};
|
|
71
|
+
var _state_spec_display, _state_spec_display1, _state_spec_display2, _state_spec_display3;
|
|
72
|
+
// reset display attributes to undefined when empty, because we don't want to save empty strings
|
|
78
73
|
onSave(state.name, {
|
|
79
74
|
...state.spec,
|
|
80
|
-
display:
|
|
75
|
+
display: {
|
|
76
|
+
name: ((_state_spec_display = state.spec.display) === null || _state_spec_display === void 0 ? void 0 : _state_spec_display.name) === '' ? undefined : (_state_spec_display1 = state.spec.display) === null || _state_spec_display1 === void 0 ? void 0 : _state_spec_display1.name,
|
|
77
|
+
description: ((_state_spec_display2 = state.spec.display) === null || _state_spec_display2 === void 0 ? void 0 : _state_spec_display2.description) === '' ? undefined : (_state_spec_display3 = state.spec.display) === null || _state_spec_display3 === void 0 ? void 0 : _state_spec_display3.description
|
|
78
|
+
}
|
|
81
79
|
});
|
|
82
80
|
};
|
|
83
81
|
// When user click on cancel, several possibilities:
|
|
@@ -200,7 +198,7 @@ function DatasourceEditorForm(props) {
|
|
|
200
198
|
shrink: action === 'read' ? true : undefined
|
|
201
199
|
},
|
|
202
200
|
InputProps: {
|
|
203
|
-
disabled: action === 'update',
|
|
201
|
+
disabled: action === 'update' && !isDraft,
|
|
204
202
|
readOnly: action === 'read'
|
|
205
203
|
},
|
|
206
204
|
error: !!fieldState.error,
|
|
@@ -23,10 +23,10 @@ Object.defineProperty(exports, "VariableEditorForm", {
|
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
|
-
const _useimmer = require("use-immer");
|
|
27
26
|
const _components = require("@perses-dev/components");
|
|
28
27
|
const _reacthookform = require("react-hook-form");
|
|
29
28
|
const _zod = require("@hookform/resolvers/zod");
|
|
29
|
+
const _useimmer = require("use-immer");
|
|
30
30
|
const _utils = require("../../../utils");
|
|
31
31
|
const _variablemodel = require("../variable-model");
|
|
32
32
|
const _PluginEditor = require("../../PluginEditor");
|
|
@@ -99,12 +99,17 @@ function VariableEditorForm(props) {
|
|
|
99
99
|
const titleAction = (0, _utils.getTitleAction)(action, isDraft);
|
|
100
100
|
const submitText = (0, _utils.getSubmitText)(action, isDraft);
|
|
101
101
|
const form = (0, _reacthookform.useForm)({
|
|
102
|
-
resolver: (0, _zod.zodResolver)(_validation.
|
|
102
|
+
resolver: (0, _zod.zodResolver)(_validation.variableEditorValidationSchema),
|
|
103
103
|
mode: 'onBlur',
|
|
104
|
-
defaultValues:
|
|
104
|
+
defaultValues: initialState
|
|
105
105
|
});
|
|
106
106
|
const processForm = ()=>{
|
|
107
|
-
|
|
107
|
+
// reset display attributes to undefined when empty, because we don't want to save empty strings
|
|
108
|
+
onSave((0, _variableeditorformmodel.getVariableDefinitionFromState)({
|
|
109
|
+
...state,
|
|
110
|
+
title: state.title === '' ? undefined : state.title,
|
|
111
|
+
description: state.description === '' ? undefined : state.description
|
|
112
|
+
}));
|
|
108
113
|
};
|
|
109
114
|
// When user click on cancel, several possibilities:
|
|
110
115
|
// - create action: ask for discard approval
|
|
@@ -117,12 +122,11 @@ function VariableEditorForm(props) {
|
|
|
117
122
|
onClose();
|
|
118
123
|
}
|
|
119
124
|
}, [
|
|
120
|
-
state,
|
|
121
125
|
initialState,
|
|
122
|
-
|
|
126
|
+
state,
|
|
123
127
|
onClose
|
|
124
128
|
]);
|
|
125
|
-
var
|
|
129
|
+
var _state_title, _state_description, _state_listVariableFields_capturingRegexp, _state_listVariableFields_sort, _state_listVariableFields_customAllValue;
|
|
126
130
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacthookform.FormProvider, {
|
|
127
131
|
...form,
|
|
128
132
|
children: [
|
|
@@ -227,11 +231,12 @@ function VariableEditorForm(props) {
|
|
|
227
231
|
shrink: action === 'read' ? true : undefined
|
|
228
232
|
},
|
|
229
233
|
InputProps: {
|
|
230
|
-
disabled: action === 'update',
|
|
234
|
+
disabled: action === 'update' && !isDraft,
|
|
231
235
|
readOnly: action === 'read'
|
|
232
236
|
},
|
|
233
237
|
error: !!fieldState.error,
|
|
234
238
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
239
|
+
value: state.name,
|
|
235
240
|
onChange: (event)=>{
|
|
236
241
|
field.onChange(event);
|
|
237
242
|
setState((draft)=>{
|
|
@@ -261,6 +266,7 @@ function VariableEditorForm(props) {
|
|
|
261
266
|
},
|
|
262
267
|
error: !!fieldState.error,
|
|
263
268
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
269
|
+
value: (_state_title = state.title) !== null && _state_title !== void 0 ? _state_title : '',
|
|
264
270
|
onChange: (event)=>{
|
|
265
271
|
field.onChange(event);
|
|
266
272
|
setState((draft)=>{
|
|
@@ -290,6 +296,7 @@ function VariableEditorForm(props) {
|
|
|
290
296
|
},
|
|
291
297
|
error: !!fieldState.error,
|
|
292
298
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
299
|
+
value: (_state_description = state.description) !== null && _state_description !== void 0 ? _state_description : '',
|
|
293
300
|
onChange: (event)=>{
|
|
294
301
|
field.onChange(event);
|
|
295
302
|
setState((draft)=>{
|
|
@@ -320,6 +327,7 @@ function VariableEditorForm(props) {
|
|
|
320
327
|
},
|
|
321
328
|
error: !!fieldState.error,
|
|
322
329
|
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
330
|
+
value: state.kind,
|
|
323
331
|
onChange: (event)=>{
|
|
324
332
|
field.onChange(event);
|
|
325
333
|
setState((draft)=>{
|
|
@@ -354,33 +362,49 @@ function VariableEditorForm(props) {
|
|
|
354
362
|
]
|
|
355
363
|
})
|
|
356
364
|
}),
|
|
357
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
366
|
+
name: "textVariableFields.value",
|
|
367
|
+
render: ({ field , fieldState })=>{
|
|
368
|
+
var _fieldState_error;
|
|
369
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
370
|
+
...field,
|
|
371
|
+
label: "Value",
|
|
372
|
+
InputLabelProps: {
|
|
373
|
+
shrink: action === 'read' ? true : undefined
|
|
374
|
+
},
|
|
375
|
+
InputProps: {
|
|
376
|
+
readOnly: action === 'read'
|
|
377
|
+
},
|
|
378
|
+
error: !!fieldState.error,
|
|
379
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
380
|
+
value: state.textVariableFields.value,
|
|
381
|
+
onChange: (event)=>{
|
|
382
|
+
field.onChange(event);
|
|
383
|
+
setState((draft)=>{
|
|
384
|
+
draft.textVariableFields.value = event.target.value;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
369
387
|
});
|
|
370
388
|
}
|
|
371
389
|
}),
|
|
372
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
390
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
391
|
+
name: "textVariableFields.constant",
|
|
392
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
393
|
+
label: "Constant",
|
|
394
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
395
|
+
...field,
|
|
396
|
+
checked: !!field.value,
|
|
397
|
+
readOnly: action === 'read',
|
|
398
|
+
value: state.textVariableFields.constant,
|
|
399
|
+
onChange: (event)=>{
|
|
400
|
+
if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
|
|
401
|
+
field.onChange(event);
|
|
402
|
+
setState((draft)=>{
|
|
403
|
+
draft.textVariableFields.constant = event.target.checked;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
})
|
|
407
|
+
})
|
|
384
408
|
})
|
|
385
409
|
]
|
|
386
410
|
})
|
|
@@ -417,89 +441,113 @@ function VariableEditorForm(props) {
|
|
|
417
441
|
onClickAway: ()=>refreshPreview(),
|
|
418
442
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {})
|
|
419
443
|
}),
|
|
420
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
444
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
445
|
+
name: "listVariableFields.plugin",
|
|
446
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginEditor.PluginEditor, {
|
|
447
|
+
width: "100%",
|
|
448
|
+
pluginType: "Variable",
|
|
449
|
+
pluginKindLabel: "Source",
|
|
450
|
+
isReadonly: action === 'read',
|
|
451
|
+
value: state.listVariableFields.plugin,
|
|
452
|
+
onChange: (val)=>{
|
|
453
|
+
field.onChange(val);
|
|
454
|
+
setState((draft)=>{
|
|
455
|
+
draft.listVariableFields.plugin = val;
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
})
|
|
431
459
|
})
|
|
432
460
|
]
|
|
433
461
|
}),
|
|
434
462
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
435
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
463
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
464
|
+
name: "listVariableFields.capturingRegexp",
|
|
465
|
+
render: ({ field , fieldState })=>{
|
|
466
|
+
var _fieldState_error;
|
|
467
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
468
|
+
...field,
|
|
469
|
+
label: "Capturing Regexp Filter",
|
|
470
|
+
InputLabelProps: {
|
|
471
|
+
shrink: action === 'read' ? true : undefined
|
|
472
|
+
},
|
|
473
|
+
InputProps: {
|
|
474
|
+
readOnly: action === 'read'
|
|
475
|
+
},
|
|
476
|
+
error: !!fieldState.error,
|
|
477
|
+
value: (_state_listVariableFields_capturingRegexp = state.listVariableFields.capturingRegexp) !== null && _state_listVariableFields_capturingRegexp !== void 0 ? _state_listVariableFields_capturingRegexp : '',
|
|
478
|
+
onChange: (event)=>{
|
|
479
|
+
field.onChange(event);
|
|
480
|
+
setState((draft)=>{
|
|
481
|
+
if (event.target.value) {
|
|
482
|
+
// TODO: do a better fix, if empty string => it should skip the filter
|
|
483
|
+
draft.listVariableFields.capturingRegexp = event.target.value;
|
|
484
|
+
} else {
|
|
485
|
+
draft.listVariableFields.capturingRegexp = undefined;
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
},
|
|
489
|
+
helperText: ((_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message) ? fieldState.error.message : 'Optional, if you want to filter on captured result.'
|
|
452
490
|
});
|
|
453
|
-
}
|
|
454
|
-
helperText: "Optional, if you want to filter on captured result."
|
|
491
|
+
}
|
|
455
492
|
})
|
|
456
493
|
}),
|
|
457
494
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
458
|
-
children: /*#__PURE__*/ (0, _jsxruntime.
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
495
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
496
|
+
name: "listVariableFields.sort",
|
|
497
|
+
render: ({ field , fieldState })=>{
|
|
498
|
+
var _fieldState_error;
|
|
499
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
500
|
+
select: true,
|
|
501
|
+
...field,
|
|
502
|
+
fullWidth: true,
|
|
503
|
+
label: "Sort",
|
|
504
|
+
InputLabelProps: {
|
|
505
|
+
shrink: action === 'read' ? true : undefined
|
|
506
|
+
},
|
|
507
|
+
InputProps: {
|
|
508
|
+
readOnly: action === 'read'
|
|
509
|
+
},
|
|
510
|
+
error: !!fieldState.error,
|
|
511
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
512
|
+
value: (_state_listVariableFields_sort = state.listVariableFields.sort) !== null && _state_listVariableFields_sort !== void 0 ? _state_listVariableFields_sort : 'none',
|
|
513
|
+
onChange: (event)=>{
|
|
514
|
+
field.onChange(event);
|
|
515
|
+
setState((draft)=>{
|
|
516
|
+
draft.listVariableFields.sort = event.target.value;
|
|
517
|
+
});
|
|
518
|
+
},
|
|
519
|
+
children: [
|
|
520
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
521
|
+
value: "none",
|
|
522
|
+
children: "None"
|
|
523
|
+
}),
|
|
524
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
525
|
+
value: "alphabetical-asc",
|
|
526
|
+
children: "Alphabetical, asc"
|
|
527
|
+
}),
|
|
528
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
529
|
+
value: "alphabetical-desc",
|
|
530
|
+
children: "Alphabetical, desc"
|
|
531
|
+
}),
|
|
532
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
533
|
+
value: "numerical-asc",
|
|
534
|
+
children: "Numerical, asc"
|
|
535
|
+
}),
|
|
536
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
537
|
+
value: "numerical-desc",
|
|
538
|
+
children: "Numerical, desc"
|
|
539
|
+
}),
|
|
540
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
541
|
+
value: "alphabetical-ci-asc",
|
|
542
|
+
children: "Alphabetical, case-insensitive, asc"
|
|
543
|
+
}),
|
|
544
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
545
|
+
value: "alphabetical-ci-desc",
|
|
546
|
+
children: "Alphabetical, case-insensitive, desc"
|
|
547
|
+
})
|
|
548
|
+
]
|
|
471
549
|
});
|
|
472
|
-
}
|
|
473
|
-
children: [
|
|
474
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
475
|
-
value: "none",
|
|
476
|
-
children: "None"
|
|
477
|
-
}),
|
|
478
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
479
|
-
value: "alphabetical-asc",
|
|
480
|
-
children: "Alphabetical, asc"
|
|
481
|
-
}),
|
|
482
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
483
|
-
value: "alphabetical-desc",
|
|
484
|
-
children: "Alphabetical, desc"
|
|
485
|
-
}),
|
|
486
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
487
|
-
value: "numerical-asc",
|
|
488
|
-
children: "Numerical, asc"
|
|
489
|
-
}),
|
|
490
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
491
|
-
value: "numerical-desc",
|
|
492
|
-
children: "Numerical, desc"
|
|
493
|
-
}),
|
|
494
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
495
|
-
value: "alphabetical-ci-asc",
|
|
496
|
-
children: "Alphabetical, case-insensitive, asc"
|
|
497
|
-
}),
|
|
498
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
499
|
-
value: "alphabetical-ci-desc",
|
|
500
|
-
children: "Alphabetical, case-insensitive, desc"
|
|
501
|
-
})
|
|
502
|
-
]
|
|
550
|
+
}
|
|
503
551
|
})
|
|
504
552
|
})
|
|
505
553
|
]
|
|
@@ -515,18 +563,24 @@ function VariableEditorForm(props) {
|
|
|
515
563
|
children: [
|
|
516
564
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
517
565
|
children: [
|
|
518
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
566
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
567
|
+
name: "listVariableFields.allowMultiple",
|
|
568
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
569
|
+
label: "Allow Multiple Values",
|
|
570
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
571
|
+
...field,
|
|
572
|
+
checked: !!field.value,
|
|
573
|
+
readOnly: action === 'read',
|
|
574
|
+
value: state.listVariableFields.allowMultiple,
|
|
575
|
+
onChange: (event)=>{
|
|
576
|
+
if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
|
|
577
|
+
field.onChange(event);
|
|
578
|
+
setState((draft)=>{
|
|
579
|
+
draft.listVariableFields.allowMultiple = event.target.checked;
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
})
|
|
583
|
+
})
|
|
530
584
|
}),
|
|
531
585
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
532
586
|
variant: "caption",
|
|
@@ -536,43 +590,59 @@ function VariableEditorForm(props) {
|
|
|
536
590
|
}),
|
|
537
591
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
538
592
|
children: [
|
|
539
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
593
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
594
|
+
name: "listVariableFields.allowAllValue",
|
|
595
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
596
|
+
label: "Allow All option",
|
|
597
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
598
|
+
...field,
|
|
599
|
+
checked: !!field.value,
|
|
600
|
+
readOnly: action === 'read',
|
|
601
|
+
value: state.listVariableFields.allowAllValue,
|
|
602
|
+
onChange: (event)=>{
|
|
603
|
+
if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
|
|
604
|
+
field.onChange(event);
|
|
605
|
+
setState((draft)=>{
|
|
606
|
+
draft.listVariableFields.allowAllValue = event.target.checked;
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
})
|
|
610
|
+
})
|
|
551
611
|
}),
|
|
552
612
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
553
613
|
mb: 1,
|
|
554
614
|
variant: "caption",
|
|
555
615
|
children: "Enables an option to include all variable values"
|
|
556
616
|
}),
|
|
557
|
-
state.listVariableFields.
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
617
|
+
state.listVariableFields.allowAllValue && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
618
|
+
name: "listVariableFields.customAllValue",
|
|
619
|
+
render: ({ field , fieldState })=>{
|
|
620
|
+
var _fieldState_error;
|
|
621
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
622
|
+
...field,
|
|
623
|
+
fullWidth: true,
|
|
624
|
+
label: "Custom All Value",
|
|
625
|
+
InputLabelProps: {
|
|
626
|
+
shrink: action === 'read' ? true : undefined
|
|
627
|
+
},
|
|
628
|
+
InputProps: {
|
|
629
|
+
readOnly: action === 'read'
|
|
630
|
+
},
|
|
631
|
+
error: !!fieldState.error,
|
|
632
|
+
helperText: ((_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message) ? fieldState.error.message : 'When All is selected, this value will be used',
|
|
633
|
+
value: (_state_listVariableFields_customAllValue = state.listVariableFields.customAllValue) !== null && _state_listVariableFields_customAllValue !== void 0 ? _state_listVariableFields_customAllValue : '',
|
|
634
|
+
onChange: (event)=>{
|
|
635
|
+
field.onChange(event);
|
|
636
|
+
setState((draft)=>{
|
|
637
|
+
if (event.target.value) {
|
|
638
|
+
draft.listVariableFields.customAllValue = event.target.value;
|
|
639
|
+
} else {
|
|
640
|
+
draft.listVariableFields.customAllValue = undefined;
|
|
641
|
+
}
|
|
642
|
+
});
|
|
572
643
|
}
|
|
573
644
|
});
|
|
574
|
-
}
|
|
575
|
-
helperText: "When All is selected, this value will be used"
|
|
645
|
+
}
|
|
576
646
|
})
|
|
577
647
|
]
|
|
578
648
|
})
|
|
@@ -37,7 +37,7 @@ function getInitialState(initialVariableDefinition) {
|
|
|
37
37
|
};
|
|
38
38
|
const listVariableFields = {
|
|
39
39
|
allowMultiple: false,
|
|
40
|
-
|
|
40
|
+
allowAllValue: false,
|
|
41
41
|
customAllValue: undefined,
|
|
42
42
|
capturingRegexp: undefined,
|
|
43
43
|
sort: undefined,
|
|
@@ -50,7 +50,7 @@ function getInitialState(initialVariableDefinition) {
|
|
|
50
50
|
var _initialVariableDefinition_spec_allowMultiple;
|
|
51
51
|
listVariableFields.allowMultiple = (_initialVariableDefinition_spec_allowMultiple = initialVariableDefinition.spec.allowMultiple) !== null && _initialVariableDefinition_spec_allowMultiple !== void 0 ? _initialVariableDefinition_spec_allowMultiple : false;
|
|
52
52
|
var _initialVariableDefinition_spec_allowAllValue;
|
|
53
|
-
listVariableFields.
|
|
53
|
+
listVariableFields.allowAllValue = (_initialVariableDefinition_spec_allowAllValue = initialVariableDefinition.spec.allowAllValue) !== null && _initialVariableDefinition_spec_allowAllValue !== void 0 ? _initialVariableDefinition_spec_allowAllValue : false;
|
|
54
54
|
listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;
|
|
55
55
|
listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;
|
|
56
56
|
listVariableFields.sort = initialVariableDefinition.spec.sort;
|
|
@@ -89,7 +89,7 @@ function getVariableDefinitionFromState(state) {
|
|
|
89
89
|
name,
|
|
90
90
|
display,
|
|
91
91
|
allowMultiple: state.listVariableFields.allowMultiple,
|
|
92
|
-
allowAllValue: state.listVariableFields.
|
|
92
|
+
allowAllValue: state.listVariableFields.allowAllValue,
|
|
93
93
|
customAllValue: state.listVariableFields.customAllValue,
|
|
94
94
|
capturingRegexp: state.listVariableFields.capturingRegexp,
|
|
95
95
|
sort: state.listVariableFields.sort,
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./datasource"), exports);
|
|
18
18
|
_export_star(require("./resource"), exports);
|
|
19
|
+
_export_star(require("./secret"), exports);
|
|
19
20
|
_export_star(require("./variable"), exports);
|
|
20
21
|
function _export_star(from, to) {
|
|
21
22
|
Object.keys(from).forEach(function(k) {
|
|
@@ -32,7 +32,7 @@ _export(exports, {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _zod = require("zod");
|
|
35
|
-
const
|
|
35
|
+
const _resource = require("./resource");
|
|
36
36
|
const permissionValidationSchema = _zod.z.object({
|
|
37
37
|
// TODO: use SCOPE & ACTIONS constants
|
|
38
38
|
actions: _zod.z.array(_zod.z.enum([
|
|
@@ -63,8 +63,8 @@ const permissionValidationSchema = _zod.z.object({
|
|
|
63
63
|
const roleValidationSchema = _zod.z.object({
|
|
64
64
|
kind: _zod.z.literal('Role'),
|
|
65
65
|
metadata: _zod.z.object({
|
|
66
|
-
name:
|
|
67
|
-
project:
|
|
66
|
+
name: _resource.resourceIdValidationSchema,
|
|
67
|
+
project: _resource.resourceIdValidationSchema
|
|
68
68
|
}),
|
|
69
69
|
spec: _zod.z.object({
|
|
70
70
|
permissions: _zod.z.array(permissionValidationSchema)
|
|
@@ -73,7 +73,7 @@ const roleValidationSchema = _zod.z.object({
|
|
|
73
73
|
const globalRoleValidationSchema = _zod.z.object({
|
|
74
74
|
kind: _zod.z.literal('GlobalRole'),
|
|
75
75
|
metadata: _zod.z.object({
|
|
76
|
-
name:
|
|
76
|
+
name: _resource.resourceIdValidationSchema
|
|
77
77
|
}),
|
|
78
78
|
spec: _zod.z.object({
|
|
79
79
|
permissions: _zod.z.array(permissionValidationSchema)
|
|
@@ -21,31 +21,31 @@ Object.defineProperty(exports, "roleBindingsEditorValidationSchema", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _zod = require("zod");
|
|
24
|
-
const
|
|
24
|
+
const _resource = require("./resource");
|
|
25
25
|
const subjectValidationSchema = _zod.z.object({
|
|
26
26
|
kind: _zod.z.enum([
|
|
27
27
|
'User'
|
|
28
28
|
]),
|
|
29
|
-
name:
|
|
29
|
+
name: _resource.resourceIdValidationSchema
|
|
30
30
|
});
|
|
31
31
|
const roleBindingValidationSchema = _zod.z.object({
|
|
32
32
|
kind: _zod.z.literal('RoleBinding'),
|
|
33
33
|
metadata: _zod.z.object({
|
|
34
|
-
name:
|
|
35
|
-
project:
|
|
34
|
+
name: _resource.resourceIdValidationSchema,
|
|
35
|
+
project: _resource.resourceIdValidationSchema
|
|
36
36
|
}),
|
|
37
37
|
spec: _zod.z.object({
|
|
38
|
-
role:
|
|
38
|
+
role: _resource.resourceIdValidationSchema,
|
|
39
39
|
subjects: _zod.z.array(subjectValidationSchema).nonempty()
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
42
|
const globalRoleBindingValidationSchema = _zod.z.object({
|
|
43
43
|
kind: _zod.z.literal('GlobalRoleBinding'),
|
|
44
44
|
metadata: _zod.z.object({
|
|
45
|
-
name:
|
|
45
|
+
name: _resource.resourceIdValidationSchema
|
|
46
46
|
}),
|
|
47
47
|
spec: _zod.z.object({
|
|
48
|
-
role:
|
|
48
|
+
role: _resource.resourceIdValidationSchema,
|
|
49
49
|
subjects: _zod.z.array(subjectValidationSchema)
|
|
50
50
|
})
|
|
51
51
|
});
|