@devtron-labs/devtron-fe-common-lib 0.0.13 → 0.0.16-beta-2

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.
@@ -1,4 +1,21 @@
1
1
  import React from 'react';
2
+ export interface InputDetailType {
3
+ label: string;
4
+ defaultValue: string;
5
+ placeholder: string;
6
+ }
7
+ export interface RegistryTypeDetailType {
8
+ value: string;
9
+ label: string;
10
+ desiredFormat: string;
11
+ placeholderText: string;
12
+ gettingStartedLink: string;
13
+ defaultRegistryURL: string;
14
+ registryURL: InputDetailType;
15
+ id: InputDetailType;
16
+ password: InputDetailType;
17
+ }
18
+ export declare const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType>;
2
19
  export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
3
20
  interface ConditionalWrapper<T> {
4
21
  condition: boolean;
@@ -267,6 +267,7 @@ export interface CommonNodeAttr {
267
267
  showPluginWarning?: boolean;
268
268
  helmPackageName?: string;
269
269
  isVirtualEnvironment?: boolean;
270
+ deploymentAppType?: DeploymentAppTypes;
270
271
  isCITriggerBlocked?: boolean;
271
272
  ciBlockState?: {
272
273
  action: any;
@@ -275,6 +276,12 @@ export interface CommonNodeAttr {
275
276
  appReleaseTagNames?: string[];
276
277
  tagsEditable?: boolean;
277
278
  }
279
+ export declare enum DeploymentAppTypes {
280
+ HELM = "helm",
281
+ GITOPS = "argo_cd",
282
+ MANIFEST_DOWNLOAD = "manifest_download",
283
+ MANIFEST_PUSH = "manifest_push"
284
+ }
278
285
  export interface VulnerabilityType {
279
286
  name: string;
280
287
  severity: 'CRITICAL' | 'MODERATE' | 'LOW';
@@ -306,5 +313,6 @@ export interface CDMaterialResponseType {
306
313
  requestedUserId: number;
307
314
  tagsEditable: boolean;
308
315
  appReleaseTagNames: string[];
316
+ hideImageTaggingHardDelete: boolean;
309
317
  }
310
318
  export {};
package/dist/index.js CHANGED
@@ -255,7 +255,14 @@ exports.DeploymentNodeType = void 0;
255
255
  DeploymentNodeType["CD"] = "CD";
256
256
  DeploymentNodeType["POSTCD"] = "POSTCD";
257
257
  DeploymentNodeType["APPROVAL"] = "APPROVAL";
258
- })(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
258
+ })(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
259
+ exports.DeploymentAppTypes = void 0;
260
+ (function (DeploymentAppTypes) {
261
+ DeploymentAppTypes["HELM"] = "helm";
262
+ DeploymentAppTypes["GITOPS"] = "argo_cd";
263
+ DeploymentAppTypes["MANIFEST_DOWNLOAD"] = "manifest_download";
264
+ DeploymentAppTypes["MANIFEST_PUSH"] = "manifest_push";
265
+ })(exports.DeploymentAppTypes || (exports.DeploymentAppTypes = {}));
259
266
 
260
267
  var responseMessages = {
261
268
  100: 'Continue',
@@ -9659,6 +9666,169 @@ toast.configure({
9659
9666
  toastClassName: 'devtron-toast',
9660
9667
  bodyClassName: 'devtron-toast__body',
9661
9668
  });
9669
+ var REGISTRY_TYPE_MAP = {
9670
+ ecr: {
9671
+ value: 'ecr',
9672
+ label: 'ECR',
9673
+ desiredFormat: '(desired format: repo-name)',
9674
+ placeholderText: 'Eg. repo_name',
9675
+ gettingStartedLink: 'https://docs.aws.amazon.com/AmazonECR/latest/userguide/get-set-up-for-amazon-ecr.html',
9676
+ defaultRegistryURL: '',
9677
+ registryURL: {
9678
+ label: 'Registry URL',
9679
+ defaultValue: '',
9680
+ placeholder: 'Eg. xxxxxxxxxxxx.dkr.ecr.region.amazonaws.com',
9681
+ },
9682
+ id: {
9683
+ label: 'Access key ID',
9684
+ defaultValue: '',
9685
+ placeholder: '',
9686
+ },
9687
+ password: {
9688
+ label: 'Secret access key',
9689
+ defaultValue: '',
9690
+ placeholder: '',
9691
+ },
9692
+ },
9693
+ 'docker-hub': {
9694
+ value: 'docker-hub',
9695
+ label: 'Docker',
9696
+ desiredFormat: '(desired format: username/repo-name)',
9697
+ placeholderText: 'Eg. username/repo_name',
9698
+ gettingStartedLink: 'https://docs.docker.com/docker-hub/',
9699
+ defaultRegistryURL: 'docker.io',
9700
+ registryURL: {
9701
+ label: 'Registry URL',
9702
+ defaultValue: 'docker.io',
9703
+ placeholder: '',
9704
+ },
9705
+ id: {
9706
+ label: 'Username',
9707
+ defaultValue: '',
9708
+ placeholder: '',
9709
+ },
9710
+ password: {
9711
+ label: 'Password/Token (Recommended: Token)',
9712
+ defaultValue: '',
9713
+ placeholder: '',
9714
+ },
9715
+ },
9716
+ acr: {
9717
+ value: 'acr',
9718
+ label: 'Azure',
9719
+ desiredFormat: '(desired format: repo-name)',
9720
+ placeholderText: 'Eg. repo_name',
9721
+ gettingStartedLink: 'https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal',
9722
+ defaultRegistryURL: '',
9723
+ registryURL: {
9724
+ label: 'Registry URL/Login Server',
9725
+ defaultValue: '',
9726
+ placeholder: 'Eg. xxx.azurecr.io',
9727
+ },
9728
+ id: {
9729
+ label: 'Username/Registry Name',
9730
+ defaultValue: '',
9731
+ placeholder: '',
9732
+ },
9733
+ password: {
9734
+ label: 'Password',
9735
+ defaultValue: '',
9736
+ placeholder: '',
9737
+ },
9738
+ },
9739
+ 'artifact-registry': {
9740
+ value: 'artifact-registry',
9741
+ label: 'Artifact Registry (GCP)',
9742
+ desiredFormat: '(desired format: project-id/artifacts-repo/repo-name)',
9743
+ placeholderText: 'Eg. project-id/artifacts-repo/repo-name',
9744
+ gettingStartedLink: 'https://cloud.google.com/artifact-registry/docs/manage-repos?hl=en_US',
9745
+ defaultRegistryURL: '',
9746
+ registryURL: {
9747
+ label: 'Registry URL',
9748
+ defaultValue: '',
9749
+ placeholder: 'Eg. region-docker.pkg.dev',
9750
+ },
9751
+ id: {
9752
+ label: 'Username',
9753
+ defaultValue: '_json_key',
9754
+ placeholder: '',
9755
+ },
9756
+ password: {
9757
+ label: 'Service Account JSON File',
9758
+ defaultValue: '',
9759
+ placeholder: 'Paste json file content here',
9760
+ },
9761
+ },
9762
+ gcr: {
9763
+ value: 'gcr',
9764
+ label: 'GCR',
9765
+ desiredFormat: '(desired format: project-id/repo-name)',
9766
+ placeholderText: 'Eg. project-id/repo_name',
9767
+ gettingStartedLink: 'https://cloud.google.com/container-registry/docs/quickstart',
9768
+ defaultRegistryURL: 'gcr.io',
9769
+ registryURL: {
9770
+ label: 'Registry URL',
9771
+ defaultValue: 'gcr.io',
9772
+ placeholder: '',
9773
+ },
9774
+ id: {
9775
+ label: 'Username',
9776
+ defaultValue: '_json_key',
9777
+ placeholder: '',
9778
+ },
9779
+ password: {
9780
+ label: 'Service Account JSON File',
9781
+ defaultValue: '',
9782
+ placeholder: 'Paste json file content here',
9783
+ },
9784
+ },
9785
+ quay: {
9786
+ value: 'quay',
9787
+ label: 'Quay',
9788
+ desiredFormat: '(desired format: username/repo-name)',
9789
+ placeholderText: 'Eg. username/repo_name',
9790
+ gettingStartedLink: '',
9791
+ defaultRegistryURL: 'quay.io',
9792
+ registryURL: {
9793
+ label: 'Registry URL',
9794
+ defaultValue: 'quay.io',
9795
+ placeholder: '',
9796
+ },
9797
+ id: {
9798
+ label: 'Username',
9799
+ defaultValue: '',
9800
+ placeholder: '',
9801
+ },
9802
+ password: {
9803
+ label: 'Token',
9804
+ defaultValue: '',
9805
+ placeholder: '',
9806
+ },
9807
+ },
9808
+ other: {
9809
+ value: 'other',
9810
+ label: 'Other',
9811
+ desiredFormat: '',
9812
+ placeholderText: '',
9813
+ gettingStartedLink: '',
9814
+ defaultRegistryURL: '',
9815
+ registryURL: {
9816
+ label: 'Registry URL',
9817
+ defaultValue: '',
9818
+ placeholder: '',
9819
+ },
9820
+ id: {
9821
+ label: 'Username',
9822
+ defaultValue: '',
9823
+ placeholder: '',
9824
+ },
9825
+ password: {
9826
+ label: 'Password/Token',
9827
+ defaultValue: '',
9828
+ placeholder: '',
9829
+ },
9830
+ },
9831
+ };
9662
9832
  function showError(serverError, showToastOnUnknownError, hideAccessError) {
9663
9833
  if (showToastOnUnknownError === void 0) { showToastOnUnknownError = true; }
9664
9834
  if (hideAccessError === void 0) { hideAccessError = false; }
@@ -22780,7 +22950,7 @@ var ImageTagsContainer = function (_a) {
22780
22950
  lowercaseValue.length >= 128 ||
22781
22951
  lowercaseValue[0] == '.' ||
22782
22952
  lowercaseValue[0] == '-') {
22783
- setTagErrorMessage('tag name cannot be empty or exceed 128 characters or cannot start with . or -');
22953
+ setTagErrorMessage('Tag name cannot be empty or exceed 128 characters or cannot start with . or -');
22784
22954
  return false;
22785
22955
  }
22786
22956
  setTagErrorMessage('');
@@ -22807,11 +22977,14 @@ var ImageTagsContainer = function (_a) {
22807
22977
  artifactId: 0,
22808
22978
  duplicateTag: false,
22809
22979
  };
22810
- setCreateTags(__spreadArray(__spreadArray([], __read(createTags), false), [newTag], false));
22980
+ var newCreateTags = __spreadArray(__spreadArray([], __read(createTags), false), [newTag], false);
22981
+ setCreateTags(newCreateTags);
22811
22982
  setDisplayedTags(__spreadArray(__spreadArray([], __read(displayedTags), false), [newTag], false));
22812
22983
  setShowTagsWarning(true);
22813
22984
  setTextInput('');
22985
+ return newCreateTags;
22814
22986
  }
22987
+ return createTags;
22815
22988
  };
22816
22989
  var handleTagSoftDelete = function (index) {
22817
22990
  var updatedTags = __spreadArray([], __read(displayedTags), false);
@@ -22865,13 +23038,13 @@ var ImageTagsContainer = function (_a) {
22865
23038
  setDisplayedTags(displayList);
22866
23039
  });
22867
23040
  };
22868
- var handleSave = function () { return __awaiter(void 0, void 0, void 0, function () {
23041
+ var handleSave = function (tagsToBeCreated) { return __awaiter(void 0, void 0, void 0, function () {
22869
23042
  var payload;
22870
23043
  return __generator(this, function (_a) {
22871
23044
  if (tagErrorMessage)
22872
23045
  return [2 /*return*/];
22873
23046
  payload = {
22874
- createTags: createTags,
23047
+ createTags: tagsToBeCreated,
22875
23048
  softDeleteTags: softDeleteTags,
22876
23049
  imageComment: {
22877
23050
  id: 0,
@@ -22925,7 +23098,7 @@ var ImageTagsContainer = function (_a) {
22925
23098
  });
22926
23099
  }); };
22927
23100
  var renderInfoCard = function () {
22928
- return (jsxRuntime.jsx(TippyCustomized, __assign({ theme: exports.TippyTheme.white, className: "w-300 fcv-5", placement: "right", Icon: SvgIcHelp, heading: "Release tags", showCloseButton: true, trigger: "click", interactive: true, additionalContent: getBuildContextAdditionalContent() }, { children: jsxRuntime.jsx("div", __assign({ className: "icon-dim-16 fcn-5 ml-8 cursor" }, { children: jsxRuntime.jsx(SvgIcHelpOutline, {}) })) })));
23101
+ return (jsxRuntime.jsx(TippyCustomized, __assign({ theme: exports.TippyTheme.white, className: "w-300 fcv-5", placement: "right", Icon: SvgIcHelp, heading: "Release tags", showCloseButton: true, trigger: "click", interactive: true, additionalContent: getBuildContextAdditionalContent() }, { children: jsxRuntime.jsx("div", __assign({ className: "flex" }, { children: jsxRuntime.jsx(SvgIcHelpOutline, { className: "fcn-5 ml-8 cursor icon-dim-16" }) })) })));
22929
23102
  };
22930
23103
  var getBuildContextAdditionalContent = function () {
22931
23104
  return (jsxRuntime.jsxs("div", __assign({ className: "h-250 fs-13 dc__overflow-scroll p-12" }, { children: [jsxRuntime.jsx("div", { children: "Release tags allow you to tag container images with readable and relatable tags eg. v1.0." }), jsxRuntime.jsxs("ul", __assign({ className: "pl-20 mt-8" }, { children: [jsxRuntime.jsx("li", { children: "A release tag can only be added if a workflow has CD pipelines deploying to Production environments." }), jsxRuntime.jsx("li", { children: "Multiple tags can be added to an image." }), jsxRuntime.jsx("li", { children: "Multiple images in an application cannot have the same tag." }), jsxRuntime.jsx("li", { children: "Tags cannot be deleted once saved. Although, you can soft delete a tag if an unwanted tag has been added." })] }))] })));
@@ -22950,12 +23123,13 @@ var ImageTagsContainer = function (_a) {
22950
23123
  }
22951
23124
  };
22952
23125
  var onClickSave = function () {
23126
+ var tagsToBeCreated = createTags;
22953
23127
  if (textInput.trim()) {
22954
- handleTagCreate(textInput);
23128
+ tagsToBeCreated = handleTagCreate(textInput);
22955
23129
  }
22956
- handleSave();
23130
+ handleSave(tagsToBeCreated);
22957
23131
  };
22958
- return (jsxRuntime.jsx("div", __assign({ className: "mt-8" }, { children: isEditing && tagsEditable ? (jsxRuntime.jsxs("div", __assign({ className: "bcn-0 dc__border-top-n1 " }, { children: [jsxRuntime.jsxs("div", __assign({ className: "cn-7 mt-12 flex left" }, { children: [jsxRuntime.jsx("span", { children: "Release tags (eg. v1.0)" }), jsxRuntime.jsx("div", __assign({ className: "flex row ml-0" }, { children: renderInfoCard() }))] })), jsxRuntime.jsxs("div", __assign({ className: "mt-6 dc__position-rel-imp", "data-testid": "add-tag-text-area" }, { children: [jsxRuntime.jsx("input", { className: "form__input", value: textInput, onChange: setInputValue, placeholder: "Type a tag and press enter", onKeyDown: handleKeydown, ref: creatableRef }), textInput.length > 0 && (jsxRuntime.jsxs("div", __assign({ onClick: enterTagCreate, className: "dc__position-abs bcn-0 flex cursor pt-2 pb-2 pr-4 pl-4 br-2 cn-7 dc__border dc__border-bottom-2", style: {
23132
+ return (jsxRuntime.jsx("div", __assign({ className: "mt-8" }, { children: isEditing && tagsEditable ? (jsxRuntime.jsxs("div", __assign({ className: "bcn-0 dc__border-top-n1 " }, { children: [jsxRuntime.jsxs("div", __assign({ className: "cn-7 mt-12 flex left" }, { children: [jsxRuntime.jsx("div", { children: "Release tags (eg. v1.0)" }), renderInfoCard()] })), jsxRuntime.jsxs("div", __assign({ className: "mt-6 dc__position-rel-imp", "data-testid": "add-tag-text-area" }, { children: [jsxRuntime.jsx("input", { className: "form__input", value: textInput, onChange: setInputValue, placeholder: "Type a tag and press enter", onKeyDown: handleKeydown, onBlur: setInputValue, ref: creatableRef }), textInput.length > 0 && (jsxRuntime.jsxs("div", __assign({ onClick: enterTagCreate, className: "dc__position-abs bcn-0 flex cursor pt-2 pb-2 pr-4 pl-4 br-2 cn-7 dc__border dc__border-bottom-2", style: {
22959
23133
  top: '50%',
22960
23134
  fontFamily: 'monospace',
22961
23135
  right: '8px',
@@ -22972,13 +23146,13 @@ var ImageTagsContainer = function (_a) {
22972
23146
  } }, { children: "Cancel" })), jsxRuntime.jsx("button", __assign({ className: "cta flex h-32 lh-32-imp ml-12", "data-testid": "save-tags-button", type: "button", onClick: function (e) {
22973
23147
  stopPropagation(e);
22974
23148
  onClickSave();
22975
- } }, { children: "Save" }))] }))] }))) : (jsxRuntime.jsxs("div", __assign({ className: "top br-4 bcn-0 image-tags-container flexbox" }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex left image-tag-left-border w-100 mt-8 mb-8 pr-10 pl-10", "data-testid": "image-tags-container-hover" }, { children: jsxRuntime.jsxs("div", __assign({ className: 'w-100' }, { children: [initialDescription && jsxRuntime.jsx("div", __assign({ className: "mb-6 fs-13 dc__word-break-all" }, { children: initialDescription })), jsxRuntime.jsx("div", __assign({ className: "flex-wrap flex left" }, { children: initialTags === null || initialTags === void 0 ? void 0 : initialTags.map(function (tag, index) { return (jsxRuntime.jsx(ImageTagButton, { text: tag === null || tag === void 0 ? void 0 : tag.tagName, isSoftDeleted: tag === null || tag === void 0 ? void 0 : tag.deleted, isEditing: isEditing, onSoftDeleteClick: function (e) {
23149
+ } }, { children: "Save" }))] }))] }))) : (jsxRuntime.jsxs("div", __assign({ className: "top br-4 bcn-0 image-tags-container flexbox" }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex left image-tag-left-border w-100 mt-8 mb-8 pr-10 pl-10", "data-testid": "image-tags-container-hover" }, { children: jsxRuntime.jsxs("div", __assign({ className: 'w-100' }, { children: [initialDescription && jsxRuntime.jsx("div", __assign({ className: "mb-6 fs-13 lh-20 dc__word-break-all" }, { children: initialDescription })), jsxRuntime.jsx("div", __assign({ className: "flex-wrap flex left" }, { children: initialTags === null || initialTags === void 0 ? void 0 : initialTags.map(function (tag, index) { return (jsxRuntime.jsx(ImageTagButton, { text: tag === null || tag === void 0 ? void 0 : tag.tagName, isSoftDeleted: tag === null || tag === void 0 ? void 0 : tag.deleted, isEditing: isEditing, onSoftDeleteClick: function (e) {
22976
23150
  stopPropagation(e);
22977
23151
  handleTagSoftDelete(index);
22978
23152
  }, onHardDeleteClick: function (e) {
22979
23153
  stopPropagation(e);
22980
23154
  handleTagHardDelete(index);
22981
- }, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag === null || tag === void 0 ? void 0 : tag.id)); }) }))] })) })), jsxRuntime.jsx("div", __assign({ className: "mt-8 mr-6 icon-dim-16" }, { children: tagsEditable && (jsxRuntime.jsx(SvgIcPencil, { className: "icon-dim-16 image-tags-container-edit__icon cursor", "data-testid": "edit-tags-icon", onClick: function (e) {
23155
+ }, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag === null || tag === void 0 ? void 0 : tag.id)); }) }))] })) })), jsxRuntime.jsx("div", __assign({ className: "mt-8 mr-10 icon-dim-16" }, { children: tagsEditable && (jsxRuntime.jsx(SvgIcPencil, { className: "icon-dim-16 image-tags-container-edit__icon cursor", "data-testid": "edit-tags-icon", onClick: function (e) {
22982
23156
  stopPropagation(e);
22983
23157
  handleEditClick();
22984
23158
  } })) }))] }))) })));
@@ -22999,7 +23173,7 @@ var ImageTagButton = function (_a) {
22999
23173
  return 'cn-9';
23000
23174
  }
23001
23175
  };
23002
- return (jsxRuntime.jsxs("div", __assign({ className: "br-4 en-2 bw-1 mr-8 bcn-0 mb-4 pt-2 pr-8 pb-2 pl-8 tag-class dc__word-break-all flex ".concat(isEditing ? 'icon-hover' : '', " ").concat(tabColor()) }, { children: [duplicateTag ? (jsxRuntime.jsx(SvgIcErrorExclamation, { className: "icon-dim-12 mr-4" })) : (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag' }, { children: jsxRuntime.jsx("div", __assign({ className: "action-icon mr-4 lh-16 pt-3 ".concat(isInSoftDeleteTags || (tagId !== 0 && !isSoftDeleted) ? 'show-icon' : '') }, { children: jsxRuntime.jsx(IconComponent, { className: "icon-dim-12 cursor".concat(isSoftDeleted ? 'scn-6' : 'fcn-6', " "), "data-testid": "".concat(text, "-tag-soft-delete"), onClick: onSoftDeleteClick }) })) }))), text, jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: "Remove tag" }, { children: jsxRuntime.jsx("div", __assign({ className: "action-icon ml-4 lh-16 pt-3 ".concat(canTagBeHardDelete ? 'show-icon' : '') }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-12 fcn-6 cursor", "data-testid": "".concat(text, "-tag-hard-delete"), onClick: onHardDeleteClick }) })) }))] })));
23176
+ return (jsxRuntime.jsxs("div", __assign({ className: "br-4 en-2 bw-1 mr-8 bcn-0 mb-4 pt-2 pr-8 pb-2 pl-8 tag-class dc__word-break-all flex ".concat(isEditing ? 'icon-hover' : '', " ").concat(tabColor()) }, { children: [duplicateTag ? (jsxRuntime.jsx(SvgIcErrorExclamation, { className: "icon-dim-12 mr-4" })) : (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag' }, { children: jsxRuntime.jsx("div", __assign({ className: "action-icon mr-4 lh-16 pt-3 ".concat(isInSoftDeleteTags || (tagId !== 0 && !isSoftDeleted) ? 'show-icon' : '') }, { children: jsxRuntime.jsx(IconComponent, { className: "icon-dim-12 cursor ".concat(isSoftDeleted ? 'scn-6' : 'fcn-6', " "), "data-testid": "".concat(text, "-tag-soft-delete"), onClick: onSoftDeleteClick }) })) }))), text, jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: "Remove tag" }, { children: jsxRuntime.jsx("div", __assign({ className: "action-icon ml-4 lh-16 pt-3 ".concat(canTagBeHardDelete ? 'show-icon' : '') }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-12 fcn-6 cursor", "data-testid": "".concat(text, "-tag-hard-delete"), onClick: onHardDeleteClick }) })) }))] })));
23003
23177
  };
23004
23178
  var AddImageButton = function (_a) {
23005
23179
  var handleEditClick = _a.handleEditClick;
@@ -23049,6 +23223,7 @@ exports.PATTERNS = PATTERNS;
23049
23223
  exports.PopupMenu = PopupMenu;
23050
23224
  exports.Progressing = Progressing;
23051
23225
  exports.PropagateTagInfo = PropagateTagInfo;
23226
+ exports.REGISTRY_TYPE_MAP = REGISTRY_TYPE_MAP;
23052
23227
  exports.ROUTES = ROUTES;
23053
23228
  exports.RadioGroup = RadioGroup$1;
23054
23229
  exports.RadioGroupItem = RadioGroupItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.13",
3
+ "version": "0.0.16-beta-2",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -18,6 +18,189 @@ toast.configure({
18
18
  bodyClassName: 'devtron-toast__body',
19
19
  })
20
20
 
21
+ export interface InputDetailType {
22
+ label: string
23
+ defaultValue: string
24
+ placeholder: string
25
+ }
26
+
27
+ export interface RegistryTypeDetailType {
28
+ value: string
29
+ label: string
30
+ desiredFormat: string
31
+ placeholderText: string
32
+ gettingStartedLink: string
33
+ defaultRegistryURL: string
34
+ registryURL: InputDetailType
35
+ id: InputDetailType
36
+ password: InputDetailType
37
+ }
38
+
39
+ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
40
+ ecr: {
41
+ value: 'ecr',
42
+ label: 'ECR',
43
+ desiredFormat: '(desired format: repo-name)',
44
+ placeholderText: 'Eg. repo_name',
45
+ gettingStartedLink: 'https://docs.aws.amazon.com/AmazonECR/latest/userguide/get-set-up-for-amazon-ecr.html',
46
+ defaultRegistryURL: '',
47
+ registryURL: {
48
+ label: 'Registry URL',
49
+ defaultValue: '',
50
+ placeholder: 'Eg. xxxxxxxxxxxx.dkr.ecr.region.amazonaws.com',
51
+ },
52
+ id: {
53
+ label: 'Access key ID',
54
+ defaultValue: '',
55
+ placeholder: '',
56
+ },
57
+ password: {
58
+ label: 'Secret access key',
59
+ defaultValue: '',
60
+ placeholder: '',
61
+ },
62
+ },
63
+ 'docker-hub': {
64
+ value: 'docker-hub',
65
+ label: 'Docker',
66
+ desiredFormat: '(desired format: username/repo-name)',
67
+ placeholderText: 'Eg. username/repo_name',
68
+ gettingStartedLink: 'https://docs.docker.com/docker-hub/',
69
+ defaultRegistryURL: 'docker.io',
70
+ registryURL: {
71
+ label: 'Registry URL',
72
+ defaultValue: 'docker.io',
73
+ placeholder: '',
74
+ },
75
+ id: {
76
+ label: 'Username',
77
+ defaultValue: '',
78
+ placeholder: '',
79
+ },
80
+ password: {
81
+ label: 'Password/Token (Recommended: Token)',
82
+ defaultValue: '',
83
+ placeholder: '',
84
+ },
85
+ },
86
+ acr: {
87
+ value: 'acr',
88
+ label: 'Azure',
89
+ desiredFormat: '(desired format: repo-name)',
90
+ placeholderText: 'Eg. repo_name',
91
+ gettingStartedLink:
92
+ 'https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal',
93
+ defaultRegistryURL: '',
94
+ registryURL: {
95
+ label: 'Registry URL/Login Server',
96
+ defaultValue: '',
97
+ placeholder: 'Eg. xxx.azurecr.io',
98
+ },
99
+ id: {
100
+ label: 'Username/Registry Name',
101
+ defaultValue: '',
102
+ placeholder: '',
103
+ },
104
+ password: {
105
+ label: 'Password',
106
+ defaultValue: '',
107
+ placeholder: '',
108
+ },
109
+ },
110
+ 'artifact-registry': {
111
+ value: 'artifact-registry',
112
+ label: 'Artifact Registry (GCP)',
113
+ desiredFormat: '(desired format: project-id/artifacts-repo/repo-name)',
114
+ placeholderText: 'Eg. project-id/artifacts-repo/repo-name',
115
+ gettingStartedLink: 'https://cloud.google.com/artifact-registry/docs/manage-repos?hl=en_US',
116
+ defaultRegistryURL: '',
117
+ registryURL: {
118
+ label: 'Registry URL',
119
+ defaultValue: '',
120
+ placeholder: 'Eg. region-docker.pkg.dev',
121
+ },
122
+ id: {
123
+ label: 'Username',
124
+ defaultValue: '_json_key',
125
+ placeholder: '',
126
+ },
127
+ password: {
128
+ label: 'Service Account JSON File',
129
+ defaultValue: '',
130
+ placeholder: 'Paste json file content here',
131
+ },
132
+ },
133
+ gcr: {
134
+ value: 'gcr',
135
+ label: 'GCR',
136
+ desiredFormat: '(desired format: project-id/repo-name)',
137
+ placeholderText: 'Eg. project-id/repo_name',
138
+ gettingStartedLink: 'https://cloud.google.com/container-registry/docs/quickstart',
139
+ defaultRegistryURL: 'gcr.io',
140
+ registryURL: {
141
+ label: 'Registry URL',
142
+ defaultValue: 'gcr.io',
143
+ placeholder: '',
144
+ },
145
+ id: {
146
+ label: 'Username',
147
+ defaultValue: '_json_key',
148
+ placeholder: '',
149
+ },
150
+ password: {
151
+ label: 'Service Account JSON File',
152
+ defaultValue: '',
153
+ placeholder: 'Paste json file content here',
154
+ },
155
+ },
156
+ quay: {
157
+ value: 'quay',
158
+ label: 'Quay',
159
+ desiredFormat: '(desired format: username/repo-name)',
160
+ placeholderText: 'Eg. username/repo_name',
161
+ gettingStartedLink: '',
162
+ defaultRegistryURL: 'quay.io',
163
+ registryURL: {
164
+ label: 'Registry URL',
165
+ defaultValue: 'quay.io',
166
+ placeholder: '',
167
+ },
168
+ id: {
169
+ label: 'Username',
170
+ defaultValue: '',
171
+ placeholder: '',
172
+ },
173
+ password: {
174
+ label: 'Token',
175
+ defaultValue: '',
176
+ placeholder: '',
177
+ },
178
+ },
179
+ other: {
180
+ value: 'other',
181
+ label: 'Other',
182
+ desiredFormat: '',
183
+ placeholderText: '',
184
+ gettingStartedLink: '',
185
+ defaultRegistryURL: '',
186
+ registryURL: {
187
+ label: 'Registry URL',
188
+ defaultValue: '',
189
+ placeholder: '',
190
+ },
191
+ id: {
192
+ label: 'Username',
193
+ defaultValue: '',
194
+ placeholder: '',
195
+ },
196
+ password: {
197
+ label: 'Password/Token',
198
+ defaultValue: '',
199
+ placeholder: '',
200
+ },
201
+ },
202
+ }
203
+
21
204
  export function showError(serverError, showToastOnUnknownError = true, hideAccessError = false) {
22
205
  if (serverError instanceof ServerErrors && Array.isArray(serverError.errors)) {
23
206
  serverError.errors.map(({ userMessage, internalMessage }) => {
@@ -114,7 +114,7 @@ export const ImageTagsContainer = ({
114
114
  lowercaseValue[0] == '.' ||
115
115
  lowercaseValue[0] == '-'
116
116
  ) {
117
- setTagErrorMessage('tag name cannot be empty or exceed 128 characters or cannot start with . or -')
117
+ setTagErrorMessage('Tag name cannot be empty or exceed 128 characters or cannot start with . or -')
118
118
  return false
119
119
  }
120
120
  setTagErrorMessage('')
@@ -130,7 +130,7 @@ export const ImageTagsContainer = ({
130
130
  return true
131
131
  }
132
132
 
133
- const handleTagCreate = (newValue) => {
133
+ const handleTagCreate = (newValue) : ReleaseTag[] => {
134
134
  const lowercaseValue = newValue.toLowerCase().trim()
135
135
  if(validateTag(lowercaseValue)) {
136
136
  const newTag: ReleaseTag = {
@@ -141,11 +141,14 @@ export const ImageTagsContainer = ({
141
141
  artifactId: 0,
142
142
  duplicateTag: false,
143
143
  }
144
- setCreateTags([...createTags, newTag])
144
+ const newCreateTags = [...createTags, newTag]
145
+ setCreateTags(newCreateTags)
145
146
  setDisplayedTags([...displayedTags, newTag])
146
147
  setShowTagsWarning(true)
147
148
  setTextInput('')
149
+ return newCreateTags
148
150
  }
151
+ return createTags
149
152
  }
150
153
 
151
154
  const handleTagSoftDelete = (index) => {
@@ -208,11 +211,11 @@ export const ImageTagsContainer = ({
208
211
  })
209
212
  }
210
213
 
211
- const handleSave = async () => {
214
+ const handleSave = async (tagsToBeCreated: ReleaseTag[]) => {
212
215
  if (tagErrorMessage) return
213
216
 
214
217
  const payload = {
215
- createTags: createTags,
218
+ createTags: tagsToBeCreated,
216
219
  softDeleteTags: softDeleteTags,
217
220
  imageComment: {
218
221
  id: 0,
@@ -274,8 +277,8 @@ export const ImageTagsContainer = ({
274
277
  interactive={true}
275
278
  additionalContent={getBuildContextAdditionalContent()}
276
279
  >
277
- <div className="icon-dim-16 fcn-5 ml-8 cursor">
278
- <Question />
280
+ <div className="flex">
281
+ <Question className="fcn-5 ml-8 cursor icon-dim-16"/>
279
282
  </div>
280
283
  </TippyCustomized>
281
284
  )
@@ -332,10 +335,11 @@ export const ImageTagsContainer = ({
332
335
  }
333
336
 
334
337
  const onClickSave = () => {
338
+ let tagsToBeCreated = createTags
335
339
  if (textInput.trim()) {
336
- handleTagCreate(textInput)
340
+ tagsToBeCreated = handleTagCreate(textInput)
337
341
  }
338
- handleSave()
342
+ handleSave(tagsToBeCreated)
339
343
  }
340
344
 
341
345
  return (
@@ -343,8 +347,8 @@ export const ImageTagsContainer = ({
343
347
  {isEditing && tagsEditable ? (
344
348
  <div className="bcn-0 dc__border-top-n1 ">
345
349
  <div className="cn-7 mt-12 flex left">
346
- <span>Release tags (eg. v1.0)</span>
347
- <div className="flex row ml-0">{renderInfoCard()}</div>
350
+ <div>Release tags (eg. v1.0)</div>
351
+ {renderInfoCard()}
348
352
  </div>
349
353
  <div className="mt-6 dc__position-rel-imp" data-testid="add-tag-text-area">
350
354
  <input
@@ -353,6 +357,7 @@ export const ImageTagsContainer = ({
353
357
  onChange={setInputValue}
354
358
  placeholder="Type a tag and press enter"
355
359
  onKeyDown={handleKeydown}
360
+ onBlur={setInputValue}
356
361
  ref={creatableRef}
357
362
  />
358
363
  {textInput.length > 0 && (
@@ -456,7 +461,7 @@ export const ImageTagsContainer = ({
456
461
  data-testid="image-tags-container-hover"
457
462
  >
458
463
  <div className='w-100'>
459
- {initialDescription && <div className="mb-6 fs-13 dc__word-break-all">{initialDescription}</div>}
464
+ {initialDescription && <div className="mb-6 fs-13 lh-20 dc__word-break-all">{initialDescription}</div>}
460
465
  <div className="flex-wrap flex left">
461
466
  {initialTags?.map((tag, index) => (
462
467
  <ImageTagButton
@@ -482,7 +487,7 @@ export const ImageTagsContainer = ({
482
487
  </div>
483
488
  </div>
484
489
  </div>
485
- <div className="mt-8 mr-6 icon-dim-16">
490
+ <div className="mt-8 mr-10 icon-dim-16">
486
491
  {tagsEditable && (
487
492
  <EditIcon
488
493
  className="icon-dim-16 image-tags-container-edit__icon cursor"
@@ -547,7 +552,7 @@ export const ImageTagButton = ({
547
552
  }`}
548
553
  >
549
554
  <IconComponent
550
- className={`icon-dim-12 cursor${isSoftDeleted ? 'scn-6' : 'fcn-6'} `}
555
+ className={`icon-dim-12 cursor ${isSoftDeleted ? 'scn-6' : 'fcn-6'} `}
551
556
  data-testid={`${text}-tag-soft-delete`}
552
557
  onClick={onSoftDeleteClick}
553
558
  />
@@ -292,6 +292,7 @@ export interface CommonNodeAttr {
292
292
  showPluginWarning?: boolean
293
293
  helmPackageName?: string
294
294
  isVirtualEnvironment?: boolean
295
+ deploymentAppType?: DeploymentAppTypes
295
296
  isCITriggerBlocked?: boolean
296
297
  ciBlockState?: {
297
298
  action: any,
@@ -301,6 +302,13 @@ export interface CommonNodeAttr {
301
302
  tagsEditable?: boolean
302
303
  }
303
304
 
305
+ export enum DeploymentAppTypes {
306
+ HELM = 'helm',
307
+ GITOPS = 'argo_cd',
308
+ MANIFEST_DOWNLOAD = 'manifest_download',
309
+ MANIFEST_PUSH='manifest_push'
310
+ }
311
+
304
312
  export interface VulnerabilityType {
305
313
  name: string
306
314
  severity: 'CRITICAL' | 'MODERATE' | 'LOW'
@@ -335,6 +343,7 @@ export interface CDMaterialResponseType {
335
343
  requestedUserId: number
336
344
  tagsEditable: boolean
337
345
  appReleaseTagNames: string[]
346
+ hideImageTaggingHardDelete: boolean
338
347
  }
339
348
 
340
349