mirror of https://github.com/rancher/dashboard.git
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
import { compatibleVersionsFor } from '@/store/catalog';
|
|
import {
|
|
REPO_TYPE, REPO, CHART, VERSION, FROM_TOOLS, _FLAGGED, _UNFLAG
|
|
} from '@/config/query-params';
|
|
import { NAME as APPS } from '@/config/product/apps';
|
|
|
|
export default {
|
|
goToInstall() {
|
|
return (fromTools) => {
|
|
let version;
|
|
const chartVersions = this.versions;
|
|
const currentCluster = this.$rootGetters['currentCluster'];
|
|
|
|
const clusterProvider = currentCluster.status.provider || 'other';
|
|
const windowsVersions = (chartVersions, 'windows');
|
|
const linuxVersions = compatibleVersionsFor(chartVersions, 'linux');
|
|
|
|
if (clusterProvider === 'rke.windows' && windowsVersions.length > 0) {
|
|
version = windowsVersions[0].version;
|
|
} else if (clusterProvider !== 'rke.windows' && linuxVersions.length > 0) {
|
|
version = linuxVersions[0].version;
|
|
} else {
|
|
version = chartVersions[0].version;
|
|
}
|
|
|
|
this.currentRouter().push({
|
|
name: 'c-cluster-apps-install',
|
|
params: {
|
|
cluster: currentCluster.id,
|
|
product: APPS,
|
|
},
|
|
query: {
|
|
[REPO_TYPE]: this.repoType,
|
|
[REPO]: this.repoName,
|
|
[CHART]: this.chartName,
|
|
[VERSION]: version,
|
|
[FROM_TOOLS]: fromTools ? _FLAGGED : _UNFLAG
|
|
}
|
|
});
|
|
};
|
|
},
|
|
};
|