@@ -8,8 +8,9 @@ import { GlobalStore } from '@/store';
88const globalStore = GlobalStore ( ) ;
99
1010// backup-agent
11- export const getLocalBackupDir = ( ) => {
12- return http . get < string > ( `/backups/local` ) ;
11+ export const getLocalBackupDir = ( node ?: string ) => {
12+ const params = node ? `?operateNode=${ node } ` : '' ;
13+ return http . get < string > ( `/backups/local${ params } ` ) ;
1314} ;
1415export const searchBackup = ( params : Backup . SearchWithType ) => {
1516 return http . post < ResPage < Backup . BackupInfo > > ( `/backups/search` , params ) ;
@@ -40,35 +41,42 @@ export const listBucket = (params: Backup.ForBucket) => {
4041 }
4142 return http . post ( '/backups/buckets' , request , TimeoutEnum . T_40S ) ;
4243} ;
43- export const handleBackup = ( params : Backup . Backup ) => {
44- return http . post ( `/backups/backup` , params , TimeoutEnum . T_10M ) ;
44+ export const handleBackup = ( params : Backup . Backup , node ?: string ) => {
45+ const query = node ? `?operateNode=${ node } ` : '' ;
46+ return http . post ( `/backups/backup${ query } ` , params , TimeoutEnum . T_10M ) ;
4547} ;
4648export const listBackupOptions = ( ) => {
4749 return http . get < Array < Backup . BackupOption > > ( `/backups/options` ) ;
4850} ;
49- export const handleRecover = ( params : Backup . Recover ) => {
50- return http . post ( `/backups/recover` , params , TimeoutEnum . T_10M ) ;
51+ export const handleRecover = ( params : Backup . Recover , node ?: string ) => {
52+ const query = node ? `?operateNode=${ node } ` : '' ;
53+ return http . post ( `/backups/recover${ query } ` , params , TimeoutEnum . T_10M ) ;
5154} ;
5255export const handleRecoverByUpload = ( params : Backup . Recover ) => {
5356 return http . post ( `/backups/recover/byupload` , params , TimeoutEnum . T_10M ) ;
5457} ;
55- export const downloadBackupRecord = ( params : Backup . RecordDownload ) => {
56- return http . post < string > ( `/backups/record/download` , params , TimeoutEnum . T_10M ) ;
58+ export const downloadBackupRecord = ( params : Backup . RecordDownload , node ?: string ) => {
59+ const query = node ? `?operateNode=${ node } ` : '' ;
60+ return http . post < string > ( `/backups/record/download${ query } ` , params , TimeoutEnum . T_10M ) ;
5761} ;
58- export const deleteBackupRecord = ( params : { ids : number [ ] } ) => {
59- return http . post ( `/backups/record/del` , params ) ;
62+ export const deleteBackupRecord = ( params : { ids : number [ ] } , node ?: string ) => {
63+ const query = node ? `?operateNode=${ node } ` : '' ;
64+ return http . post ( `/backups/record/del${ query } ` , params ) ;
6065} ;
61- export const updateRecordDescription = ( id : Number , description : String ) => {
62- return http . post ( `/backups/record/description/update` , { id : id , description : description } ) ;
66+ export const updateRecordDescription = ( id : Number , description : String , node ?: string ) => {
67+ const query = node ? `?operateNode=${ node } ` : '' ;
68+ return http . post ( `/backups/record/description/update${ query } ` , { id : id , description : description } ) ;
6369} ;
6470export const uploadByRecover = ( filePath : string , targetDir : String ) => {
6571 return http . post ( `/backups/upload` , { filePath : filePath , targetDir : targetDir } ) ;
6672} ;
67- export const searchBackupRecords = ( params : Backup . SearchBackupRecord ) => {
68- return http . post < ResPage < Backup . RecordInfo > > ( `/backups/record/search` , params , TimeoutEnum . T_5M ) ;
73+ export const searchBackupRecords = ( params : Backup . SearchBackupRecord , node ?: string ) => {
74+ const query = node ? `?operateNode=${ node } ` : '' ;
75+ return http . post < ResPage < Backup . RecordInfo > > ( `/backups/record/search${ query } ` , params , TimeoutEnum . T_5M ) ;
6976} ;
70- export const loadRecordSize = ( param : Backup . SearchForSize ) => {
71- return http . post < Array < Backup . RecordFileSize > > ( `/backups/record/size` , param ) ;
77+ export const loadRecordSize = ( param : Backup . SearchForSize , node ?: string ) => {
78+ const query = node ? `?operateNode=${ node } ` : '' ;
79+ return http . post < Array < Backup . RecordFileSize > > ( `/backups/record/size${ query } ` , param ) ;
7280} ;
7381export const searchBackupRecordsByCronjob = ( params : Backup . SearchBackupRecordByCronjob ) => {
7482 return http . post < ResPage < Backup . RecordInfo > > ( `/backups/record/search/bycronjob` , params , TimeoutEnum . T_5M ) ;
0 commit comments