2017-11-20 04:57:08 -05:00
|
|
|
import axios from '../../lib/utils/axios_utils';
|
2018-05-16 05:01:13 -04:00
|
|
|
import { JUPYTER } from '../constants';
|
2017-10-24 00:56:39 -04:00
|
|
|
|
|
|
|
export default class ClusterService {
|
|
|
|
constructor(options = {}) {
|
|
|
|
this.options = options;
|
|
|
|
this.appInstallEndpointMap = {
|
|
|
|
helm: this.options.installHelmEndpoint,
|
2017-11-06 11:07:19 -05:00
|
|
|
ingress: this.options.installIngressEndpoint,
|
|
|
|
runner: this.options.installRunnerEndpoint,
|
2017-12-22 12:23:43 -05:00
|
|
|
prometheus: this.options.installPrometheusEndpoint,
|
2018-05-16 05:01:13 -04:00
|
|
|
jupyter: this.options.installJupyterEndpoint,
|
2017-10-24 00:56:39 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchData() {
|
|
|
|
return axios.get(this.options.endpoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
installApplication(appId) {
|
2018-05-16 05:01:13 -04:00
|
|
|
const data = {};
|
|
|
|
|
|
|
|
if (appId === JUPYTER) {
|
|
|
|
data.hostname = document.getElementById('jupyter-hostname').value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return axios.post(this.appInstallEndpointMap[appId], data);
|
2017-10-24 00:56:39 -04:00
|
|
|
}
|
2017-11-24 08:43:00 -05:00
|
|
|
|
|
|
|
static updateCluster(endpoint, data) {
|
|
|
|
return axios.put(endpoint, data);
|
|
|
|
}
|
2017-10-24 00:56:39 -04:00
|
|
|
}
|