in frontend/src/model.tsx [157:190]
function UpdateCluster(
clusterName: any,
clusterConfig: any,
dryrun = false,
forceUpdate: any,
successCallback?: Callback,
errorCallback?: Callback,
) {
var url = `api?path=/v3/clusters/${clusterName}`
url += dryrun ? '&dryrun=true' : ''
url += forceUpdate ? '&forceUpdate=true' : ''
var body = {clusterConfiguration: clusterConfig}
request('put', url, body)
.then((response: any) => {
if (response.status === 202) {
if (!dryrun) {
notify('Successfully Updated: ' + clusterName, 'success')
updateState(['clusters', 'index', clusterName], (existing: any) => {
return {...existing, ...response.data}
})
}
successCallback && successCallback(response.data)
} else {
console.log(response)
notify(`Error (${clusterName}): ${response.data.message}`, 'error')
}
})
.catch((error: any) => {
if (error.response) {
errorCallback && errorCallback(error.response.data)
console.log(error.response.data)
}
})
}