add rank support

This commit is contained in:
AceDataCloud committed 2023-03-19 19:22:18 +08:00
1 parent a3f49d4b0b
commit 18b59b7a50
5 files changed
+23 -11

No files matched your search

+7 -4
View File
@@ -3,8 +3,9 @@ import { httpClient } from '../instance';
import { IApi, IApiDetailResponse, IApiListResponse } from '../api/models';
export interface IApiQuery {
limit: number;
offset: number;
limit?: number;
offset?: number;
ordering?: string;
}
class ApiOperator {
@@ -32,8 +33,10 @@ class ApiOperator {
return await httpClient.delete(`/${this.key}/${id}`);
}
async getAllForService(serviceId: string): Promise<AxiosResponse<IApiListResponse>> {
return await httpClient.get(`/services/${serviceId}/${this.key}/`);
async getAllForService(serviceId: string, query?: IApiQuery): Promise<AxiosResponse<IApiListResponse>> {
return await httpClient.get(`/services/${serviceId}/${this.key}/`, {
params: query
});
}
}
+1
View File
@@ -8,6 +8,7 @@ export interface IApplicationQuery {
limit?: number;
type?: IApplicationType;
api_id?: string;
ordering?: string;
}
class ApplicationOperator {
+7 -4
View File
@@ -3,8 +3,9 @@ import { httpClient } from '../instance';
import { IProxy, IProxyDetailResponse, IProxyListResponse } from '../proxy/models';
export interface IProxyQuery {
limit: number;
offset: number;
limit?: number;
offset?: number;
ordering?: string;
}
class ProxyOperator {
@@ -32,8 +33,10 @@ class ProxyOperator {
return await httpClient.delete(`/${this.key}/${id}`);
}
async getAllForService(serviceId: string): Promise<AxiosResponse<IProxyListResponse>> {
return await httpClient.get(`/services/${serviceId}/${this.key}/`);
async getAllForService(serviceId: string, query: IProxyQuery): Promise<AxiosResponse<IProxyListResponse>> {
return await httpClient.get(`/services/${serviceId}/${this.key}/`, {
params: query
});
}
}
+2 -1
View File
@@ -223,7 +223,8 @@ export default defineComponent({
limit: this.limit,
offset: (this.page - 1) * this.limit,
user_id: this.$store.getters.user.id,
type: this.type
type: this.type,
ordering: '-created_at'
})
.then(({ data: data }: { data: IApplicationListResponse }) => {
this.applications = data.items;
+6 -2
View File
@@ -205,7 +205,9 @@ export default defineComponent({
onFetchApis() {
this.loadingApis = true;
apiOperator
.getAllForService(this.id)
.getAllForService(this.id, {
ordering: 'rank'
})
.then(({ data: data }: { data: IApiListResponse }) => {
this.apis = data.items;
this.loadingApis = false;
@@ -217,7 +219,9 @@ export default defineComponent({
onFetchProxies() {
this.loadingProxies = true;
proxyOperator
.getAllForService(this.id)
.getAllForService(this.id, {
ordering: 'rank'
})
.then(({ data: data }: { data: IProxyListResponse }) => {
this.proxies = data.items;
})