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

View File

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

View File

@ -109,8 +109,4 @@ export default Component.extend({
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, '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() {

View File

@ -54,5 +54,11 @@ export default Component.extend({
if (!get(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'),
tagName: '',
editing: true,
pvcs: null,
pvcChoices: computed('pvcs.@each.{name,state}', function() {

View File

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

View File

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

View File

@ -14,7 +14,7 @@ export default Component.extend({
configMapName: null,
mode: SECRET,
editing: true,
editing: null,
ary: null,
keys: null,
allSecrets: null,
@ -50,6 +50,8 @@ export default Component.extend({
if ( get(this, 'mode') === 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);
this.updateSecretKeys();
}

View File

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

View File

@ -1,6 +1,6 @@
import $ from 'jquery';
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 { inject as service } from '@ember/service';
import Component from '@ember/component';
@ -169,6 +169,7 @@ export default Component.extend(NodeDriver, {
instanceTypes : INSTANCE_TYPES,
regionChoices : REGIONS,
step : 1,
tags : null,
bootstrap: function() {
let pref = get(this, 'prefs.amazonec2')||{};
@ -219,6 +220,17 @@ export default Component.extend(NodeDriver, {
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() {
@ -508,4 +520,15 @@ export default Component.extend(NodeDriver, {
subnetById: function(id) {
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>
{{/if}}
</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}}
<div class="over-hr"><span>{{templateOptionsTitle}}</span></div>

View File

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

View File

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

View File

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

View File

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

View File

@ -3685,6 +3685,11 @@ formVolumeRow:
readOnly: Read-Only
noVolume: The volume will not be mounted in the current container. It may be used by other containers in the pod.
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:
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:
@ -4402,6 +4407,10 @@ nodeDriver:
defaultCreate: "Standard: Automatically create a <code>{groupName}</code> group"
next: "Next: Set Instance options"
loading: Loading Instance options...
tags:
addActionLabel: Add AWS Tag
valueLabel: Tags
placeholder: e.g. dev
instance:
title: 4. Instance
detail: Customize the EC2 Instance that will be created.