@devtron-labs/devtron-fe-common-lib 0.0.48-beta-7 → 0.0.48-beta-9

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.
Files changed (127) hide show
  1. package/.eslintrc.js +16 -84
  2. package/.github/workflows/release-package.yml +3 -2
  3. package/dist/Common/BreadCrumb/BreadCrumb.d.ts +1 -1
  4. package/dist/Common/BreadCrumb/BreadcrumbStore.d.ts +2 -2
  5. package/dist/Common/Constants.d.ts +5 -1
  6. package/dist/Common/CustomInput/CustomInput.d.ts +1 -1
  7. package/dist/Common/CustomInput/Types.d.ts +2 -2
  8. package/dist/Common/CustomTagSelector/ResizableTagTextArea.d.ts +1 -1
  9. package/dist/Common/DeleteComponentModal/DeleteComponent.d.ts +1 -1
  10. package/dist/Common/DevtronProgressing/DevtronProgressing.d.ts +1 -1
  11. package/dist/Common/Dialogs/ConfirmationDialog.d.ts +6 -6
  12. package/dist/Common/Dialogs/DeleteDialog.d.ts +1 -1
  13. package/dist/Common/Dialogs/ForceDeleteDialog.d.ts +1 -1
  14. package/dist/Common/Dialogs/Types.d.ts +1 -1
  15. package/dist/Common/EmptyState/EmptyState.d.ts +17 -20
  16. package/dist/Common/EmptyState/GenericEmptyState.d.ts +1 -1
  17. package/dist/Common/Error.d.ts +1 -2
  18. package/dist/Common/ErrorScreenNotFound.d.ts +1 -1
  19. package/dist/Common/Helper.d.ts +1 -1
  20. package/dist/Common/ImageTags.d.ts +1 -1
  21. package/dist/Common/InfoColorBar/InfoColourbar.d.ts +1 -1
  22. package/dist/Common/Modals/Modal.d.ts +2 -2
  23. package/dist/Common/Modals/OpaqueModal.d.ts +3 -3
  24. package/dist/Common/Modals/VisibleModal.d.ts +3 -3
  25. package/dist/Common/Modals/VisibleModal2.d.ts +3 -3
  26. package/dist/Common/MultiSelectCustomization.d.ts +1 -1
  27. package/dist/Common/Policy.Types.d.ts +2 -2
  28. package/dist/Common/PopupMenu.d.ts +5 -5
  29. package/dist/Common/Progressing.d.ts +2 -2
  30. package/dist/Common/RadioGroup/RadioGroup.d.ts +1 -1
  31. package/dist/Common/ResizableTextarea.d.ts +1 -1
  32. package/dist/Common/TippyCustomized.d.ts +1 -1
  33. package/dist/Common/ToastBody.d.ts +5 -5
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +351 -266
  36. package/package.json +2 -19
  37. package/src/Common/AddCDButton/AddCDButton.tsx +2 -1
  38. package/src/Common/Api.ts +26 -21
  39. package/src/Common/AppStatus/AppStatus.tsx +12 -12
  40. package/src/Common/AppStatus/utils.ts +5 -6
  41. package/src/Common/BreadCrumb/BreadCrumb.tsx +28 -32
  42. package/src/Common/BreadCrumb/BreadcrumbStore.tsx +2 -2
  43. package/src/Common/BreadCrumb/Types.ts +12 -11
  44. package/src/Common/Checkbox.tsx +19 -17
  45. package/src/Common/ClipboardButton/ClipboardButton.tsx +1 -1
  46. package/src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx +1 -0
  47. package/src/Common/Common.service.ts +64 -59
  48. package/src/Common/Constants.ts +14 -9
  49. package/src/Common/CustomInput/CustomInput.tsx +29 -22
  50. package/src/Common/CustomInput/Types.ts +4 -4
  51. package/src/Common/CustomInput/index.ts +1 -1
  52. package/src/Common/CustomTagSelector/PropagateTagInfo.tsx +18 -15
  53. package/src/Common/CustomTagSelector/ResizableTagTextArea.tsx +9 -9
  54. package/src/Common/CustomTagSelector/TagDetails.tsx +3 -9
  55. package/src/Common/CustomTagSelector/TagLabelSelect.tsx +9 -7
  56. package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +35 -31
  57. package/src/Common/CustomTagSelector/TagSelector.utils.ts +3 -2
  58. package/src/Common/CustomTagSelector/Types.ts +1 -1
  59. package/src/Common/CustomTagSelector/ValidationRules.ts +22 -18
  60. package/src/Common/CustomTagSelector/index.ts +2 -2
  61. package/src/Common/DebouncedSearch/DebouncedSearch.tsx +1 -2
  62. package/src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx +1 -0
  63. package/src/Common/DeleteComponentModal/DeleteComponent.tsx +32 -27
  64. package/src/Common/DeleteComponentModal/types.ts +1 -1
  65. package/src/Common/DevtronProgressing/DevtronProgressing.tsx +8 -5
  66. package/src/Common/Dialogs/ConfirmationDialog.tsx +24 -24
  67. package/src/Common/Dialogs/DeleteDialog.tsx +5 -3
  68. package/src/Common/Dialogs/DialogForm.tsx +35 -31
  69. package/src/Common/Dialogs/ForceDeleteDialog.tsx +7 -13
  70. package/src/Common/Dialogs/Types.ts +12 -12
  71. package/src/Common/Dialogs/index.ts +1 -1
  72. package/src/Common/Drawer/Drawer.tsx +1 -1
  73. package/src/Common/EmptyState/EmptyState.tsx +17 -13
  74. package/src/Common/EmptyState/GenericEmptyState.tsx +21 -7
  75. package/src/Common/Error.tsx +5 -5
  76. package/src/Common/ErrorScreenNotFound.tsx +12 -9
  77. package/src/Common/Grid/Grid.tsx +2 -1
  78. package/src/Common/Helper.tsx +24 -23
  79. package/src/Common/Hooks/UseClickOutside/UseClickOutside.tsx +1 -1
  80. package/src/Common/Hooks/UseSuperAdmin/UseSuperAdmin.tsx +1 -1
  81. package/src/Common/ImageTags.Types.ts +3 -2
  82. package/src/Common/ImageTags.tsx +66 -61
  83. package/src/Common/InfoColorBar/InfoColourbar.tsx +5 -10
  84. package/src/Common/Modals/Modal.tsx +3 -3
  85. package/src/Common/Modals/OpaqueModal.tsx +18 -25
  86. package/src/Common/Modals/VisibleModal.tsx +3 -7
  87. package/src/Common/Modals/VisibleModal2.tsx +15 -20
  88. package/src/Common/MultiSelectCustomization.tsx +13 -9
  89. package/src/Common/Policy.Types.ts +38 -38
  90. package/src/Common/PopupMenu.tsx +9 -10
  91. package/src/Common/Progressing.tsx +18 -15
  92. package/src/Common/RJSF/Form.tsx +1 -0
  93. package/src/Common/RJSF/common/FieldRow.tsx +1 -0
  94. package/src/Common/RJSF/config.ts +1 -0
  95. package/src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx +1 -1
  96. package/src/Common/RJSF/templates/ArrayFieldTemplate.tsx +1 -0
  97. package/src/Common/RJSF/templates/BaseInput.tsx +1 -0
  98. package/src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx +1 -0
  99. package/src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx +1 -0
  100. package/src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx +6 -1
  101. package/src/Common/RJSF/templates/Description.tsx +1 -0
  102. package/src/Common/RJSF/templates/Field.tsx +3 -14
  103. package/src/Common/RJSF/templates/FieldErrorTemplate.tsx +9 -6
  104. package/src/Common/RJSF/templates/ObjectFieldTemplate.tsx +7 -5
  105. package/src/Common/RJSF/templates/TitleField.tsx +1 -0
  106. package/src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx +1 -0
  107. package/src/Common/RJSF/utils.ts +57 -53
  108. package/src/Common/RJSF/widgets/Checkbox.tsx +2 -2
  109. package/src/Common/RJSF/widgets/Select.tsx +1 -0
  110. package/src/Common/RadioGroup/RadioGroup.tsx +23 -18
  111. package/src/Common/RadioGroup.tsx +23 -24
  112. package/src/Common/Reload.tsx +1 -0
  113. package/src/Common/ResizableTextarea.tsx +17 -18
  114. package/src/Common/Security/ScanVulnerabilitiesTable.tsx +34 -29
  115. package/src/Common/ServerError.ts +1 -5
  116. package/src/Common/TippyCustomized.tsx +38 -41
  117. package/src/Common/ToastBody.tsx +7 -6
  118. package/src/Common/Toggle/Toggle.tsx +3 -3
  119. package/src/Common/Types.ts +12 -12
  120. package/src/custom.d.ts +7 -7
  121. package/src/index.ts +1 -1
  122. package/.eslintignore +0 -75
  123. package/.github/pull_request_template.md +0 -25
  124. package/.github/workflows/ci.yml +0 -31
  125. package/.husky/pre-commit +0 -4
  126. package/.lintstagedrc +0 -5
  127. package/.nvmrc +0 -1
@@ -1,6 +1,4 @@
1
- import { useEffect, useMemo, useRef, useState } from 'react'
2
- import { toast } from 'react-toastify'
3
- import Tippy from '@tippyjs/react'
1
+ import React, { useEffect, useMemo, useRef, useState } from 'react'
4
2
  import { ReactComponent as Add } from '../Assets/Icon/ic-add.svg'
5
3
  import { ReactComponent as Close } from '../Assets/Icon/ic-cross.svg'
6
4
  import { ReactComponent as QuestionFilled } from '../Assets/Icon/ic-help.svg'
@@ -9,6 +7,7 @@ import { ReactComponent as Question } from '../Assets/Icon/ic-help-outline.svg'
9
7
  import { ReactComponent as EditIcon } from '../Assets/Icon/ic-pencil.svg'
10
8
  import { ReactComponent as Redo } from '../Assets/Icon/ic-arrow-counter-clockwise.svg'
11
9
  import { ReactComponent as Minus } from '../Assets/Icon/ic-minus.svg'
10
+ import { toast } from 'react-toastify'
12
11
  import { ReactComponent as Info } from '../Assets/Icon/ic-info-filled.svg'
13
12
  import { ReactComponent as Error } from '../Assets/Icon/ic-warning.svg'
14
13
  import { ReactComponent as Warning } from '../Assets/Icon/ic-error-exclamation.svg'
@@ -18,6 +17,7 @@ import { ImageButtonType, ImageTaggingContainerType, ReleaseTag } from './ImageT
18
17
  import { showError, stopPropagation } from './Helper'
19
18
  import { TippyCustomized } from './TippyCustomized'
20
19
  import { setImageTags } from './Common.service'
20
+ import Tippy from '@tippyjs/react'
21
21
  import { Progressing } from './Progressing'
22
22
 
23
23
  export const ImageTagsContainer = ({
@@ -34,15 +34,15 @@ export const ImageTagsContainer = ({
34
34
  toggleCardMode,
35
35
  hideHardDelete,
36
36
  forceReInit,
37
- isSuperAdmin,
37
+ isSuperAdmin
38
38
  }: ImageTaggingContainerType) => {
39
- const [initialTags, setInitialTags] = useState<ReleaseTag[]>(imageReleaseTags || [])
39
+ const [initialTags, setInitialTags] = useState<ReleaseTag[]>(imageReleaseTags ? imageReleaseTags : [])
40
40
  const [initialDescription, setInitialDescription] = useState(imageComment ? imageComment.comment : '')
41
- const [existingTags, setExistingTags] = useState(appReleaseTagNames || [])
41
+ const [existingTags, setExistingTags] = useState(appReleaseTagNames ? appReleaseTagNames : [])
42
42
  const [newDescription, setNewDescription] = useState(imageComment ? imageComment.comment : '')
43
43
  const [isEditing, setIsEditing] = useState(false)
44
44
  const [showTagsWarning, setShowTagsWarning] = useState(false)
45
- const [displayedTags, setDisplayedTags] = useState<ReleaseTag[]>(imageReleaseTags || [])
45
+ const [displayedTags, setDisplayedTags] = useState<ReleaseTag[]>(imageReleaseTags ? imageReleaseTags : [])
46
46
  const [tagErrorMessage, setTagErrorMessage] = useState('')
47
47
  const [createTags, setCreateTags] = useState<ReleaseTag[]>([])
48
48
  const [softDeleteTags, setSoftDeleteTags] = useState<ReleaseTag[]>([])
@@ -51,20 +51,22 @@ export const ImageTagsContainer = ({
51
51
  const [textInput, setTextInput] = useState<string>('')
52
52
  const [loading, setLoading] = useState<boolean>(false)
53
53
 
54
+
54
55
  useEffect(() => {
55
56
  reInitState()
56
57
  }, [imageReleaseTags, imageComment, tagsEditable])
57
58
 
58
59
  useEffect(() => {
59
- setExistingTags(appReleaseTagNames || [])
60
+ setExistingTags(appReleaseTagNames ? appReleaseTagNames : [])
60
61
  }, [appReleaseTagNames])
61
62
 
63
+
62
64
  const reInitState = () => {
63
65
  if (forceReInit || !isEditing) {
64
- setInitialTags(imageReleaseTags || [])
66
+ setInitialTags(imageReleaseTags ? imageReleaseTags : [])
65
67
  setInitialDescription(imageComment ? imageComment.comment : '')
66
68
  setNewDescription(imageComment ? imageComment.comment : '')
67
- setDisplayedTags(imageReleaseTags || [])
69
+ setDisplayedTags(imageReleaseTags ? imageReleaseTags : [])
68
70
  setIsEditing(false)
69
71
  }
70
72
  }
@@ -95,7 +97,7 @@ export const ImageTagsContainer = ({
95
97
  setTagErrorMessage('')
96
98
  }
97
99
 
98
- const validateTag = (lowercaseValue): boolean => {
100
+ const validateTag = (lowercaseValue) : boolean => {
99
101
  if (
100
102
  lowercaseValue.length == 0 ||
101
103
  lowercaseValue.length >= 128 ||
@@ -118,9 +120,9 @@ export const ImageTagsContainer = ({
118
120
  return true
119
121
  }
120
122
 
121
- const handleTagCreate = (newValue): ReleaseTag[] => {
123
+ const handleTagCreate = (newValue) : ReleaseTag[] => {
122
124
  const lowercaseValue = newValue.toLowerCase().trim()
123
- if (validateTag(lowercaseValue)) {
125
+ if(validateTag(lowercaseValue)) {
124
126
  const newTag: ReleaseTag = {
125
127
  id: 0,
126
128
  tagName: lowercaseValue,
@@ -146,7 +148,7 @@ export const ImageTagsContainer = ({
146
148
  deleted: !updatedTags[index].deleted,
147
149
  }
148
150
  const updatedTag = updatedTags[index]
149
- const updatedSoftDeleteTags = [...softDeleteTags]
151
+ let updatedSoftDeleteTags = [...softDeleteTags]
150
152
  const tagIndex = updatedSoftDeleteTags.findIndex((tag) => tag.tagName === updatedTag.tagName)
151
153
  if (tagIndex !== -1) {
152
154
  // Tag already exists in softDeleteTags array, remove it
@@ -204,13 +206,13 @@ export const ImageTagsContainer = ({
204
206
 
205
207
  const payload = {
206
208
  createTags: tagsToBeCreated,
207
- softDeleteTags,
209
+ softDeleteTags: softDeleteTags,
208
210
  imageComment: {
209
211
  id: 0,
210
212
  comment: newDescription.trim(),
211
213
  artifactId: 0,
212
214
  },
213
- hardDeleteTags,
215
+ hardDeleteTags: hardDeleteTags,
214
216
  }
215
217
 
216
218
  // set loading state true
@@ -240,7 +242,7 @@ export const ImageTagsContainer = ({
240
242
  handleEditClick()
241
243
  setShowTagsWarning(false)
242
244
  setTagErrorMessage('')
243
- if (updateCurrentAppMaterial) updateCurrentAppMaterial(artifactId, tags, res.result?.imageComment)
245
+ if(updateCurrentAppMaterial)updateCurrentAppMaterial(artifactId,tags,res.result?.imageComment)
244
246
  })
245
247
  .catch((err) => {
246
248
  // Fix toast message
@@ -251,45 +253,50 @@ export const ImageTagsContainer = ({
251
253
  showError(err)
252
254
  }
253
255
  })
254
- .finally(() => {
256
+ .finally(()=>{
255
257
  setLoading(false)
256
258
  })
257
259
  }
258
260
 
259
- const renderInfoCard = (): JSX.Element => (
260
- <TippyCustomized
261
- theme={TippyTheme.white}
262
- className="w-300 fcv-5"
263
- placement="right"
264
- Icon={QuestionFilled}
265
- heading="Release tags"
266
- showCloseButton
267
- trigger="click"
268
- interactive
269
- additionalContent={getBuildContextAdditionalContent()}
270
- >
271
- <div className="flex">
272
- <Question className="fcn-5 ml-8 cursor icon-dim-16" />
273
- </div>
274
- </TippyCustomized>
275
- )
261
+ const renderInfoCard = (): JSX.Element => {
262
+ return (
263
+ <TippyCustomized
264
+ theme={TippyTheme.white}
265
+ className="w-300 fcv-5"
266
+ placement="right"
267
+ Icon={QuestionFilled}
268
+ heading="Release tags"
269
+ showCloseButton={true}
270
+ trigger="click"
271
+ interactive={true}
272
+ additionalContent={getBuildContextAdditionalContent()}
273
+ >
274
+ <div className="flex">
275
+ <Question className="fcn-5 ml-8 cursor icon-dim-16"/>
276
+ </div>
277
+ </TippyCustomized>
278
+ )
279
+ }
276
280
 
277
- const getBuildContextAdditionalContent = () => (
278
- <div className="h-250 fs-13 dc__overflow-scroll p-12">
279
- <div>Release tags allow you to tag container images with readable and relatable tags eg. v1.0.</div>
280
- <ul className="pl-20 mt-8">
281
- <li>
282
- A release tag can only be added if a workflow has CD pipelines deploying to Production environments.
283
- </li>
284
- <li>Multiple tags can be added to an image.</li>
285
- <li>Multiple images in an application cannot have the same tag.</li>
286
- <li>
287
- Tags cannot be deleted once saved. Although, you can soft delete a tag if an unwanted tag has been
288
- added.
289
- </li>
290
- </ul>
291
- </div>
292
- )
281
+ const getBuildContextAdditionalContent = () => {
282
+ return (
283
+ <div className="h-250 fs-13 dc__overflow-scroll p-12">
284
+ <div>Release tags allow you to tag container images with readable and relatable tags eg. v1.0.</div>
285
+ <ul className="pl-20 mt-8">
286
+ <li>
287
+ A release tag can only be added if a workflow has CD pipelines deploying to Production
288
+ environments.
289
+ </li>
290
+ <li>Multiple tags can be added to an image.</li>
291
+ <li>Multiple images in an application cannot have the same tag.</li>
292
+ <li>
293
+ Tags cannot be deleted once saved. Although, you can soft delete a tag if an unwanted tag has
294
+ been added.
295
+ </li>
296
+ </ul>
297
+ </div>
298
+ )
299
+ }
293
300
 
294
301
  const creatableRef = useRef(null)
295
302
 
@@ -299,7 +306,7 @@ export const ImageTagsContainer = ({
299
306
  <AddImageButton handleEditClick={handleEditClick} />
300
307
  </div>
301
308
  ) : (
302
- <div />
309
+ <div></div>
303
310
  )
304
311
  }
305
312
 
@@ -449,10 +456,8 @@ export const ImageTagsContainer = ({
449
456
  className="flex left image-tag-left-border w-100 mt-8 mb-8 pr-10 pl-10"
450
457
  data-testid="image-tags-container-hover"
451
458
  >
452
- <div className="w-100">
453
- {initialDescription && (
454
- <div className="mb-6 fs-13 lh-20 dc__word-break-all">{initialDescription}</div>
455
- )}
459
+ <div className='w-100'>
460
+ {initialDescription && <div className="mb-6 fs-13 lh-20 dc__word-break-all">{initialDescription}</div>}
456
461
  <div className="flex-wrap flex left">
457
462
  {initialTags?.map((tag, index) => (
458
463
  <ImageTagButton
@@ -515,11 +520,11 @@ export const ImageTagButton = ({
515
520
  const tabColor = () => {
516
521
  if (duplicateTag) {
517
522
  return 'cr-5 bcr-1 er-2'
518
- }
519
- if (isSoftDeleted) {
523
+ } else if (isSoftDeleted) {
520
524
  return 'cy-7 bcy-1 dc__strike-through ey-2'
525
+ } else {
526
+ return 'cn-9'
521
527
  }
522
- return 'cn-9'
523
528
  }
524
529
 
525
530
  return (
@@ -533,7 +538,7 @@ export const ImageTagButton = ({
533
538
  ) : (
534
539
  <Tippy
535
540
  className="default-tt"
536
- arrow
541
+ arrow={true}
537
542
  placement="top"
538
543
  content={isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag'}
539
544
  >
@@ -551,7 +556,7 @@ export const ImageTagButton = ({
551
556
  </Tippy>
552
557
  )}
553
558
  {text}
554
- <Tippy className="default-tt" arrow placement="top" content="Remove tag">
559
+ <Tippy className="default-tt" arrow={true} placement="top" content="Remove tag">
555
560
  <div className={`action-icon ml-4 lh-16 pt-3 ${canTagBeHardDelete ? 'show-icon' : ''}`}>
556
561
  <Close
557
562
  className="icon-dim-12 fcn-6 cursor"
@@ -1,8 +1,9 @@
1
+ import React from 'react'
1
2
  import { Link } from 'react-router-dom'
2
3
  import { InfoColourBarType } from '../Types'
3
4
  import './infoColourBar.scss'
4
5
 
5
- const InfoColourBar = ({
6
+ function InfoColourBar({
6
7
  message,
7
8
  classname,
8
9
  Icon,
@@ -15,12 +16,11 @@ const InfoColourBar = ({
15
16
  linkClass,
16
17
  internalLink,
17
18
  styles,
18
- }: InfoColourBarType) => {
19
+ }: InfoColourBarType) {
19
20
  const renderLink = () => {
20
21
  if (!linkText) {
21
22
  return null
22
- }
23
- if (redirectLink) {
23
+ } else if (redirectLink) {
24
24
  if (internalLink) {
25
25
  return (
26
26
  <Link
@@ -41,7 +41,6 @@ const InfoColourBar = ({
41
41
  onClick={linkOnClick}
42
42
  data-testid="info-bar-redirectLink"
43
43
  className="cursor dc__link dc__underline-onhover mr-5"
44
- rel="noreferrer"
45
44
  >
46
45
  {linkText}
47
46
  </a>
@@ -50,11 +49,7 @@ const InfoColourBar = ({
50
49
 
51
50
  return (
52
51
  linkOnClick && (
53
- <div
54
- onClick={linkOnClick}
55
- className="cursor dc__link dc__underline-onhover"
56
- data-testid="info-bar-linkText"
57
- >
52
+ <div onClick={linkOnClick} className="cursor dc__link dc__underline-onhover" data-testid="info-bar-linkText">
58
53
  {linkText}
59
54
  </div>
60
55
  )
@@ -1,4 +1,4 @@
1
- import { useRef, useEffect } from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import ReactDOM from 'react-dom'
3
3
  import { ModalType } from '../Types'
4
4
 
@@ -12,7 +12,7 @@ export const Modal = ({
12
12
  preventWheelDisable = false,
13
13
  noBackDrop,
14
14
  }: ModalType) => {
15
- const innerRef = useRef(null)
15
+ const innerRef = React.useRef(null)
16
16
  function handleClick(e) {
17
17
  if (typeof onClick !== 'function') return
18
18
  if (innerRef && innerRef.current?.contains(e.target)) {
@@ -35,7 +35,7 @@ export const Modal = ({
35
35
  }
36
36
  useEffect(() => {
37
37
  document.addEventListener('click', handleClick)
38
- const modal = document.getElementById('visible-modal')
38
+ let modal = document.getElementById('visible-modal')
39
39
  if (modal) modal.classList.add('show')
40
40
  if (noBackDrop) modal.classList.add('no-back-drop')
41
41
  if (!preventWheelDisable) document.body.addEventListener('wheel', disableWheel, { passive: false })
@@ -1,43 +1,36 @@
1
- import { Component } from 'react'
2
- import ReactDOM from 'react-dom'
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom';
3
3
  import closeIcon from '../../Assets/Icon/ic-cross.svg'
4
4
 
5
5
  export interface OpaqueModalProps {
6
- className?: string
7
- onHide?: any
8
- noBackground?: boolean
6
+ className?: string;
7
+ onHide?: any;
8
+ noBackground?: boolean;
9
9
  }
10
10
 
11
- export class OpaqueModal extends Component<OpaqueModalProps> {
12
- modalRef = document.getElementById('full-screen-modal')
11
+ export class OpaqueModal extends React.Component<OpaqueModalProps> {
12
+ modalRef = document.getElementById('full-screen-modal');
13
13
 
14
14
  componentDidMount() {
15
- if (this.props.noBackground) this.modalRef.classList.add('show')
16
- else this.modalRef.classList.add('show-with-bg')
15
+ if (this.props.noBackground)
16
+ this.modalRef.classList.add("show");
17
+ else this.modalRef.classList.add("show-with-bg");
17
18
  }
18
19
 
19
20
  componentWillUnmount() {
20
- this.modalRef.classList.remove('show')
21
- this.modalRef.classList.remove('show-with-bg')
21
+ this.modalRef.classList.remove("show");
22
+ this.modalRef.classList.remove("show-with-bg");
22
23
  }
23
24
 
24
25
  render() {
25
- const { className = '', onHide = null } = { ...this.props }
26
+ const { className = "", onHide = null } = { ...this.props };
26
27
 
27
28
  return ReactDOM.createPortal(
28
29
  <div className={`full-screen-modal__body-container ${className}`}>
29
30
  {this.props.children}
30
- {typeof onHide === 'function' && (
31
- <div
32
- className="close-btn icon-dim-24"
33
- onClick={(e) => onHide(false)}
34
- data-testid="opaque-modal-close"
35
- >
36
- <img className="close-img" src={closeIcon} alt="close" />
37
- </div>
38
- )}
39
- </div>,
40
- document.getElementById('full-screen-modal'),
41
- )
31
+ {typeof onHide === 'function' && <div className="close-btn icon-dim-24" onClick={e => onHide(false)} data-testid="opaque-modal-close">
32
+ <img className="close-img" src={closeIcon} alt="close" />
33
+ </div>}
34
+ </div>, document.getElementById('full-screen-modal'))
42
35
  }
43
- }
36
+ }
@@ -1,7 +1,7 @@
1
- import { Component } from 'react'
1
+ import React from 'react'
2
2
  import ReactDOM from 'react-dom'
3
3
 
4
- export class VisibleModal extends Component<{
4
+ export class VisibleModal extends React.Component<{
5
5
  className: string
6
6
  parentClassName?: string
7
7
  noBackground?: boolean
@@ -46,11 +46,7 @@ export class VisibleModal extends Component<{
46
46
 
47
47
  render() {
48
48
  return ReactDOM.createPortal(
49
- <div
50
- className={`visible-modal__body ${this.props.className}`}
51
- onClick={this.props?.close}
52
- data-testid="visible-modal-close"
53
- >
49
+ <div className={`visible-modal__body ${this.props.className}`} onClick={this.props?.close} data-testid="visible-modal-close">
54
50
  {this.props.children}
55
51
  </div>,
56
52
  document.getElementById('visible-modal'),
@@ -1,40 +1,35 @@
1
- import { Component } from 'react'
2
- import ReactDOM from 'react-dom'
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
3
 
4
- export class VisibleModal2 extends Component<{ className: string; close?: (e) => void }> {
5
- modalRef = document.getElementById('visible-modal-2')
4
+ export class VisibleModal2 extends React.Component<{ className: string; close?: (e) => void; }> {
5
+
6
+ modalRef = document.getElementById('visible-modal-2');
6
7
 
7
8
  constructor(props) {
8
- super(props)
9
- this.escFunction = this.escFunction.bind(this)
9
+ super(props);
10
+ this.escFunction = this.escFunction.bind(this);
10
11
  }
11
12
 
12
13
  escFunction(event) {
13
14
  if (event.keyCode === 27 && this.props.close) {
14
- this.props.close(event)
15
+ this.props.close(event);
15
16
  }
16
17
  }
17
18
 
18
19
  componentDidMount() {
19
- document.addEventListener('keydown', this.escFunction)
20
- this.modalRef.classList.add('show-with-bg')
20
+ document.addEventListener("keydown", this.escFunction);
21
+ this.modalRef.classList.add("show-with-bg");
21
22
  }
22
23
 
23
24
  componentWillUnmount() {
24
- document.removeEventListener('keydown', this.escFunction)
25
- this.modalRef.classList.remove('show-with-bg')
25
+ document.removeEventListener("keydown", this.escFunction);
26
+ this.modalRef.classList.remove("show-with-bg");
26
27
  }
27
28
 
28
29
  render() {
29
30
  return ReactDOM.createPortal(
30
- <div
31
- className={`visible-modal__body ${this.props.className}`}
32
- onClick={this.props?.close}
33
- data-testid="visible-modal2-close"
34
- >
31
+ <div className={`visible-modal__body ${this.props.className}`} onClick={this.props?.close} data-testid="visible-modal2-close">
35
32
  {this.props.children}
36
- </div>,
37
- document.getElementById('visible-modal-2'),
38
- )
33
+ </div>, document.getElementById('visible-modal-2'))
39
34
  }
40
- }
35
+ }
@@ -1,4 +1,4 @@
1
- import * as React from 'react'
1
+ import React from 'react'
2
2
  import Select, { components } from 'react-select'
3
3
  import { ReactComponent as ClearIcon } from '../Assets/Icon/ic-appstatus-cancelled.svg'
4
4
  import { ReactComponent as Check } from '../Assets/Icon/ic-check.svg'
@@ -42,7 +42,7 @@ export const MultiValueContainer = (props) => {
42
42
  const { label, value } = data
43
43
  return (
44
44
  <components.MultiValueContainer {...{ data, innerProps, selectProps }}>
45
- <div className="flex fs-12 ml-4 cn-9">{label}</div>
45
+ <div className={`flex fs-12 ml-4 cn-9`}>{label}</div>
46
46
  {children[1]}
47
47
  </components.MultiValueContainer>
48
48
  )
@@ -106,12 +106,14 @@ export const multiSelectStyles = {
106
106
  menu: (base, state) => ({
107
107
  ...base,
108
108
  }),
109
- option: (base, state) => ({
110
- ...base,
111
- backgroundColor: state.isFocused ? 'var(--N100)' : 'white',
112
- color: 'var(--N900)',
113
- padding: '8px 12px',
114
- }),
109
+ option: (base, state) => {
110
+ return {
111
+ ...base,
112
+ backgroundColor: state.isFocused ? 'var(--N100)' : 'white',
113
+ color: 'var(--N900)',
114
+ padding: '8px 12px',
115
+ }
116
+ },
115
117
  container: (base, state) => ({
116
118
  ...base,
117
119
  cursor: state.isDisabled ? 'not-allowed' : 'pointer',
@@ -141,4 +143,6 @@ export interface CustomSelect {
141
143
  formatOptionLabel?: (...args) => any
142
144
  }
143
145
 
144
- export const CustomSelect: React.FC<CustomSelect> = (props) => <Select {...props} />
146
+ export const CustomSelect: React.FC<CustomSelect> = (props) => {
147
+ return <Select {...props} />
148
+ }
@@ -1,63 +1,63 @@
1
- import { VariableType } from './CIPipeline.Types'
2
- import { ResponseType } from './Types'
1
+ import { VariableType } from "./CIPipeline.Types"
2
+ import { ResponseType } from "./Types"
3
3
 
4
4
  export enum ApplyPolicyToStage {
5
- PRE_CI = 'PRE_CI',
6
- POST_CI = 'POST_CI',
7
- PRE_OR_POST_CI = 'PRE_OR_POST_CI',
5
+ PRE_CI = 'PRE_CI',
6
+ POST_CI = 'POST_CI',
7
+ PRE_OR_POST_CI = 'PRE_OR_POST_CI',
8
8
  }
9
9
 
10
10
  export enum PluginRequiredStage {
11
- PRE_CI = 'preBuildStage',
12
- POST_CI = 'postBuildStage',
13
- PRE_OR_POST_CI = 'PRE_OR_POST_CI',
11
+ PRE_CI = 'preBuildStage',
12
+ POST_CI = 'postBuildStage',
13
+ PRE_OR_POST_CI = 'PRE_OR_POST_CI',
14
14
  }
15
15
 
16
16
  export interface DefinitionSourceType {
17
- projectName: string
18
- isDueToProductionEnvironment: boolean
19
- isDueToLinkedPipeline: boolean
20
- policyName: string
21
- appName?: string
22
- clusterName?: string
23
- environmentName?: string
24
- branchNames?: string[]
25
- ciPipelineName?: string
17
+ projectName: string
18
+ isDueToProductionEnvironment: boolean
19
+ isDueToLinkedPipeline: boolean
20
+ policyName: string
21
+ appName?: string
22
+ clusterName?: string
23
+ environmentName?: string
24
+ branchNames?: string[]
25
+ ciPipelineName?: string
26
26
  }
27
27
  export interface MandatoryPluginDetailType {
28
- id: number
29
- icon: string
30
- name: string
31
- description?: string
32
- requiredIn: PluginRequiredStage
33
- applied?: boolean
34
- inputVariables?: VariableType[]
35
- outputVariables?: VariableType[]
36
- definitionSources?: DefinitionSourceType[]
28
+ id: number
29
+ icon: string
30
+ name: string
31
+ description?: string
32
+ requiredIn: PluginRequiredStage
33
+ applied?: boolean
34
+ inputVariables?: VariableType[]
35
+ outputVariables?: VariableType[]
36
+ definitionSources?: DefinitionSourceType[]
37
37
  }
38
38
  export interface MandatoryPluginDataType {
39
- pluginData: MandatoryPluginDetailType[]
40
- isValidPre: boolean
41
- isValidPost: boolean
39
+ pluginData: MandatoryPluginDetailType[]
40
+ isValidPre: boolean
41
+ isValidPost: boolean
42
42
  }
43
43
 
44
44
  export enum ConsequenceAction {
45
- BLOCK = 'BLOCK',
46
- ALLOW_UNTIL_TIME = 'ALLOW_UNTIL_TIME',
47
- ALLOW_FOREVER = 'ALLOW_FOREVER',
45
+ BLOCK = 'BLOCK',
46
+ ALLOW_UNTIL_TIME = 'ALLOW_UNTIL_TIME',
47
+ ALLOW_FOREVER = 'ALLOW_FOREVER',
48
48
  }
49
49
 
50
50
  export interface ConsequenceType {
51
- action: ConsequenceAction
52
- metadataField: string
51
+ action: ConsequenceAction
52
+ metadataField: string
53
53
  }
54
54
 
55
55
  export interface BlockedStateData {
56
- isOffendingMandatoryPlugin: boolean
57
- isCITriggerBlocked: boolean
58
- ciBlockState: ConsequenceType
56
+ isOffendingMandatoryPlugin: boolean
57
+ isCITriggerBlocked: boolean
58
+ ciBlockState: ConsequenceType
59
59
  }
60
60
 
61
61
  export interface GetBlockedStateResponse extends ResponseType {
62
62
  result?: BlockedStateData
63
- }
63
+ }