@devtron-labs/devtron-fe-common-lib 0.0.17 → 0.0.18

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 } from './Types';
1
+ import { TeamList, ResponseType, DeploymentNodeType } from './Types';
2
2
  export declare const getTeamListMin: () => Promise<TeamList>;
3
3
  interface UserRole extends ResponseType {
4
4
  result?: {
@@ -6,6 +6,14 @@ interface UserRole extends ResponseType {
6
6
  superAdmin: boolean;
7
7
  };
8
8
  }
9
+ export declare const SourceTypeMap: {
10
+ BranchFixed: string;
11
+ WEBHOOK: string;
12
+ BranchRegex: string;
13
+ };
9
14
  export declare function getUserRole(appName?: string): Promise<UserRole>;
10
15
  export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType>;
16
+ export declare const getCDMaterials: (cdMaterialId: any, stageType: DeploymentNodeType, abortSignal: AbortSignal, isApprovalNode?: boolean, imageTag?: string) => Promise<any>;
17
+ export declare function extractImage(image: string): string;
18
+ export declare function createGitCommitUrl(url: string, revision: string): string;
11
19
  export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { UseSearchString } from './Types';
2
3
  export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
3
4
  interface ConditionalWrapper<T> {
4
5
  condition: boolean;
@@ -40,4 +41,5 @@ export declare function CustomInput({ name, value, error, onChange, onBlur, onFo
40
41
  dataTestid?: string;
41
42
  }): JSX.Element;
42
43
  export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
44
+ export declare function useSearchString(): UseSearchString;
43
45
  export {};
@@ -332,4 +332,10 @@ 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
+ };
340
+ }
335
341
  export {};
package/dist/index.js CHANGED
@@ -2162,7 +2162,6 @@ 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);
2166
2165
  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] })));
2167
2166
  }
2168
2167
 
@@ -10079,6 +10078,22 @@ function handleUTCTime(ts, isRelativeTime) {
10079
10078
  console.error("Error Parsing Date:", ts);
10080
10079
  }
10081
10080
  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 };
10082
10097
  }
10083
10098
 
10084
10099
  function Progressing(_a) {
@@ -22524,11 +22539,118 @@ var getTeamListMin = function () {
22524
22539
  };
22525
22540
  });
22526
22541
  };
22542
+ var stageMap = {
22543
+ PRECD: 'PRE',
22544
+ CD: 'DEPLOY',
22545
+ POSTCD: 'POST',
22546
+ APPROVAL: 'APPROVAL',
22547
+ };
22548
+ var SourceTypeMap = {
22549
+ BranchFixed: 'SOURCE_TYPE_BRANCH_FIXED',
22550
+ WEBHOOK: 'WEBHOOK',
22551
+ BranchRegex: 'SOURCE_TYPE_BRANCH_REGEX',
22552
+ };
22527
22553
  function getUserRole(appName) {
22528
22554
  return get("".concat(ROUTES.USER_CHECK_ROLE).concat(appName ? "?appName=".concat(appName) : ''));
22529
22555
  }
22530
22556
  function setImageTags(request, pipelineId, artifactId) {
22531
22557
  return post("".concat(ROUTES.IMAGE_TAGGING, "/").concat(pipelineId, "/").concat(artifactId), request);
22558
+ }
22559
+ var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
22560
+ 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);
22561
+ return get(URL, {
22562
+ signal: abortSignal,
22563
+ }).then(function (response) {
22564
+ var _a;
22565
+ var artifacts = (_a = response.result.ci_artifacts) !== null && _a !== void 0 ? _a : [];
22566
+ if (!response.result) {
22567
+ return {
22568
+ materials: [],
22569
+ };
22570
+ }
22571
+ else {
22572
+ var materials = artifacts.map(function (material, index) {
22573
+ var artifactStatusValue = '';
22574
+ return {
22575
+ index: index,
22576
+ id: material.id,
22577
+ deployedTime: material.deployed_time
22578
+ ? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
22579
+ : 'Not Deployed',
22580
+ deployedBy: material.deployedBy,
22581
+ wfrId: material.wfrId,
22582
+ image: extractImage(material.image),
22583
+ showChanges: false,
22584
+ vulnerabilities: [],
22585
+ buildTime: material.build_time || '',
22586
+ tab: CDModalTab.Changes,
22587
+ showSourceInfo: false,
22588
+ deployed: material.deployed || false,
22589
+ latest: material.latest || false,
22590
+ vulnerabilitiesLoading: true,
22591
+ scanned: material.scanned,
22592
+ scanEnabled: material.scanEnabled,
22593
+ isSelected: !material.vulnerable && index === 0,
22594
+ vulnerable: material.vulnerable,
22595
+ runningOnParentCd: material.runningOnParentCd,
22596
+ artifactStatus: artifactStatusValue,
22597
+ userApprovalMetadata: material.userApprovalMetadata,
22598
+ triggeredBy: material.triggeredBy,
22599
+ isVirtualEnvironment: material.isVirtualEnvironment,
22600
+ imageComment: material.imageComment,
22601
+ imageReleaseTags: material.imageReleaseTags,
22602
+ materialInfo: material.material_info
22603
+ ? material.material_info.map(function (mat) {
22604
+ return {
22605
+ modifiedTime: mat.modifiedTime ? moment(mat.modifiedTime).format("ddd, DD MMM YYYY, hh:mm A") : '',
22606
+ commitLink: createGitCommitUrl(mat.url, mat.revision),
22607
+ author: mat.author || '',
22608
+ message: mat.message || '',
22609
+ revision: mat.revision || '',
22610
+ tag: mat.tag || '',
22611
+ webhookData: mat.webhookData || '',
22612
+ url: mat.url || '',
22613
+ branch: (material.ciConfigureSourceType === SourceTypeMap.WEBHOOK
22614
+ ? material.ciConfigureSourceValue
22615
+ : mat.branch) || '',
22616
+ type: material.ciConfigureSourceType || '',
22617
+ };
22618
+ })
22619
+ : [],
22620
+ };
22621
+ });
22622
+ return {
22623
+ materials: materials
22624
+ };
22625
+ }
22626
+ });
22627
+ };
22628
+ function extractImage(image) {
22629
+ return image ? image.split(':').pop() : '';
22630
+ }
22631
+ function createGitCommitUrl(url, revision) {
22632
+ if (!url || !revision) {
22633
+ return "NA";
22634
+ }
22635
+ if (url.indexOf("gitlab") > 0 || url.indexOf("github") > 0 || url.indexOf("azure") > 0) {
22636
+ var urlpart = url.split("@");
22637
+ if (urlpart.length > 1) {
22638
+ return "https://" + urlpart[1].split(".git")[0] + "/commit/" + revision;
22639
+ }
22640
+ if (urlpart.length == 1) {
22641
+ return urlpart[0].split(".git")[0] + "/commit/" + revision;
22642
+ }
22643
+ }
22644
+ if (url.indexOf("bitbucket") > 0) {
22645
+ var urlpart = url.split("@");
22646
+ if (urlpart.length > 1) {
22647
+ return "https://" + urlpart[1].split(".git")[0] + "/commits/" + revision;
22648
+ }
22649
+ if (urlpart.length == 1) {
22650
+ return urlpart[0].split(".git")[0] + "/commits/" + revision;
22651
+ }
22652
+ }
22653
+ return "NA";
22532
22654
  }
22533
22655
 
22534
22656
  /*
@@ -23130,7 +23252,7 @@ var ImageTagsContainer = function (_a) {
23130
23252
  }
23131
23253
  handleSave(tagsToBeCreated);
23132
23254
  };
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: {
23255
+ 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: {
23134
23256
  top: '50%',
23135
23257
  fontFamily: 'monospace',
23136
23258
  right: '8px',
@@ -23141,7 +23263,7 @@ var ImageTagsContainer = function (_a) {
23141
23263
  }, onHardDeleteClick: function (e) {
23142
23264
  stopPropagation(e);
23143
23265
  handleTagHardDelete(index);
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) {
23266
+ }, 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) {
23145
23267
  stopPropagation(e);
23146
23268
  handleCancel();
23147
23269
  } }, { 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) {
@@ -23235,6 +23357,7 @@ exports.ScanVulnerabilitiesTable = ScanVulnerabilitiesTable;
23235
23357
  exports.ServerError = ServerError;
23236
23358
  exports.ServerErrors = ServerErrors;
23237
23359
  exports.SingleSelectOption = SingleSelectOption;
23360
+ exports.SourceTypeMap = SourceTypeMap;
23238
23361
  exports.StyledRadioGroup = RadioGroup;
23239
23362
  exports.TOAST_ACCESS_DENIED = TOAST_ACCESS_DENIED;
23240
23363
  exports.TOKEN_COOKIE_NAME = TOKEN_COOKIE_NAME;
@@ -23250,8 +23373,11 @@ exports.TriggerTypeMap = TriggerTypeMap;
23250
23373
  exports.URLS = URLS;
23251
23374
  exports.VisibleModal = VisibleModal;
23252
23375
  exports.VisibleModal2 = VisibleModal2;
23376
+ exports.createGitCommitUrl = createGitCommitUrl;
23377
+ exports.extractImage = extractImage;
23253
23378
  exports.get = get;
23254
23379
  exports.getAlphabetIcon = getAlphabetIcon;
23380
+ exports.getCDMaterials = getCDMaterials;
23255
23381
  exports.getCookie = getCookie;
23256
23382
  exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
23257
23383
  exports.getLoginInfo = getLoginInfo;
@@ -23273,4 +23399,5 @@ exports.trash = trash;
23273
23399
  exports.useBreadcrumb = useBreadcrumb;
23274
23400
  exports.useEffectAfterMount = useEffectAfterMount;
23275
23401
  exports.useForm = useForm;
23402
+ exports.useSearchString = useSearchString;
23276
23403
  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",
3
+ "version": "0.0.18",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,7 +1,8 @@
1
+ import moment from 'moment';
1
2
  import {get, post} from './Api';
2
3
  import { ROUTES } from './Constants'
3
4
  import { sortCallback } from './Helper';
4
- import { TeamList ,ResponseType } from './Types';
5
+ import { TeamList ,ResponseType, DeploymentNodeType, CDModalTab } from './Types';
5
6
 
6
7
  export const getTeamListMin = (): Promise<TeamList> => {
7
8
  // ignore active field
@@ -29,10 +30,128 @@ interface UserRole extends ResponseType {
29
30
  }
30
31
  }
31
32
 
33
+ let stageMap = {
34
+ PRECD: 'PRE',
35
+ CD: 'DEPLOY',
36
+ POSTCD: 'POST',
37
+ APPROVAL: 'APPROVAL',
38
+ }
39
+
40
+ export const SourceTypeMap = {
41
+ BranchFixed: 'SOURCE_TYPE_BRANCH_FIXED',
42
+ WEBHOOK: 'WEBHOOK',
43
+ BranchRegex: 'SOURCE_TYPE_BRANCH_REGEX',
44
+ }
45
+
32
46
  export function getUserRole(appName?: string): Promise<UserRole> {
33
47
  return get(`${ROUTES.USER_CHECK_ROLE}${appName ? `?appName=${appName}` : ''}`)
34
48
  }
35
49
 
36
50
  export function setImageTags(request, pipelineId: number, artifactId: number){
37
51
  return post(`${ROUTES.IMAGE_TAGGING}/${pipelineId}/${artifactId}`,request )
38
- }
52
+ }
53
+
54
+ export const getCDMaterials = (
55
+ cdMaterialId,
56
+ stageType: DeploymentNodeType,
57
+ abortSignal: AbortSignal,
58
+ isApprovalNode?: boolean,
59
+ imageTag?: string): Promise<any> => {
60
+ const URL = (!imageTag) ? `app/cd-pipeline/${cdMaterialId}/material?stage=${stageMap[stageType]}` : `app/cd-pipeline/${cdMaterialId}/material?stage=${stageMap[stageType]}&search=${imageTag}`
61
+
62
+ return get(URL, {
63
+ signal: abortSignal,
64
+ }).then((response) => {
65
+ let artifacts = response.result.ci_artifacts ?? []
66
+ if (!response.result) {
67
+ return {
68
+ materials: [],
69
+ }
70
+ }
71
+ else {
72
+ const materials = artifacts.map((material, index) => {
73
+ let artifactStatusValue = ''
74
+ return {
75
+ index,
76
+ id: material.id,
77
+ deployedTime: material.deployed_time
78
+ ? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
79
+ : 'Not Deployed',
80
+ deployedBy: material.deployedBy,
81
+ wfrId: material.wfrId,
82
+ image: extractImage(material.image),
83
+ showChanges: false,
84
+ vulnerabilities: [],
85
+ buildTime: material.build_time || '',
86
+ tab: CDModalTab.Changes,
87
+ showSourceInfo: false,
88
+ deployed: material.deployed || false,
89
+ latest: material.latest || false,
90
+ vulnerabilitiesLoading: true,
91
+ scanned: material.scanned,
92
+ scanEnabled: material.scanEnabled,
93
+ isSelected: !material.vulnerable && index === 0,
94
+ vulnerable: material.vulnerable,
95
+ runningOnParentCd: material.runningOnParentCd,
96
+ artifactStatus: artifactStatusValue,
97
+ userApprovalMetadata: material.userApprovalMetadata,
98
+ triggeredBy: material.triggeredBy,
99
+ isVirtualEnvironment: material.isVirtualEnvironment,
100
+ imageComment: material.imageComment,
101
+ imageReleaseTags: material.imageReleaseTags,
102
+ materialInfo: material.material_info
103
+ ? material.material_info.map((mat) => {
104
+ return {
105
+ modifiedTime: mat.modifiedTime ? moment(mat.modifiedTime).format("ddd, DD MMM YYYY, hh:mm A") : '',
106
+ commitLink: createGitCommitUrl(mat.url, mat.revision),
107
+ author: mat.author || '',
108
+ message: mat.message || '',
109
+ revision: mat.revision || '',
110
+ tag: mat.tag || '',
111
+ webhookData: mat.webhookData || '',
112
+ url: mat.url || '',
113
+ branch:
114
+ (material.ciConfigureSourceType === SourceTypeMap.WEBHOOK
115
+ ? material.ciConfigureSourceValue
116
+ : mat.branch) || '',
117
+ type: material.ciConfigureSourceType || '',
118
+ }
119
+ })
120
+ : [],
121
+ }
122
+ })
123
+ return {
124
+ materials: materials
125
+ }
126
+ }
127
+ })
128
+ }
129
+
130
+ export function extractImage(image: string): string {
131
+ return image ? image.split(':').pop() : ''
132
+ }
133
+
134
+ export function createGitCommitUrl(url: string, revision: string): string {
135
+ if (!url || !revision) {
136
+ return "NA"
137
+ }
138
+ if (url.indexOf("gitlab") > 0 || url.indexOf("github") > 0 || url.indexOf("azure") > 0) {
139
+ let urlpart = url.split("@")
140
+ if (urlpart.length > 1) {
141
+ return "https://" + urlpart[1].split(".git")[0] + "/commit/" + revision
142
+ }
143
+ if (urlpart.length == 1) {
144
+ return urlpart[0].split(".git")[0] + "/commit/" + revision
145
+ }
146
+ }
147
+ if (url.indexOf("bitbucket") > 0) {
148
+ let urlpart = url.split("@")
149
+ if (urlpart.length > 1) {
150
+ return "https://" + urlpart[1].split(".git")[0] + "/commits/" + revision
151
+ }
152
+ if (urlpart.length == 1) {
153
+ return urlpart[0].split(".git")[0] + "/commits/" + revision
154
+ }
155
+ }
156
+ return "NA"
157
+ }
@@ -19,7 +19,6 @@ function GenericEmptyState({
19
19
  SvgImage,
20
20
  noImage
21
21
  }: GenericEmptyStateType): JSX.Element {
22
- console.log(image);
23
22
 
24
23
  return (
25
24
  <div
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react'
1
+ import React, { useCallback, useEffect, useMemo, 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,6 +6,8 @@ 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'
9
11
 
10
12
  toast.configure({
11
13
  autoClose: 3000,
@@ -346,3 +348,24 @@ export function handleUTCTime(ts: string, isRelativeTime = false) {
346
348
  }
347
349
  return timestamp;
348
350
  }
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"
355
+ className="form__input fs-13"
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"
423
+ className="flex left flex-wrap dc__gap-8 dc__description-textarea fs-13"
424
424
  style={{ height: '90px !important' }}
425
425
  />
426
426
  </div>
@@ -364,4 +364,11 @@ export interface RegistryTypeDetailType {
364
364
  registryURL: InputDetailType
365
365
  id: InputDetailType
366
366
  password: InputDetailType
367
+ }
368
+
369
+ export interface UseSearchString {
370
+ queryParams: URLSearchParams
371
+ searchParams: {
372
+ [key: string]: string
373
+ }
367
374
  }