mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 04:15:28 +02:00
fix(kube): updated kube terminology for configmaps/secrets [EE-4816] (#8770)
This commit is contained in:
parent
8fa49d47f4
commit
0743f26ab8
9 changed files with 38 additions and 25 deletions
|
@ -28,7 +28,7 @@ class KubernetesConfigurationsController {
|
|||
this.configurations = await this.KubernetesConfigurationService.get();
|
||||
KubernetesConfigurationHelper.setConfigurationsUsed(this.configurations, this.applications);
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve configurations');
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve ConfigMaps & Secrets');
|
||||
} finally {
|
||||
this.state.configurationsLoading = false;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ class KubernetesConfigurationsController {
|
|||
for (const configuration of selectedItems) {
|
||||
try {
|
||||
await this.KubernetesConfigurationService.delete(configuration);
|
||||
this.Notifications.success('Configurations successfully removed', configuration.Name);
|
||||
this.Notifications.success('ConfigMaps/Secrets successfully removed', configuration.Name);
|
||||
const index = this.configurations.indexOf(configuration);
|
||||
this.configurations.splice(index, 1);
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to remove configuration');
|
||||
this.Notifications.error('Failure', err, 'Unable to remove ConfigMaps/Secrets');
|
||||
} finally {
|
||||
--actionCount;
|
||||
if (actionCount === 0) {
|
||||
|
@ -58,7 +58,7 @@ class KubernetesConfigurationsController {
|
|||
}
|
||||
|
||||
removeAction(selectedItems) {
|
||||
confirmDelete('Do you want to remove the selected configuration(s)?').then((confirmed) => {
|
||||
confirmDelete('Do you want to remove the selected ConfigMap(s) & Secret(s)?').then((confirmed) => {
|
||||
if (confirmed) {
|
||||
return this.$async(this.removeActionAsync, selectedItems);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<page-header
|
||||
ng-if="ctrl.state.viewReady"
|
||||
title="'Create configuration'"
|
||||
breadcrumbs="[{ label:'ConfigMaps and Secrets', link:'kubernetes.configurations' }, 'Create a configuration']"
|
||||
title="'Create ConfigMap or Secret'"
|
||||
breadcrumbs="[{ label:'ConfigMaps and Secrets', link:'kubernetes.configurations' }, 'Create a ConfigMap or Secret']"
|
||||
reload="true"
|
||||
></page-header>
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
|||
ng-model="ctrl.formValues.Name"
|
||||
ng-pattern="/^[a-z0-9]([a-z0-9-.]{0,61}[a-z0-9])?$/"
|
||||
ng-change="ctrl.onChangeName()"
|
||||
placeholder="my-configuration"
|
||||
placeholder="my-configmap-or-secret"
|
||||
auto-focus
|
||||
required
|
||||
data-cy="k8sConfigCreate-nameInput"
|
||||
|
@ -81,10 +81,10 @@
|
|||
</div>
|
||||
|
||||
<div ng-if="ctrl.formValues.ResourcePool">
|
||||
<div class="col-sm-12 form-section-title"> Configuration kind </div>
|
||||
<div class="col-sm-12 form-section-title"> Kind </div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 small text-muted"> Select the kind of data that you want to save in the configuration. </div>
|
||||
<div class="col-sm-12 small text-muted"> Select the kind of data that you want to save. </div>
|
||||
</div>
|
||||
|
||||
<box-selector options="ctrl.typeOptions" value="ctrl.formValues.Kind" on-change="(ctrl.onChangeKind)" radio-name="'Kind'" slim="true"> </box-selector>
|
||||
|
|
|
@ -140,6 +140,11 @@ class KubernetesCreateConfigurationController {
|
|||
}
|
||||
|
||||
async createConfigurationAsync() {
|
||||
let kind = 'ConfigMap';
|
||||
if (this.formValues.Kind === this.KubernetesConfigurationKinds.SECRET) {
|
||||
kind = 'Secret';
|
||||
}
|
||||
|
||||
try {
|
||||
this.state.actionInProgress = true;
|
||||
this.formValues.ConfigurationOwner = this.Authentication.getUserDetails().username;
|
||||
|
@ -148,11 +153,12 @@ class KubernetesCreateConfigurationController {
|
|||
}
|
||||
|
||||
await this.KubernetesConfigurationService.create(this.formValues);
|
||||
this.Notifications.success('Success', 'Configuration succesfully created');
|
||||
|
||||
this.Notifications.success('Success', `${kind} successfully created`);
|
||||
this.state.isEditorDirty = false;
|
||||
this.$state.go('kubernetes.configurations');
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to create configuration');
|
||||
this.Notifications.error('Failure', err, `Unable to create ${kind}`);
|
||||
} finally {
|
||||
this.state.actionInProgress = false;
|
||||
}
|
||||
|
@ -166,7 +172,7 @@ class KubernetesCreateConfigurationController {
|
|||
try {
|
||||
this.configurations = await this.KubernetesConfigurationService.get();
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve configurations');
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve ConfigMaps and Secrets');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<page-header
|
||||
ng-if="ctrl.state.viewReady"
|
||||
title="'Configuration details'"
|
||||
title="'ConfigMap or Secret details'"
|
||||
breadcrumbs="[
|
||||
{ label:'Namespaces', link:'kubernetes.resourcePools' },
|
||||
{
|
||||
|
@ -46,7 +46,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="!pl-0">Configuration kind</td>
|
||||
<td class="!pl-0">Kind</td>
|
||||
<td>
|
||||
{{ ctrl.configuration.Kind | kubernetesConfigurationKindText }}
|
||||
</td>
|
||||
|
|
|
@ -87,6 +87,11 @@ class KubernetesConfigurationController {
|
|||
// It looks like we're still doing a create/delete process but we've decided to get rid of this
|
||||
// approach.
|
||||
async updateConfigurationAsync() {
|
||||
let kind = 'ConfigMap';
|
||||
if (this.formValues.Kind === KubernetesConfigurationKinds.SECRET) {
|
||||
kind = 'Secret';
|
||||
}
|
||||
|
||||
try {
|
||||
this.state.actionInProgress = true;
|
||||
if (
|
||||
|
@ -96,7 +101,7 @@ class KubernetesConfigurationController {
|
|||
) {
|
||||
await this.KubernetesConfigurationService.create(this.formValues);
|
||||
await this.KubernetesConfigurationService.delete(this.configuration);
|
||||
this.Notifications.success('Success', 'Configuration succesfully updated');
|
||||
this.Notifications.success('Success', `${kind} successfully updated`);
|
||||
this.$state.go(
|
||||
'kubernetes.configurations.configuration',
|
||||
{
|
||||
|
@ -107,11 +112,11 @@ class KubernetesConfigurationController {
|
|||
);
|
||||
} else {
|
||||
await this.KubernetesConfigurationService.update(this.formValues, this.configuration);
|
||||
this.Notifications.success('Success', 'Configuration succesfully updated');
|
||||
this.Notifications.success('Success', `${kind} successfully updated`);
|
||||
this.$state.reload(this.$state.current);
|
||||
}
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to update configuration');
|
||||
this.Notifications.error('Failure', err, `Unable to update ${kind}`);
|
||||
} finally {
|
||||
this.state.actionInProgress = false;
|
||||
}
|
||||
|
@ -120,8 +125,9 @@ class KubernetesConfigurationController {
|
|||
updateConfiguration() {
|
||||
if (this.configuration.Used) {
|
||||
const plural = this.configuration.Applications.length > 1 ? 's' : '';
|
||||
const thisorthese = this.configuration.Applications.length > 1 ? 'these' : 'this';
|
||||
confirmUpdate(
|
||||
`The changes will be propagated to ${this.configuration.Applications.length} running application${plural}. Are you sure you want to update this configuration?`,
|
||||
`The changes will be propagated to ${this.configuration.Applications.length} running application${plural}. Are you sure you want to update ${thisorthese} ConfigMap${plural} or Secret${plural}?`,
|
||||
(confirmed) => {
|
||||
if (confirmed) {
|
||||
return this.$async(this.updateConfigurationAsync);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue