iguazio.dashboard-react-controls 1.7.0 → 1.8.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.
@@ -14,7 +14,7 @@ var _types = require("../../types");
14
14
  var _constants = require("../../constants");
15
15
  require("./Button.scss");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
- var _excluded = ["className", "density", "icon", "label", "tooltip", "variant"];
17
+ var _excluded = ["className", "density", "icon", "id", "label", "tooltip", "variant"];
18
18
  /*
19
19
  Copyright 2022 Iguazio Systems Ltd.
20
20
  Licensed under the Apache License, Version 2.0 (the "License") with
@@ -45,6 +45,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
45
45
  var className = _ref.className,
46
46
  density = _ref.density,
47
47
  icon = _ref.icon,
48
+ id = _ref.id,
48
49
  label = _ref.label,
49
50
  tooltip = _ref.tooltip,
50
51
  variant = _ref.variant,
@@ -53,20 +54,23 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
53
54
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", _objectSpread(_objectSpread({}, restProps), {}, {
54
55
  className: buttonClassName,
55
56
  ref: ref,
56
- children: [icon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
57
+ "data-testid": id,
58
+ children: [icon, tooltip ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
57
59
  template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
58
60
  text: tooltip
59
61
  }),
60
- hidden: !tooltip,
61
- children: label && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
62
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
62
63
  children: label
63
64
  })
65
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
66
+ children: label
64
67
  })]
65
68
  }));
66
69
  });
67
70
  Button.defaultProps = {
68
71
  className: '',
69
72
  density: 'normal',
73
+ id: 'btn',
70
74
  label: 'Button',
71
75
  tooltip: '',
72
76
  variant: _constants.TERTIARY_BUTTON
@@ -75,6 +79,7 @@ Button.propTypes = {
75
79
  className: _propTypes.default.string,
76
80
  density: _propTypes.default.oneOf(['dense', 'normal', 'medium', 'chunky']),
77
81
  icon: _propTypes.default.element,
82
+ id: _propTypes.default.string,
78
83
  label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
79
84
  tooltip: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
80
85
  variant: _types.BUTTON_VARIANTS
@@ -58,11 +58,12 @@ var FormCheckBox = function FormCheckBox(_ref) {
58
58
  var input = _ref2.input;
59
59
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
60
60
  className: formFieldClassNames,
61
+ "data-testid": "form-field-checkbox",
61
62
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
62
63
  ref: inputRef,
63
64
  className: (0, _classnames.default)(input.checked ? 'checked' : 'unchecked'),
64
65
  type: "checkbox",
65
- "data-testid": "checkbox",
66
+ "data-testid": name ? "".concat(name, "-form-checkbox") : 'form-checkbox',
66
67
  id: (_inputProps$value = inputProps.value) !== null && _inputProps$value !== void 0 ? _inputProps$value : name
67
68
  }, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
68
69
  value: String(input.checked)
@@ -268,6 +268,7 @@ var FormChipCell = function FormChipCell(_ref) {
268
268
  };
269
269
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
270
270
  className: chipsClassName,
271
+ "data-testid": "".concat(name, "-chips"),
271
272
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
272
273
  className: "chips__label",
273
274
  children: label
@@ -137,6 +137,7 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
137
137
  children: chips.hiddenChipsNumber
138
138
  })]
139
139
  }), isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
140
+ "data-testid": "".concat(name, "-add-chip"),
140
141
  className: buttonAddClassNames,
141
142
  onClick: function onClick(e) {
142
143
  return handleAddNewChip(e, fields);
@@ -22,6 +22,6 @@ such restriction.
22
22
  */
23
23
  var uniquenessError = {
24
24
  name: 'uniqueness',
25
- label: 'Key should be unique'
25
+ label: 'Key must be unique'
26
26
  };
27
27
  exports.uniquenessError = uniquenessError;
@@ -331,6 +331,7 @@ var FormCombobox = function FormCombobox(_ref) {
331
331
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
332
332
  className: comboboxClassNames,
333
333
  ref: comboboxRef,
334
+ "data-testid": name ? "".concat(name, "-form-combobox") : 'form-combobox',
334
335
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
335
336
  className: labelClassNames,
336
337
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
@@ -391,6 +392,7 @@ var FormCombobox = function FormCombobox(_ref) {
391
392
  })]
392
393
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
393
394
  className: inputClassNames,
395
+ "data-testid": name ? "".concat(name, "-form-combobox-input") : 'form-combobox-input',
394
396
  id: input.name,
395
397
  onChange: handleInputChange,
396
398
  onFocus: inputOnFocus,
@@ -412,6 +414,7 @@ var FormCombobox = function FormCombobox(_ref) {
412
414
  children: [!hideSearchInput && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
413
415
  className: "form-field-combobox__search-wrapper",
414
416
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
417
+ "data-testid": name ? "".concat(name, "-form-combobox-search") : 'form-combobox-search',
415
418
  className: "form-field-combobox__search form-field__control",
416
419
  onChange: suggestionListSearchChange,
417
420
  onFocus: function onFocus() {
@@ -231,13 +231,13 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
231
231
  if (inputProps.max && +valueToValidate > +inputProps.max) {
232
232
  validationError = {
233
233
  name: 'maxValue',
234
- label: "The maximum value should be ".concat(inputProps.max)
234
+ label: "The maximum value must be ".concat(inputProps.max)
235
235
  };
236
236
  }
237
237
  if (inputProps.min && +valueToValidate < +inputProps.min) {
238
238
  validationError = {
239
239
  name: 'minValue',
240
- label: "The minimum value should be ".concat(inputProps.min)
240
+ label: "The minimum value must be ".concat(inputProps.min)
241
241
  };
242
242
  }
243
243
  }
@@ -321,10 +321,11 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
321
321
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
322
322
  ref: ref,
323
323
  className: formFieldClassNames,
324
+ "data-testid": name ? "".concat(name, "-form-field-input") : 'form-field-input',
324
325
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
325
326
  className: labelClassNames,
326
327
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
327
- "data-testid": "label",
328
+ "data-testid": name ? "".concat(name, "-form-label") : 'form-label',
328
329
  htmlFor: input.name,
329
330
  children: [label, (required || validationRules.find(function (rule) {
330
331
  return rule.name === 'required';
@@ -354,7 +355,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
354
355
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
355
356
  className: "form-field__control",
356
357
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
357
- "data-testid": "input",
358
+ "data-testid": name ? "".concat(name, "-form-input") : 'form-input',
358
359
  id: input.name,
359
360
  ref: inputRef,
360
361
  required: isInvalid || required
@@ -31,7 +31,8 @@ such restriction.
31
31
  */
32
32
 
33
33
  var FormKeyValueTable = function FormKeyValueTable(_ref) {
34
- var addNewItemLabel = _ref.addNewItemLabel,
34
+ var actionButtonId = _ref.actionButtonId,
35
+ addNewItemLabel = _ref.addNewItemLabel,
35
36
  className = _ref.className,
36
37
  defaultKey = _ref.defaultKey,
37
38
  disabled = _ref.disabled,
@@ -63,6 +64,7 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
63
64
  };
64
65
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
65
66
  className: tableClassNames,
67
+ "data-testid": fieldsPath,
66
68
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
67
69
  className: "form-table__row form-table__header-row no-hover",
68
70
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -98,7 +100,7 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
98
100
  required: isKeyRequired,
99
101
  validationRules: [{
100
102
  name: 'uniqueness',
101
- label: 'Name should be unique',
103
+ label: 'Name must be unique',
102
104
  pattern: function pattern(newValue) {
103
105
  return uniquenessValidator(fields, newValue);
104
106
  }
@@ -156,6 +158,7 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
156
158
  disabled: disabled,
157
159
  hidden: editingItem === null || editingItem === void 0 ? void 0 : (_editingItem$ui = editingItem.ui) === null || _editingItem$ui === void 0 ? void 0 : _editingItem$ui.isNew,
158
160
  fields: fields,
161
+ id: actionButtonId,
159
162
  label: addNewItemLabel,
160
163
  onClick: function onClick() {
161
164
  for (var _len = arguments.length, addRowArgs = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -176,6 +179,7 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
176
179
  });
177
180
  };
178
181
  FormKeyValueTable.defaultProps = {
182
+ actionButtonId: '',
179
183
  addNewItemLabel: 'Add new item',
180
184
  className: '',
181
185
  defaultKey: '',
@@ -190,6 +194,7 @@ FormKeyValueTable.defaultProps = {
190
194
  valueLabel: 'Value'
191
195
  };
192
196
  FormKeyValueTable.propTypes = {
197
+ actionButtonId: _propTypes.default.string,
193
198
  addNewItemLabel: _propTypes.default.string,
194
199
  className: _propTypes.default.string,
195
200
  defaultKey: _propTypes.default.string,
@@ -51,10 +51,11 @@ var FormRadio = function FormRadio(_ref) {
51
51
  var input = _ref2.input;
52
52
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
53
53
  className: formFieldClassNames,
54
+ "data-testid": name ? "".concat(name, "-").concat(inputProps.value, "-form-radio") : 'form-field-radio',
54
55
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
55
56
  className: (0, _classnames.default)(input.checked ? 'checked' : 'unchecked'),
56
57
  type: "radio",
57
- "data-testid": "radio-".concat(inputProps.value)
58
+ "data-testid": name ? "".concat(name, "-").concat(inputProps.value, "-radio") : 'form-radio'
58
59
  }, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
59
60
  checked: input.checked,
60
61
  id: name + inputProps.value
@@ -243,14 +243,14 @@ var FormSelect = function FormSelect(_ref) {
243
243
  }),
244
244
  hidden: !tooltip,
245
245
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
246
- "data-testid": "select",
246
+ "data-testid": name ? "".concat(name, "-form-field-select") : 'form-field-select',
247
247
  ref: selectRef,
248
248
  className: "form-field-select ".concat(className),
249
249
  onClick: toggleOpen,
250
250
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
251
251
  className: selectLabelClassName,
252
252
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
253
- "data-testid": "select-label",
253
+ "data-testid": name ? "".concat(name, "-form-select-label") : 'form-select-label',
254
254
  children: [label, meta.error && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
255
255
  className: "form-field__label-mandatory",
256
256
  children: " *"
@@ -52,11 +52,12 @@ var FormToggle = function FormToggle(_ref) {
52
52
  var input = _ref2.input;
53
53
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
54
54
  className: "form-field-toggle",
55
+ "data-testid": name ? "".concat(name, "-form-field-toggle") : 'form-field-toggle',
55
56
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
57
  className: "form-field__label",
57
58
  children: label
58
59
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
59
- "data-testid": "toggle",
60
+ "data-testid": name ? "".concat(name, "-form-toggle") : 'form-toggle',
60
61
  id: name
61
62
  }, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
62
63
  onChange: function onChange(event) {
@@ -45,6 +45,7 @@ var RoundedIcon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
45
45
  "data-testid": id,
46
46
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
47
47
  hidden: !tooltipText,
48
+ id: id,
48
49
  template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextTooltipTemplate.default, {
49
50
  text: tooltipText
50
51
  }),
@@ -52,7 +53,6 @@ var RoundedIcon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
52
53
  onClick: onClick,
53
54
  disabled: disabled,
54
55
  className: IconClassNames,
55
- id: id,
56
56
  children: children
57
57
  })
58
58
  })
@@ -47,6 +47,7 @@ var Tooltip = function Tooltip(_ref) {
47
47
  var children = _ref.children,
48
48
  className = _ref.className,
49
49
  hidden = _ref.hidden,
50
+ id = _ref.id,
50
51
  renderChildAsHtml = _ref.renderChildAsHtml,
51
52
  template = _ref.template,
52
53
  textShow = _ref.textShow;
@@ -151,14 +152,14 @@ var Tooltip = function Tooltip(_ref) {
151
152
  }, [clearStyles, style]);
152
153
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
153
154
  children: [renderChildAsHtml ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
154
- "data-testid": "tooltip-wrapper",
155
+ "data-testid": id ? "".concat(id, "-tooltip-wrapper") : 'tooltip-wrapper',
155
156
  ref: parentRef,
156
157
  className: tooltipClassNames,
157
158
  dangerouslySetInnerHTML: {
158
159
  __html: children
159
160
  }
160
161
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
161
- "data-testid": "tooltip-wrapper",
162
+ "data-testid": id ? "".concat(id, "-tooltip-wrapper") : 'tooltip-wrapper',
162
163
  ref: parentRef,
163
164
  className: tooltipClassNames,
164
165
  children: children
@@ -168,7 +169,7 @@ var Tooltip = function Tooltip(_ref) {
168
169
  timeout: duration,
169
170
  unmountOnExit: true,
170
171
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
171
- "data-testid": "tooltip",
172
+ "data-testid": id ? "".concat(id, "-tooltip") : 'tooltip',
172
173
  ref: tooltipRef,
173
174
  style: _objectSpread({}, style),
174
175
  className: "tooltip",
@@ -179,12 +180,14 @@ var Tooltip = function Tooltip(_ref) {
179
180
  };
180
181
  Tooltip.defaultProps = {
181
182
  hidden: false,
183
+ id: '',
182
184
  renderChildAsHtml: false,
183
185
  textShow: false
184
186
  };
185
187
  Tooltip.propTypes = {
186
188
  className: _propTypes.default.string,
187
189
  hidden: _propTypes.default.bool,
190
+ id: _propTypes.default.string,
188
191
  renderChildAsHtml: _propTypes.default.bool,
189
192
  template: _propTypes.default.element.isRequired,
190
193
  textShow: _propTypes.default.bool
@@ -139,6 +139,7 @@ var Wizard = function Wizard(_ref) {
139
139
  var defaultActions = [];
140
140
  if (activeStepNumber !== 0) {
141
141
  defaultActions.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
142
+ id: "wizard-btn-back",
142
143
  onClick: goToPreviousStep,
143
144
  disabled: activeStepNumber === 0,
144
145
  label: "Back",
@@ -146,6 +147,7 @@ var Wizard = function Wizard(_ref) {
146
147
  }));
147
148
  }
148
149
  defaultActions.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
150
+ id: "wizard-btn-next",
149
151
  disabled: stepConfig.nextIsDisabled || isLastStep,
150
152
  onClick: goToNextStep,
151
153
  label: 'Next',
@@ -9,43 +9,47 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _plus = require("../../images/plus.svg");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- /*
13
- Copyright 2019 Iguazio Systems Ltd.
14
-
15
- Licensed under the Apache License, Version 2.0 (the "License") with
16
- an addition restriction as set forth herein. You may not use this
17
- file except in compliance with the License. You may obtain a copy of
18
- the License at http://www.apache.org/licenses/LICENSE-2.0.
19
-
20
- Unless required by applicable law or agreed to in writing, software
21
- distributed under the License is distributed on an "AS IS" BASIS,
22
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
23
- implied. See the License for the specific language governing
24
- permissions and limitations under the License.
25
-
26
- In addition, you may not use the software for any purposes that are
27
- illegal under applicable law, and the grant of the foregoing license
28
- under the Apache 2.0 license is conditioned upon your compliance with
29
- such restriction.
30
- */
31
-
12
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
16
+ Copyright 2019 Iguazio Systems Ltd.
17
+
18
+ Licensed under the Apache License, Version 2.0 (the "License") with
19
+ an addition restriction as set forth herein. You may not use this
20
+ file except in compliance with the License. You may obtain a copy of
21
+ the License at http://www.apache.org/licenses/LICENSE-2.0.
22
+
23
+ Unless required by applicable law or agreed to in writing, software
24
+ distributed under the License is distributed on an "AS IS" BASIS,
25
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
26
+ implied. See the License for the specific language governing
27
+ permissions and limitations under the License.
28
+
29
+ In addition, you may not use the software for any purposes that are
30
+ illegal under applicable law, and the grant of the foregoing license
31
+ under the Apache 2.0 license is conditioned upon your compliance with
32
+ such restriction.
33
+ */
32
34
  var FormActionButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
35
+ var _jsxs2;
33
36
  var disabled = _ref.disabled,
34
37
  fields = _ref.fields,
35
38
  fieldsPath = _ref.fieldsPath,
36
39
  hidden = _ref.hidden,
40
+ id = _ref.id,
37
41
  label = _ref.label,
38
42
  _onClick = _ref.onClick;
39
43
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
40
44
  children: [!hidden && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
41
45
  className: "form-table__row form-table__action-row no-hover",
42
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
46
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", (_jsxs2 = {
47
+ "data-testid": "".concat(fieldsPath, "-add-btn"),
43
48
  onClick: function onClick(event) {
44
49
  return _onClick(event, fields, fieldsPath);
45
50
  },
46
- disabled: disabled,
47
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_plus.ReactComponent, {}), label]
48
- })
51
+ disabled: disabled
52
+ }, _defineProperty(_jsxs2, "data-testid", id), _defineProperty(_jsxs2, "children", [/*#__PURE__*/(0, _jsxRuntime.jsx)(_plus.ReactComponent, {}), label]), _jsxs2))
49
53
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
50
54
  ref: ref
51
55
  })]
@@ -53,12 +57,14 @@ var FormActionButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
53
57
  });
54
58
  FormActionButton.defaultProps = {
55
59
  disabled: false,
60
+ id: '',
56
61
  label: 'Add new item'
57
62
  };
58
63
  FormActionButton.propTypes = {
59
64
  disabled: _propTypes.default.bool,
60
65
  fields: _propTypes.default.shape({}).isRequired,
61
66
  fieldsPath: _propTypes.default.string.isRequired,
67
+ id: _propTypes.default.string,
62
68
  label: _propTypes.default.string,
63
69
  onClick: _propTypes.default.func.isRequired
64
70
  };
@@ -35,7 +35,7 @@ such restriction.
35
35
  */
36
36
 
37
37
  var FormRowActions = function FormRowActions(_ref) {
38
- var _editingItem$ui, _editingItem$ui2, _editingItem$ui3;
38
+ var _editingItem$ui, _editingItem$ui2, _editingItem$ui3, _editingItem$ui4;
39
39
  var applyChanges = _ref.applyChanges,
40
40
  deleteButtonIsHidden = _ref.deleteButtonIsHidden,
41
41
  deleteRow = _ref.deleteRow,
@@ -47,10 +47,11 @@ var FormRowActions = function FormRowActions(_ref) {
47
47
  index = _ref.index;
48
48
  return hidden ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
49
49
  className: "form-table__cell form-table__actions-cell"
50
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
50
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
51
51
  className: "form-table__cell form-table__actions-cell",
52
- children: (editingItem === null || editingItem === void 0 ? void 0 : (_editingItem$ui = editingItem.ui) === null || _editingItem$ui === void 0 ? void 0 : _editingItem$ui.index) === index ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
52
+ children: [(editingItem === null || editingItem === void 0 ? void 0 : (_editingItem$ui = editingItem.ui) === null || _editingItem$ui === void 0 ? void 0 : _editingItem$ui.index) === index && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
53
53
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
54
+ id: "apply-btn",
54
55
  onClick: function onClick(event) {
55
56
  return applyChanges(event, index);
56
57
  },
@@ -58,6 +59,7 @@ var FormRowActions = function FormRowActions(_ref) {
58
59
  disabled: disabled,
59
60
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkmark.ReactComponent, {})
60
61
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
62
+ id: "delete-discard-btn",
61
63
  onClick: function onClick(event) {
62
64
  return discardOrDelete(event, fieldsPath, index);
63
65
  },
@@ -65,8 +67,9 @@ var FormRowActions = function FormRowActions(_ref) {
65
67
  disabled: disabled,
66
68
  children: (_editingItem$ui3 = editingItem.ui) !== null && _editingItem$ui3 !== void 0 && _editingItem$ui3.isNew ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.ReactComponent, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_close.ReactComponent, {})
67
69
  })]
68
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
70
+ }), (!editingItem || (editingItem === null || editingItem === void 0 ? void 0 : (_editingItem$ui4 = editingItem.ui) === null || _editingItem$ui4 === void 0 ? void 0 : _editingItem$ui4.index) !== index) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
69
71
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
72
+ id: "edit-btn",
70
73
  onClick: function onClick(event) {
71
74
  event.preventDefault();
72
75
  },
@@ -74,6 +77,7 @@ var FormRowActions = function FormRowActions(_ref) {
74
77
  disabled: disabled,
75
78
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_edit.ReactComponent, {})
76
79
  }), !deleteButtonIsHidden && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
80
+ id: "delete-btn",
77
81
  onClick: function onClick(event) {
78
82
  deleteRow(event, fieldsPath, index);
79
83
  },
@@ -81,7 +85,7 @@ var FormRowActions = function FormRowActions(_ref) {
81
85
  disabled: disabled,
82
86
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.ReactComponent, {})
83
87
  })]
84
- })
88
+ })]
85
89
  });
86
90
  };
87
91
  FormRowActions.defaultProps = {
@@ -96,9 +96,12 @@ textarea {
96
96
 
97
97
  .link {
98
98
  color: $cornflowerBlue;
99
+ cursor: pointer;
100
+ line-height: 20px;
99
101
 
100
102
  &:hover {
101
103
  text-decoration: underline;
104
+ text-underline-offset: 3px;
102
105
  }
103
106
  }
104
107
 
@@ -180,7 +183,7 @@ textarea {
180
183
  }
181
184
 
182
185
  &.form-table__row_invalid {
183
- background-color: rgba($amaranth, 0.15)
186
+ background-color: rgba($amaranth, 0.15);
184
187
  }
185
188
 
186
189
  &_multiline {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.openPopUp = exports.openConfirmPopUp = exports.isEveryObjectValueEmpty = exports.getTransitionEndEventName = exports.getErrorDetail = exports.areArraysEqual = void 0;
6
+ exports.openPopUp = exports.openConfirmPopUp = exports.isEveryObjectValueEmpty = exports.getTransitionEndEventName = exports.getErrorMsg = exports.getErrorDetail = exports.areArraysEqual = void 0;
7
7
  var _reactModalPromise = require("react-modal-promise");
8
8
  var _lodash = require("lodash");
9
9
  var _components = require("../components");
@@ -60,9 +60,16 @@ var areArraysEqual = function areArraysEqual(firstArray, secondArray) {
60
60
  return (0, _lodash.isEqual)((0, _lodash.omit)(a, omitBy), (0, _lodash.omit)(b, omitBy));
61
61
  }));
62
62
  };
63
+
64
+ /**
65
+ * Get error information from the error object.
66
+ *
67
+ * @param {Error} error - The error object.
68
+ * @returns {string} - The detailed error information.
69
+ */
63
70
  exports.areArraysEqual = areArraysEqual;
64
71
  var getErrorDetail = function getErrorDetail(error) {
65
- var errorDetail = (0, _lodash.get)(error, 'response.data.detail', '');
72
+ var errorDetail = (0, _lodash.get)(error, 'response.data.detail', null);
66
73
  if (typeof errorDetail === 'string') {
67
74
  return errorDetail;
68
75
  } else {
@@ -70,12 +77,30 @@ var getErrorDetail = function getErrorDetail(error) {
70
77
  }
71
78
  };
72
79
 
80
+ /**
81
+ * Get the error message from the error object or a default error message.
82
+ *
83
+ * @param {Error} error - The error object.
84
+ * @param {string} defaultError - The default error message.
85
+ * @returns {string} - The error message.
86
+ */
87
+ exports.getErrorDetail = getErrorDetail;
88
+ var getErrorMsg = function getErrorMsg(error, defaultError) {
89
+ var errorDetail = getErrorDetail(error);
90
+ var errorMsg = errorDetail || error.message;
91
+ if ((!errorMsg || errorMsg === 'Not Found' || errorMsg.startsWith('Request failed with status code')) && defaultError) {
92
+ return defaultError;
93
+ } else {
94
+ return errorMsg || '';
95
+ }
96
+ };
97
+
73
98
  /**
74
99
  * Retrieves the appropriate transition end event name based on the browser.
75
100
  *
76
101
  * @returns {string} The transition end event name.
77
102
  */
78
- exports.getErrorDetail = getErrorDetail;
103
+ exports.getErrorMsg = getErrorMsg;
79
104
  var getTransitionEndEventName = function getTransitionEndEventName() {
80
105
  var transitions = {
81
106
  transition: 'transitionend',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-react-controls",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
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",