Skip to content

Commit

Permalink
frontend: Unify general and cluster settings
Browse files Browse the repository at this point in the history
Accessing settings in Headlamp is confusing. This change adds the cluster
settings to the sidebar along with the general and plugin settings. When
we open a cluster, clicking the Settings (gear) icon at the top will now
take us to the cluster settings in the home context. If there are
multiple clusters set up, a cluster selector will appear at the top of
the cluster settings page.

Fixes: #1927 and #2037

Signed-off-by: Evangelos Skopelitis <eskopelitis@microsoft.com>
  • Loading branch information
skoeva committed Jul 30, 2024
1 parent 69e9227 commit 29219ba
Show file tree
Hide file tree
Showing 10 changed files with 353 additions and 222 deletions.
430 changes: 215 additions & 215 deletions frontend/src/components/App/Settings/SettingsCluster.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button Mui-selected css-sayhe9-MuiButtonBase-root-MuiListItem-root"
href="/settings"
href="/settings/general"
role="button"
tabindex="0"
>
Expand Down Expand Up @@ -94,6 +94,29 @@
<ul
class="MuiList-root css-2l483y-MuiList-root"
>
<li
class="css-b4fdej"
>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button css-sayhe9-MuiButtonBase-root-MuiListItem-root"
href="/settings/general"
role="button"
tabindex="0"
>
<div
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
>
<span
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-nqgwvn-MuiTypography-root"
>
General
</span>
</div>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</a>
</li>
<li
class="css-b4fdej"
>
Expand All @@ -117,6 +140,29 @@
/>
</a>
</li>
<li
class="css-b4fdej"
>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button css-sayhe9-MuiButtonBase-root-MuiListItem-root"
href="/settings/cluster"
role="button"
tabindex="0"
>
<div
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
>
<span
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-nqgwvn-MuiTypography-root"
>
Cluster
</span>
</div>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</a>
</li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button Mui-selected css-sayhe9-MuiButtonBase-root-MuiListItem-root"
href="/settings"
href="/settings/general"
role="button"
tabindex="0"
>
Expand Down Expand Up @@ -115,6 +115,29 @@
<ul
class="MuiList-root css-2l483y-MuiList-root"
>
<li
class="css-b4fdej"
>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button css-sayhe9-MuiButtonBase-root-MuiListItem-root"
href="/settings/general"
role="button"
tabindex="0"
>
<div
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
>
<span
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-nqgwvn-MuiTypography-root"
>
General
</span>
</div>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</a>
</li>
<li
class="css-b4fdej"
>
Expand All @@ -138,6 +161,29 @@
/>
</a>
</li>
<li
class="css-b4fdej"
>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button css-sayhe9-MuiButtonBase-root-MuiListItem-root"
href="/settings/cluster"
role="button"
tabindex="0"
>
<div
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
>
<span
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-nqgwvn-MuiTypography-root"
>
Cluster
</span>
</div>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</a>
</li>
</ul>
</div>
</div>
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/components/Sidebar/prepareRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,23 @@ function prepareRoutes(
name: 'settings',
icon: 'mdi:cog',
label: t('translation|Settings'),
url: '/settings',
url: '/settings/general',
subList: [
{
name: 'general',
label: t('translation|General'),
url: '/settings/general',
},
{
name: 'plugins',
label: t('translation|Plugins'),
url: '/settings/plugins',
},
{
name: 'settingsCluster',
label: t('glossary|Cluster'),
url: '/settings/cluster',
},
],
},
];
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"The default namespace for e.g. when applying resources (when not specified directly).": "Der Standard-Namespace z. B. für die Anwendung von Ressourcen (wenn nicht anders angegeben).",
"Allowed namespaces": "Erlaubte Namespaces",
"The list of namespaces you are allowed to access in this cluster.": "Liste der Namespaces, auf die Sie in diesem Cluster zugreifen dürfen.",
"Cluster {{ clusterName }} does not exist. Please select a valid cluster.": "",
"Remove Cluster": "Cluster entfernen",
"Server": "Server",
"light theme": "helles Design",
Expand Down Expand Up @@ -370,6 +371,7 @@
"Expand sidebar": "Seitenleiste erweitern",
"Main Navigation": "Hauptnavigation",
"Navigation Tabs": "Navigationstabs",
"General": "",
"Collapse Sidebar": "Seitenleiste einklappen",
"Navigation": "Navigation",
"Cluster version upgraded to {{ gitVersion }}": "Cluster-Version auf {{ gitVersion }} aktualisiert",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"The default namespace for e.g. when applying resources (when not specified directly).": "The default namespace for e.g. when applying resources (when not specified directly).",
"Allowed namespaces": "Allowed namespaces",
"The list of namespaces you are allowed to access in this cluster.": "The list of namespaces you are allowed to access in this cluster.",
"Cluster {{ clusterName }} does not exist. Please select a valid cluster.": "Cluster {{ clusterName }} does not exist. Please select a valid cluster.",
"Remove Cluster": "Remove Cluster",
"Server": "Server",
"light theme": "light theme",
Expand Down Expand Up @@ -370,6 +371,7 @@
"Expand sidebar": "Expand sidebar",
"Main Navigation": "Main Navigation",
"Navigation Tabs": "Navigation Tabs",
"General": "General",
"Collapse Sidebar": "Collapse Sidebar",
"Navigation": "Navigation",
"Cluster version upgraded to {{ gitVersion }}": "Cluster version upgraded to {{ gitVersion }}",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"The default namespace for e.g. when applying resources (when not specified directly).": "El espacio de nombre por defecto para, por ejemplo, cuando se aplican recursos (cuando no especificado directamente).",
"Allowed namespaces": "Espacios de nombre permitidos",
"The list of namespaces you are allowed to access in this cluster.": "La lista de espacios de nombre a los que tiene permiso para acceder en este cluster.",
"Cluster {{ clusterName }} does not exist. Please select a valid cluster.": "",
"Remove Cluster": "Eliminar cluster",
"Server": "Servidor",
"light theme": "tema claro",
Expand Down Expand Up @@ -371,6 +372,7 @@
"Expand sidebar": "Expandir barra lateral",
"Main Navigation": "Navegación principal",
"Navigation Tabs": "Pestañas de navegación",
"General": "",
"Collapse Sidebar": "Contraer barra lateral",
"Navigation": "Navegación",
"Cluster version upgraded to {{ gitVersion }}": "Versión del cluster actualizada a {{ gitVersion }}",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"The default namespace for e.g. when applying resources (when not specified directly).": "L'espace de noms par défaut, par exemple lors de l'application de ressources (lorsqu'il n'est pas spécifié directement).",
"Allowed namespaces": "Espaces de noms autorisés",
"The list of namespaces you are allowed to access in this cluster.": "La liste des espaces de noms que vous pouvez accéder dans ce cluster.",
"Cluster {{ clusterName }} does not exist. Please select a valid cluster.": "",
"Remove Cluster": "Supprimer le cluster",
"Server": "Serveur",
"light theme": "thème clair",
Expand Down Expand Up @@ -371,6 +372,7 @@
"Expand sidebar": "Développer la barre latérale",
"Main Navigation": "Navigation principale",
"Navigation Tabs": "Onglets de navigation",
"General": "",
"Collapse Sidebar": "Réduire la barre latérale",
"Navigation": "Navigation",
"Cluster version upgraded to {{ gitVersion }}": "Version du cluster mise à jour vers {{ gitVersion }}",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"The default namespace for e.g. when applying resources (when not specified directly).": "O namespace por defeito, por exemplo, quando se aplicam recursos (quando não especificado directamente).",
"Allowed namespaces": "Namespaces permitidos",
"The list of namespaces you are allowed to access in this cluster.": "A lista de namespaces que tem permissão para aceder neste cluster.",
"Cluster {{ clusterName }} does not exist. Please select a valid cluster.": "",
"Remove Cluster": "Remover Cluster",
"Server": "Servidor",
"light theme": "tema claro",
Expand Down Expand Up @@ -371,6 +372,7 @@
"Expand sidebar": "Expandir barra lateral",
"Main Navigation": "Navegação Principal",
"Navigation Tabs": "Separadores de Navegação",
"General": "",
"Collapse Sidebar": "Encolher Barra Lateral",
"Navigation": "Navegação",
"Cluster version upgraded to {{ gitVersion }}": "Versão do cluster actualizada para {{ gitVersion }}",
Expand Down
27 changes: 23 additions & 4 deletions frontend/src/lib/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,11 @@ const defaultRoutes: {
),
},
settings: {
path: '/settings',
path: '/settings/general',
exact: true,
name: 'Settings',
sidebar: {
item: 'settings',
item: 'general',
sidebar: DefaultSidebars.HOME,
},
useClusterURL: false,
Expand All @@ -684,7 +684,6 @@ const defaultRoutes: {
</PageGrid>
),
},

settingsClusters: {
path: '/settings/clusters',
exact: true,
Expand All @@ -702,7 +701,27 @@ const defaultRoutes: {
path: '/settings',
exact: true,
name: 'Cluster Settings',
sidebar: 'settingsCluster',
sidebar: {
item: 'settingsCluster',
sidebar: DefaultSidebars.HOME,
},
useClusterURL: true,
noAuthRequired: true,
component: () => (
<PageGrid>
<SettingsCluster />
</PageGrid>
),
},
settingsClusterHomeContext: {
path: '/settings/cluster',
exact: true,
name: 'Cluster Settings',
sidebar: {
item: 'settingsCluster',
sidebar: DefaultSidebars.HOME,
},
useClusterURL: false,
noAuthRequired: true,
component: () => (
<PageGrid>
Expand Down

0 comments on commit 29219ba

Please sign in to comment.