diff --git a/src/operators/api/operator.ts b/src/operators/api/operator.ts index 12a5fa1f..8ebd3b25 100644 --- a/src/operators/api/operator.ts +++ b/src/operators/api/operator.ts @@ -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> { - return await httpClient.get(`/services/${serviceId}/${this.key}/`); + async getAllForService(serviceId: string, query?: IApiQuery): Promise> { + return await httpClient.get(`/services/${serviceId}/${this.key}/`, { + params: query + }); } } diff --git a/src/operators/application/operator.ts b/src/operators/application/operator.ts index e6cddfe6..fdf92878 100644 --- a/src/operators/application/operator.ts +++ b/src/operators/application/operator.ts @@ -8,6 +8,7 @@ export interface IApplicationQuery { limit?: number; type?: IApplicationType; api_id?: string; + ordering?: string; } class ApplicationOperator { diff --git a/src/operators/proxy/operator.ts b/src/operators/proxy/operator.ts index e5fd740a..563bc863 100644 --- a/src/operators/proxy/operator.ts +++ b/src/operators/proxy/operator.ts @@ -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> { - return await httpClient.get(`/services/${serviceId}/${this.key}/`); + async getAllForService(serviceId: string, query: IProxyQuery): Promise> { + return await httpClient.get(`/services/${serviceId}/${this.key}/`, { + params: query + }); } } diff --git a/src/pages/console/application/List.vue b/src/pages/console/application/List.vue index b46413e6..cd1dd067 100644 --- a/src/pages/console/application/List.vue +++ b/src/pages/console/application/List.vue @@ -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; diff --git a/src/pages/service/Detail.vue b/src/pages/service/Detail.vue index 9bf08a7f..875c6248 100644 --- a/src/pages/service/Detail.vue +++ b/src/pages/service/Detail.vue @@ -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; })