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

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
@@ -22798,9 +22798,7 @@ var ImageTagsContainer = function (_a) {
22798
22798
  };
22799
22799
  var handleTagCreate = function (newValue) {
22800
22800
  var lowercaseValue = newValue.toLowerCase().trim();
22801
- console.log("handleTagCreate,outside validation : ");
22802
22801
  if (validateTag(lowercaseValue)) {
22803
- console.log("handleTagCreate,inside validation : ");
22804
22802
  var newTag = {
22805
22803
  id: 0,
22806
22804
  tagName: lowercaseValue,
@@ -22809,11 +22807,14 @@ var ImageTagsContainer = function (_a) {
22809
22807
  artifactId: 0,
22810
22808
  duplicateTag: false,
22811
22809
  };
22812
- setCreateTags(__spreadArray(__spreadArray([], __read(createTags), false), [newTag], false));
22810
+ var newCreateTags = __spreadArray(__spreadArray([], __read(createTags), false), [newTag], false);
22811
+ setCreateTags(newCreateTags);
22813
22812
  setDisplayedTags(__spreadArray(__spreadArray([], __read(displayedTags), false), [newTag], false));
22814
22813
  setShowTagsWarning(true);
22815
22814
  setTextInput('');
22815
+ return newCreateTags;
22816
22816
  }
22817
+ return createTags;
22817
22818
  };
22818
22819
  var handleTagSoftDelete = function (index) {
22819
22820
  var updatedTags = __spreadArray([], __read(displayedTags), false);
@@ -22867,13 +22868,13 @@ var ImageTagsContainer = function (_a) {
22867
22868
  setDisplayedTags(displayList);
22868
22869
  });
22869
22870
  };
22870
- var handleSave = function () { return __awaiter(void 0, void 0, void 0, function () {
22871
+ var handleSave = function (tagsToBeCreated) { return __awaiter(void 0, void 0, void 0, function () {
22871
22872
  var payload;
22872
22873
  return __generator(this, function (_a) {
22873
22874
  if (tagErrorMessage)
22874
22875
  return [2 /*return*/];
22875
22876
  payload = {
22876
- createTags: createTags,
22877
+ createTags: tagsToBeCreated,
22877
22878
  softDeleteTags: softDeleteTags,
22878
22879
  imageComment: {
22879
22880
  id: 0,
@@ -22942,8 +22943,6 @@ var ImageTagsContainer = function (_a) {
22942
22943
  }
22943
22944
  };
22944
22945
  var setInputValue = function (e) {
22945
- console.log("setInputValue: ");
22946
- console.log(e.target.value);
22947
22946
  e.target.value && validateTag(e.target.value);
22948
22947
  setTextInput(e.target.value);
22949
22948
  };
@@ -22954,12 +22953,11 @@ var ImageTagsContainer = function (_a) {
22954
22953
  }
22955
22954
  };
22956
22955
  var onClickSave = function () {
22957
- console.log("onClickSave: ");
22958
- console.log(textInput);
22956
+ var tagsToBeCreated = createTags;
22959
22957
  if (textInput.trim()) {
22960
- handleTagCreate(textInput);
22958
+ tagsToBeCreated = handleTagCreate(textInput);
22961
22959
  }
22962
- handleSave();
22960
+ handleSave(tagsToBeCreated);
22963
22961
  };
22964
22962
  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, 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: {
22965
22963
  top: '50%',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.13-beta-2",
3
+ "version": "0.0.13-beta-3",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -130,11 +130,9 @@ 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
- console.log("handleTagCreate,outside validation : ")
136
135
  if(validateTag(lowercaseValue)) {
137
- console.log("handleTagCreate,inside validation : ")
138
136
  const newTag: ReleaseTag = {
139
137
  id: 0,
140
138
  tagName: lowercaseValue,
@@ -143,11 +141,14 @@ export const ImageTagsContainer = ({
143
141
  artifactId: 0,
144
142
  duplicateTag: false,
145
143
  }
146
- setCreateTags([...createTags, newTag])
144
+ const newCreateTags = [...createTags, newTag]
145
+ setCreateTags(newCreateTags)
147
146
  setDisplayedTags([...displayedTags, newTag])
148
147
  setShowTagsWarning(true)
149
148
  setTextInput('')
149
+ return newCreateTags
150
150
  }
151
+ return createTags
151
152
  }
152
153
 
153
154
  const handleTagSoftDelete = (index) => {
@@ -210,11 +211,11 @@ export const ImageTagsContainer = ({
210
211
  })
211
212
  }
212
213
 
213
- const handleSave = async () => {
214
+ const handleSave = async (tagsToBeCreated: ReleaseTag[]) => {
214
215
  if (tagErrorMessage) return
215
216
 
216
217
  const payload = {
217
- createTags: createTags,
218
+ createTags: tagsToBeCreated,
218
219
  softDeleteTags: softDeleteTags,
219
220
  imageComment: {
220
221
  id: 0,
@@ -322,8 +323,6 @@ export const ImageTagsContainer = ({
322
323
  }
323
324
 
324
325
  const setInputValue = (e) => {
325
- console.log("setInputValue: ")
326
- console.log(e.target.value)
327
326
  e.target.value && validateTag(e.target.value)
328
327
  setTextInput(e.target.value)
329
328
  }
@@ -336,12 +335,11 @@ export const ImageTagsContainer = ({
336
335
  }
337
336
 
338
337
  const onClickSave = () => {
339
- console.log("onClickSave: ")
340
- console.log(textInput)
338
+ let tagsToBeCreated = createTags
341
339
  if (textInput.trim()) {
342
- handleTagCreate(textInput)
340
+ tagsToBeCreated = handleTagCreate(textInput)
343
341
  }
344
- handleSave()
342
+ handleSave(tagsToBeCreated)
345
343
  }
346
344
 
347
345
  return (