function CreateCluster()

in frontend/src/model.js [55:80]


function CreateCluster(clusterName, clusterConfig, region, dryrun=false, successCallback=null, errorCallback=null) {
  const selectedRegion = getState(['app', 'selectedRegion']);
  var url = 'api?path=/v3/clusters';
  url += dryrun ? "&dryrun=true" : ""
  url += region ? `&region=${region}` : ""
  var body = {clusterName: clusterName, clusterConfiguration: clusterConfig}
  request('post', url, body).then(response => {
    if(response.status === 202) {
      if(!dryrun && region === selectedRegion) {
        notify("Successfully created: " + clusterName, 'success');
        updateState(['clusters', 'index', clusterName], (existing) => {return {...existing, ...response.data}});
      }
      successCallback && successCallback(response.data)
    } else {
      console.log(response)
      notify(`Error (${clusterName}): ${response.data.message}`, 'error');
    }
  }).catch(error => {
    if(error.response)
    {
      //notify(`Error (${clusterName}): ${error.response.data.message}`, 'error');
      errorCallback && errorCallback(error.response.data)
      console.log(error.response.data)
    }
  })
}