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'));
|
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') || [];
|
const clusterOptErrors = get(this, 'clusterOptErrors') || [];
|
||||||
|
|
||||||
set(this, 'errors', errors);
|
set(this, 'errors', errors);
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ export default Component.extend({
|
||||||
const config = set(this, 'config', get(this, `cluster.${ get(this, 'configName') }`));
|
const config = set(this, 'config', get(this, `cluster.${ get(this, 'configName') }`));
|
||||||
|
|
||||||
if (( config.privateRegistries || [] ).length <= 0) {
|
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') {
|
newPrivateRegistry(registryType = 'privateRegistry', isDefault = false) {
|
||||||
return get(this, 'globalStore').createRecord({ type: registryType });
|
return get(this, 'globalStore').createRecord({
|
||||||
|
isDefault,
|
||||||
|
type: registryType,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
urlWarning=(action (mut urlWarning))
|
urlWarning=(action (mut urlWarning))
|
||||||
urlError=(action (mut urlError))
|
urlError=(action (mut urlError))
|
||||||
value=reg.url
|
value=reg.url
|
||||||
|
stripScheme=false
|
||||||
}}
|
}}
|
||||||
{{/input-or-display}}
|
{{/input-or-display}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,20 @@ export default TextField.extend({
|
||||||
type: 'url',
|
type: 'url',
|
||||||
classNameBindings: ['invalid:input-error'],
|
classNameBindings: ['invalid:input-error'],
|
||||||
invalid: false,
|
invalid: false,
|
||||||
|
stripScheme: true,
|
||||||
isInvalid: null,
|
isInvalid: null,
|
||||||
urlWarning: null,
|
urlWarning: null,
|
||||||
urlError: null,
|
urlError: null,
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
scheduleOnce('afterRender', () => {
|
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));
|
set(this, 'value', this.validateInput(val));
|
||||||
});
|
});
|
||||||
|
|
@ -39,7 +46,13 @@ export default TextField.extend({
|
||||||
return;
|
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);
|
debounce(this, 'validateInput', val, 250);
|
||||||
|
|
||||||
|
|
@ -49,7 +62,13 @@ export default TextField.extend({
|
||||||
focusOut() {
|
focusOut() {
|
||||||
this._super(...arguments);
|
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));
|
set(this, 'value', this.validateInput(val));
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -934,6 +934,7 @@ cruPrivateRegistry:
|
||||||
label: Private Registries
|
label: Private Registries
|
||||||
detail: Add private registries to this cluster
|
detail: Add private registries to this cluster
|
||||||
noData: This cluster does not have any private registries defined
|
noData: This cluster does not have any private registries defined
|
||||||
|
defaultError: You must designate one private registry as the default
|
||||||
add:
|
add:
|
||||||
label: Add Private Registry
|
label: Add Private Registry
|
||||||
registry:
|
registry:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue