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',
|
tagName: 'tr',
|
||||||
secrets: null,
|
secrets: null,
|
||||||
allSecrets: computed('secrets.@each.{sourceName}', function() {
|
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,
|
secret: null,
|
||||||
usePrefix: false,
|
usePrefix: false,
|
||||||
|
|
@ -16,16 +16,37 @@ export default Component.extend({
|
||||||
secretSet: computed('secret.sourceName', function() {
|
secretSet: computed('secret.sourceName', function() {
|
||||||
return get(this, 'secret.sourceName') ? false : true;
|
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({
|
sourceKey: computed({
|
||||||
get(key) {
|
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) {
|
set(key, value) {
|
||||||
let out = get(this, 'secret.sourceKey');
|
let out = get(this, 'secret.sourceKey');
|
||||||
|
|
||||||
if (value === 'prefix') {
|
if (value === 'prefix') {
|
||||||
|
// TODO verify that when prefix is set we do not set the sourceKey
|
||||||
out = "prefix";
|
out = "prefix";
|
||||||
//need to do something with all keys of secret data eg create a bunch of entires
|
|
||||||
} else {
|
} else {
|
||||||
set(this, 'secret.sourceKey', value);
|
set(this, 'secret.sourceKey', value);
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +54,6 @@ export default Component.extend({
|
||||||
set(this, 'disableTarget', false)
|
set(this, 'disableTarget', false)
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
prefixOrKeys: computed('allSecrets.[]', 'secret.sourceName', function() {
|
prefixOrKeys: computed('allSecrets.[]', 'secret.sourceName', function() {
|
||||||
|
|
@ -41,7 +61,7 @@ export default Component.extend({
|
||||||
let selectedSecret = get(this, 'secret.sourceName');
|
let selectedSecret = get(this, 'secret.sourceName');
|
||||||
let out = [prefix];
|
let out = [prefix];
|
||||||
if (selectedSecret) {
|
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'));
|
let secretKeys = Object.keys(get(secret, 'data'));
|
||||||
if (secretKeys) {
|
if (secretKeys) {
|
||||||
secretKeys.forEach((sk) => {
|
secretKeys.forEach((sk) => {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,18 @@
|
||||||
<td> </td>
|
<td> </td>
|
||||||
|
|
||||||
<td data-title="{{t 'formSecrets.prefix.label'}}">
|
<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>
|
||||||
<td>
|
<td>
|
||||||
{{#if editing}}
|
{{#if editing}}
|
||||||
|
|
|
||||||
|
|
@ -7,26 +7,21 @@ import {
|
||||||
} from 'shared/components/accordion-list-item/component';
|
} from 'shared/components/accordion-list-item/component';
|
||||||
import layout from './template';
|
import layout from './template';
|
||||||
import { get, set, computed } from '@ember/object';
|
import { get, set, computed } from '@ember/object';
|
||||||
import { task } from 'ember-concurrency';
|
|
||||||
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
layout,
|
layout,
|
||||||
secrets: null,
|
secrets: null,
|
||||||
_allSecrets: null,
|
_allSecrets: null,
|
||||||
intl: service(),
|
intl: service(),
|
||||||
store: service('store'),
|
store: service('store'),
|
||||||
statusClass: null,
|
statusClass: null,
|
||||||
fetching: false,
|
fetching: false,
|
||||||
editing: true,
|
editing: true,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
addSecret() {
|
addSecret() {
|
||||||
let secret = {
|
let secret = {source: 'secret'};
|
||||||
source: 'secret',
|
|
||||||
sourceName: null,
|
|
||||||
targetKey: null,
|
|
||||||
};
|
|
||||||
get(this, 'secrets').addObject(secret);
|
get(this, 'secrets').addObject(secret);
|
||||||
},
|
},
|
||||||
removeSecret(secret) {
|
removeSecret(secret) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<th width="10"></th>
|
<th width="10"></th>
|
||||||
<th class="{{unless editing 'acc-label'}}">{{t 'formSecrets.prefixOrKey.label'}}{{#if editing}}{{field-required}}{{/if}}</th>
|
<th class="{{unless editing 'acc-label'}}">{{t 'formSecrets.prefixOrKey.label'}}{{#if editing}}{{field-required}}{{/if}}</th>
|
||||||
<th width="10"></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>
|
<th width="40"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ export default Component.extend(NewOrEdit, {
|
||||||
window.nec = this;
|
window.nec = this;
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
if ( !this.get('launchConfig.secrets') ) {
|
if ( !this.get('launchConfig.environmentFrom') ) {
|
||||||
this.set('launchConfig.secrets', []);
|
this.set('launchConfig.environmentFrom', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !this.get('launchConfig.metadata') ) {
|
if ( !this.get('launchConfig.metadata') ) {
|
||||||
|
|
|
||||||
|
|
@ -3147,7 +3147,7 @@ formSecrets:
|
||||||
prefixOrKey:
|
prefixOrKey:
|
||||||
label: Prefix or Key
|
label: Prefix or Key
|
||||||
prefix:
|
prefix:
|
||||||
label: As Prefix or As Name
|
label: Prefix or Alias
|
||||||
uid:
|
uid:
|
||||||
label: User ID
|
label: User ID
|
||||||
placeholder: e.g. 0 (root)
|
placeholder: e.g. 0 (root)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue