mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
feat(k8s/config): disable edit used config keys (#4754)
* feat(k8s/config): tag used data keys * feat(k8s/config): disabled edit of used data keys
This commit is contained in:
parent
c84da11a91
commit
20f8d03366
3 changed files with 36 additions and 4 deletions
|
@ -204,6 +204,23 @@ class KubernetesConfigurationController {
|
|||
return this.$async(this.getConfigurationsAsync);
|
||||
}
|
||||
|
||||
tagUsedDataKeys() {
|
||||
const configName = this.$transition$.params().name;
|
||||
const usedDataKeys = _.uniq(
|
||||
this.configuration.Applications.flatMap((app) =>
|
||||
app.Env.filter((e) => e.valueFrom && e.valueFrom.configMapKeyRef && e.valueFrom.configMapKeyRef.name === configName).map((e) => e.name)
|
||||
)
|
||||
);
|
||||
|
||||
this.formValues.Data = this.formValues.Data.map((variable) => {
|
||||
if (!usedDataKeys.includes(variable.Key)) {
|
||||
return variable;
|
||||
}
|
||||
|
||||
return { ...variable, Used: true };
|
||||
});
|
||||
}
|
||||
|
||||
async onInit() {
|
||||
try {
|
||||
this.state = {
|
||||
|
@ -228,6 +245,8 @@ class KubernetesConfigurationController {
|
|||
await this.getApplications(this.configuration.Namespace);
|
||||
await this.getEvents(this.configuration.Namespace);
|
||||
await this.getConfigurations();
|
||||
|
||||
this.tagUsedDataKeys();
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to load view data');
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue