mirror of https://github.com/rancher/ui.git
fix form-secrets
This commit is contained in:
parent
0907e6c5ad
commit
e9b5c5123b
|
|
@ -65,23 +65,25 @@ export default Component.extend({
|
||||||
return out;
|
return out;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
selectedSecret: null,
|
||||||
prefixOrKeys: computed('allSecrets.[]', 'secret.sourceName', function() {
|
prefixOrKeys: computed('allSecrets.[]', 'secret.sourceName', function() {
|
||||||
let prefix = { id: 'prefix', label: 'All'};
|
let prefix = { id: 'prefix', label: 'All'};
|
||||||
let selectedSecret = get(this, 'secret.sourceName');
|
let secretSourceName = get(this, 'secret.sourceName');
|
||||||
let out = [prefix];
|
let out = [prefix];
|
||||||
|
let secret = get(this, 'selectedSecret');
|
||||||
|
|
||||||
if (selectedSecret) {
|
if (secretSourceName) {
|
||||||
let secret = get(this, 'secrets').findBy('name', selectedSecret);
|
if (get(secret, 'data')) {
|
||||||
let secretKeys = Object.keys(get(secret, 'data'));
|
let secretKeys = Object.keys(get(secret, 'data'));
|
||||||
|
|
||||||
set(this, 'sourceKey', 'prefix');
|
|
||||||
|
|
||||||
if (secretKeys) {
|
if (secretKeys) {
|
||||||
secretKeys.forEach((sk) => {
|
secretKeys.forEach((sk) => {
|
||||||
out.addObject({id: sk, label: sk});
|
out.addObject({id: sk, label: sk});
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
set(this, 'sourceKey', 'prefix');
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,10 @@
|
||||||
<td data-title="{{t 'formSecrets.kind.label'}}">
|
<td data-title="{{t 'formSecrets.kind.label'}}">
|
||||||
{{#if editing}}
|
{{#if editing}}
|
||||||
{{schema/input-secret
|
{{schema/input-secret
|
||||||
namespace=namespace
|
namespace=namespace
|
||||||
value=secret.sourceName
|
value=secret.sourceName
|
||||||
valueKey='name'
|
valueKey='name'
|
||||||
|
selectedSecret=(action (mut selectedSecret))
|
||||||
}}
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if secret}}
|
{{#if secret}}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ export default Component.extend({
|
||||||
intl: service(),
|
intl: service(),
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
|
value: null,
|
||||||
namespace: null,
|
namespace: null,
|
||||||
selectClass: 'form-control',
|
selectClass: 'form-control',
|
||||||
valueKey: 'name', // What to set the value as.. 'name' or 'id'
|
valueKey: 'name', // What to set the value as.. 'name' or 'id'
|
||||||
|
|
@ -21,6 +22,10 @@ export default Component.extend({
|
||||||
projectSecrets: null,
|
projectSecrets: null,
|
||||||
namespaceSecrets: null,
|
namespaceSecrets: null,
|
||||||
|
|
||||||
|
findSecret() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
|
|
@ -89,9 +94,12 @@ export default Component.extend({
|
||||||
let str = null;
|
let str = null;
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
let secret = get(this,'store').getById('secret',id);
|
let secret = get(this, 'projectSecrets').findBy('id', id) || get(this, 'namespaceSecrets').findBy('id', id);
|
||||||
if ( secret ) {
|
if ( secret ) {
|
||||||
|
get(this, 'selectedSecret')(secret);
|
||||||
str = get(secret,get(this,'valueKey'));
|
str = get(secret,get(this,'valueKey'));
|
||||||
|
} else {
|
||||||
|
get(this, 'selectedSecret')(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
content=filtered
|
content=filtered
|
||||||
prompt="schema.inputSecret.prompt"
|
prompt="schema.inputSecret.prompt"
|
||||||
localizedPrompt=true
|
localizedPrompt=true
|
||||||
value=seleted
|
value=selected
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue