-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2158 from pcbailey/feature-hide-deprecated-bootvo…
…lumes-by-default CNV-45860: Select 'Hide deprecated bootable volume' filter by default
- Loading branch information
Showing
18 changed files
with
159 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/utils/resources/bootableresources/hooks/useHideDeprecatedBootableVolumes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useEffect } from 'react'; | ||
|
||
import { CREATE_VM_TAB } from '@catalog/CreateVMHorizontalNav/constants'; | ||
import { useURLParams } from '@kubevirt-utils/hooks/useURLParams'; | ||
import { | ||
HIDE_DEPRECATED_BOOTABLE_VOLUMES, | ||
HIDE_DEPRECATED_BOOTABLE_VOLUMES_LABEL, | ||
} from '@kubevirt-utils/resources/bootableresources/constants'; | ||
import { FilterValue } from '@openshift-console/dynamic-plugin-sdk'; | ||
|
||
type UseHideDeprecatedBootableVolumes = ( | ||
onFilterChange: (type: string, value: FilterValue) => void, | ||
currentTab?: CREATE_VM_TAB, | ||
) => void; | ||
|
||
const useHideDeprecatedBootableVolumes: UseHideDeprecatedBootableVolumes = ( | ||
onFilterChange, | ||
currentTab, | ||
) => { | ||
const { setParam } = useURLParams(); | ||
|
||
useEffect(() => { | ||
if (currentTab !== CREATE_VM_TAB.INSTANCE_TYPES && currentTab !== undefined) return null; | ||
|
||
// This is to select the 'Hide deprecated bootable volumes' filter by default | ||
onFilterChange(HIDE_DEPRECATED_BOOTABLE_VOLUMES, { | ||
all: [HIDE_DEPRECATED_BOOTABLE_VOLUMES], | ||
selected: [HIDE_DEPRECATED_BOOTABLE_VOLUMES], | ||
}); | ||
|
||
setParam( | ||
`rowFilter-${HIDE_DEPRECATED_BOOTABLE_VOLUMES}`, | ||
HIDE_DEPRECATED_BOOTABLE_VOLUMES_LABEL, | ||
); | ||
}, [currentTab]); | ||
}; | ||
|
||
export default useHideDeprecatedBootableVolumes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/views/catalog/templatescatalog/hooks/useHideDeprecatedTemplateTiles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useEffect } from 'react'; | ||
|
||
import { CREATE_VM_TAB } from '@catalog/CreateVMHorizontalNav/constants'; | ||
import { CATALOG_FILTERS } from '@catalog/templatescatalog/utils/consts'; | ||
import { useURLParams } from '@kubevirt-utils/hooks/useURLParams'; | ||
import { HIDE_DEPRECATED_TEMPLATES } from '@kubevirt-utils/resources/template'; | ||
|
||
type UseHideDeprecatedTemplateTiles = ( | ||
currentTab: CREATE_VM_TAB, | ||
onFilterChange: (type: CATALOG_FILTERS, value: boolean | string) => void, | ||
) => void; | ||
|
||
const useHideDeprecatedTemplateTiles: UseHideDeprecatedTemplateTiles = ( | ||
currentTab, | ||
onFilterChange, | ||
) => { | ||
const { setParam } = useURLParams(); | ||
|
||
// This is to select the 'Hide deprecated templates' filter by default | ||
useEffect(() => { | ||
if (currentTab !== CREATE_VM_TAB.TEMPLATE) return null; | ||
|
||
onFilterChange(CATALOG_FILTERS.HIDE_DEPRECATED_TEMPLATES, true); | ||
|
||
setParam(HIDE_DEPRECATED_TEMPLATES, 'true'); | ||
}, [currentTab]); | ||
}; | ||
|
||
export default useHideDeprecatedTemplateTiles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/views/templates/list/hooks/useHideDeprecatedTemplates.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useEffect } from 'react'; | ||
|
||
import { useURLParams } from '@kubevirt-utils/hooks/useURLParams'; | ||
import { | ||
HIDE_DEPRECATED_TEMPLATES, | ||
HIDE_DEPRECATED_TEMPLATES_KEY, | ||
} from '@kubevirt-utils/resources/template'; | ||
import { FilterValue } from '@openshift-console/dynamic-plugin-sdk'; | ||
|
||
type UseHideDeprecatedTemplates = ( | ||
onFilterChange: (type: string, value: FilterValue) => void, | ||
) => void; | ||
|
||
const useHideDeprecatedTemplates: UseHideDeprecatedTemplates = (onFilterChange) => { | ||
const { setParam } = useURLParams(); | ||
|
||
useEffect(() => { | ||
// This is to select the 'Hide deprecated templates' filter by default | ||
onFilterChange(HIDE_DEPRECATED_TEMPLATES, { | ||
all: [HIDE_DEPRECATED_TEMPLATES], | ||
selected: [HIDE_DEPRECATED_TEMPLATES], | ||
}); | ||
|
||
setParam(`rowFilter-${HIDE_DEPRECATED_TEMPLATES}`, HIDE_DEPRECATED_TEMPLATES_KEY); | ||
}, []); | ||
}; | ||
|
||
export default useHideDeprecatedTemplates; |
Oops, something went wrong.