@devtron-labs/devtron-fe-common-lib 0.0.7-beta-49 → 0.0.7-beta-50

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/index.js CHANGED
@@ -6,20 +6,20 @@ var ReactDOM = require('react-dom');
6
6
  var reactRouterDom = require('react-router-dom');
7
7
 
8
8
  function _interopNamespaceDefault(e) {
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
19
17
  });
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
23
  }
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
@@ -75,6 +75,11 @@ var TOKEN_COOKIE_NAME = 'argocd.token';
75
75
  var TriggerTypeMap = {
76
76
  automatic: 'Auto',
77
77
  manual: 'Manual',
78
+ };
79
+ var BuildStageVariable = {
80
+ PreBuild: 'preBuildStage',
81
+ Build: 'buildStage',
82
+ PostBuild: 'postBuildStage',
78
83
  };
79
84
 
80
85
  /******************************************************************************
@@ -248,7 +253,19 @@ exports.DeploymentNodeType = void 0;
248
253
  DeploymentNodeType["CD"] = "CD";
249
254
  DeploymentNodeType["POSTCD"] = "POSTCD";
250
255
  DeploymentNodeType["APPROVAL"] = "APPROVAL";
251
- })(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
256
+ })(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
257
+ exports.PluginRequiredStageKeys = void 0;
258
+ (function (PluginRequiredStageKeys) {
259
+ PluginRequiredStageKeys["PRE_CI"] = "PRE_CI";
260
+ PluginRequiredStageKeys["POST_CI"] = "POST_CI";
261
+ PluginRequiredStageKeys["PRE_OR_POST_CI"] = "PRE_OR_POST_CI";
262
+ })(exports.PluginRequiredStageKeys || (exports.PluginRequiredStageKeys = {}));
263
+ exports.PluginRequiredStage = void 0;
264
+ (function (PluginRequiredStage) {
265
+ PluginRequiredStage["PRE_CI"] = "preBuildStage";
266
+ PluginRequiredStage["POST_CI"] = "postBuildStage";
267
+ PluginRequiredStage["PRE_OR_POST_CI"] = "PRE_OR_POST_CI";
268
+ })(exports.PluginRequiredStage || (exports.PluginRequiredStage = {}));
252
269
 
253
270
  var responseMessages = {
254
271
  100: 'Continue',
@@ -503,7 +520,7 @@ function styleInject(css, ref) {
503
520
  var css_248z$6 = ".empty-state {\n height: 100%;\n}\n.empty-state img {\n height: 40%;\n max-height: 200px;\n width: auto;\n max-width: 250px;\n}\n.empty-state svg {\n height: 40%;\n max-height: 200px;\n width: auto;\n}\n.empty-state h1,\n.empty-state h2,\n.empty-state h3,\n.empty-state h4,\n.empty-state h5,\n.empty-state h6 {\n color: var(--N900);\n}\n.empty-state .subtitle {\n font-size: 13px;\n width: 300px;\n font-weight: 400;\n text-align: center;\n line-height: 1.5;\n margin-bottom: 20px;\n}\n.empty-state .cta {\n height: 36px;\n}\n.empty-state p {\n width: 300px;\n text-align: center;\n font-size: 13px;\n color: var(--N700);\n}\n.empty-state strong {\n font-size: 16px;\n margin-bottom: 4px;\n color: var(--N900);\n font-weight: normal;\n}\n.empty-state .select-popup {\n height: min-content;\n max-height: 250px;\n overflow: auto;\n padding: 8px 0;\n}\n.empty-state .empty-state__loader {\n width: 34px;\n height: 34px;\n margin-bottom: 16px;\n}\n.empty-state .empty-state__loading-text {\n font-size: 12px;\n width: 200px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: var(--N900);\n}\n.empty-state .button__icon {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n}";
504
521
  styleInject(css_248z$6);
505
522
 
506
- var _g$3;
523
+ var _g$2;
507
524
  function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
508
525
  var SvgIcProgressing = function SvgIcProgressing(props) {
509
526
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
@@ -511,7 +528,7 @@ var SvgIcProgressing = function SvgIcProgressing(props) {
511
528
  viewBox: "0 0 24 24",
512
529
  width: "1em",
513
530
  height: "1em"
514
- }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
531
+ }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
515
532
  fill: "none"
516
533
  }, /*#__PURE__*/React__namespace.createElement("animateTransform", {
517
534
  attributeName: "transform",
@@ -3927,28 +3944,6 @@ function captureException(exception, captureContext) {
3927
3944
  return getCurrentHub().captureException(exception, { captureContext });
3928
3945
  }
3929
3946
 
3930
- var _g$2;
3931
- function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
3932
- var SvgIcWarning = function SvgIcWarning(props) {
3933
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
3934
- xmlns: "http://www.w3.org/2000/svg",
3935
- width: "1em",
3936
- height: "1em",
3937
- viewBox: "0 0 32 32"
3938
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
3939
- fill: "none",
3940
- fillRule: "evenodd"
3941
- }, /*#__PURE__*/React__namespace.createElement("path", {
3942
- d: "M0 0h32v32H0z"
3943
- }), /*#__PURE__*/React__namespace.createElement("path", {
3944
- fill: "#FFCB5D",
3945
- d: "M18.315 5.052 29.72 25.01A2.667 2.667 0 0 1 27.405 29H4.595a2.667 2.667 0 0 1-2.315-3.99L13.685 5.052a2.667 2.667 0 0 1 4.63 0z"
3946
- }), /*#__PURE__*/React__namespace.createElement("path", {
3947
- fill: "#FFF",
3948
- d: "M16 22.667a1.333 1.333 0 1 1 0 2.666 1.333 1.333 0 0 1 0-2.666zM16 12c.736 0 1.333.597 1.333 1.333v6.334a1.333 1.333 0 1 1-2.666 0v-6.334c0-.736.597-1.333 1.333-1.333z"
3949
- }))));
3950
- };
3951
-
3952
3947
  toast.configure({
3953
3948
  autoClose: 3000,
3954
3949
  hideProgressBar: true,
@@ -4087,110 +4082,6 @@ function getLoginInfo() {
4087
4082
  return null;
4088
4083
  }
4089
4084
  }
4090
- }
4091
- function useForm(stateSchema, validationSchema, callback) {
4092
- if (validationSchema === void 0) { validationSchema = {}; }
4093
- var _a = __read(React.useState(stateSchema), 2), state = _a[0], setState = _a[1];
4094
- var _b = __read(React.useState(true), 2), disable = _b[0], setDisable = _b[1];
4095
- var _c = __read(React.useState(false), 2), isDirty = _c[0], setIsDirty = _c[1];
4096
- // Disable button in initial render.
4097
- React.useEffect(function () {
4098
- setDisable(true);
4099
- }, []);
4100
- // For every changed in our state this will be fired
4101
- // To be able to disable the button
4102
- React.useEffect(function () {
4103
- if (isDirty) {
4104
- setDisable(validateState(state));
4105
- }
4106
- }, [state, isDirty]);
4107
- // Used to disable submit button if there's an error in state
4108
- // or the required field in state has no value.
4109
- // Wrapped in useCallback to cached the function to avoid intensive memory leaked
4110
- // in every re-render in component
4111
- var validateState = React.useCallback(function (state) {
4112
- //check errors in all fields
4113
- var hasErrorInState = Object.keys(validationSchema).some(function (key) {
4114
- var isInputFieldRequired = validationSchema[key].required;
4115
- var stateValue = state[key].value; // state value
4116
- var stateError = state[key].error; // state error
4117
- return (isInputFieldRequired && !stateValue) || stateError;
4118
- });
4119
- return hasErrorInState;
4120
- }, [state, validationSchema]);
4121
- function validateField(name, value) {
4122
- if (validationSchema[name].required) {
4123
- if (!value) {
4124
- return 'This is a required field.';
4125
- }
4126
- }
4127
- function _validateSingleValidator(validator, value) {
4128
- if (value && !validator.regex.test(value)) {
4129
- return false;
4130
- }
4131
- return true;
4132
- }
4133
- // single validator
4134
- var _validator = validationSchema[name].validator;
4135
- if (_validator && typeof _validator === 'object') {
4136
- if (!_validateSingleValidator(_validator, value)) {
4137
- return _validator.error;
4138
- }
4139
- }
4140
- // multiple validators
4141
- var _validators = validationSchema[name].validators;
4142
- if (_validators && typeof _validators === 'object' && Array.isArray(_validators)) {
4143
- var errors_1 = [];
4144
- _validators.forEach(function (_validator) {
4145
- if (!_validateSingleValidator(_validator, value)) {
4146
- errors_1.push(_validator.error);
4147
- }
4148
- });
4149
- if (errors_1.length > 0) {
4150
- return errors_1;
4151
- }
4152
- }
4153
- return '';
4154
- }
4155
- var handleOnChange = React.useCallback(function (event) {
4156
- setIsDirty(true);
4157
- var _a = event.target, name = _a.name, value = _a.value;
4158
- var error = validateField(name, value);
4159
- setState(function (prevState) {
4160
- var _a;
4161
- return (__assign(__assign({}, prevState), (_a = {}, _a[name] = { value: value, error: error }, _a)));
4162
- });
4163
- }, [validationSchema]);
4164
- var handleOnSubmit = function (event) {
4165
- event.preventDefault();
4166
- var newState = Object.keys(validationSchema).reduce(function (agg, curr) {
4167
- agg[curr] = __assign(__assign({}, state[curr]), { error: validateField(curr, state[curr].value) });
4168
- return agg;
4169
- }, state);
4170
- if (!validateState(newState)) {
4171
- callback(state);
4172
- }
4173
- else {
4174
- setState(__assign({}, newState));
4175
- }
4176
- };
4177
- return { state: state, disable: disable, handleOnChange: handleOnChange, handleOnSubmit: handleOnSubmit };
4178
- }
4179
- function handleError(error) {
4180
- if (!error) {
4181
- return [];
4182
- }
4183
- if (!Array.isArray(error)) {
4184
- return [error];
4185
- }
4186
- return error;
4187
- }
4188
- function CustomInput(_a) {
4189
- var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange, _b = _a.onBlur, onBlur = _b === void 0 ? function (e) { } : _b, _c = _a.onFocus, onFocus = _c === void 0 ? function (e) { } : _c, label = _a.label, _d = _a.type, type = _d === void 0 ? 'text' : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.autoComplete; var _g = _a.labelClassName, labelClassName = _g === void 0 ? '' : _g, _h = _a.placeholder, placeholder = _h === void 0 ? '' : _h, _j = _a.tabIndex, tabIndex = _j === void 0 ? 1 : _j, _k = _a.dataTestid, dataTestid = _k === void 0 ? '' : _k;
4190
- return (jsxRuntime.jsxs("div", __assign({ className: "flex column left top" }, { children: [jsxRuntime.jsx("label", __assign({ className: "form__label ".concat(labelClassName) }, { children: label })), jsxRuntime.jsx("input", { "data-testid": dataTestid, type: type, name: name, autoComplete: "off", className: "form__input", onChange: function (e) {
4191
- e.persist();
4192
- onChange(e);
4193
- }, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex }), handleError(error).map(function (err) { return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), err] }))); })] })));
4194
4085
  }
4195
4086
 
4196
4087
  function Progressing(_a) {
@@ -4318,16 +4209,16 @@ var Modal = function (_a) {
4318
4209
  }, id: "popup", className: "".concat(rootClassName, " popup ").concat(modal ? 'modal' : ''), style: __assign({}, style) }, { children: children })), document.getElementById('visible-modal'));
4319
4210
  };
4320
4211
 
4321
- var _path$5;
4322
- function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
4212
+ var _path$6;
4213
+ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
4323
4214
  var SvgIcCross = function SvgIcCross(props) {
4324
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
4215
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
4325
4216
  width: "1em",
4326
4217
  height: "1em",
4327
4218
  viewBox: "0 0 24 24",
4328
4219
  fill: "none",
4329
4220
  xmlns: "http://www.w3.org/2000/svg"
4330
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
4221
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
4331
4222
  d: "M19.28 5.78a.75.75 0 0 0-1.06-1.06l1.06 1.06ZM4.72 18.22a.75.75 0 1 0 1.06 1.06l-1.06-1.06Zm13.5 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM5.78 4.72a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm12.44 0-6.75 6.75 1.06 1.06 6.75-6.75-1.06-1.06Zm-6.75 6.75-6.75 6.75 1.06 1.06 6.75-6.75-1.06-1.06Zm7.81 6.75-6.75-6.75-1.06 1.06 6.75 6.75 1.06-1.06Zm-6.75-6.75L5.78 4.72 4.72 5.78l6.75 6.75 1.06-1.06Z",
4332
4223
  fill: "#596168"
4333
4224
  })));
@@ -8626,6 +8517,21 @@ var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy));
8626
8517
 
8627
8518
  var Tippy = index;
8628
8519
 
8520
+ var _path$5;
8521
+ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
8522
+ var SvgIcHelp = function SvgIcHelp(props) {
8523
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
8524
+ xmlns: "http://www.w3.org/2000/svg",
8525
+ width: "1em",
8526
+ height: "1em",
8527
+ viewBox: "0 0 24 24"
8528
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
8529
+ fill: "#767D84",
8530
+ fillRule: "evenodd",
8531
+ d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm-.205 12.868c-.615 0-1.12.505-1.12 1.12 0 .617.505 1.121 1.12 1.121.615 0 1.12-.504 1.12-1.12 0-.616-.506-1.12-1.12-1.12zM11.863 7c-1.667 0-3.197 1.187-3.196 2.527 0 .546.41.833.888.833 1.325 0 .642-1.803 2.39-1.803.82 0 1.311.438 1.311 1.175 0 1.34-2.39 1.708-2.39 3.334 0 .438.287.915.874.915.902 0 .792-.67 1.12-1.148.438-.642 2.473-1.325 2.473-3.101 0-1.927-1.721-2.732-3.47-2.732z"
8532
+ })));
8533
+ };
8534
+
8629
8535
  var css_248z$4 = ".tippy-box[data-animation=shift-toward-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=top][data-state=hidden]{transform:translateY(-5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=bottom][data-state=hidden]{transform:translateY(5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=left][data-state=hidden]{transform:translateX(-5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=right][data-state=hidden]{transform:translateX(5px)}";
8630
8536
  styleInject(css_248z$4);
8631
8537
 
@@ -8633,6 +8539,7 @@ styleInject(css_248z$4);
8633
8539
  // So this can be updated to support further for new features or interactions
8634
8540
  function TippyCustomized(props) {
8635
8541
  var tippyRef = React.useRef(null);
8542
+ var _a = __read(React.useState(false), 2), showHeadingInfo = _a[0], setShowHeadingInfo = _a[1];
8636
8543
  var isWhiteTheme = props.theme === exports.TippyTheme.white;
8637
8544
  var onTippyMount = function (tippyInstance) {
8638
8545
  tippyRef.current = tippyInstance;
@@ -8647,15 +8554,19 @@ function TippyCustomized(props) {
8647
8554
  props.onClose();
8648
8555
  }
8649
8556
  }
8557
+ setShowHeadingInfo(false);
8650
8558
  };
8651
8559
  var closeOnEsc = function (e) {
8652
8560
  if (e.keyCode === 27) {
8653
8561
  closeTippy();
8654
8562
  }
8655
8563
  };
8564
+ var toggleHeadingInfo = function (e) {
8565
+ setShowHeadingInfo(not);
8566
+ };
8656
8567
  var getTippyContent = function () {
8657
- var Icon = props.Icon, iconPath = props.iconPath, iconClass = props.iconClass, iconSize = props.iconSize, onImageLoadError = props.onImageLoadError, heading = props.heading, infoTextHeading = props.infoTextHeading, infoText = props.infoText, showCloseButton = props.showCloseButton, additionalContent = props.additionalContent, documentationLink = props.documentationLink, documentationLinkText = props.documentationLinkText;
8658
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "dc__word-break dc__hyphens-auto flex left ".concat(isWhiteTheme ? 'p-12 dc__border-bottom-n1 cn-9' : 'pt-20 pb-12 pr-20 pl-20 cn-0 top') }, { children: [iconPath ? (jsxRuntime.jsx("img", { className: "icon-dim-".concat(iconSize || 20, " mr-6 ").concat(iconClass || ''), src: iconPath, alt: 'Heading', onError: onImageLoadError })) : (Icon && (jsxRuntime.jsx("div", __assign({ className: "icon-dim-".concat(iconSize || 20, " mr-6") }, { children: jsxRuntime.jsx(Icon, { className: "icon-dim-".concat(iconSize || 20, " ").concat(iconClass || '') }) })))), heading && jsxRuntime.jsx("span", __assign({ className: "fs-14 fw-6 lh-20 ".concat(showCloseButton ? 'mr-6' : '') }, { children: heading })), showCloseButton && (jsxRuntime.jsx("div", __assign({ className: "icon-dim-16 ml-auto" }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-16 cursor ".concat(isWhiteTheme ? 'fcn-9' : 'fcn-0'), onClick: closeTippy }) })))] })), infoTextHeading && (jsxRuntime.jsx("div", __assign({ className: "dc__word-break dc__hyphens-auto fs-14 fw-6 lh-20 ".concat(isWhiteTheme ? 'pl-12 pr-12' : 'pl-20 pr-20') }, { children: infoTextHeading }))), infoText && (jsxRuntime.jsx("div", __assign({ className: "dc__word-break dc__hyphens-auto fs-13 fw-4 lh-20 ".concat(isWhiteTheme
8568
+ var Icon = props.Icon, iconPath = props.iconPath, iconClass = props.iconClass, iconSize = props.iconSize, onImageLoadError = props.onImageLoadError, heading = props.heading, headingInfo = props.headingInfo, infoTextHeading = props.infoTextHeading, infoText = props.infoText, showCloseButton = props.showCloseButton, additionalContent = props.additionalContent, documentationLink = props.documentationLink, documentationLinkText = props.documentationLinkText;
8569
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "dc__word-break dc__hyphens-auto flex left ".concat(isWhiteTheme ? 'p-12 dc__border-bottom-n1 cn-9' : 'pt-20 pb-12 pr-20 pl-20 cn-0 top') }, { children: [iconPath ? (jsxRuntime.jsx("img", { className: "icon-dim-".concat(iconSize || 20, " mr-6 ").concat(iconClass || ''), src: iconPath, alt: heading, onError: onImageLoadError })) : (Icon && (jsxRuntime.jsx("div", __assign({ className: "icon-dim-".concat(iconSize || 20, " mr-6") }, { children: jsxRuntime.jsx(Icon, { className: "icon-dim-".concat(iconSize || 20, " ").concat(iconClass || '') }) })))), heading && jsxRuntime.jsx("span", __assign({ className: "fs-14 fw-6 lh-20 ".concat(showCloseButton ? 'mr-6' : '') }, { children: heading })), headingInfo && (jsxRuntime.jsx("div", __assign({ className: "icon-dim-20 cursor", onClick: toggleHeadingInfo }, { children: jsxRuntime.jsx(SvgIcHelp, { className: "icon-dim-20" }) }))), showCloseButton && (jsxRuntime.jsx("div", __assign({ className: "icon-dim-16 ml-auto" }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-16 cursor ".concat(isWhiteTheme ? 'fcn-9' : 'fcn-0'), onClick: closeTippy }) })))] })), showHeadingInfo && (jsxRuntime.jsxs("div", __assign({ className: "flex left bcv-1 fs-13 fw-4 lh-20 pt-8 pb-8 ".concat(isWhiteTheme ? 'pl-12 pr-12' : 'pl-20 pr-20') }, { children: [jsxRuntime.jsx("div", __assign({ className: "icon-dim-20 mr-8" }, { children: jsxRuntime.jsx(SvgIcHelp, { className: "icon-dim-20 fcv-5" }) })), jsxRuntime.jsx("div", __assign({ className: "dc__word-break dc__hyphens-auto" }, { children: headingInfo }))] }))), infoTextHeading && (jsxRuntime.jsx("div", __assign({ className: "dc__word-break dc__hyphens-auto fs-14 fw-6 lh-20 ".concat(isWhiteTheme ? 'pl-12 pr-12' : 'pl-20 pr-20') }, { children: infoTextHeading }))), infoText && (jsxRuntime.jsx("div", __assign({ className: "dc__word-break dc__hyphens-auto fs-13 fw-4 lh-20 ".concat(isWhiteTheme
8659
8570
  ? 'p-12'
8660
8571
  : "pl-20 pr-20 pt-4 ".concat(additionalContent && documentationLink ? 'pb-12' : 'pb-20')) }, { children: infoText }))), additionalContent, documentationLink && (jsxRuntime.jsx("div", __assign({ className: "pl-12 pb-12" }, { children: jsxRuntime.jsx("a", __assign({ href: documentationLink, target: "_blank", rel: "noreferrer noopener", className: "fs-13 cb-5", onClick: closeTippy }, { children: documentationLinkText || 'Learn more' })) })))] }));
8661
8572
  };
@@ -8795,39 +8706,35 @@ var ValidationRules = /** @class */ (function () {
8795
8706
  errorList.push('Key is required');
8796
8707
  }
8797
8708
  else {
8798
- if (!key.startsWith("devtron.ai/")) {
8799
- var re = new RegExp('/', 'g');
8800
- var noOfSlashInKey = (_a = key.match(re)) === null || _a === void 0 ? void 0 : _a.length;
8801
- if (noOfSlashInKey > 1) {
8802
- errorList.push('Key: Max 1 ( / ) allowed');
8803
- }
8804
- else if (noOfSlashInKey === 1) {
8805
- var _b = __read(key.split('/'), 2), prefix = _b[0], name_1 = _b[1];
8806
- errorList.push.apply(errorList, __spreadArray([], __read(validateTagValue(name_1).map(function (error) { return "Name: ".concat(error); })), false));
8807
- if (prefix.length > 253) {
8808
- errorList.push('Prefix: Can be max 253 characters');
8809
- }
8810
- var validPrefix = PATTERNS.KUBERNETES_KEY_PREFIX.test(prefix);
8811
- if (!validPrefix) {
8812
- errorList.push('Prefix: Must be a DNS subdomain (a series of DNS labels separated by dots (.)');
8813
- }
8709
+ var re = new RegExp('/', 'g');
8710
+ var noOfSlashInKey = (_a = key.match(re)) === null || _a === void 0 ? void 0 : _a.length;
8711
+ if (noOfSlashInKey > 1) {
8712
+ errorList.push('Key: Max 1 ( / ) allowed');
8713
+ }
8714
+ else if (noOfSlashInKey === 1) {
8715
+ var _b = __read(key.split('/'), 2), prefix = _b[0], name_1 = _b[1];
8716
+ errorList.push.apply(errorList, __spreadArray([], __read(validateTagValue(name_1).map(function (error) { return "Name: ".concat(error); })), false));
8717
+ if (prefix.length > 253) {
8718
+ errorList.push('Prefix: Can be max 253 characters');
8814
8719
  }
8815
- else {
8816
- errorList.push.apply(errorList, __spreadArray([], __read(validateTagValue(key).map(function (error) { return "Name: ".concat(error); })), false));
8720
+ var validPrefix = PATTERNS.KUBERNETES_KEY_PREFIX.test(prefix);
8721
+ if (!validPrefix) {
8722
+ errorList.push('Prefix: Must be a DNS subdomain (a series of DNS labels separated by dots (.)');
8817
8723
  }
8818
8724
  }
8725
+ else {
8726
+ errorList.push.apply(errorList, __spreadArray([], __read(validateTagValue(key).map(function (error) { return "Name: ".concat(error); })), false));
8727
+ }
8819
8728
  }
8820
8729
  return { isValid: errorList.length === 0, messages: errorList };
8821
8730
  };
8822
- this.propagateTagValue = function (value, key) {
8731
+ this.propagateTagValue = function (value) {
8823
8732
  var errorList = [];
8824
8733
  if (!value) {
8825
8734
  errorList.push('Value is required');
8826
8735
  }
8827
8736
  else {
8828
- if (!key.startsWith("devtron.ai/")) {
8829
- errorList.push.apply(errorList, __spreadArray([], __read(validateTagValue(value)), false));
8830
- }
8737
+ errorList.push.apply(errorList, __spreadArray([], __read(validateTagValue(value)), false));
8831
8738
  }
8832
8739
  return { isValid: errorList.length === 0, messages: errorList };
8833
8740
  };
@@ -8862,7 +8769,7 @@ var TagLabelValueSelector = function (_a) {
8862
8769
  : _tagData.value !== '';
8863
8770
  }
8864
8771
  else if (selectedValue || isRequired || _tagData.propagate) {
8865
- _tagData.isInvalidValue = !validationRules.propagateTagValue(selectedValue, _tagData.key).isValid;
8772
+ _tagData.isInvalidValue = !validationRules.propagateTagValue(selectedValue).isValid;
8866
8773
  _tagData.isInvalidKey = !_tagData.key || _tagData.isInvalidKey;
8867
8774
  }
8868
8775
  else {
@@ -8891,7 +8798,7 @@ var TagLabelValueSelector = function (_a) {
8891
8798
  }
8892
8799
  }
8893
8800
  else if (isRequired || selectedValue || tagData.propagate) {
8894
- field = validationRules.propagateTagValue(selectedValue, tagData.key);
8801
+ field = validationRules.propagateTagValue(selectedValue);
8895
8802
  }
8896
8803
  if (!field.isValid) {
8897
8804
  return (jsxRuntime.jsxs("div", __assign({ className: "p-4", onClick: stopPropagation, "data-testid": "tag-label-cross-stop-propagation" }, { children: [field.messages.map(function (error) { return (jsxRuntime.jsxs("div", __assign({ className: "flexbox pr-4 pl-4" }, { children: [jsxRuntime.jsx("span", { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-14 scr-5 mt-3 mr-4" }) }), jsxRuntime.jsx("span", { children: error })] }), error)); }), tagInputType === exports.KEY_VALUE.KEY && (jsxRuntime.jsxs("div", __assign({ className: "flexbox pr-4 pl-4" }, { children: [jsxRuntime.jsx("span", { children: jsxRuntime.jsx(SvgIcInfoOutlined, { className: "icon-dim-14 mt-3 mr-4" }) }), jsxRuntime.jsx("span", __assign({ className: "dc__italic-font-style" }, { children: "Key format: prefix/name or name" }))] })))] })));
@@ -8943,12 +8850,12 @@ var TagDetails = function (_a) {
8943
8850
  _tagData.isInvalidKey =
8944
8851
  _tagData.key || _tagData.value ? !validationRules.propagateTagKey(_tagData.key).isValid : false;
8945
8852
  _tagData.isInvalidValue = _tagData.value
8946
- ? !validationRules.propagateTagValue(_tagData.value, _tagData.key).isValid
8853
+ ? !validationRules.propagateTagValue(_tagData.value).isValid
8947
8854
  : false;
8948
8855
  }
8949
8856
  setTagData(index, _tagData);
8950
8857
  };
8951
- return (jsxRuntime.jsxs("div", __assign({ className: "flexbox mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ".concat(tagData.propagate ? 'bcn-7' : '', " ").concat(tagData.key.startsWith("devtron.ai/") ? 'cursor-not-allowed bcn-1' : ''), onClick: propagateTagToResource, "data-testid": "propagate-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-20 mt-4 ".concat(tagData.propagate ? 'scn-0' : '') }) })), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.KEY, placeholder: "Enter key", tabIndex: tabIndex - 1, refVar: keyRef, dependentRef: valueRef, tagOptions: suggestedTagsOptions }), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.VALUE, placeholder: "Enter value", tabIndex: tabIndex, refVar: valueRef, dependentRef: keyRef }), jsxRuntime.jsx("div", __assign({ className: "dc__border pl-4 pr-4 dc__right-radius-4 pointer flex top", onClick: deleteTag, "data-testid": "delete-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-20 mt-4" }) }))] })));
8858
+ return (jsxRuntime.jsxs("div", __assign({ className: "flexbox mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ".concat(tagData.propagate ? 'bcn-7' : ''), onClick: propagateTagToResource, "data-testid": "propagate-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-20 mt-4 ".concat(tagData.propagate ? 'scn-0' : '') }) })), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.KEY, placeholder: "Enter key", tabIndex: tabIndex - 1, refVar: keyRef, dependentRef: valueRef, tagOptions: suggestedTagsOptions }), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.VALUE, placeholder: "Enter value", tabIndex: tabIndex, refVar: valueRef, dependentRef: keyRef }), jsxRuntime.jsx("div", __assign({ className: "dc__border pl-4 pr-4 dc__right-radius-4 pointer flex top", onClick: deleteTag, "data-testid": "delete-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-20 mt-4" }) }))] })));
8952
8859
  };
8953
8860
 
8954
8861
  var _path$1;
@@ -8970,11 +8877,7 @@ var TagLabelSelect = function (_a) {
8970
8877
  var isCreateApp = _a.isCreateApp, labelTags = _a.labelTags, setLabelTags = _a.setLabelTags, _b = _a.tabIndex, tabIndex = _b === void 0 ? 0 : _b;
8971
8878
  var setTagData = function (index, tagValue) {
8972
8879
  var _tags = __spreadArray([], __read(labelTags), false);
8973
- var _tagValue = tagValue;
8974
- if (_tagValue.key.startsWith("devtron.ai/")) {
8975
- _tagValue.propagate = false;
8976
- }
8977
- _tags[index] = _tagValue;
8880
+ _tags[index] = tagValue;
8978
8881
  setLabelTags(_tags);
8979
8882
  };
8980
8883
  var addNewTag = function () {
@@ -16712,80 +16615,59 @@ function Radio(_a) {
16712
16615
  }
16713
16616
  RadioGroup.Radio = Radio;
16714
16617
 
16715
- var info = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%20%20%20%20%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M0%200h32v32H0z%22%2F%3E%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2306C%22%20d%3D%22M16%202.667C8.64%202.667%202.667%208.64%202.667%2016S8.64%2029.333%2016%2029.333%2029.333%2023.36%2029.333%2016%2023.36%202.667%2016%202.667z%22%2F%3E%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M16%2014.667c.736%200%201.333.597%201.333%201.333v5.333a1.333%201.333%200%201%201-2.666%200V16c0-.736.597-1.333%201.333-1.333zm0-5.334A1.333%201.333%200%201%201%2016%2012a1.333%201.333%200%200%201%200-2.667z%22%2F%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E";
16716
-
16717
- function DeleteComponent(_a) {
16718
- var setDeleting = _a.setDeleting, toggleConfirmation = _a.toggleConfirmation, deleteComponent = _a.deleteComponent, title = _a.title, component = _a.component, payload = _a.payload, _b = _a.confirmationDialogDescription, confirmationDialogDescription = _b === void 0 ? '' : _b, _c = _a.redirectTo, redirectTo = _c === void 0 ? false : _c, _d = _a.url, url = _d === void 0 ? '' : _d, reload = _a.reload, _e = _a.configuration, configuration = _e === void 0 ? '' : _e, closeCustomComponent = _a.closeCustomComponent;
16719
- var _f = __read(React.useState(false), 2), showCannotDeleteDialogModal = _f[0], setCannotDeleteDialogModal = _f[1];
16720
- var push = reactRouterDom.useHistory().push;
16721
- function handleDelete() {
16722
- return __awaiter(this, void 0, void 0, function () {
16723
- var serverError_1;
16724
- return __generator(this, function (_a) {
16725
- switch (_a.label) {
16726
- case 0:
16727
- setDeleting(true);
16728
- _a.label = 1;
16729
- case 1:
16730
- _a.trys.push([1, 3, 4, 5]);
16731
- return [4 /*yield*/, deleteComponent(payload)];
16732
- case 2:
16733
- _a.sent();
16734
- toast.success('Successfully deleted');
16735
- toggleConfirmation(false);
16736
- if (redirectTo) {
16737
- push(url);
16738
- }
16739
- else {
16740
- reload();
16741
- }
16742
- if (typeof closeCustomComponent === 'function') {
16743
- closeCustomComponent();
16744
- }
16745
- return [3 /*break*/, 5];
16746
- case 3:
16747
- serverError_1 = _a.sent();
16748
- if (serverError_1 instanceof ServerErrors && serverError_1.code === 500) {
16749
- setCannotDeleteDialogModal(true);
16750
- }
16751
- return [3 /*break*/, 5];
16752
- case 4:
16753
- setDeleting(false);
16754
- return [7 /*endfinally*/];
16755
- case 5: return [2 /*return*/];
16756
- }
16757
- });
16758
- });
16759
- }
16760
- var handleConfirmation = function () {
16761
- setCannotDeleteDialogModal(false);
16762
- toggleConfirmation(false);
16763
- if (typeof closeCustomComponent === 'function') {
16764
- closeCustomComponent();
16765
- }
16766
- };
16767
- var renderCannotDeleteDialogModal = function () {
16768
- return (jsxRuntime.jsxs(ConfirmationDialog, __assign({ className: "confirmation-dialog__body--w-360" }, { children: [jsxRuntime.jsx(ConfirmationDialog.Icon, { src: info }), jsxRuntime.jsx(ConfirmationDialog.Body, { title: "Cannot delete ".concat(component, " '").concat(title, "'") }), jsxRuntime.jsx("p", __assign({ className: "fs-13 cn-7 " }, { children: confirmationDialogDescription })), jsxRuntime.jsx(ConfirmationDialog.ButtonGroup, { children: jsxRuntime.jsx("button", __assign({ type: "button", className: "cta", onClick: handleConfirmation }, { children: "Okay" })) })] })));
16769
- };
16770
- var renderDeleteDialog = function () {
16771
- return (jsxRuntime.jsx(DeleteDialog, __assign({ title: "Delete ".concat(component, " '").concat(title, "'"), delete: handleDelete, closeDelete: function () { return toggleConfirmation(false); }, dataTestId: "delete-dialog" }, { children: jsxRuntime.jsx(DeleteDialog.Description, { children: jsxRuntime.jsxs("p", { children: ["Are you sure you want to delete this ", configuration ? configuration : component, "? "] }) }) })));
16772
- };
16773
- return (jsxRuntime.jsxs("div", { children: [!showCannotDeleteDialogModal && renderDeleteDialog(), showCannotDeleteDialogModal && renderCannotDeleteDialogModal()] }));
16774
- }
16618
+ exports.RefVariableType = void 0;
16619
+ (function (RefVariableType) {
16620
+ RefVariableType["GLOBAL"] = "GLOBAL";
16621
+ RefVariableType["FROM_PREVIOUS_STEP"] = "FROM_PREVIOUS_STEP";
16622
+ RefVariableType["NEW"] = "NEW";
16623
+ })(exports.RefVariableType || (exports.RefVariableType = {}));
16624
+ exports.PluginType = void 0;
16625
+ (function (PluginType) {
16626
+ PluginType["INLINE"] = "INLINE";
16627
+ PluginType["PLUGIN_REF"] = "REF_PLUGIN";
16628
+ })(exports.PluginType || (exports.PluginType = {}));
16629
+ exports.ScriptType = void 0;
16630
+ (function (ScriptType) {
16631
+ ScriptType["SHELL"] = "SHELL";
16632
+ ScriptType["DOCKERFILE"] = "DOCKERFILE";
16633
+ ScriptType["CONTAINERIMAGE"] = "CONTAINER_IMAGE";
16634
+ })(exports.ScriptType || (exports.ScriptType = {}));
16635
+ exports.MountPath = void 0;
16636
+ (function (MountPath) {
16637
+ MountPath["TRUE"] = "Yes";
16638
+ MountPath["FALSE"] = "No";
16639
+ })(exports.MountPath || (exports.MountPath = {}));
16640
+ exports.ConditionType = void 0;
16641
+ (function (ConditionType) {
16642
+ ConditionType["SKIP"] = "SKIP";
16643
+ ConditionType["TRIGGER"] = "TRIGGER";
16644
+ ConditionType["PASS"] = "PASS";
16645
+ ConditionType["FAIL"] = "FAIL";
16646
+ })(exports.ConditionType || (exports.ConditionType = {}));
16647
+ exports.RefVariableStageType = void 0;
16648
+ (function (RefVariableStageType) {
16649
+ RefVariableStageType["PRE_CI"] = "PRE_CI";
16650
+ RefVariableStageType["POST_CI"] = "POST_CI";
16651
+ })(exports.RefVariableStageType || (exports.RefVariableStageType = {}));
16652
+ exports.CIBuildType = void 0;
16653
+ (function (CIBuildType) {
16654
+ CIBuildType["SELF_DOCKERFILE_BUILD_TYPE"] = "self-dockerfile-build";
16655
+ CIBuildType["MANAGED_DOCKERFILE_BUILD_TYPE"] = "managed-dockerfile-build";
16656
+ CIBuildType["BUILDPACK_BUILD_TYPE"] = "buildpack-build";
16657
+ })(exports.CIBuildType || (exports.CIBuildType = {}));
16775
16658
 
16776
16659
  exports.BreadCrumb = BreadCrumb;
16777
16660
  exports.BreadcrumbStore = Store;
16661
+ exports.BuildStageVariable = BuildStageVariable;
16778
16662
  exports.CDModalTab = CDModalTab;
16779
16663
  exports.Checkbox = Checkbox;
16780
16664
  exports.ClearIndicator = ClearIndicator;
16781
16665
  exports.ConditionalWrap = ConditionalWrap;
16782
16666
  exports.ConfirmationDialog = ConfirmationDialog;
16783
- exports.CustomInput = CustomInput;
16784
16667
  exports.CustomSelect = CustomSelect;
16785
16668
  exports.DEFAULT_TAG_DATA = DEFAULT_TAG_DATA;
16786
16669
  exports.DOCUMENTATION = DOCUMENTATION;
16787
16670
  exports.DOCUMENTATION_HOME_PAGE = DOCUMENTATION_HOME_PAGE;
16788
- exports.DeleteComponent = DeleteComponent;
16789
16671
  exports.DeleteDialog = DeleteDialog;
16790
16672
  exports.DetailsProgressing = DetailsProgressing;
16791
16673
  exports.DialogForm = DialogForm;
@@ -16853,5 +16735,4 @@ exports.toastAccessDenied = toastAccessDenied;
16853
16735
  exports.trash = trash;
16854
16736
  exports.useBreadcrumb = useBreadcrumb;
16855
16737
  exports.useEffectAfterMount = useEffectAfterMount;
16856
- exports.useForm = useForm;
16857
16738
  exports.useThrottledEffect = useThrottledEffect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.7-beta-49",
3
+ "version": "0.0.7-beta-50",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#767D84" fill-rule="evenodd" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm-.205 12.868c-.615 0-1.12.505-1.12 1.12 0 .617.505 1.121 1.12 1.121.615 0 1.12-.504 1.12-1.12 0-.616-.506-1.12-1.12-1.12zM11.863 7c-1.667 0-3.197 1.187-3.196 2.527 0 .546.41.833.888.833 1.325 0 .642-1.803 2.39-1.803.82 0 1.311.438 1.311 1.175 0 1.34-2.39 1.708-2.39 3.334 0 .438.287.915.874.915.902 0 .792-.67 1.12-1.148.438-.642 2.473-1.325 2.473-3.101 0-1.927-1.721-2.732-3.47-2.732z"/>
3
+ </svg>