mirror of https://github.com/rancher/ui.git
Sets the first added private reg as default
This commit is contained in:
parent
0eb6e0f9d1
commit
260a4ac5f9
|
|
@ -603,6 +603,14 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
errors.push(get(this, 'intl').t('clusterNew.psp.required'));
|
||||
}
|
||||
|
||||
if (get(this, 'config.privateRegistries.length') >= 1) {
|
||||
let hasDefault = get(this, 'config.privateRegistries').findBy('isDefault') || false;
|
||||
|
||||
if (!hasDefault) {
|
||||
errors.push(get(this, 'intl').t('cruPrivateRegistry.defaultError'));
|
||||
}
|
||||
}
|
||||
|
||||
const clusterOptErrors = get(this, 'clusterOptErrors') || [];
|
||||
|
||||
set(this, 'errors', errors);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export default Component.extend({
|
|||
const config = set(this, 'config', get(this, `cluster.${ get(this, 'configName') }`));
|
||||
|
||||
if (( config.privateRegistries || [] ).length <= 0) {
|
||||
set(config, 'privateRegistries', [this.newPrivateRegistry()]);
|
||||
set(config, 'privateRegistries', [this.newPrivateRegistry('privateRegistry', true)]);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -82,7 +82,10 @@ export default Component.extend({
|
|||
}
|
||||
})),
|
||||
|
||||
newPrivateRegistry(registryType = 'privateRegistry') {
|
||||
return get(this, 'globalStore').createRecord({ type: registryType });
|
||||
newPrivateRegistry(registryType = 'privateRegistry', isDefault = false) {
|
||||
return get(this, 'globalStore').createRecord({
|
||||
isDefault,
|
||||
type: registryType,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
urlWarning=(action (mut urlWarning))
|
||||
urlError=(action (mut urlError))
|
||||
value=reg.url
|
||||
stripScheme=false
|
||||
}}
|
||||
{{/input-or-display}}
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -22,13 +22,20 @@ export default TextField.extend({
|
|||
type: 'url',
|
||||
classNameBindings: ['invalid:input-error'],
|
||||
invalid: false,
|
||||
stripScheme: true,
|
||||
isInvalid: null,
|
||||
urlWarning: null,
|
||||
urlError: null,
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
scheduleOnce('afterRender', () => {
|
||||
let val = stripScheme(get(this, 'value') || '');
|
||||
let val = null;
|
||||
|
||||
if (get(this, 'stripScheme')) {
|
||||
val = stripScheme(get(this, 'element.value') || '');
|
||||
} else {
|
||||
val = get(this, 'element.value') || '';
|
||||
}
|
||||
|
||||
set(this, 'value', this.validateInput(val));
|
||||
});
|
||||
|
|
@ -39,7 +46,13 @@ export default TextField.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
let val = stripScheme(get(this, 'element.value') || '');
|
||||
let val = null;
|
||||
|
||||
if (get(this, 'stripScheme')) {
|
||||
val = stripScheme(get(this, 'element.value') || '');
|
||||
} else {
|
||||
val = get(this, 'element.value') || '';
|
||||
}
|
||||
|
||||
debounce(this, 'validateInput', val, 250);
|
||||
|
||||
|
|
@ -49,7 +62,13 @@ export default TextField.extend({
|
|||
focusOut() {
|
||||
this._super(...arguments);
|
||||
|
||||
let val = stripScheme(get(this, 'element.value'));
|
||||
let val = null;
|
||||
|
||||
if (get(this, 'stripScheme')) {
|
||||
val = stripScheme(get(this, 'element.value') || '');
|
||||
} else {
|
||||
val = get(this, 'element.value') || '';
|
||||
}
|
||||
|
||||
set(this, 'value', this.validateInput(val));
|
||||
},
|
||||
|
|
|
|||
|
|
@ -934,6 +934,7 @@ cruPrivateRegistry:
|
|||
label: Private Registries
|
||||
detail: Add private registries to this cluster
|
||||
noData: This cluster does not have any private registries defined
|
||||
defaultError: You must designate one private registry as the default
|
||||
add:
|
||||
label: Add Private Registry
|
||||
registry:
|
||||
|
|
|
|||
Loading…
Reference in New Issue