mirror of https://github.com/rancher/ui.git
Merge pull request #4723 from WuJun2016/harvester-rke1
fix: add cluster driver filter when create a cloud credential
This commit is contained in:
commit
9094ae1f45
|
|
@ -17,12 +17,14 @@ const CRED_CONFIG_CHOICES = [
|
||||||
displayName: 'Amazon',
|
displayName: 'Amazon',
|
||||||
driver: 'amazonec2',
|
driver: 'amazonec2',
|
||||||
configField: 'amazonec2credentialConfig',
|
configField: 'amazonec2credentialConfig',
|
||||||
|
kontainerDriverId: 'amazonelasticcontainerservice'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'azure',
|
name: 'azure',
|
||||||
displayName: 'Azure',
|
displayName: 'Azure',
|
||||||
driver: 'azure',
|
driver: 'azure',
|
||||||
configField: 'azurecredentialConfig',
|
configField: 'azurecredentialConfig',
|
||||||
|
kontainerDriverId: 'azurekubernetesservice'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'digitalOcean',
|
name: 'digitalOcean',
|
||||||
|
|
@ -35,6 +37,7 @@ const CRED_CONFIG_CHOICES = [
|
||||||
displayName: 'Google',
|
displayName: 'Google',
|
||||||
driver: 'google',
|
driver: 'google',
|
||||||
configField: 'googlecredentialConfig',
|
configField: 'googlecredentialConfig',
|
||||||
|
kontainerDriverId: 'googlekubernetesengine'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'harvester',
|
name: 'harvester',
|
||||||
|
|
@ -47,6 +50,7 @@ const CRED_CONFIG_CHOICES = [
|
||||||
displayName: 'Linode',
|
displayName: 'Linode',
|
||||||
driver: 'linode',
|
driver: 'linode',
|
||||||
configField: 'linodecredentialConfig',
|
configField: 'linodecredentialConfig',
|
||||||
|
kontainerDriverId: 'linodekubernetesengine'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'oci',
|
name: 'oci',
|
||||||
|
|
@ -95,11 +99,12 @@ export default Component.extend(ViewNewEdit, {
|
||||||
gkeProjectId: null,
|
gkeProjectId: null,
|
||||||
clusters: null,
|
clusters: null,
|
||||||
allNodeDrivers: null,
|
allNodeDrivers: null,
|
||||||
|
allKontainerDrivers: null,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
let cloudCredentialType = 'amazon';
|
let cloudCredentialType = '';
|
||||||
let model = null;
|
let model = null;
|
||||||
|
|
||||||
const driverName = get(this, 'driverName') === 'aks' ? 'azure' : get(this, 'driverName');
|
const driverName = get(this, 'driverName') === 'aks' ? 'azure' : get(this, 'driverName');
|
||||||
|
|
@ -122,6 +127,7 @@ export default Component.extend(ViewNewEdit, {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.feetchNodeDriver();
|
this.feetchNodeDriver();
|
||||||
|
this.feetchKontainerDriver();
|
||||||
|
|
||||||
if (driverName === 'harvester' || cloudCredentialType === 'harvester') {
|
if (driverName === 'harvester' || cloudCredentialType === 'harvester') {
|
||||||
this.fetchCluster();
|
this.fetchCluster();
|
||||||
|
|
@ -197,7 +203,7 @@ export default Component.extend(ViewNewEdit, {
|
||||||
return get(model, configField);
|
return get(model, configField);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
configChoices: computed('driverName', 'allNodeDrivers', function() {
|
configChoices: computed('driverName', 'allNodeDrivers', 'allKontainerDrivers', function() {
|
||||||
if (get(this, 'driverName')) {
|
if (get(this, 'driverName')) {
|
||||||
// const { driverName } = this;
|
// const { driverName } = this;
|
||||||
const driverName = get(this, 'driverName') === 'aks' ? 'azure' : get(this, 'driverName');
|
const driverName = get(this, 'driverName') === 'aks' ? 'azure' : get(this, 'driverName');
|
||||||
|
|
@ -214,9 +220,11 @@ export default Component.extend(ViewNewEdit, {
|
||||||
|
|
||||||
return [match];
|
return [match];
|
||||||
} else {
|
} else {
|
||||||
if (get(this, 'allNodeDrivers')) {
|
if (get(this, 'allNodeDrivers') && get(this, 'allKontainerDrivers')) {
|
||||||
return (CRED_CONFIG_CHOICES.filter((N) => {
|
return (CRED_CONFIG_CHOICES.filter((N) => {
|
||||||
return (get(this, 'allNodeDrivers') || []).find((O) => O.id === N.driver && O.active === true) ? true : false;
|
const isActive = (get(this, 'allNodeDrivers') || []).find((O) => O.id === N.driver && O.active === true) || (get(this, 'allKontainerDrivers') || []).find((O) => O.id === N.kontainerDriverId && O.active === true);
|
||||||
|
|
||||||
|
return isActive ? true : false;
|
||||||
})).sortBy('displayName');
|
})).sortBy('displayName');
|
||||||
} else {
|
} else {
|
||||||
return CRED_CONFIG_CHOICES.sortBy('displayName');
|
return CRED_CONFIG_CHOICES.sortBy('displayName');
|
||||||
|
|
@ -464,6 +472,12 @@ export default Component.extend(ViewNewEdit, {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
feetchKontainerDriver() {
|
||||||
|
get(this, 'globalStore').findAll('kontainerDriver').then((allKontainerDrivers) => {
|
||||||
|
set(this, 'allKontainerDrivers', allKontainerDrivers);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
fetchZones() {
|
fetchZones() {
|
||||||
let credentials = null;
|
let credentials = null;
|
||||||
let config = null;
|
let config = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue