Skip to content

Commit 1cd7def

Browse files
authored
Merge pull request #154 from devtron-labs/feat/rollout-filters
feat: add partial in useUrlFilters, extend filter chips, generic section error state
2 parents 649f459 + 9620ee7 commit 1cd7def

File tree

19 files changed

+115
-73
lines changed

19 files changed

+115
-73
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
jobs:
1212
ci:
1313
runs-on: ubuntu-latest
14+
15+
if: ${{ !github.event.pull_request.draft }}
16+
1417
steps:
1518
- name: Checkout repository
1619
uses: actions/checkout@v4

.github/workflows/release-package.yml

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,32 @@ on:
55
types: [created]
66

77
jobs:
8-
build:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v4
12-
- uses: actions/setup-node@v4
13-
with:
14-
node-version-file: '.nvmrc'
15-
- run: npm ci
16-
- run: npm test
8+
build-and-publish:
9+
name: Build and Publish to NPM Registry
1710

18-
publish-gpr:
19-
needs: build
2011
runs-on: ubuntu-latest
21-
permissions:
22-
packages: write
23-
contents: read
12+
2413
steps:
25-
- uses: actions/checkout@v4
26-
- uses: actions/setup-node@v4
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
2719
with:
2820
node-version-file: '.nvmrc'
29-
registry-url: https://npm.pkg.github.com/
30-
- run: npm ci
31-
- run: npm run build-lib
32-
- run: npm publish
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
publish-npm:
36-
name: Publish to NPM Registry
37-
runs-on: ubuntu-latest
38-
steps:
39-
- uses: actions/checkout@v4
40-
- uses: actions/setup-node@v4
41-
with:
42-
node-version: 16
21+
cache: 'npm'
4322
registry-url: 'https://registry.npmjs.org/'
44-
- run: npm ci
45-
- run: npm run build-lib
46-
- run: npm publish --access public
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Execute test cases
28+
run: npm test
29+
30+
- name: Build Lib
31+
run: npm run build-lib
32+
33+
- name: Publish to NPM Registry
34+
run: npm publish --access public
4735
env:
4836
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.83-beta-3",
3+
"version": "0.0.83-beta-4",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-exclamation.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Common/Helper.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,3 @@ export function deepEqual(configA: any, configB: any): boolean {
786786
}
787787

788788
export const prefixZeroIfSingleDigit = (value: number = 0) => (value > 0 && value < 10 ? `0${value}` : value)
789-
790-
// TODO Eshank: Remove this function once the rollout status is implemented
791-
export const caseInsensitiveStringComparator = (a: string, b: string): number =>
792-
a.toLowerCase().localeCompare(b.toLowerCase())

src/Common/Hooks/useUrlFilters/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ export type UseUrlFiltersReturnType<T, K = unknown> = K & {
5757
/**
5858
* Update the search params with the passed object
5959
*/
60-
updateSearchParams: (paramsToSerialize: K) => void
60+
updateSearchParams: (paramsToSerialize: Partial<K>) => void
6161
}

src/Common/Hooks/useUrlFilters/useUrlFilters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const useUrlFilters = <T = string, K = unknown>({
107107
history.replace({ search: '' })
108108
}
109109

110-
const updateSearchParams = (paramsToSerialize: K) => {
110+
const updateSearchParams = (paramsToSerialize: Partial<K>) => {
111111
Object.keys(paramsToSerialize).forEach((key) => {
112112
if (paramsToSerialize[key]) {
113113
if (Array.isArray(paramsToSerialize[key])) {

src/Common/SearchBar/SearchBar.component.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const SearchBar = ({
4747
containerClassName,
4848
shouldDebounce = false,
4949
debounceTimeout = 300,
50+
noBackgroundAndBorder = false,
5051
}: SearchBarProps) => {
5152
const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
5253
const inputRef = useRef<HTMLInputElement>()
@@ -97,17 +98,19 @@ const SearchBar = ({
9798

9899
return (
99100
<div className={containerClassName}>
100-
<div className="search-bar bc-n50 focus-within-border-b5 dc__hover-border-n300 dc__block w-100 min-w-200 dc__position-rel en-2 bw-1 br-4 h-32">
101+
<div
102+
className={`search-bar ${noBackgroundAndBorder ? 'dc__no-border dc__no-background dc__hover-n50' : 'bc-n50 en-2 dc__hover-border-n300'} focus-within-border-b5 dc__block w-100 min-w-200 dc__position-rel br-4 bw-1 h-32`}
103+
>
101104
<Search className="search-bar__icon dc__position-abs icon-color-n6 icon-dim-16" />
102105
<input
103106
placeholder="Search"
104107
data-testid="search-bar"
105108
type="text"
106109
{...inputProps}
107110
defaultValue={initialSearchText}
108-
className={`search-bar__input bc-n50 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 ${
111+
className={`search-bar__input 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 ${
109112
showClearButton ? 'pr-30' : 'pr-10'
110-
}`}
113+
} ${noBackgroundAndBorder ? 'dc__no-background' : 'bc-n50'}`}
111114
onChange={handleChange}
112115
onKeyDown={handleKeyDown}
113116
ref={inputRef}

src/Common/SearchBar/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ export interface SearchBarProps {
3131
* Timeout for the debounce handler to be triggered
3232
*/
3333
debounceTimeout?: number
34+
/**
35+
* Hide the background and border of the search
36+
*/
37+
noBackgroundAndBorder?: boolean
3438
}

0 commit comments

Comments
 (0)