2022-10-20 18:45:47 +08:00
|
|
|
import http from '@/api';
|
2022-11-03 23:42:42 +08:00
|
|
|
import { ReqPage, ResPage } from '../interface';
|
2022-10-20 18:45:47 +08:00
|
|
|
import { Database } from '../interface/database';
|
|
|
|
|
2022-11-18 16:14:23 +08:00
|
|
|
export const searchMysqlDBs = (params: ReqPage) => {
|
2022-11-08 19:03:38 +08:00
|
|
|
return http.post<ResPage<Database.MysqlDBInfo>>(`/databases/search`, params);
|
2022-10-20 18:45:47 +08:00
|
|
|
};
|
|
|
|
|
2022-10-27 23:09:39 +08:00
|
|
|
export const backup = (params: Database.Backup) => {
|
|
|
|
return http.post(`/databases/backup`, params);
|
|
|
|
};
|
|
|
|
export const recover = (params: Database.Recover) => {
|
|
|
|
return http.post(`/databases/recover`, params);
|
|
|
|
};
|
2022-11-09 15:08:38 +08:00
|
|
|
export const recoverByUpload = (params: Database.RecoverByUpload) => {
|
|
|
|
return http.post(`/databases/recover/byupload`, params);
|
|
|
|
};
|
2022-10-27 23:09:39 +08:00
|
|
|
|
2022-10-20 18:45:47 +08:00
|
|
|
export const addMysqlDB = (params: Database.MysqlDBCreate) => {
|
|
|
|
return http.post(`/databases`, params);
|
|
|
|
};
|
2022-12-08 19:07:32 +08:00
|
|
|
export const updateMysqlAccess = (params: Database.ChangeInfo) => {
|
|
|
|
return http.post(`/databases/change/access`, params);
|
|
|
|
};
|
|
|
|
export const updateMysqlPassword = (params: Database.ChangeInfo) => {
|
|
|
|
return http.post(`/databases/change/[password]`, params);
|
2022-10-24 18:46:19 +08:00
|
|
|
};
|
2022-11-18 16:14:23 +08:00
|
|
|
export const updateMysqlVariables = (params: Array<Database.VariablesUpdate>) => {
|
|
|
|
return http.post(`/databases/variables/update`, params);
|
2022-10-25 11:41:19 +08:00
|
|
|
};
|
2022-11-02 18:30:22 +08:00
|
|
|
export const updateMysqlConfByFile = (params: Database.MysqlConfUpdateByFile) => {
|
|
|
|
return http.post(`/databases/conf/update/byfile`, params);
|
|
|
|
};
|
2022-12-04 17:28:03 +08:00
|
|
|
export const deleteCheckMysqlDB = (id: number) => {
|
|
|
|
return http.post<Array<string>>(`/databases/del/check/${id}`);
|
|
|
|
};
|
|
|
|
export const deleteMysqlDB = (id: number) => {
|
|
|
|
return http.post(`/databases/del/${id}`);
|
2022-10-20 18:45:47 +08:00
|
|
|
};
|
2022-10-21 18:50:38 +08:00
|
|
|
|
2022-11-18 16:14:23 +08:00
|
|
|
export const loadMysqlBaseInfo = () => {
|
|
|
|
return http.get<Database.BaseInfo>(`/databases/baseinfo`);
|
2022-10-21 18:50:38 +08:00
|
|
|
};
|
2022-11-18 16:14:23 +08:00
|
|
|
export const loadMysqlVariables = () => {
|
|
|
|
return http.get<Database.MysqlVariables>(`/databases/variables`);
|
2022-10-25 18:34:33 +08:00
|
|
|
};
|
2022-11-18 16:14:23 +08:00
|
|
|
export const loadMysqlStatus = () => {
|
|
|
|
return http.get<Database.MysqlStatus>(`/databases/status`);
|
2022-10-25 18:34:33 +08:00
|
|
|
};
|
2022-11-18 16:14:23 +08:00
|
|
|
export const loadDBNames = () => {
|
2022-11-30 15:47:11 +08:00
|
|
|
return http.get<Array<string>>(`/databases/options`);
|
2022-10-21 18:50:38 +08:00
|
|
|
};
|
2022-10-31 17:26:15 +08:00
|
|
|
|
|
|
|
// redis
|
2022-11-02 16:28:54 +08:00
|
|
|
export const loadRedisStatus = () => {
|
|
|
|
return http.get<Database.RedisStatus>(`/databases/redis/status`);
|
2022-10-31 17:26:15 +08:00
|
|
|
};
|
2022-11-02 16:28:54 +08:00
|
|
|
export const loadRedisConf = () => {
|
|
|
|
return http.get<Database.RedisConf>(`/databases/redis/conf`);
|
2022-10-31 23:52:39 +08:00
|
|
|
};
|
2022-11-02 16:28:54 +08:00
|
|
|
export const RedisPersistenceConf = () => {
|
|
|
|
return http.get<Database.RedisPersistenceConf>(`/databases/redis/persistence/conf`);
|
2022-10-31 23:52:39 +08:00
|
|
|
};
|
2022-11-03 23:42:42 +08:00
|
|
|
export const updateRedisPersistenceConf = (params: Database.RedisConfPersistenceUpdate) => {
|
|
|
|
return http.post(`/databases/redis/conf/update/persistence`, params);
|
|
|
|
};
|
2022-10-31 23:52:39 +08:00
|
|
|
export const updateRedisConf = (params: Database.RedisConfUpdate) => {
|
2022-11-02 18:30:22 +08:00
|
|
|
return http.post(`/databases/redis/conf/update`, params);
|
|
|
|
};
|
|
|
|
export const updateRedisConfByFile = (params: Database.RedisConfUpdateByFile) => {
|
|
|
|
return http.post(`/databases/redis/conf/update/byfile`, params);
|
2022-10-31 17:26:15 +08:00
|
|
|
};
|
2022-11-03 23:42:42 +08:00
|
|
|
export const backupRedis = () => {
|
|
|
|
return http.post(`/databases/redis/backup`);
|
|
|
|
};
|
|
|
|
export const recoverRedis = (param: Database.RedisRecover) => {
|
|
|
|
return http.post(`/databases/redis/recover`, param);
|
|
|
|
};
|
|
|
|
export const redisBackupRedisRecords = (param: ReqPage) => {
|
2022-11-08 19:03:38 +08:00
|
|
|
return http.post<ResPage<Database.FileRecord>>(`/databases/redis/backup/records`, param);
|
2022-11-03 23:42:42 +08:00
|
|
|
};
|