Merge pull request #1853 from loganhz/fix

Fix
This commit is contained in:
Vincent Fiduccia 2018-04-26 13:44:01 -07:00 committed by GitHub
commit c2fc0bb38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 169 additions and 75 deletions

View File

@ -38,7 +38,7 @@
<section> <section>
{{#accordion-list as |al expandFn|}} {{#accordion-list as |al expandFn|}}
{{#if model.app.status.notes}} {{#if model.app.notes}}
{{#accordion-list-item {{#accordion-list-item
title=(t 'appDetailPage.notes.title') title=(t 'appDetailPage.notes.title')
detail=(t 'appDetailPage.notes.detail') detail=(t 'appDetailPage.notes.detail')
@ -46,7 +46,7 @@
expand=(action expandFn) expand=(action expandFn)
expandOnInit=false expandOnInit=false
}} }}
{{marked-down markdown=model.app.status.notes}} {{marked-down markdown=model.app.notes}}
{{/accordion-list-item}} {{/accordion-list-item}}
{{/if}} {{/if}}

View File

@ -173,6 +173,7 @@
{{container/form-volumes {{container/form-volumes
launchConfig=activeLaunchConfig launchConfig=activeLaunchConfig
workload=service workload=service
namespace=service.namespace
editing=false editing=false
expandAll=al.expandAll expandAll=al.expandAll
expandFn=expandFn expandFn=expandFn

View File

@ -109,8 +109,4 @@ export default Component.extend({
next(this, 'focusSomething'); next(this, 'focusSomething');
}, },
willDestroyElement() {
set(this, 'shown', false);
},
}); });

View File

@ -67,6 +67,15 @@ export default Component.extend(ClusterDriver, {
set(this, 'initialNodeCounts', counts); set(this, 'initialNodeCounts', counts);
set(this, 'initialVersion', get(this, 'cluster.rancherKubernetesEngineConfig.kubernetesVersion')); set(this, 'initialVersion', get(this, 'cluster.rancherKubernetesEngineConfig.kubernetesVersion'));
const config = get(this, 'cluster.rancherKubernetesEngineConfig');
if ( config && get(config, 'privateRegistries.length') > 0 ) {
const registry = get(config, 'privateRegistries.firstObject');
set(this, 'registry', 'custom');
set(this, 'registryUrl', get(registry, 'url'));
set(this, 'registryUser', get(registry, 'user'));
set(this, 'registryPass', get(registry, 'password'));
}
}, },
didInsertElement() { didInsertElement() {

View File

@ -54,5 +54,11 @@ export default Component.extend({
if (!get(this, 'sources') ) { if (!get(this, 'sources') ) {
set(this, 'sources', []) set(this, 'sources', [])
} }
get(this, 'sources').forEach((source) => {
if ( source.sourceKey === undefined ) {
set(source, 'sourceKey', null);
}
});
}, },
}); });

View File

@ -10,6 +10,7 @@ export default Component.extend({
modalService: service('modal'), modalService: service('modal'),
tagName: '', tagName: '',
editing: true,
pvcs: null, pvcs: null,
pvcChoices: computed('pvcs.@each.{name,state}', function() { pvcChoices: computed('pvcs.@each.{name,state}', function() {

View File

@ -70,7 +70,7 @@
{{else if (eq model.mode "bindMount")}} {{else if (eq model.mode "bindMount")}}
{{volume-source/source-host-path {{volume-source/source-host-path
volume=model.volume volume=model.volume
editing=true editing=editing
}} }}
{{else if (eq model.mode "customLogPath")}} {{else if (eq model.mode "customLogPath")}}
{{volume-source/source-custom-log-path {{volume-source/source-custom-log-path
@ -78,19 +78,19 @@
model=model model=model
volume=model.volume volume=model.volume
mounts=model.mounts mounts=model.mounts
editing=true editing=editing
}} }}
{{else if (eq model.mode "secret")}} {{else if (eq model.mode "secret")}}
{{volume-source/source-secret {{volume-source/source-secret
namespace=namespace namespace=namespace
volume=model.volume volume=model.volume
editing=true editing=editing
}} }}
{{else if (eq model.mode "configmap")}} {{else if (eq model.mode "configmap")}}
{{volume-source/source-config-map {{volume-source/source-config-map
namespace=namespace namespace=namespace
volume=model.volume volume=model.volume
editing=true editing=editing
}} }}
{{/if}} {{/if}}
{{#if (eq model.mode "customLogPath")}} {{#if (eq model.mode "customLogPath")}}
@ -99,47 +99,66 @@
<div class="row"> <div class="row">
<div class="col span-12"> <div class="col span-12">
{{#if model.mounts.length}} {{#if model.mounts.length}}
<table class="fixed"> <table class="table fixed no-lines">
<thead>
<tr> <tr>
<th>Mount Point{{field-required}}</th> <th>{{t "formVolumeRow.mounts.mountPoint"}}{{#if editing}}{{field-required}}{{/if}}</th>
<th width="20">&nbsp;</th> <th width="20">&nbsp;</th>
<th>Sub Path in Volume</th> <th>{{t "formVolumeRow.mounts.subPath"}}</th>
<th width="20">&nbsp;</th> <th width="20">&nbsp;</th>
<th width="100" class="text-center">Read-Only</th> <th width="100" class="text-center">{{t "formVolumeRow.mounts.readOnly"}}</th>
<th width="40">&nbsp;</th> <th width="40">&nbsp;</th>
</tr> </tr>
</thead>
<tbody>
{{#each model.mounts as |mnt|}} {{#each model.mounts as |mnt|}}
<tr> <tr>
<td> <td>
{{#if editing}}
{{input value=mnt.mountPath}} {{input value=mnt.mountPath}}
{{else}}
{{mnt.mountPath}}
{{/if}}
</td> </td>
<td></td> <td></td>
<td> <td>
{{#if editing}}
{{input value=mnt.subPath}} {{input value=mnt.subPath}}
{{else}}
{{mnt.subPath}}
{{/if}}
</td> </td>
<td></td> <td></td>
<td class="text-center"> <td class="text-center">
{{#if editing}}
{{input type="checkbox" classNames="form-control" checked=mnt.readOnly}} {{input type="checkbox" classNames="form-control" checked=mnt.readOnly}}
{{else}}
{{mnt.readOnly}}
{{/if}}
</td> </td>
<td> <td>
{{#if editing}}
<button class="btn bg-primary btn-sm" {{action "removeMount" mnt}}> <button class="btn bg-primary btn-sm" {{action "removeMount" mnt}}>
<i class="icon icon-minus"/> <i class="icon icon-minus"/>
<span class="sr-only">{{t 'generic.remove'}}</span> <span class="sr-only">{{t 'generic.remove'}}</span>
</button> </button>
{{/if}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
</tbody>
</table> </table>
{{else}} {{else}}
The volume will not be mounted in the current container. It may be used by other containers in the pod. {{t "formVolumeRow.mounts.helper"}}
{{/if}} {{/if}}
{{#if editing}}
<div class="mt-20"> <div class="mt-20">
<button class="btn bg-link icon-btn" {{action "addMount"}}> <button class="btn bg-link icon-btn" {{action "addMount"}}>
<span class="darken"><i class="icon icon-plus text-small"/></span> <span class="darken"><i class="icon icon-plus text-small"/></span>
<span>{{t "formVolumeRow.addMount"}}</span> <span>{{t "formVolumeRow.addMount"}}</span>
</button> </button>
</div> </div>
{{/if}}
</div> </div>
</div> </div>
{{/if}} {{/if}}

View File

@ -71,6 +71,11 @@ export default Component.extend({
mode: SECRET, mode: SECRET,
volume, volume,
}; };
} else if (volume.configMap) {
entry = {
mode: CONFIG_MAP,
volume,
};
} else { } else {
entry = { entry = {
mode: EXISTING_VOLUME, mode: EXISTING_VOLUME,

View File

@ -14,7 +14,7 @@ export default Component.extend({
configMapName: null, configMapName: null,
mode: SECRET, mode: SECRET,
editing: true, editing: null,
ary: null, ary: null,
keys: null, keys: null,
allSecrets: null, allSecrets: null,
@ -50,6 +50,8 @@ export default Component.extend({
if ( get(this, 'mode') === SECRET ) { if ( get(this, 'mode') === SECRET ) {
const allSecrets = get(this, 'store').all('secret'); const allSecrets = get(this, 'store').all('secret');
const namespacedSecrets = get(this,'store').all('namespacedSecret').filterBy('type','namespacedSecret');
allSecrets.pushObjects(namespacedSecrets);
set(this, 'allSecrets', allSecrets); set(this, 'allSecrets', allSecrets);
this.updateSecretKeys(); this.updateSecretKeys();
} }

View File

@ -25,9 +25,9 @@ export default Component.extend(ModalBase, {
actions: { actions: {
save(cb) { save(cb) {
const revision = get(this, 'revisionId'); const revisionId = get(this, 'revisionId');
get(this, 'model').doAction('rollback', { get(this, 'model').doAction('rollback', {
revision, revisionId,
}).then(() => { }).then(() => {
this.send('cancel'); this.send('cancel');
}).finally(() => { }).finally(() => {

View File

@ -1,6 +1,6 @@
import $ from 'jquery'; import $ from 'jquery';
import { scheduleOnce } from '@ember/runloop'; import { scheduleOnce } from '@ember/runloop';
import EmberObject, { computed, get, set, setProperties } from '@ember/object'; import EmberObject, { observer, computed, get, set, setProperties } from '@ember/object';
import { alias, equal } from '@ember/object/computed'; import { alias, equal } from '@ember/object/computed';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import Component from '@ember/component'; import Component from '@ember/component';
@ -169,6 +169,7 @@ export default Component.extend(NodeDriver, {
instanceTypes : INSTANCE_TYPES, instanceTypes : INSTANCE_TYPES,
regionChoices : REGIONS, regionChoices : REGIONS,
step : 1, step : 1,
tags : null,
bootstrap: function() { bootstrap: function() {
let pref = get(this, 'prefs.amazonec2')||{}; let pref = get(this, 'prefs.amazonec2')||{};
@ -219,6 +220,17 @@ export default Component.extend(NodeDriver, {
selectedSecurityGroup : cur, selectedSecurityGroup : cur,
}); });
} }
const tagsString = get(this, 'config.tags');
if( tagsString ) {
const array = tagsString.split(',');
const tags = {};
for (let i=0; i< array.length-1; i=i+2) {
tags[array[i]] = array[i+1];
}
debugger
set(this, 'tags', tags);
}
}, },
willDestroyElement: function() { willDestroyElement: function() {
@ -508,4 +520,15 @@ export default Component.extend(NodeDriver, {
subnetById: function(id) { subnetById: function(id) {
return (get(this, 'allSubnets')||[]).filterBy('subnetId',id)[0]; return (get(this, 'allSubnets')||[]).filterBy('subnetId',id)[0];
}, },
tagsDidChange: observer('tags', function() {
const array = [];
const tags = get(this, 'tags') || {};
Object.keys(tags).forEach((key) => {
array.push(key);
array.push(tags[key]);
});
set(this, 'config.tags', array.join(','));
}),
}); });

View File

@ -282,6 +282,16 @@
</div> </div>
{{/if}} {{/if}}
</div> </div>
<div class="row">
<div class="col span-12">
{{form-key-value
addActionLabel="nodeDriver.amazonec2.tags.addActionLabel"
initialMap=tags
changed=(action (mut tags))
}}
</div>
</div>
{{/accordion-list-item}} {{/accordion-list-item}}
<div class="over-hr"><span>{{templateOptionsTitle}}</span></div> <div class="over-hr"><span>{{templateOptionsTitle}}</span></div>

View File

@ -33,7 +33,7 @@ export default Component.extend({
var exact; var exact;
get(this,'projectSecrets').forEach((secret) => { get(this,'projectSecrets').forEach((secret) => {
if ( def === get(secret,'name') ) { if ( def === get(secret, get(this,'valueKey')) ) {
exact = get(secret,'id'); exact = get(secret,'id');
} }
}); });
@ -41,7 +41,7 @@ export default Component.extend({
const namespaceId = get(this,'namespace.id'); const namespaceId = get(this,'namespace.id');
if ( !exact && namespaceId ) { if ( !exact && namespaceId ) {
get(this,'namespaceSecrets').forEach((secret) => { get(this,'namespaceSecrets').forEach((secret) => {
if ( def === get(secret,'name') && get(secret,'namespaceId') === namespaceId) { if ( def === get(secret, get(this,'valueKey')) && get(secret,'namespaceId') === namespaceId) {
exact = get(secret,'id'); exact = get(secret,'id');
} }
}); });

View File

@ -18,7 +18,7 @@
</label> </label>
</div> </div>
{{else}} {{else}}
<div class="text-muted"> <div>
{{config.optional}} {{config.optional}}
</div> </div>
{{/if}} {{/if}}
@ -27,11 +27,17 @@
<div class="row mb-20"> <div class="row mb-20">
<div class="col span-6"> <div class="col span-6">
<label class="acc-label">{{t 'cruPersistentVolume.configMap.name.label'}}</label> <label class="acc-label">{{t 'cruPersistentVolume.configMap.name.label'}}</label>
{{#if editing}}
{{schema/input-config-map {{schema/input-config-map
namespace=namespace namespace=namespace
value=config.name value=config.name
valueKey='name' valueKey='name'
}} }}
{{else}}
<div>
{{config.name}}
</div>
{{/if}}
</div> </div>
{{#if config.name}} {{#if config.name}}
<div class="col span-6"> <div class="col span-6">
@ -50,12 +56,12 @@
</div> </div>
</div> </div>
{{else if specific}} {{else if specific}}
<div class="text-muted"> <div>
{{t 'formKeyToPath.default'}} {{t 'formKeyToPath.specific'}}
</div> </div>
{{else if (not specific)}} {{else if (not specific)}}
<div class="text-muted"> <div>
{{t 'formKeyToPath.specific'}} {{t 'formKeyToPath.default'}}
</div> </div>
{{/if}} {{/if}}
</div> </div>

View File

@ -10,6 +10,7 @@ export default Component.extend(VolumeSource, {
specific: false, specific: false,
defaultMode: null, defaultMode: null,
editing: true,
didReceiveAttrs() { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);

View File

@ -18,7 +18,7 @@
</label> </label>
</div> </div>
{{else}} {{else}}
<div class="text-muted"> <div>
{{config.optional}} {{config.optional}}
</div> </div>
{{/if}} {{/if}}
@ -27,11 +27,17 @@
<div class="row mb-20"> <div class="row mb-20">
<div class="col span-6"> <div class="col span-6">
<label class="acc-label">{{t 'cruPersistentVolume.secret.secretId.label'}}</label> <label class="acc-label">{{t 'cruPersistentVolume.secret.secretId.label'}}</label>
{{#if editing}}
{{schema/input-secret {{schema/input-secret
namespace=namespace namespace=namespace
value=config.secretId value=config.secretId
valueKey='id' valueKey='id'
}} }}
{{else}}
<div>
{{config.secretId}}
</div>
{{/if}}
</div> </div>
{{#if config.secretId}} {{#if config.secretId}}
<div class="col span-6"> <div class="col span-6">
@ -50,12 +56,12 @@
</div> </div>
</div> </div>
{{else if specific}} {{else if specific}}
<div class="text-muted"> <div>
{{t 'formKeyToPath.default'}} {{t 'formKeyToPath.specific'}}
</div> </div>
{{else if (not specific)}} {{else if (not specific)}}
<div class="text-muted"> <div>
{{t 'formKeyToPath.specific'}} {{t 'formKeyToPath.default'}}
</div> </div>
{{/if}} {{/if}}
</div> </div>

View File

@ -3685,6 +3685,11 @@ formVolumeRow:
readOnly: Read-Only readOnly: Read-Only
noVolume: The volume will not be mounted in the current container. It may be used by other containers in the pod. noVolume: The volume will not be mounted in the current container. It may be used by other containers in the pod.
addMount: Add Mount addMount: Add Mount
mounts:
mountPoint: Mount Point
subPath: Sub Path in Volume
readOnly: Read-Only
helper: The volume will not be mounted in the current container. It may be used by other containers in the pod.
customLogPath: customLogPath:
helpText: We will deploy a flexvolume driver to create a volume and mount the log to the host. This feature is supported on GKE cluster now. helpText: We will deploy a flexvolume driver to create a volume and mount the log to the host. This feature is supported on GKE cluster now.
formVolumes: formVolumes:
@ -4402,6 +4407,10 @@ nodeDriver:
defaultCreate: "Standard: Automatically create a <code>{groupName}</code> group" defaultCreate: "Standard: Automatically create a <code>{groupName}</code> group"
next: "Next: Set Instance options" next: "Next: Set Instance options"
loading: Loading Instance options... loading: Loading Instance options...
tags:
addActionLabel: Add AWS Tag
valueLabel: Tags
placeholder: e.g. dev
instance: instance:
title: 4. Instance title: 4. Instance
detail: Customize the EC2 Instance that will be created. detail: Customize the EC2 Instance that will be created.