feat: add amis jssdk page

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-12-25 15:41:27 +08:00
parent cabf6cf613
commit aed21b2ff6
27 changed files with 522 additions and 66 deletions

View File

@@ -181,6 +181,13 @@ export declare namespace service {
RollbackConfig: RollbackConfig;
}
export interface UpdateStatus {
State: string;
StartedAt: string;
CompletedAt: string;
Message: string;
}
export interface Service {
ID: string;
Version: Version;
@@ -189,7 +196,7 @@ export declare namespace service {
Spec: Spec;
Endpoint: Endpoint;
PreviousSpec: PreviousSpec;
UpdateStatus: UpdateStatus;
}
}

View File

@@ -10,6 +10,9 @@ export namespace service {
}
export async function inspect(id: string, query: { insertDefaults: boolean } = { insertDefaults: false }) {
return await api.get<any>(`/services/${id}`, query);
return await api.get<types.service.Service>(`/services/${id}`, query);
}
export async function update(id: string, query: { version: number, registryAuthFrom?: string, rollback?: string }, data: any) {
return await api.post<any>(api.getUri(`/services/${id}/update`, query), data)
}
}

View File

@@ -19,6 +19,13 @@ export async function stream<T = http.ServerResponse>(path: string, data?: objec
return await handle<T>("GET", path, { params: data, responseType: "stream" });
}
export function getUri(path: string, data?: object) {
return api.getUri({
url: path,
params: data
})
}
async function handle<T>(method: Method, path: string, reqConfig?: AxiosRequestConfig): Promise<T> {
let config: AxiosRequestConfig = {
method,