Make basic backup target add and edit work
This commit is contained in:
@@ -20,10 +20,16 @@ function create() {
|
||||
if (error || result.status !== 200) return [error || result];
|
||||
return [null, result.body.backupTargets];
|
||||
},
|
||||
async add(label, format, provider, config) {
|
||||
async add(label, format, provider, config, schedule, retention, limits = null, encryptionPassword = null, encryptedFilenames = null) {
|
||||
const data = { label, format, provider, config, schedule, retention };
|
||||
|
||||
if (limits !== null) data.limits = limits;
|
||||
if (encryptionPassword !== null) data.encryptionPassword = encryptionPassword;
|
||||
if (encryptedFilenames !== null) data.encryptedFilenames = encryptedFilenames;
|
||||
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets`, { label, format, provider, config }, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets`, data, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
@@ -68,7 +74,7 @@ function create() {
|
||||
async setPrimary(id) {
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/primary`, {}, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/configure/primary`, {}, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
@@ -79,7 +85,7 @@ function create() {
|
||||
async setRetention(id, retention) {
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/retention`, { retention }, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/configure/retention`, { retention }, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
@@ -90,7 +96,7 @@ function create() {
|
||||
async setLimits(id, limits) {
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/limits`, { limits }, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/configure/limits`, { limits }, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
@@ -101,7 +107,7 @@ function create() {
|
||||
async setSchedule(id, schedule) {
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/schedule`, { schedule }, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/configure/schedule`, { schedule }, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
@@ -112,7 +118,7 @@ function create() {
|
||||
async setConfig(id, config) {
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/config`, { config }, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/backup_targets/${id}/configure/config`, { config }, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user