Skip to content

Commit

Permalink
fixup! frontend: Add UI to rename cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Joaquim Rocha <joaquim.rocha@microsoft.com>
  • Loading branch information
joaquimrocha authored and knrt10 committed Jun 3, 2024
1 parent 08c4785 commit 656e6e3
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 93 deletions.
106 changes: 56 additions & 50 deletions frontend/src/components/App/Settings/SettingsCluster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,62 @@ export default function SettingsCluster() {
],
}}
>
{helpers.isElectron() && (
<NameValueTable
rows={[
{
name: t('translation|Name'),
value: (
<TextField
onChange={event => {
let value = event.target.value;
value = value.replace(' ', '');
setNewClusterName(value);
}}
value={newClusterName}
placeholder={cluster}
error={!isValidCurrentName}
helperText={
isValidCurrentName
? t(
'translation|The current name of cluster. You can define custom modified name.'
)
: invalidClusterNameMessage
}
InputProps={{
endAdornment: (
<Box pt={2} textAlign="right">
<ConfirmButton
onConfirm={() => {
if (isValidCurrentName) {
handleUpdateClusterName(source);
}
}}
confirmTitle={t('translation|Change name')}
confirmDescription={t(
'translation|Are you sure you want to change the name for "{{ clusterName }}"?',
{ clusterName: cluster }
)}
disabled={!newClusterName || !isValidCurrentName}
>
{t('translation|Apply')}
</ConfirmButton>
</Box>
),
onKeyPress: event => {
if (event.key === 'Enter' && isValidCurrentName) {
handleUpdateClusterName(source);
}
},
autoComplete: 'off',
sx: { maxWidth: 250 },
}}
/>
),
},
]}
/>
)}
<NameValueTable
rows={[
{
Expand Down Expand Up @@ -358,56 +414,6 @@ export default function SettingsCluster() {
</>
),
},
{
name: t('translation|Current name'),
value: (
<TextField
onChange={event => {
let value = event.target.value;
value = value.replace(' ', '');
setNewClusterName(value);
}}
value={newClusterName}
placeholder={cluster}
error={!isValidCurrentName}
helperText={
isValidCurrentName
? t(
'translation|The current name of cluster. You can define custom modified name.'
)
: invalidClusterNameMessage
}
InputProps={{
endAdornment: (
<Box pt={2} textAlign="right">
<ConfirmButton
color="secondary"
onConfirm={() => {
if (isValidCurrentName) {
handleUpdateClusterName(source);
}
}}
confirmTitle={t('translation|Change name')}
confirmDescription={t(
'translation|Are you sure you want to change the name for "{{ clusterName }}"?',
{ clusterName: cluster }
)}
disabled={!newClusterName || !isValidCurrentName}
>
{t('translation|Change name')}
</ConfirmButton>
</Box>
),
onKeyPress: event => {
if (event.key === 'Enter' && isValidCurrentName) {
handleUpdateClusterName(source);
}
},
autoComplete: 'off',
}}
/>
),
},
]}
/>
</SectionBox>
Expand Down
15 changes: 8 additions & 7 deletions frontend/src/i18n/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "",
"Cluster Settings ({{ clusterName }})": "Cluster-Einstellungen ({{ clusterName }})",
"Cluster Settings": "Cluster-Einstellungen",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Default namespace": "Standard-Namespace",
"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.",
"Current name": "",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Remove Cluster": "Cluster entfernen",
"Server": "Server",
"light theme": "helles Design",
Expand Down Expand Up @@ -149,8 +148,8 @@
"All namespaces": "Alle Namespaces",
"From": "Von",
"Age": "Alter",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_plural": "",
"Release Notes ({{ appVersion }})": "Versionshinweise ({{ appVersion }})",
"Fetching release information…": "Abrufen von Release-Informationen…",
"Skip": "Überspringen",
Expand Down Expand Up @@ -395,5 +394,7 @@
"\"{{metricName}}\" on pods": "\"{{metricName}}\" auf Pods",
"resource {{resourceName}} on pods": "Ressource {{resourceName}} auf Pods",
"resource {{resourceName}} of container {{containerName}} on pods": "Ressource {{resourceName}} des Containers {{containerName}} auf Pods",
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Warnung. Inkompatible Plugins deaktiviert: ({{ pluginList }})"
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Warnung. Inkompatible Plugins deaktiviert: ({{ pluginList }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": ""
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/de/translation_old.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": ""
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": "",
"Current name": ""
}
15 changes: 8 additions & 7 deletions frontend/src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.",
"Cluster Settings ({{ clusterName }})": "Cluster Settings ({{ clusterName }})",
"Cluster Settings": "Cluster Settings",
"The current name of cluster. You can define custom modified name.": "The current name of cluster. You can define custom modified name.",
"Change name": "Change name",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "Are you sure you want to change the name for \"{{ clusterName }}\"?",
"Default namespace": "Default namespace",
"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.",
"Current name": "Current name",
"The current name of cluster. You can define custom modified name.": "The current name of cluster. You can define custom modified name.",
"Change name": "Change name",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "Are you sure you want to change the name for \"{{ clusterName }}\"?",
"Remove Cluster": "Remove Cluster",
"Server": "Server",
"light theme": "light theme",
Expand Down Expand Up @@ -149,8 +148,8 @@
"All namespaces": "All namespaces",
"From": "From",
"Age": "Age",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "{{ eventDate }} ({{ count }} times since {{ firstEventDate }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": "{{ eventDate }} ({{ count }} times since {{ firstEventDate }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})": "{{ eventDate }} ({{ count }} times since {{ firstEventDate }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_plural": "{{ eventDate }} ({{ count }} times since {{ firstEventDate }})",
"Release Notes ({{ appVersion }})": "Release Notes ({{ appVersion }})",
"Fetching release information…": "Fetching release information…",
"Skip": "Skip",
Expand Down Expand Up @@ -395,5 +394,7 @@
"\"{{metricName}}\" on pods": "\"{{metricName}}\" on pods",
"resource {{resourceName}} on pods": "resource {{resourceName}} on pods",
"resource {{resourceName}} of container {{containerName}} on pods": "resource {{resourceName}} of container {{containerName}} on pods",
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Warning. Incompatible plugins disabled: ({{ pluginList }})"
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Warning. Incompatible plugins disabled: ({{ pluginList }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "{{ eventDate }} ({{ count }} times since {{ firstEventDate }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": "{{ eventDate }} ({{ count }} times since {{ firstEventDate }})"
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/en/translation_old.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": "This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?"
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": "This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?",
"Current name": "Current name"
}
17 changes: 9 additions & 8 deletions frontend/src/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "",
"Cluster Settings ({{ clusterName }})": "Configuración del cluster ({{ clusterName }})",
"Cluster Settings": "Configuración del cluster",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Default namespace": "Espacio de nombre por defecto",
"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.",
"Current name": "",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Remove Cluster": "Eliminar cluster",
"Server": "Servidor",
"light theme": "tema claro",
Expand Down Expand Up @@ -149,9 +148,8 @@
"All namespaces": "Todos los esp. de nombre",
"From": "De",
"Age": "Edad",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_many": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_plural": "",
"Release Notes ({{ appVersion }})": "Notas de lanzamiento ({{ appVersion }})",
"Fetching release information…": "Obteniendo información de la versión…",
"Skip": "Saltar",
Expand Down Expand Up @@ -396,5 +394,8 @@
"\"{{metricName}}\" on pods": "\"{{metricName}}\" en pods",
"resource {{resourceName}} on pods": "recurso {{resourceName}} en pods",
"resource {{resourceName}} of container {{containerName}} on pods": "recurso {{resourceName}} del contenedor {{containerName}} en pods",
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Advertencia. Plugins incompatibles deshabilitados: ({{ pluginList }})"
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Advertencia. Plugins incompatibles deshabilitados: ({{ pluginList }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_many": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": ""
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/es/translation_old.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": ""
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": "",
"Current name": ""
}
17 changes: 9 additions & 8 deletions frontend/src/i18n/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "",
"Cluster Settings ({{ clusterName }})": "Paramètres du cluster ({{ clusterName }})",
"Cluster Settings": "Paramètres du cluster",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Default namespace": "Espace de noms par défaut",
"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.",
"Current name": "",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Remove Cluster": "Supprimer le cluster",
"Server": "Serveur",
"light theme": "thème clair",
Expand Down Expand Up @@ -149,9 +148,8 @@
"All namespaces": "Tous les espaces de noms",
"From": "De",
"Age": "Âge",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_many": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_plural": "",
"Release Notes ({{ appVersion }})": "Notes de version ({{ appVersion }})",
"Fetching release information…": "Récupération des informations de version…",
"Skip": "Passer",
Expand Down Expand Up @@ -396,5 +394,8 @@
"\"{{metricName}}\" on pods": "\"{{metricName}}\" sur les pods",
"resource {{resourceName}} on pods": "ressource {{resourceName}} sur les pods",
"resource {{resourceName}} of container {{containerName}} on pods": "ressource {{resourceName}} du conteneur {{containerName}} sur les pods",
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Attention. Plugins incompatibles désactivés : ({{ pluginList }})"
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Attention. Plugins incompatibles désactivés : ({{ pluginList }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_many": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": ""
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/fr/translation_old.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": ""
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": "",
"Current name": ""
}
17 changes: 9 additions & 8 deletions frontend/src/i18n/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@
"Cluster name must contain only lowercase alphanumeric characters or '-', and must start and end with an alphanumeric character.": "",
"Cluster Settings ({{ clusterName }})": "Definições do cluster ({{ clusterName }})",
"Cluster Settings": "Definições do cluster",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Default namespace": "Namespace padrão",
"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.",
"Current name": "",
"The current name of cluster. You can define custom modified name.": "",
"Change name": "",
"Are you sure you want to change the name for \"{{ clusterName }}\"?": "",
"Remove Cluster": "Remover Cluster",
"Server": "Servidor",
"light theme": "tema claro",
Expand Down Expand Up @@ -149,9 +148,8 @@
"All namespaces": "Todos os \"namespaces\"",
"From": "De",
"Age": "Idade",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_many": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_plural": "",
"Release Notes ({{ appVersion }})": "Notas de lançamento ({{ appVersion }})",
"Fetching release information…": "A obter informação da versão…",
"Skip": "Saltar",
Expand Down Expand Up @@ -396,5 +394,8 @@
"\"{{metricName}}\" on pods": "\"{{metricName}}\" em pods",
"resource {{resourceName}} on pods": "resource {{resourceName}} em pods",
"resource {{resourceName}} of container {{containerName}} on pods": "resource {{resourceName}} do container {{containerName}} em pods",
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Aviso. Plugins incompatíveis desactivados: ({{ pluginList }})"
"Warning. Incompatible plugins disabled: ({{ pluginList }})": "Aviso. Plugins incompatíveis desactivados: ({{ pluginList }})",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_one": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_many": "",
"{{ eventDate }} ({{ count }} times since {{ firstEventDate }})_other": ""
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/pt/translation_old.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": ""
"This will add an extension field in your kubeconfig file for \"{{ clusterName }}. Are you sure\"?": "",
"Current name": ""
}

0 comments on commit 656e6e3

Please sign in to comment.