iguazio.dashboard-react-controls 2.0.3 → 2.0.5
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.
|
@@ -41,6 +41,7 @@ const FormKeyValueTable = _ref => {
|
|
|
41
41
|
exitEditModeTriggerItem,
|
|
42
42
|
fieldsPath,
|
|
43
43
|
formState,
|
|
44
|
+
isKeyEditable,
|
|
44
45
|
isKeyRequired,
|
|
45
46
|
isValueRequired,
|
|
46
47
|
keyHeader,
|
|
@@ -50,9 +51,10 @@ const FormKeyValueTable = _ref => {
|
|
|
50
51
|
onExitEditModeCallback,
|
|
51
52
|
valueHeader,
|
|
52
53
|
valueLabel,
|
|
54
|
+
valueType,
|
|
53
55
|
valueValidationRules
|
|
54
56
|
} = _ref;
|
|
55
|
-
const tableClassNames = (0, _classnames.default)('form-table form-key-value-table', className);
|
|
57
|
+
const tableClassNames = (0, _classnames.default)('form-table form-key-value-table', disabled && 'form-table_disabled', className);
|
|
56
58
|
const {
|
|
57
59
|
addNewRow,
|
|
58
60
|
applyChanges,
|
|
@@ -73,6 +75,14 @@ const FormKeyValueTable = _ref => {
|
|
|
73
75
|
return newValue.trim() === key.trim() && index !== editingItem.ui.index;
|
|
74
76
|
});
|
|
75
77
|
};
|
|
78
|
+
const getKeyTextTemplate = keyValue => {
|
|
79
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
80
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
81
|
+
text: keyValue
|
|
82
|
+
}),
|
|
83
|
+
children: keyValue
|
|
84
|
+
});
|
|
85
|
+
};
|
|
76
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
77
87
|
className: tableClassNames,
|
|
78
88
|
"data-testid": fieldsPath,
|
|
@@ -105,7 +115,7 @@ const FormKeyValueTable = _ref => {
|
|
|
105
115
|
name: "".concat(rowPath, ".data.key"),
|
|
106
116
|
density: "normal",
|
|
107
117
|
options: keyOptions
|
|
108
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormInput, {
|
|
118
|
+
}) : isKeyEditable || editingItem.ui.isNew ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormInput, {
|
|
109
119
|
className: "input_edit",
|
|
110
120
|
placeholder: keyLabel,
|
|
111
121
|
density: "normal",
|
|
@@ -116,7 +126,7 @@ const FormKeyValueTable = _ref => {
|
|
|
116
126
|
label: 'Name must be unique',
|
|
117
127
|
pattern: newValue => uniquenessValidator(fields, newValue)
|
|
118
128
|
}]
|
|
119
|
-
})
|
|
129
|
+
}) : getKeyTextTemplate(fields.value[index].data.key)
|
|
120
130
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
131
|
className: "form-table__cell form-table__cell_1",
|
|
122
132
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormInput, {
|
|
@@ -124,6 +134,7 @@ const FormKeyValueTable = _ref => {
|
|
|
124
134
|
placeholder: valueLabel,
|
|
125
135
|
density: "normal",
|
|
126
136
|
name: "".concat(rowPath, ".data.value"),
|
|
137
|
+
type: valueType,
|
|
127
138
|
required: isValueRequired,
|
|
128
139
|
validationRules: valueValidationRules
|
|
129
140
|
})
|
|
@@ -137,22 +148,17 @@ const FormKeyValueTable = _ref => {
|
|
|
137
148
|
})]
|
|
138
149
|
}, index) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
139
150
|
className: tableRowClassNames,
|
|
140
|
-
onClick: event => enterEditMode(event, fields, fieldsPath, index),
|
|
151
|
+
onClick: event => !disabled && enterEditMode(event, fields, fieldsPath, index),
|
|
141
152
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
142
153
|
className: "form-table__cell form-table__cell_1",
|
|
143
|
-
children:
|
|
144
|
-
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
145
|
-
text: fields.value[index].data.key
|
|
146
|
-
}),
|
|
147
|
-
children: fields.value[index].data.key
|
|
148
|
-
})
|
|
154
|
+
children: getKeyTextTemplate(fields.value[index].data.key)
|
|
149
155
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
150
156
|
className: "form-table__cell form-table__cell_1",
|
|
151
157
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
152
158
|
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
153
|
-
text: fields.value[index].data.value
|
|
159
|
+
text: valueType === 'password' ? null : fields.value[index].data.value
|
|
154
160
|
}),
|
|
155
|
-
children: fields.value[index].data.value
|
|
161
|
+
children: valueType === 'password' ? '*****' : fields.value[index].data.value
|
|
156
162
|
})
|
|
157
163
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.FormRowActions, {
|
|
158
164
|
applyChanges: applyChanges,
|
|
@@ -195,6 +201,7 @@ FormKeyValueTable.defaultProps = {
|
|
|
195
201
|
defaultKey: '',
|
|
196
202
|
disabled: false,
|
|
197
203
|
exitEditModeTriggerItem: null,
|
|
204
|
+
isKeyEditable: true,
|
|
198
205
|
isKeyRequired: true,
|
|
199
206
|
isValueRequired: true,
|
|
200
207
|
keyHeader: 'Key',
|
|
@@ -204,6 +211,7 @@ FormKeyValueTable.defaultProps = {
|
|
|
204
211
|
onExitEditModeCallback: () => {},
|
|
205
212
|
valueHeader: 'Value',
|
|
206
213
|
valueLabel: 'Value',
|
|
214
|
+
valueType: 'text',
|
|
207
215
|
valueValidationRules: []
|
|
208
216
|
};
|
|
209
217
|
FormKeyValueTable.propTypes = {
|
|
@@ -215,6 +223,7 @@ FormKeyValueTable.propTypes = {
|
|
|
215
223
|
exitEditModeTriggerItem: _propTypes.default.any,
|
|
216
224
|
fieldsPath: _propTypes.default.string.isRequired,
|
|
217
225
|
formState: _propTypes.default.shape({}).isRequired,
|
|
226
|
+
isKeyEditable: _propTypes.default.bool,
|
|
218
227
|
isKeyRequired: _propTypes.default.bool,
|
|
219
228
|
isValueRequired: _propTypes.default.bool,
|
|
220
229
|
keyHeader: _propTypes.default.string,
|
|
@@ -227,6 +236,7 @@ FormKeyValueTable.propTypes = {
|
|
|
227
236
|
onExitEditModeCallback: _propTypes.default.func,
|
|
228
237
|
valueHeader: _propTypes.default.string,
|
|
229
238
|
valueLabel: _propTypes.default.string,
|
|
239
|
+
valueType: _propTypes.default.string,
|
|
230
240
|
valueValidationRules: _types.INPUT_VALIDATION_RULES
|
|
231
241
|
};
|
|
232
242
|
var _default = exports.default = FormKeyValueTable;
|
package/dist/scss/common.scss
CHANGED
|
@@ -303,6 +303,28 @@ textarea {
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
.form-table_disabled {
|
|
307
|
+
.form-table__row {
|
|
308
|
+
&:not(.no-hover):hover {
|
|
309
|
+
.form-table__actions-cell {
|
|
310
|
+
visibility: hidden;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.form-table__action-row {
|
|
316
|
+
button {
|
|
317
|
+
color: $spunPearl;
|
|
318
|
+
|
|
319
|
+
svg {
|
|
320
|
+
rect {
|
|
321
|
+
fill: $spunPearl;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
306
328
|
.chip-block-hidden {
|
|
307
329
|
position: fixed;
|
|
308
330
|
display: flex;
|
|
@@ -329,10 +329,13 @@ const validationRules = {
|
|
|
329
329
|
params: {
|
|
330
330
|
key: [generateRule.beginEndNotWith('s')],
|
|
331
331
|
value: [generateRule.beginEndNotWith('s')]
|
|
332
|
+
},
|
|
333
|
+
secrets: {
|
|
334
|
+
key: [generateRule.validCharacters('a-z A-Z 0-9 - _ .')]
|
|
332
335
|
}
|
|
333
336
|
},
|
|
334
337
|
nodeSelectors: {
|
|
335
|
-
key: commonRules.
|
|
338
|
+
key: commonRules.prefixedQualifiedName,
|
|
336
339
|
value: commonRules.k8sLabels.value
|
|
337
340
|
},
|
|
338
341
|
environmentVariables: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|