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