@devtron-labs/devtron-fe-common-lib 0.0.53-beta-4 → 0.0.53-beta-6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.53-beta-4",
3
+ "version": "0.0.53-beta-6",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -133,6 +133,8 @@ const cdMaterialListModal = (artifacts: any[], offset: number, artifactId?: numb
133
133
  isVirtualEnvironment: material.isVirtualEnvironment,
134
134
  imageComment: material.imageComment,
135
135
  imageReleaseTags: material.imageReleaseTags,
136
+ hasDuplicateImages: material.hasDuplicateImages,
137
+ isSuperseded: material.isSuperseded,
136
138
  // It is going to be null but required in type so can't remove
137
139
  lastExecution: material.lastExecution,
138
140
  materialInfo: material.material_info
@@ -4,8 +4,6 @@ import { ReactComponent as ICClear } from '../../Assets/Icon/ic-error-cross.svg'
4
4
  import { DebouncedSearchProps } from './Types'
5
5
 
6
6
  /**
7
- * @deprecated Use `SearchBar` component instead.
8
- *
9
7
  * @param onSearch - Callback function to be called on search
10
8
  * @param Icon - (Optional) Icon to be shown before the input
11
9
  * @param iconClass - (Optional) Class for the icon
@@ -559,18 +559,3 @@ export function getLockedJSON(json, jsonPathArray: string[]) {
559
559
  return resultJson['$']
560
560
  }
561
561
 
562
- /**
563
- * Returns a debounced variant of the function
564
- */
565
- export const debounce = (func, timeout = 500) => {
566
- let timer
567
-
568
- return function (this, ...args) {
569
- const context = this
570
- if (timer) clearTimeout(timer)
571
- timer = setTimeout(() => {
572
- timer = null
573
- func.apply(context, args)
574
- }, timeout)
575
- }
576
- }
@@ -261,6 +261,8 @@ export interface CDMaterialType {
261
261
  registryType?: string;
262
262
  imagePath?: string
263
263
  registryName?: string
264
+ hasDuplicateImages?: boolean
265
+ isSuperseded?: boolean
264
266
  // Not even coming from API but required in CDMaterials for Security which makes its own api call but stores data in CDMaterials
265
267
  scanToolId?: number
266
268
  appliedFiltersTimestamp?: string
@@ -26,7 +26,6 @@ export * from './Common.service'
26
26
  export * from './Checkbox'
27
27
  export { default as EmptyState } from './EmptyState/EmptyState'
28
28
  export { default as GenericEmptyState } from './EmptyState/GenericEmptyState'
29
- export * from './SearchBar'
30
29
  export { default as Toggle } from './Toggle/Toggle'
31
30
  export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable'
32
31
  export { default as StyledRadioGroup } from './RadioGroup/RadioGroup'
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { SearchBarProps } from './types';
3
- import './searchBar.scss';
4
- /**
5
- * Generic search input component with support for enter based and debounced search
6
- */
7
- declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout, }: SearchBarProps) => JSX.Element;
8
- export default SearchBar;
@@ -1,2 +0,0 @@
1
- export { default as SearchBar } from './SearchBar.component';
2
- export type { SearchBarProps } from './types';
@@ -1,35 +0,0 @@
1
- import { InputHTMLAttributes } from 'react';
2
- export interface SearchBarProps {
3
- /**
4
- * Initial search text
5
- *
6
- * @default ''
7
- */
8
- initialSearchText?: string;
9
- /**
10
- * Search handler for the search input
11
- */
12
- handleSearchChange?: (searchText: string) => void;
13
- /**
14
- * Enter event handler for the search input
15
- */
16
- handleEnter?: (searchText: string) => void;
17
- /**
18
- * Input props for the search input
19
- */
20
- inputProps?: InputHTMLAttributes<HTMLInputElement>;
21
- /**
22
- * Class name for the container; can be used for handling width
23
- */
24
- containerClassName?: string;
25
- /**
26
- * If true, the change handler would be triggered with debounce
27
- *
28
- * @default false
29
- */
30
- shouldDebounce?: boolean;
31
- /**
32
- * Timeout for the debounce handler to be triggered
33
- */
34
- debounceTimeout?: number;
35
- }
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
- <g fill="none" fill-rule="evenodd">
3
- <path d="M0 0h24v24H0z"/>
4
- <path fill="#959BA1" d="M10 2a8 8 0 0 1 6.32 12.905l5.044 5.045a1 1 0 1 1-1.414 1.414l-5.045-5.043A8 8 0 1 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12z"/>
5
- </g>
6
- </svg>
@@ -1,89 +0,0 @@
1
- import { ChangeEvent, useCallback, useRef, useState, KeyboardEvent } from 'react'
2
- import { ReactComponent as Search } from '../../Assets/Icon/ic-search.svg'
3
- import { ReactComponent as Clear } from '../../Assets/Icon/ic-error-cross.svg'
4
- import { SearchBarProps } from './types'
5
- import './searchBar.scss'
6
- import { debounce } from '../Helper'
7
-
8
- /**
9
- * Generic search input component with support for enter based and debounced search
10
- */
11
- const SearchBar = ({
12
- initialSearchText = '',
13
- handleSearchChange = () => {},
14
- handleEnter = () => {},
15
- inputProps = {},
16
- containerClassName,
17
- shouldDebounce = false,
18
- debounceTimeout = 300,
19
- }: SearchBarProps) => {
20
- const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
21
- const inputRef = useRef<HTMLInputElement>()
22
- const debouncedSearchChange = useCallback(debounce(handleSearchChange, debounceTimeout), [
23
- handleSearchChange,
24
- debounceTimeout,
25
- ])
26
-
27
- const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
28
- const { value } = e.target
29
- setShowClearButton(!!value)
30
- if (shouldDebounce) {
31
- debouncedSearchChange(value)
32
- } else {
33
- handleSearchChange(value)
34
- }
35
- }
36
-
37
- const _applySearch = (value: string) => {
38
- handleSearchChange(value)
39
- handleEnter(value)
40
- }
41
-
42
- const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
43
- const { key } = e
44
-
45
- if (key === 'Enter') {
46
- const inputTarget = e.target as HTMLInputElement
47
- const value = inputTarget.value.trim()
48
- _applySearch(value)
49
- }
50
- }
51
-
52
- const clearSearch = () => {
53
- inputRef.current.value = ''
54
- _applySearch('')
55
- }
56
-
57
- return (
58
- <div className={containerClassName}>
59
- <div className="search-bar bcn-0 dc__block w-100 min-w-200 dc__position-rel en-2 bw-1 br-4 h-32">
60
- <Search className="search-bar__icon dc__position-abs icon-color-n6 icon-dim-18" />
61
- <input
62
- placeholder="Search"
63
- data-testid="search-bar"
64
- type="text"
65
- {...inputProps}
66
- defaultValue={initialSearchText}
67
- className={`search-bar__input bcn-0 dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 ${
68
- showClearButton ? 'pr-30' : 'pr-10'
69
- }`}
70
- onChange={handleChange}
71
- onKeyDown={handleKeyDown}
72
- ref={inputRef}
73
- />
74
- {showClearButton && (
75
- <button
76
- className="flex search-bar__clear-button dc__position-abs dc__transparent mt-0 mb-0 mr-5 ml-5"
77
- type="button"
78
- onClick={clearSearch}
79
- aria-label="Clear search"
80
- >
81
- <Clear className="icon-dim-18 icon-n4 dc__vertical-align-middle" />
82
- </button>
83
- )}
84
- </div>
85
- </div>
86
- )
87
- }
88
-
89
- export default SearchBar
@@ -1,2 +0,0 @@
1
- export { default as SearchBar } from './SearchBar.component'
2
- export type { SearchBarProps } from './types'
@@ -1,31 +0,0 @@
1
- .search-bar {
2
-
3
- &:focus,
4
- &:focus-within {
5
- outline: none;
6
- border: solid 1px var(--B500);
7
- }
8
-
9
- &__input {
10
-
11
- &:focus,
12
- &:focus-visible {
13
- border: none;
14
- outline: none;
15
- }
16
- }
17
-
18
- &__icon {
19
- z-index: 1;
20
- top: 50%;
21
- left: 8px;
22
- transform: translateY(-50%);
23
- }
24
-
25
- &__clear-button {
26
- right: 0;
27
- top: 50%;
28
- transform: translateY(-50%);
29
- z-index: 1;
30
- }
31
- }
@@ -1,36 +0,0 @@
1
- import { InputHTMLAttributes } from 'react'
2
-
3
- export interface SearchBarProps {
4
- /**
5
- * Initial search text
6
- *
7
- * @default ''
8
- */
9
- initialSearchText?: string
10
- /**
11
- * Search handler for the search input
12
- */
13
- handleSearchChange?: (searchText: string) => void
14
- /**
15
- * Enter event handler for the search input
16
- */
17
- handleEnter?: (searchText: string) => void
18
- /**
19
- * Input props for the search input
20
- */
21
- inputProps?: InputHTMLAttributes<HTMLInputElement>
22
- /**
23
- * Class name for the container; can be used for handling width
24
- */
25
- containerClassName?: string
26
- /**
27
- * If true, the change handler would be triggered with debounce
28
- *
29
- * @default false
30
- */
31
- shouldDebounce?: boolean
32
- /**
33
- * Timeout for the debounce handler to be triggered
34
- */
35
- debounceTimeout?: number
36
- }