Skip to content

Commit 9cf1db0

Browse files
committed
frontend: component: Add helm secrets filter switch
1 parent 61c1d2d commit 9cf1db0

File tree

14 files changed

+67
-87
lines changed

14 files changed

+67
-87
lines changed

frontend/src/components/secret/List.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,43 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { FormControlLabel, Switch } from '@mui/material';
18+
import { useState } from 'react';
1719
import { useTranslation } from 'react-i18next';
1820
import Secret from '../../lib/k8s/secret';
21+
import { CreateResourceButton } from '../common';
1922
import ResourceListView from '../common/Resource/ResourceListView';
2023

2124
export default function SecretList() {
2225
const { t } = useTranslation(['glossary', 'translation']);
26+
const [hideHelm, setHideHelm] = useState(true);
27+
const [secrets, error] = Secret.useList();
28+
29+
const filteredSecrets =
30+
hideHelm && secrets ? secrets.filter(secret => secret.type !== 'helm.sh/release.v1') : secrets;
2331

2432
return (
2533
<ResourceListView
2634
title={t('Secrets')}
27-
resourceClass={Secret}
35+
data={filteredSecrets}
36+
errorMessage={Secret.getErrorMessage(error)}
37+
headerProps={{
38+
titleSideActions: [
39+
<CreateResourceButton key="create-button" resourceClass={Secret} />,
40+
<FormControlLabel
41+
key="helm-switch"
42+
control={
43+
<Switch
44+
checked={hideHelm}
45+
onChange={e => setHideHelm(e.target.checked)}
46+
color="primary"
47+
/>
48+
}
49+
label={t('translation|Hide Helm Secrets')}
50+
sx={{ marginLeft: '0.5rem' }}
51+
/>,
52+
],
53+
}}
2854
columns={[
2955
'name',
3056
'namespace',

frontend/src/components/secret/__snapshots__/List.Items.stories.storyshot

Lines changed: 28 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -31,95 +31,37 @@
3131
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
3232
/>
3333
</button>
34-
</div>
35-
</div>
36-
</div>
37-
<div
38-
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
39-
>
40-
<div
41-
class="MuiGrid-root MuiGrid-container MuiGrid-item css-ztq4zc-MuiGrid-root"
42-
>
43-
<div
44-
class="MuiGrid-root MuiGrid-item css-13i4rnv-MuiGrid-root"
45-
>
46-
<div
47-
class="MuiAutocomplete-root MuiAutocomplete-hasPopupIcon css-1x6bjyf-MuiAutocomplete-root"
34+
<label
35+
class="MuiFormControlLabel-root MuiFormControlLabel-labelPlacementEnd css-b28cjl-MuiFormControlLabel-root"
4836
>
49-
<div
50-
class="MuiBox-root css-1dipl1t"
37+
<span
38+
class="MuiSwitch-root MuiSwitch-sizeMedium css-julti5-MuiSwitch-root"
5139
>
52-
<div
53-
class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root css-wb57ya-MuiFormControl-root-MuiTextField-root"
54-
style="margin-top: 0px;"
40+
<span
41+
class="MuiButtonBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary Mui-checked PrivateSwitchBase-root MuiSwitch-switchBase MuiSwitch-colorPrimary Mui-checked Mui-checked css-1emuodk-MuiButtonBase-root-MuiSwitch-switchBase"
5542
>
56-
<label
57-
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-sizeSmall MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-sizeSmall MuiInputLabel-outlined css-1f7ywh2-MuiFormLabel-root-MuiInputLabel-root"
58-
data-shrink="true"
59-
for="namespaces-filter"
60-
id="namespaces-filter-label"
61-
>
62-
Namespaces
63-
</label>
64-
<div
65-
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd MuiAutocomplete-inputRoot css-1xjtaff-MuiInputBase-root-MuiOutlinedInput-root"
66-
>
67-
<input
68-
aria-autocomplete="both"
69-
aria-expanded="false"
70-
aria-invalid="false"
71-
autocapitalize="none"
72-
autocomplete="off"
73-
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-19qh8xo-MuiInputBase-input-MuiOutlinedInput-input"
74-
id="namespaces-filter"
75-
placeholder="Filter"
76-
role="combobox"
77-
spellcheck="false"
78-
type="text"
79-
value=""
80-
/>
81-
<div
82-
class="MuiAutocomplete-endAdornment css-p1olib-MuiAutocomplete-endAdornment"
83-
>
84-
<button
85-
aria-label="Open"
86-
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeMedium MuiAutocomplete-popupIndicator css-1aav1nn-MuiButtonBase-root-MuiIconButton-root-MuiAutocomplete-popupIndicator"
87-
tabindex="-1"
88-
title="Open"
89-
type="button"
90-
>
91-
<svg
92-
aria-hidden="true"
93-
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
94-
data-testid="ArrowDropDownIcon"
95-
focusable="false"
96-
viewBox="0 0 24 24"
97-
>
98-
<path
99-
d="M7 10l5 5 5-5z"
100-
/>
101-
</svg>
102-
<span
103-
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
104-
/>
105-
</button>
106-
</div>
107-
<fieldset
108-
aria-hidden="true"
109-
class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
110-
>
111-
<legend
112-
class="css-14lo706"
113-
>
114-
<span>
115-
Namespaces
116-
</span>
117-
</legend>
118-
</fieldset>
119-
</div>
120-
</div>
121-
</div>
122-
</div>
43+
<input
44+
checked=""
45+
class="PrivateSwitchBase-input MuiSwitch-input css-1m9pwf3"
46+
type="checkbox"
47+
/>
48+
<span
49+
class="MuiSwitch-thumb css-jsexje-MuiSwitch-thumb"
50+
/>
51+
<span
52+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
53+
/>
54+
</span>
55+
<span
56+
class="MuiSwitch-track css-1yjjitx-MuiSwitch-track"
57+
/>
58+
</span>
59+
<span
60+
class="MuiTypography-root MuiTypography-body1 MuiFormControlLabel-label css-1ezega9-MuiTypography-root"
61+
>
62+
Hide Helm Secrets
63+
</span>
64+
</label>
12365
</div>
12466
</div>
12567
</div>

frontend/src/i18n/locales/de/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@
685685
"Users": "Benutzer",
686686
"Handler": "Handler",
687687
"No data in this secret": "Keine Daten in dieser Secret",
688+
"Hide Helm Secrets": "",
688689
"Shrink sidebar": "Seitenleiste verkleinern",
689690
"Expand sidebar": "Seitenleiste erweitern",
690691
"Main Navigation": "Hauptnavigation",

frontend/src/i18n/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@
685685
"Users": "Users",
686686
"Handler": "Handler",
687687
"No data in this secret": "No data in this secret",
688+
"Hide Helm Secrets": "Hide Helm Secrets",
688689
"Shrink sidebar": "Shrink sidebar",
689690
"Expand sidebar": "Expand sidebar",
690691
"Main Navigation": "Main Navigation",

frontend/src/i18n/locales/es/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@
689689
"Users": "Usuarios",
690690
"Handler": "Manejador",
691691
"No data in this secret": "Sin datos en este secret",
692+
"Hide Helm Secrets": "",
692693
"Shrink sidebar": "Reducir barra lateral",
693694
"Expand sidebar": "Expandir barra lateral",
694695
"Main Navigation": "Navegación principal",

frontend/src/i18n/locales/fr/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@
689689
"Users": "Utilisateurs",
690690
"Handler": "Gestionnaire",
691691
"No data in this secret": "Aucune donnée pour cette secret",
692+
"Hide Helm Secrets": "",
692693
"Shrink sidebar": "Réduire la barre latérale",
693694
"Expand sidebar": "Développer la barre latérale",
694695
"Main Navigation": "Navigation principale",

frontend/src/i18n/locales/hi/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@
685685
"Users": "उपयोगकर्ता",
686686
"Handler": "",
687687
"No data in this secret": "",
688+
"Hide Helm Secrets": "",
688689
"Shrink sidebar": "साइडबार संकुचित करें",
689690
"Expand sidebar": "साइडबार विस्तृत करें",
690691
"Main Navigation": "मुख्य नेविगेशन",

frontend/src/i18n/locales/it/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@
689689
"Users": "Utenti",
690690
"Handler": "Gestore",
691691
"No data in this secret": "Nessun dato in questo segreto",
692+
"Hide Helm Secrets": "",
692693
"Shrink sidebar": "Comprimi barra laterale",
693694
"Expand sidebar": "Espandi barra laterale",
694695
"Main Navigation": "Navigazione Principale",

frontend/src/i18n/locales/ja/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@
681681
"Users": "ユーザー",
682682
"Handler": "ハンドラー",
683683
"No data in this secret": "このシークレットにデータがありません",
684+
"Hide Helm Secrets": "",
684685
"Shrink sidebar": "サイドバーを縮小",
685686
"Expand sidebar": "サイドバーを展開",
686687
"Main Navigation": "メインナビゲーション",

frontend/src/i18n/locales/ko/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@
681681
"Users": "Users",
682682
"Handler": "Handler",
683683
"No data in this secret": "이 비밀에 데이터가 없습니다",
684+
"Hide Helm Secrets": "",
684685
"Shrink sidebar": "사이드바 축소",
685686
"Expand sidebar": "사이드바 확장",
686687
"Main Navigation": "메인 탐색",

0 commit comments

Comments
 (0)