mirror of https://github.com/rancher/ui.git
commit
392339bc5e
|
|
@ -37,7 +37,10 @@ const cloudCredential = Resource.extend({
|
|||
|
||||
actions: {
|
||||
edit() {
|
||||
this.modal.toggleModal('modal-add-cloud-credential', { cloudCredential: this });
|
||||
this.modal.toggleModal('modal-add-cloud-credential', {
|
||||
cloudCredential: this,
|
||||
mode: 'edit',
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { inject as service } from '@ember/service';
|
||||
import Component from '@ember/component';
|
||||
import NewOrEdit from 'shared/mixins/new-or-edit';
|
||||
import ViewNewEdit from 'shared/mixins/view-new-edit';
|
||||
import layout from './template';
|
||||
import { get, set, computed, setProperties } from '@ember/object';
|
||||
import { next } from '@ember/runloop';
|
||||
|
|
@ -34,7 +34,7 @@ const CRED_CONFIG_CHOICES = [
|
|||
},
|
||||
]
|
||||
|
||||
export default Component.extend(NewOrEdit, {
|
||||
export default Component.extend(ViewNewEdit, {
|
||||
globalStore: service(),
|
||||
digitalOcean: service(),
|
||||
intl: service(),
|
||||
|
|
@ -48,8 +48,9 @@ export default Component.extend(NewOrEdit, {
|
|||
validatingKeys: false,
|
||||
errors: null,
|
||||
region: null,
|
||||
regionChoices: REGIONS,
|
||||
sinlgeCloudKeyChoice: null,
|
||||
regionChoices: REGIONS,
|
||||
mode: 'new',
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
|
@ -137,6 +138,24 @@ export default Component.extend(NewOrEdit, {
|
|||
return 'saveCancel.saving';
|
||||
}),
|
||||
|
||||
validate() {
|
||||
var ok = this._super(...arguments);
|
||||
let errors = get(this, 'errors') || [];
|
||||
const { cloudCredentialType } = this;
|
||||
|
||||
if (cloudCredentialType === 'amazon') {
|
||||
if (!get(this, 'region')) {
|
||||
ok = false;
|
||||
|
||||
errors.pushObject(this.intl.t('modalAddCloudKey.errors.region'));
|
||||
}
|
||||
}
|
||||
|
||||
set(this, 'errors', errors);
|
||||
|
||||
return ok;
|
||||
},
|
||||
|
||||
willSave() {
|
||||
set(this, 'errors', null);
|
||||
|
||||
|
|
@ -202,7 +221,7 @@ export default Component.extend(NewOrEdit, {
|
|||
setError(message = '') {
|
||||
setProperties(this, {
|
||||
validatingKeys: false,
|
||||
errors: [this.intl.t('modalAddCloudKey.error', { status: message })],
|
||||
errors: [this.intl.t('modalAddCloudKey.errors.validation', { status: message })],
|
||||
});
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
<section class="horizontal-form container-fluid">
|
||||
{{#unless disableHeader}}
|
||||
<h2>
|
||||
{{t "modalAddCloudKey.header"}}
|
||||
{{#if isNew}}
|
||||
{{t "modalAddCloudKey.header.new"}}
|
||||
{{else if isEdit}}
|
||||
{{t "modalAddCloudKey.header.edit"}}
|
||||
{{/if}}
|
||||
</h2>
|
||||
{{/unless}}
|
||||
<hr/>
|
||||
|
|
@ -49,7 +53,9 @@
|
|||
{{#if (eq cloudCredentialType "amazon")}}
|
||||
<div class="row">
|
||||
<div class="col span-6">
|
||||
<label class="acc-label">{{t "nodeDriver.amazonec2.region.label"}}</label>
|
||||
<label class="acc-label">
|
||||
{{t "nodeDriver.amazonec2.region.label"}}{{field-required}}
|
||||
</label>
|
||||
<select class="form-control" onchange={{action (mut region) value="target.value"}}>
|
||||
<option value="" selected={{eq region choice}}>Select a region</option>
|
||||
{{#each regionChoices as |choice|}}
|
||||
|
|
@ -204,7 +210,7 @@
|
|||
{{top-errors errors=errors}}
|
||||
{{save-cancel
|
||||
cancel=cancelAdd
|
||||
editing=originalModel
|
||||
editing=isEdit
|
||||
save="save"
|
||||
savingLabel=savingLabel
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import Component from '@ember/component';
|
||||
import ModalBase from 'shared/mixins/modal-base';
|
||||
import layout from './template';
|
||||
import { alias } from '@ember/object/computed';
|
||||
|
||||
export default Component.extend(ModalBase, {
|
||||
layout,
|
||||
classNames: ['large-modal', 'alert'],
|
||||
mode: alias('modalOpts.mode'),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{{cru-cloud-credential
|
||||
originalModel=modalOpts.cloudCredential
|
||||
doneSavingCloudCredential=(action "close")
|
||||
cancelAdd=(action "cancel")
|
||||
doneSavingCloudCredential=(action "close")
|
||||
mode=mode
|
||||
originalModel=modalOpts.cloudCredential
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export default Controller.extend(ViewNewEdit, {
|
|||
projectsToRemoveOnUpgrade: null,
|
||||
errors: null,
|
||||
originalModel: null,
|
||||
mode: 'new',
|
||||
recordType: 'multi',
|
||||
|
||||
headers: HEADERS,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
<section class="header">
|
||||
<h1>
|
||||
{{t "globalDnsPage.entriesPage.add"}}
|
||||
{{#if isNew}}
|
||||
{{t "globalDnsPage.entriesPage.header.new"}}
|
||||
{{else if isEdit}}
|
||||
{{t "globalDnsPage.entriesPage.header.edit"}}
|
||||
{{/if}}
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
<form class="horizontal-form container-fluid text-left" autocomplete="off">
|
||||
{{#accordion-list as |al expandFn|}}
|
||||
{{#accordion-list-item
|
||||
title=(t "globalDnsPage.providersPage.options.title")
|
||||
detail=(t "globalDnsPage.providersPage.options.detail")
|
||||
title=(t "globalDnsPage.entriesPage.options.title")
|
||||
detail=(t "globalDnsPage.entriesPage.options.detail")
|
||||
expandAll=al.expandAll
|
||||
expand=(action expandFn)
|
||||
expandOnInit=true
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import Controller from '@ember/controller';
|
||||
import { get, set, computed } from '@ember/object';
|
||||
import { inject as service } from '@ember/service';
|
||||
import NewOrEdit from 'ui/mixins/new-or-edit';
|
||||
import ViewNewEdit from 'shared/mixins/view-new-edit';
|
||||
import { alias } from '@ember/object/computed';
|
||||
|
||||
const DNS_PROVIDERS = ['route53', 'cloudflare', 'alidns'];
|
||||
|
||||
export default Controller.extend(NewOrEdit, {
|
||||
export default Controller.extend(ViewNewEdit, {
|
||||
router: service(),
|
||||
globalStore: service(),
|
||||
|
||||
|
|
@ -14,6 +14,7 @@ export default Controller.extend(NewOrEdit, {
|
|||
id: null,
|
||||
|
||||
activeProvider: 'route53',
|
||||
mode: 'new',
|
||||
saveDisabled: false,
|
||||
config: alias('model'),
|
||||
primaryResource: alias('config'),
|
||||
|
|
@ -46,8 +47,8 @@ export default Controller.extend(NewOrEdit, {
|
|||
},
|
||||
},
|
||||
|
||||
availableProviders: computed('editing', function() {
|
||||
if ( get(this, 'editing') ) {
|
||||
availableProviders: computed('isEdit', function() {
|
||||
if ( get(this, 'isEdit') ) {
|
||||
return [{ name: get(this, 'activeProvider') }];
|
||||
} else {
|
||||
return DNS_PROVIDERS.map( (p) => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { get, set, setProperties } from '@ember/object';
|
||||
import { get, setProperties } from '@ember/object';
|
||||
import { all } from 'rsvp';
|
||||
|
||||
export default Route.extend({
|
||||
|
|
@ -26,10 +26,14 @@ export default Route.extend({
|
|||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
set(controller, 'editing', model && get(model, 'id'));
|
||||
if ( get(model, 'provider') ) {
|
||||
set(controller, 'activeProvider', get(model, 'provider'));
|
||||
if (model && get(model, 'id')) {
|
||||
controller.set('mode', 'edit');
|
||||
}
|
||||
|
||||
if ( get(model, 'provider') ) {
|
||||
controller.set('activeProvider', get(model, 'provider'));
|
||||
}
|
||||
|
||||
this._super(controller, model);
|
||||
},
|
||||
|
||||
|
|
@ -37,7 +41,8 @@ export default Route.extend({
|
|||
if (isExiting) {
|
||||
setProperties(controller, {
|
||||
id: null,
|
||||
activeProvider: 'route53'
|
||||
activeProvider: 'route53',
|
||||
mode: 'new',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
<section class="header">
|
||||
<h1>
|
||||
{{t "globalDnsPage.providersPage.add"}}
|
||||
{{#if isNew}}
|
||||
{{t "globalDnsPage.providersPage.header.new"}}
|
||||
{{else if isEdit}}
|
||||
{{t "globalDnsPage.providersPage.header.edit"}}
|
||||
{{/if}}
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
|
|
@ -59,6 +63,7 @@
|
|||
cancel="cancel"
|
||||
classNames="text-center mt-20"
|
||||
save="save"
|
||||
editing=isEdit
|
||||
saveDisabled=saveDisabled
|
||||
}}
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default Controller.extend({
|
|||
|
||||
actions: {
|
||||
addCloudKey() {
|
||||
this.modal.toggleModal('modal-add-cloud-credential');
|
||||
this.modal.toggleModal('modal-add-cloud-credential', { mode: 'new' });
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<section>
|
||||
{{form-name-description
|
||||
model=config
|
||||
nameDisabled=editing
|
||||
nameDisabled=isEdit
|
||||
}}
|
||||
</section>
|
||||
<form class="horizontal-form container-fluid text-left" autocomplete="off">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<section>
|
||||
{{form-name-description
|
||||
model=config
|
||||
nameDisabled=editing
|
||||
nameDisabled=isEdit
|
||||
}}
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<section>
|
||||
{{form-name-description
|
||||
model=config
|
||||
nameDisabled=editing
|
||||
nameDisabled=isEdit
|
||||
}}
|
||||
</section>
|
||||
<form class="horizontal-form container-fluid text-left" autocomplete="off">
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@
|
|||
<label class="acc-label">{{t "clusterNew.azureaks.tags.label"}}</label>
|
||||
{{form-key-value
|
||||
initialMap=tags
|
||||
changed=(action 'setTags')
|
||||
changed=(action "setTags")
|
||||
addActionLabel="clusterNew.azureaks.tags.addActionLabel"
|
||||
}}
|
||||
</div>
|
||||
|
|
@ -443,7 +443,11 @@
|
|||
</div>
|
||||
{{/accordion-list-item}}
|
||||
|
||||
{{save-cancel editing=isEditing save="driverSave" cancel=close}}
|
||||
{{save-cancel
|
||||
editing=(eq mode "edit")
|
||||
save="driverSave"
|
||||
cancel=close
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -158,5 +158,9 @@
|
|||
|
||||
{{#if (and isEdit (not provider))}}
|
||||
{{top-errors errors=errors}}
|
||||
{{save-cancel editing=true save="save" cancel="close"}}
|
||||
{{save-cancel
|
||||
editing=isEdit
|
||||
save="save"
|
||||
cancel="close"
|
||||
}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export default Component.extend({
|
|||
|
||||
createLabel: 'saveCancel.create',
|
||||
savingLabel: 'generic.loading',
|
||||
mode: 'new',
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
|
@ -43,18 +44,17 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
initSingleOrAddCredential() {
|
||||
if ( isEmpty(get(this, 'primaryResource.cloudCredentialId')) && (get(this, 'cloudCredentials.length') || []) >= 1) {
|
||||
let singleCloudCredentialId = get(this, 'cloudCredentials.firstObject.id');
|
||||
let { cloudCredentials = [] } = this;
|
||||
let singleCloudCredentialId = get((cloudCredentials || []), 'firstObject.id') || null;
|
||||
|
||||
next(() => {
|
||||
set(this, 'primaryResource.cloudCredentialId', singleCloudCredentialId);
|
||||
});
|
||||
} else {
|
||||
if (isEmpty(get(this, 'cloudCredentials'))) {
|
||||
next(() => {
|
||||
set(this, 'showAddCloudCredential', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
next(() => {
|
||||
set(this, 'primaryResource.cloudCredentialId', singleCloudCredentialId);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
{{#if showAddCloudCredential}}
|
||||
<div class="row">
|
||||
{{cru-cloud-credential
|
||||
mode=mode
|
||||
driverName=driverName
|
||||
region=region
|
||||
errors=errors
|
||||
|
|
|
|||
|
|
@ -1114,11 +1114,16 @@ globalDnsPage:
|
|||
noApps: No Accessible Multi Cluster Apps
|
||||
noProviders: No Accessible Providers
|
||||
entriesPage:
|
||||
header:
|
||||
new: Add Global DNS Entry
|
||||
edit: Edit Global DNS Entry
|
||||
options:
|
||||
title: Entry Options
|
||||
detail: Customize options for the DNS entry
|
||||
access:
|
||||
noAccessMulti: You do not have access to the target app
|
||||
noAccessProvider: You do not have access to the provider
|
||||
noAccessProject: You do not have access to the target project
|
||||
add: Add Global DNS Entry
|
||||
projectHelp: "To finalize Global DNS for projects you must add the following annotation label ( <code>rancher.io/globalDNS.hostname</code> ) on the ingress in the project, where <code>hostname</code> is the host name used in the routing rules."
|
||||
table:
|
||||
name: Name
|
||||
|
|
@ -1148,7 +1153,9 @@ globalDnsPage:
|
|||
label: DNS TTL
|
||||
providersPage:
|
||||
title: Global DNS Providers
|
||||
add: Add Global DNS Provider
|
||||
header:
|
||||
new: Add Global DNS Provider
|
||||
edit: Edit Global DNS Provider
|
||||
options:
|
||||
title: Provider Options
|
||||
detail: Customize options for the DNS provider
|
||||
|
|
@ -5390,11 +5397,15 @@ modalAddPayment:
|
|||
dollar: "US Dollar ($)"
|
||||
|
||||
modalAddCloudKey:
|
||||
header: Add Cloud Credential
|
||||
header:
|
||||
new: Add Cloud Credential
|
||||
edit: Edit Cloud Credential
|
||||
type: Cloud Credential Type
|
||||
saving:
|
||||
validating: Validating Keys
|
||||
error: '{ status }: There was a problem validating your keys. Enter valid credentials and try agian.'
|
||||
errors:
|
||||
validation: '{ status }: There was a problem validating your keys. Enter valid credentials and try agian.'
|
||||
region: You must select a region in order to validate your keys
|
||||
typeSelect:
|
||||
prompt: Choose a cloud credential provider type
|
||||
amazonec2:
|
||||
|
|
|
|||
Loading…
Reference in New Issue