mirror of
https://github.com/cuigh/swirl
synced 2025-06-26 18:16:50 +00:00
Refactor UI with vue3
This commit is contained in:
65
ui/src/api/volume.ts
Normal file
65
ui/src/api/volume.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import ajax, { Result } from './ajax'
|
||||
|
||||
export interface Volume {
|
||||
name: string;
|
||||
driver: string;
|
||||
customDriver: string;
|
||||
mountPoint: string;
|
||||
createdAt: string;
|
||||
scope: string;
|
||||
refCount: number;
|
||||
size: number;
|
||||
labels?: {
|
||||
name: string;
|
||||
value: string;
|
||||
}[];
|
||||
options?: {
|
||||
name: string;
|
||||
value: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface SearchArgs {
|
||||
name?: string;
|
||||
pageIndex: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
export interface SearchResult {
|
||||
items: Volume[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface FindResult {
|
||||
volume: Volume;
|
||||
raw: string;
|
||||
}
|
||||
|
||||
export interface PruneResult {
|
||||
deletedVolumes: string[];
|
||||
reclaimedSpace: number;
|
||||
}
|
||||
|
||||
export class VolumeApi {
|
||||
find(name: string) {
|
||||
return ajax.get<FindResult>('/volume/find', { name })
|
||||
}
|
||||
|
||||
search(args: SearchArgs) {
|
||||
return ajax.get<SearchResult>('/volume/search', args)
|
||||
}
|
||||
|
||||
delete(name: string) {
|
||||
return ajax.post<Result<Object>>('/volume/delete', { name })
|
||||
}
|
||||
|
||||
save(v: Volume) {
|
||||
return ajax.post<Result<Object>>('/volume/save', v)
|
||||
}
|
||||
|
||||
prune() {
|
||||
return ajax.post<PruneResult>('/volume/prune')
|
||||
}
|
||||
}
|
||||
|
||||
export default new VolumeApi
|
||||
Reference in New Issue
Block a user