mirror of https://github.com/rancher/ui.git
more updates
This commit is contained in:
parent
ca6cf80513
commit
539ff7d24e
|
|
@ -7,7 +7,7 @@ export default Component.extend({
|
|||
tagName: 'tr',
|
||||
secrets: null,
|
||||
allSecrets: computed('secrets.@each.{sourceName}', function() {
|
||||
return get(this, 'secrets').map(s => { return {id: get(s, 'id'), label: get(s, 'name')} })
|
||||
return get(this, 'secrets').map(s => { return {id: get(s, 'name'), label: get(s, 'name')} }).sortBy('label');
|
||||
}),
|
||||
secret: null,
|
||||
usePrefix: false,
|
||||
|
|
@ -16,16 +16,37 @@ export default Component.extend({
|
|||
secretSet: computed('secret.sourceName', function() {
|
||||
return get(this, 'secret.sourceName') ? false : true;
|
||||
}),
|
||||
|
||||
prefixOrTarget: computed('sourceKey', {
|
||||
get(key) {
|
||||
if (get(this, 'sourceKey') === 'prefix') {
|
||||
return get(this, 'secret.prefix');
|
||||
} else {
|
||||
return get(this, 'secret.targetKey');
|
||||
}
|
||||
},
|
||||
set(key, value) {
|
||||
if (get(this, 'sourceKey') === 'prefix') {
|
||||
return set(this, 'secret.prefix', value);
|
||||
} else {
|
||||
return set(this, 'secret.targetKey', value);
|
||||
}
|
||||
}
|
||||
}),
|
||||
sourceKey: computed({
|
||||
get(key) {
|
||||
return get(this, 'secret.sourceKey');
|
||||
let nue = key;
|
||||
if (get(this, 'secret.prefix')) {
|
||||
nue = 'prefix';
|
||||
}
|
||||
return get(this, `secret.${nue}`);
|
||||
},
|
||||
set(key, value) {
|
||||
let out = get(this, 'secret.sourceKey');
|
||||
|
||||
if (value === 'prefix') {
|
||||
// TODO verify that when prefix is set we do not set the sourceKey
|
||||
out = "prefix";
|
||||
//need to do something with all keys of secret data eg create a bunch of entires
|
||||
} else {
|
||||
set(this, 'secret.sourceKey', value);
|
||||
}
|
||||
|
|
@ -33,7 +54,6 @@ export default Component.extend({
|
|||
set(this, 'disableTarget', false)
|
||||
|
||||
return out;
|
||||
|
||||
},
|
||||
}),
|
||||
prefixOrKeys: computed('allSecrets.[]', 'secret.sourceName', function() {
|
||||
|
|
@ -41,7 +61,7 @@ export default Component.extend({
|
|||
let selectedSecret = get(this, 'secret.sourceName');
|
||||
let out = [prefix];
|
||||
if (selectedSecret) {
|
||||
let secret = get(this, 'secrets').findBy('id', selectedSecret);
|
||||
let secret = get(this, 'secrets').findBy('name', selectedSecret);
|
||||
let secretKeys = Object.keys(get(secret, 'data'));
|
||||
if (secretKeys) {
|
||||
secretKeys.forEach((sk) => {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,18 @@
|
|||
<td> </td>
|
||||
|
||||
<td data-title="{{t 'formSecrets.prefix.label'}}">
|
||||
{{input type="text" value=prefixTarget classNames="form-control" disabled=disableTarget}}
|
||||
<div class="row">
|
||||
<div class="col span-2">
|
||||
{{#if (eq sourceKey 'prefix')}}
|
||||
{{sourceKey}}
|
||||
{{else}}
|
||||
{{t 'generic.as'}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="col span-10">
|
||||
{{input type="text" value=prefixOrTarget classNames="form-control" disabled=disableTarget}}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{#if editing}}
|
||||
|
|
|
|||
|
|
@ -7,26 +7,21 @@ import {
|
|||
} from 'shared/components/accordion-list-item/component';
|
||||
import layout from './template';
|
||||
import { get, set, computed } from '@ember/object';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
secrets: null,
|
||||
secrets: null,
|
||||
_allSecrets: null,
|
||||
intl: service(),
|
||||
store: service('store'),
|
||||
store: service('store'),
|
||||
statusClass: null,
|
||||
fetching: false,
|
||||
editing: true,
|
||||
fetching: false,
|
||||
editing: true,
|
||||
|
||||
actions: {
|
||||
addSecret() {
|
||||
let secret = {
|
||||
source: 'secret',
|
||||
sourceName: null,
|
||||
targetKey: null,
|
||||
};
|
||||
let secret = {source: 'secret'};
|
||||
get(this, 'secrets').addObject(secret);
|
||||
},
|
||||
removeSecret(secret) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<th width="10"></th>
|
||||
<th class="{{unless editing 'acc-label'}}">{{t 'formSecrets.prefixOrKey.label'}}{{#if editing}}{{field-required}}{{/if}}</th>
|
||||
<th width="10"></th>
|
||||
<th class="{{unless editing 'acc-label'}}">{{t 'formSecrets.prefix.label'}}{{#if editing}}{{field-required}}{{/if}}</th>
|
||||
<th class="{{unless editing 'acc-label'}}">{{t 'formSecrets.prefix.label'}}</th>
|
||||
<th width="40"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ export default Component.extend(NewOrEdit, {
|
|||
window.nec = this;
|
||||
this._super(...arguments);
|
||||
|
||||
if ( !this.get('launchConfig.secrets') ) {
|
||||
this.set('launchConfig.secrets', []);
|
||||
if ( !this.get('launchConfig.environmentFrom') ) {
|
||||
this.set('launchConfig.environmentFrom', []);
|
||||
}
|
||||
|
||||
if ( !this.get('launchConfig.metadata') ) {
|
||||
|
|
|
|||
|
|
@ -3147,7 +3147,7 @@ formSecrets:
|
|||
prefixOrKey:
|
||||
label: Prefix or Key
|
||||
prefix:
|
||||
label: As Prefix or As Name
|
||||
label: Prefix or Alias
|
||||
uid:
|
||||
label: User ID
|
||||
placeholder: e.g. 0 (root)
|
||||
|
|
|
|||
Loading…
Reference in New Issue