@devtron-labs/devtron-fe-common-lib 0.0.17-beta-9 → 0.0.17-beta-11

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,4 @@
1
- import { TeamList, ResponseType, DeploymentNodeType } from './Types';
1
+ import { TeamList, ResponseType } from './Types';
2
2
  export declare const getTeamListMin: () => Promise<TeamList>;
3
3
  interface UserRole extends ResponseType {
4
4
  result?: {
@@ -8,6 +8,4 @@ interface UserRole extends ResponseType {
8
8
  }
9
9
  export declare function getUserRole(appName?: string): Promise<UserRole>;
10
10
  export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType>;
11
- export declare const getCDMaterials: (cdMaterialId: any, stageType: DeploymentNodeType, abortSignal: AbortSignal, isApprovalNode?: boolean, imageTag?: string) => Promise<any>;
12
- export declare function extractImage(image: string): string;
13
11
  export {};
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { UseSearchString } from './Types';
3
2
  export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
4
3
  interface ConditionalWrapper<T> {
5
4
  condition: boolean;
@@ -41,5 +40,4 @@ export declare function CustomInput({ name, value, error, onChange, onBlur, onFo
41
40
  dataTestid?: string;
42
41
  }): JSX.Element;
43
42
  export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
44
- export declare function useSearchString(): UseSearchString;
45
43
  export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ResizableTextareaProps } from './Types';
3
+ export declare const ResizableTextarea: React.FC<ResizableTextareaProps>;
@@ -332,10 +332,19 @@ export interface RegistryTypeDetailType {
332
332
  id: InputDetailType;
333
333
  password: InputDetailType;
334
334
  }
335
- export interface UseSearchString {
336
- queryParams: URLSearchParams;
337
- searchParams: {
338
- [key: string]: string;
339
- };
335
+ export interface ResizableTextareaProps {
336
+ minHeight?: number;
337
+ maxHeight?: number;
338
+ value?: string;
339
+ onChange?: (e: any) => void;
340
+ onBlur?: (e: any) => void;
341
+ onFocus?: (e: any) => void;
342
+ className?: string;
343
+ placeholder?: string;
344
+ lineHeight?: number;
345
+ padding?: number;
346
+ disabled?: boolean;
347
+ name?: string;
348
+ dataTestId?: string;
340
349
  }
341
350
  export {};
@@ -34,3 +34,4 @@ export * from './Policy.Types';
34
34
  export { default as DeleteComponent } from './DeleteComponentModal/DeleteComponent';
35
35
  export * from './ImageTags';
36
36
  export * from './ImageTags.Types';
37
+ export * from './ResizableTextarea';
package/dist/index.js CHANGED
@@ -2162,6 +2162,7 @@ var AppNotDeployed = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYA
2162
2162
 
2163
2163
  function GenericEmptyState(_a) {
2164
2164
  var title = _a.title, image = _a.image, subTitle = _a.subTitle, isButtonAvailable = _a.isButtonAvailable, classname = _a.classname, styles = _a.styles, heightToDeduct = _a.heightToDeduct, imageType = _a.imageType, renderButton = _a.renderButton, imageClassName = _a.imageClassName, children = _a.children, SvgImage = _a.SvgImage, noImage = _a.noImage;
2165
+ console.log(image);
2165
2166
  return (jsxRuntime.jsxs("div", __assign({ className: "flex column empty-state ".concat(classname ? classname : ''), style: styles, "data-testid": "generic-empty-state" }, (heightToDeduct >= 0 && { style: __assign(__assign({}, styles), { height: "calc(100vh - ".concat(heightToDeduct, "px)") }) }), { children: [!SvgImage ? !noImage && jsxRuntime.jsx("img", { className: imageClassName ? imageClassName : '', src: image || AppNotDeployed, width: imageType === exports.ImageType.Medium ? '200' : '250', height: imageType === exports.ImageType.Medium ? '160' : '200', alt: "empty-state" }) : jsxRuntime.jsx(SvgImage, {}), jsxRuntime.jsx("h4", __assign({ className: "title fw-6 cn-9 mb-8" }, { children: title })), subTitle && jsxRuntime.jsx("p", __assign({ className: "subtitle" }, { children: subTitle })), isButtonAvailable && renderButton(), children] })));
2166
2167
  }
2167
2168
 
@@ -10078,22 +10079,6 @@ function handleUTCTime(ts, isRelativeTime) {
10078
10079
  console.error("Error Parsing Date:", ts);
10079
10080
  }
10080
10081
  return timestamp;
10081
- }
10082
- function useSearchString() {
10083
- var location = reactRouterDom.useLocation();
10084
- var queryParams = React.useMemo(function () {
10085
- var queryParams = new URLSearchParams(location.search);
10086
- return queryParams;
10087
- }, [location]);
10088
- // const searchParams={}
10089
- // for (let [key, value] of queryParams.entries()){
10090
- // searchParams[key]=value
10091
- // }
10092
- var searchParams = Array.from(queryParams.entries()).reduce(function (agg, curr, idx) {
10093
- agg[curr[0]] = curr[1];
10094
- return agg;
10095
- }, {});
10096
- return { queryParams: queryParams, searchParams: searchParams };
10097
10082
  }
10098
10083
 
10099
10084
  function Progressing(_a) {
@@ -22539,82 +22524,11 @@ var getTeamListMin = function () {
22539
22524
  };
22540
22525
  });
22541
22526
  };
22542
- var stageMap = {
22543
- PRECD: 'PRE',
22544
- CD: 'DEPLOY',
22545
- POSTCD: 'POST',
22546
- APPROVAL: 'APPROVAL',
22547
- };
22548
22527
  function getUserRole(appName) {
22549
22528
  return get("".concat(ROUTES.USER_CHECK_ROLE).concat(appName ? "?appName=".concat(appName) : ''));
22550
22529
  }
22551
22530
  function setImageTags(request, pipelineId, artifactId) {
22552
22531
  return post("".concat(ROUTES.IMAGE_TAGGING, "/").concat(pipelineId, "/").concat(artifactId), request);
22553
- }
22554
- var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
22555
- var URL = (!imageTag) ? "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=").concat(stageMap[stageType]) : "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=").concat(stageMap[stageType], "&search=").concat(imageTag);
22556
- return get(URL, {
22557
- signal: abortSignal,
22558
- }).then(function (response) {
22559
- var _a;
22560
- var artifacts = (_a = response.result.ci_artifacts) !== null && _a !== void 0 ? _a : [];
22561
- if (!response.result) {
22562
- return {
22563
- materials: [],
22564
- };
22565
- }
22566
- else {
22567
- var materials = artifacts.map(function (material, index) {
22568
- var artifactStatusValue = '';
22569
- return {
22570
- index: index,
22571
- id: material.id,
22572
- deployedTime: material.deployed_time
22573
- ? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
22574
- : 'Not Deployed',
22575
- deployedBy: material.deployedBy,
22576
- wfrId: material.wfrId,
22577
- image: extractImage(material.image),
22578
- showChanges: false,
22579
- vulnerabilities: [],
22580
- buildTime: material.build_time || '',
22581
- showSourceInfo: false,
22582
- deployed: material.deployed || false,
22583
- latest: material.latest || false,
22584
- vulnerabilitiesLoading: true,
22585
- scanned: material.scanned,
22586
- scanEnabled: material.scanEnabled,
22587
- vulnerable: material.vulnerable,
22588
- runningOnParentCd: material.runningOnParentCd,
22589
- artifactStatus: artifactStatusValue,
22590
- userApprovalMetadata: material.userApprovalMetadata,
22591
- triggeredBy: material.triggeredBy,
22592
- isVirtualEnvironment: material.isVirtualEnvironment,
22593
- imageComment: material.imageComment,
22594
- imageReleaseTags: material.imageReleaseTags,
22595
- materialInfo: material.material_info
22596
- ? material.material_info.map(function (mat) {
22597
- return {
22598
- author: mat.author || '',
22599
- message: mat.message || '',
22600
- revision: mat.revision || '',
22601
- tag: mat.tag || '',
22602
- webhookData: mat.webhookData || '',
22603
- url: mat.url || '',
22604
- type: material.ciConfigureSourceType || '',
22605
- };
22606
- })
22607
- : [],
22608
- };
22609
- });
22610
- return {
22611
- materials: materials
22612
- };
22613
- }
22614
- });
22615
- };
22616
- function extractImage(image) {
22617
- return image ? image.split(':').pop() : '';
22618
22532
  }
22619
22533
 
22620
22534
  /*
@@ -23216,7 +23130,7 @@ var ImageTagsContainer = function (_a) {
23216
23130
  }
23217
23131
  handleSave(tagsToBeCreated);
23218
23132
  };
23219
- 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 fs-13", 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: {
23133
+ 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: {
23220
23134
  top: '50%',
23221
23135
  fontFamily: 'monospace',
23222
23136
  right: '8px',
@@ -23227,7 +23141,7 @@ var ImageTagsContainer = function (_a) {
23227
23141
  }, onHardDeleteClick: function (e) {
23228
23142
  stopPropagation(e);
23229
23143
  handleTagHardDelete(index);
23230
- }, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag.id)); }) })), showTagsWarning && (jsxRuntime.jsxs("div", __assign({ className: "cn-7 mb-8 flex left" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon--info icon-dim-16 mr-2" }), "Tags cannot be edited/removed later"] }))), jsxRuntime.jsx("div", __assign({ className: "cn-7 mt-12" }, { children: "Comment" })), jsxRuntime.jsx("div", __assign({ className: "flex left flex-wrap dc__gap-8 w-100 mt-6 mb-12", "data-testid": "add-image-comment-text-area" }, { children: jsxRuntime.jsx("textarea", { value: newDescription, onChange: handleDescriptionChange, className: "flex left flex-wrap dc__gap-8 dc__description-textarea fs-13", style: { height: '90px !important' } }) })), descriptionValidationMessage !== '' && (jsxRuntime.jsxs("div", __assign({ className: "flex left" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), jsxRuntime.jsx("div", __assign({ className: "form__error" }, { children: descriptionValidationMessage }))] }))), jsxRuntime.jsxs("div", __assign({ className: "w-100 flex right mt-12" }, { children: [jsxRuntime.jsx("button", __assign({ className: "cta flex cancel h-32 lh-32-imp", type: "button", onClick: function (e) {
23144
+ }, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag.id)); }) })), showTagsWarning && (jsxRuntime.jsxs("div", __assign({ className: "cn-7 mb-8 flex left" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon--info icon-dim-16 mr-2" }), "Tags cannot be edited/removed later"] }))), jsxRuntime.jsx("div", __assign({ className: "cn-7 mt-12" }, { children: "Comment" })), jsxRuntime.jsx("div", __assign({ className: "flex left flex-wrap dc__gap-8 w-100 mt-6 mb-12", "data-testid": "add-image-comment-text-area" }, { children: jsxRuntime.jsx("textarea", { value: newDescription, onChange: handleDescriptionChange, className: "flex left flex-wrap dc__gap-8 dc__description-textarea", style: { height: '90px !important' } }) })), descriptionValidationMessage !== '' && (jsxRuntime.jsxs("div", __assign({ className: "flex left" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), jsxRuntime.jsx("div", __assign({ className: "form__error" }, { children: descriptionValidationMessage }))] }))), jsxRuntime.jsxs("div", __assign({ className: "w-100 flex right mt-12" }, { children: [jsxRuntime.jsx("button", __assign({ className: "cta flex cancel h-32 lh-32-imp", type: "button", onClick: function (e) {
23231
23145
  stopPropagation(e);
23232
23146
  handleCancel();
23233
23147
  } }, { 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) {
@@ -23271,6 +23185,41 @@ var AddImageButton = function (_a) {
23271
23185
  return (jsxRuntime.jsx("div", __assign({ className: "add-tag-button flex pt-12 pr-12", "data-testid": "add-tags-button", onClick: handleClick }, { children: jsxRuntime.jsxs("div", __assign({ className: "lh-16 flex" }, { children: [jsxRuntime.jsx(SvgIcAdd, { className: "icon-dim-16 cn-6" }), jsxRuntime.jsx("span", __assign({ className: "cn-7" }, { children: "Add tags/comment" }))] })) })));
23272
23186
  };
23273
23187
 
23188
+ var ResizableTextarea = function (_a) {
23189
+ var minHeight = _a.minHeight, maxHeight = _a.maxHeight, value = _a.value, _b = _a.onChange, onChange = _b === void 0 ? null : _b, _c = _a.onBlur, onBlur = _c === void 0 ? null : _c, _d = _a.onFocus, onFocus = _d === void 0 ? null : _d, _e = _a.className, className = _e === void 0 ? '' : _e, _f = _a.placeholder, placeholder = _f === void 0 ? 'Enter your text here..' : _f, _g = _a.lineHeight, lineHeight = _g === void 0 ? 14 : _g, _h = _a.padding, padding = _h === void 0 ? 12 : _h, _j = _a.disabled, disabled = _j === void 0 ? false : _j, dataTestId = _a.dataTestId, props = __rest(_a, ["minHeight", "maxHeight", "value", "onChange", "onBlur", "onFocus", "className", "placeholder", "lineHeight", "padding", "disabled", "dataTestId"]);
23190
+ var _k = __read(React.useState(''), 2), text = _k[0], setText = _k[1];
23191
+ var _textRef = React.useRef(null);
23192
+ React.useEffect(function () {
23193
+ setText(value);
23194
+ }, [value]);
23195
+ function handleChange(e) {
23196
+ e.persist();
23197
+ setText(e.target.value);
23198
+ if (typeof onChange === 'function')
23199
+ onChange(e);
23200
+ }
23201
+ function handleBlur(e) {
23202
+ if (typeof onBlur === 'function')
23203
+ onBlur(e);
23204
+ }
23205
+ function handleFocus(e) {
23206
+ if (typeof onFocus === 'function')
23207
+ onFocus(e);
23208
+ }
23209
+ useThrottledEffect(function () {
23210
+ _textRef.current.style.height = 'auto';
23211
+ var nextHeight = _textRef.current.scrollHeight;
23212
+ if (minHeight && nextHeight < minHeight) {
23213
+ nextHeight = minHeight;
23214
+ }
23215
+ if (maxHeight && nextHeight > maxHeight) {
23216
+ nextHeight = maxHeight;
23217
+ }
23218
+ _textRef.current.style.height = nextHeight + 2 + 'px';
23219
+ }, 500, [text]);
23220
+ return (jsxRuntime.jsx("textarea", __assign({ "data-testid": dataTestId, ref: function (el) { return (_textRef.current = el); }, value: text, placeholder: placeholder, className: "dc__resizable-textarea ".concat(className), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, style: { lineHeight: "".concat(lineHeight, "px"), padding: "".concat(padding, "px") }, spellCheck: false, disabled: disabled }, props)));
23221
+ };
23222
+
23274
23223
  exports.BreadCrumb = BreadCrumb;
23275
23224
  exports.BreadcrumbStore = Store;
23276
23225
  exports.BuildStageVariable = BuildStageVariable;
@@ -23317,6 +23266,7 @@ exports.RadioGroupItem = RadioGroupItem;
23317
23266
  exports.Reload = Reload;
23318
23267
  exports.RequestTimeout = RequestTimeout;
23319
23268
  exports.ResizableTagTextArea = ResizableTagTextArea;
23269
+ exports.ResizableTextarea = ResizableTextarea;
23320
23270
  exports.ScanVulnerabilitiesTable = ScanVulnerabilitiesTable;
23321
23271
  exports.ServerError = ServerError;
23322
23272
  exports.ServerErrors = ServerErrors;
@@ -23336,10 +23286,8 @@ exports.TriggerTypeMap = TriggerTypeMap;
23336
23286
  exports.URLS = URLS;
23337
23287
  exports.VisibleModal = VisibleModal;
23338
23288
  exports.VisibleModal2 = VisibleModal2;
23339
- exports.extractImage = extractImage;
23340
23289
  exports.get = get;
23341
23290
  exports.getAlphabetIcon = getAlphabetIcon;
23342
- exports.getCDMaterials = getCDMaterials;
23343
23291
  exports.getCookie = getCookie;
23344
23292
  exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
23345
23293
  exports.getLoginInfo = getLoginInfo;
@@ -23361,5 +23309,4 @@ exports.trash = trash;
23361
23309
  exports.useBreadcrumb = useBreadcrumb;
23362
23310
  exports.useEffectAfterMount = useEffectAfterMount;
23363
23311
  exports.useForm = useForm;
23364
- exports.useSearchString = useSearchString;
23365
23312
  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.17-beta-9",
3
+ "version": "0.0.17-beta-11",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,8 +1,7 @@
1
- import moment from 'moment';
2
1
  import {get, post} from './Api';
3
2
  import { ROUTES } from './Constants'
4
3
  import { sortCallback } from './Helper';
5
- import { TeamList ,ResponseType, DeploymentNodeType } from './Types';
4
+ import { TeamList ,ResponseType } from './Types';
6
5
 
7
6
  export const getTeamListMin = (): Promise<TeamList> => {
8
7
  // ignore active field
@@ -30,89 +29,10 @@ interface UserRole extends ResponseType {
30
29
  }
31
30
  }
32
31
 
33
- let stageMap = {
34
- PRECD: 'PRE',
35
- CD: 'DEPLOY',
36
- POSTCD: 'POST',
37
- APPROVAL: 'APPROVAL',
38
- }
39
-
40
32
  export function getUserRole(appName?: string): Promise<UserRole> {
41
33
  return get(`${ROUTES.USER_CHECK_ROLE}${appName ? `?appName=${appName}` : ''}`)
42
34
  }
43
35
 
44
36
  export function setImageTags(request, pipelineId: number, artifactId: number){
45
37
  return post(`${ROUTES.IMAGE_TAGGING}/${pipelineId}/${artifactId}`,request )
46
- }
47
-
48
- export const getCDMaterials = (
49
- cdMaterialId,
50
- stageType: DeploymentNodeType,
51
- abortSignal: AbortSignal,
52
- isApprovalNode?: boolean,
53
- imageTag?: string): Promise<any> => {
54
- const URL = (!imageTag) ? `app/cd-pipeline/${cdMaterialId}/material?stage=${stageMap[stageType]}` : `app/cd-pipeline/${cdMaterialId}/material?stage=${stageMap[stageType]}&search=${imageTag}`
55
-
56
- return get(URL, {
57
- signal: abortSignal,
58
- }).then((response) => {
59
- let artifacts = response.result.ci_artifacts ?? []
60
- if (!response.result) {
61
- return {
62
- materials: [],
63
- }
64
- }
65
- else {
66
- const materials = artifacts.map((material, index) => {
67
- let artifactStatusValue = ''
68
- return {
69
- index,
70
- id: material.id,
71
- deployedTime: material.deployed_time
72
- ? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
73
- : 'Not Deployed',
74
- deployedBy: material.deployedBy,
75
- wfrId: material.wfrId,
76
- image: extractImage(material.image),
77
- showChanges: false,
78
- vulnerabilities: [],
79
- buildTime: material.build_time || '',
80
- showSourceInfo: false,
81
- deployed: material.deployed || false,
82
- latest: material.latest || false,
83
- vulnerabilitiesLoading: true,
84
- scanned: material.scanned,
85
- scanEnabled: material.scanEnabled,
86
- vulnerable: material.vulnerable,
87
- runningOnParentCd: material.runningOnParentCd,
88
- artifactStatus: artifactStatusValue,
89
- userApprovalMetadata: material.userApprovalMetadata,
90
- triggeredBy: material.triggeredBy,
91
- isVirtualEnvironment: material.isVirtualEnvironment,
92
- imageComment: material.imageComment,
93
- imageReleaseTags: material.imageReleaseTags,
94
- materialInfo: material.material_info
95
- ? material.material_info.map((mat) => {
96
- return {
97
- author: mat.author || '',
98
- message: mat.message || '',
99
- revision: mat.revision || '',
100
- tag: mat.tag || '',
101
- webhookData: mat.webhookData || '',
102
- url: mat.url || '',
103
- type: material.ciConfigureSourceType || '',
104
- }
105
- })
106
- : [],
107
- }
108
- })
109
- return {
110
- materials: materials
111
- }
112
- }
113
- })
114
- }
115
-
116
- export function extractImage(image: string): string {
117
- return image ? image.split(':').pop() : ''
118
38
  }
@@ -19,6 +19,7 @@ function GenericEmptyState({
19
19
  SvgImage,
20
20
  noImage
21
21
  }: GenericEmptyStateType): JSX.Element {
22
+ console.log(image);
22
23
 
23
24
  return (
24
25
  <div
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
2
2
  import { ServerErrors } from './ServerError'
3
3
  import { toast } from 'react-toastify'
4
4
  import * as Sentry from '@sentry/browser'
@@ -6,8 +6,6 @@ import { toastAccessDenied } from './ToastBody'
6
6
  import { ERROR_EMPTY_SCREEN, TOKEN_COOKIE_NAME } from './Constants'
7
7
  import { ReactComponent as FormError } from '../Assets/Icon/ic-warning.svg'
8
8
  import moment from 'moment';
9
- import { UseSearchString } from './Types'
10
- import { useLocation } from 'react-router-dom'
11
9
 
12
10
  toast.configure({
13
11
  autoClose: 3000,
@@ -348,24 +346,3 @@ export function handleUTCTime(ts: string, isRelativeTime = false) {
348
346
  }
349
347
  return timestamp;
350
348
  }
351
-
352
- export function useSearchString(): UseSearchString {
353
- const location = useLocation()
354
- const queryParams: URLSearchParams = useMemo(() => {
355
- const queryParams = new URLSearchParams(location.search)
356
- return queryParams
357
- }, [location])
358
-
359
- // const searchParams={}
360
- // for (let [key, value] of queryParams.entries()){
361
- // searchParams[key]=value
362
- // }
363
- const searchParams = Array.from(queryParams.entries()).reduce((agg, curr, idx) => {
364
- agg[curr[0]] = curr[1]
365
- return agg
366
- }, {})
367
-
368
- return { queryParams, searchParams }
369
- }
370
-
371
-
@@ -352,7 +352,7 @@ export const ImageTagsContainer = ({
352
352
  </div>
353
353
  <div className="mt-6 dc__position-rel-imp" data-testid="add-tag-text-area">
354
354
  <input
355
- className="form__input fs-13"
355
+ className="form__input"
356
356
  value={textInput}
357
357
  onChange={setInputValue}
358
358
  placeholder="Type a tag and press enter"
@@ -420,7 +420,7 @@ export const ImageTagsContainer = ({
420
420
  <textarea
421
421
  value={newDescription}
422
422
  onChange={handleDescriptionChange}
423
- className="flex left flex-wrap dc__gap-8 dc__description-textarea fs-13"
423
+ className="flex left flex-wrap dc__gap-8 dc__description-textarea"
424
424
  style={{ height: '90px !important' }}
425
425
  />
426
426
  </div>
@@ -0,0 +1,73 @@
1
+ import React, { useState, useEffect, useRef } from 'react'
2
+ import { useThrottledEffect } from './Helper'
3
+ import { ResizableTextareaProps } from './Types'
4
+
5
+ export const ResizableTextarea: React.FC<ResizableTextareaProps> = ({
6
+ minHeight,
7
+ maxHeight,
8
+ value,
9
+ onChange = null,
10
+ onBlur = null,
11
+ onFocus = null,
12
+ className = '',
13
+ placeholder = 'Enter your text here..',
14
+ lineHeight = 14,
15
+ padding = 12,
16
+ disabled = false,
17
+ dataTestId,
18
+ ...props
19
+ }) => {
20
+ const [text, setText] = useState('')
21
+ const _textRef = useRef(null)
22
+
23
+ useEffect(() => {
24
+ setText(value)
25
+ }, [value])
26
+
27
+ function handleChange(e) {
28
+ e.persist()
29
+ setText(e.target.value)
30
+ if (typeof onChange === 'function') onChange(e)
31
+ }
32
+
33
+ function handleBlur(e) {
34
+ if (typeof onBlur === 'function') onBlur(e)
35
+ }
36
+
37
+ function handleFocus(e) {
38
+ if (typeof onFocus === 'function') onFocus(e)
39
+ }
40
+
41
+ useThrottledEffect(
42
+ () => {
43
+ _textRef.current.style.height = 'auto'
44
+ let nextHeight = _textRef.current.scrollHeight
45
+ if (minHeight && nextHeight < minHeight) {
46
+ nextHeight = minHeight
47
+ }
48
+ if (maxHeight && nextHeight > maxHeight) {
49
+ nextHeight = maxHeight
50
+ }
51
+ _textRef.current.style.height = nextHeight + 2 + 'px'
52
+ },
53
+ 500,
54
+ [text],
55
+ )
56
+
57
+ return (
58
+ <textarea
59
+ data-testid={dataTestId}
60
+ ref={(el) => (_textRef.current = el)}
61
+ value={text}
62
+ placeholder={placeholder}
63
+ className={`dc__resizable-textarea ${className}`}
64
+ onChange={handleChange}
65
+ onBlur={handleBlur}
66
+ onFocus={handleFocus}
67
+ style={{ lineHeight: `${lineHeight}px`, padding: `${padding}px` }}
68
+ spellCheck={false}
69
+ disabled={disabled}
70
+ {...props}
71
+ />
72
+ )
73
+ }
@@ -366,9 +366,18 @@ export interface RegistryTypeDetailType {
366
366
  password: InputDetailType
367
367
  }
368
368
 
369
- export interface UseSearchString {
370
- queryParams: URLSearchParams
371
- searchParams: {
372
- [key: string]: string
373
- }
369
+ export interface ResizableTextareaProps {
370
+ minHeight?: number
371
+ maxHeight?: number
372
+ value?: string
373
+ onChange?: (e) => void
374
+ onBlur?: (e) => void
375
+ onFocus?: (e) => void
376
+ className?: string
377
+ placeholder?: string
378
+ lineHeight?: number
379
+ padding?: number
380
+ disabled?: boolean
381
+ name?: string
382
+ dataTestId?: string
374
383
  }
@@ -34,3 +34,4 @@ export * from './Policy.Types'
34
34
  export { default as DeleteComponent } from './DeleteComponentModal/DeleteComponent'
35
35
  export * from './ImageTags'
36
36
  export * from './ImageTags.Types'
37
+ export * from './ResizableTextarea'