update proxy management
This commit is contained in:
1 parent
d34e578868
commit
f22d21bb53
10 files changed
+209
-10
No files matched your search
@@ -12,7 +12,8 @@
|
||||
<el-table v-loading="loading" :data="applications" stripe>
|
||||
<el-table-column :label="$t('application.field.api')" width="200px">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row?.api?.title }}</span>
|
||||
<span v-if="scope.row.type === applicationType.API">{{ scope.row?.api?.title }}</span>
|
||||
<span v-if="scope.row.type === applicationType.PROXY">{{ scope.row?.proxy?.title }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
||||
@@ -20,9 +20,18 @@
|
||||
<el-descriptions-item :label="$t('order.field.description')">
|
||||
{{ order?.description }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('order.field.api')">
|
||||
<el-descriptions-item
|
||||
v-if="order?.application?.type === applicationType.API"
|
||||
:label="$t('order.field.api')"
|
||||
>
|
||||
{{ order?.application?.api?.title }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="order?.application?.type === applicationType.PROXY"
|
||||
:label="$t('order.field.proxy')"
|
||||
>
|
||||
{{ order?.application?.proxy?.title }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('order.field.amount')">
|
||||
{{ order?.amount }}
|
||||
</el-descriptions-item>
|
||||
@@ -116,6 +125,7 @@ import {
|
||||
ElButton
|
||||
} from 'element-plus';
|
||||
import PayOrder from '@/components/order/Pay.vue';
|
||||
import { IApplicationType } from '@/operators';
|
||||
|
||||
enum PayWay {
|
||||
WechatPay = 'WechatPay',
|
||||
@@ -130,6 +140,7 @@ interface IData {
|
||||
loading: boolean;
|
||||
paying: boolean;
|
||||
prepaying: boolean;
|
||||
applicationType: typeof IApplicationType;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -154,7 +165,8 @@ export default defineComponent({
|
||||
order: undefined,
|
||||
loading: false,
|
||||
paying: false,
|
||||
prepaying: false
|
||||
prepaying: false,
|
||||
applicationType: IApplicationType
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="service" id="apis" class="apis">
|
||||
<el-row v-if="service && apis?.length > 0" id="apis" class="apis">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-card shadow="hover" :body-style="{ padding: '50px' }">
|
||||
<div v-for="(api, apiIndex) in apis" :key="apiIndex">
|
||||
@@ -73,6 +73,28 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="service && proxies?.length > 0" id="proxies" class="proxies">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-card shadow="hover" :body-style="{ padding: '50px' }">
|
||||
<div v-for="(proxy, proxyIndex) in proxies" :key="proxyIndex">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<proxy-info :proxy="proxy" />
|
||||
</el-col>
|
||||
<el-col :span="4" class="operations">
|
||||
<el-button v-if="!proxy.applied" type="primary" @click="onApply(proxy, applicationType.PROXY)">
|
||||
{{ $t('common.button.apply') }}
|
||||
</el-button>
|
||||
<el-button v-else disabled type="primary">
|
||||
{{ $t('common.button.applied') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider v-if="proxyIndex < apis.length - 1" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -80,8 +102,11 @@ import {
|
||||
applicationOperator,
|
||||
IApplication,
|
||||
IApplicationDetailResponse,
|
||||
IProxy,
|
||||
IProxyListResponse,
|
||||
IService,
|
||||
IServiceDetailResponse,
|
||||
proxyOperator,
|
||||
serviceOperator
|
||||
} from '@/operators';
|
||||
import { defineComponent } from 'vue';
|
||||
@@ -94,13 +119,17 @@ import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ROUTE_CONSOLE_APPLICATION_LIST } from '@/router';
|
||||
import { ElCol, ElRow, ElButton, ElCard, ElDivider, ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
import ApiInfo from '@/components/api/Info.vue';
|
||||
import ProxyInfo from '@/components/proxy/Info.vue';
|
||||
import { getVerificationUrl } from '@/utils';
|
||||
|
||||
interface IData {
|
||||
service: IService | undefined;
|
||||
apis: IApi[];
|
||||
proxies: IProxy[];
|
||||
application: IApplication | undefined;
|
||||
loading: boolean;
|
||||
loadingApis: boolean;
|
||||
loadingProxies: boolean;
|
||||
activeTab: string;
|
||||
applicationType: typeof IApplicationType;
|
||||
}
|
||||
@@ -115,6 +144,7 @@ export default defineComponent({
|
||||
ElCard,
|
||||
ElDivider,
|
||||
ApiInfo,
|
||||
ProxyInfo,
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
},
|
||||
@@ -122,8 +152,11 @@ export default defineComponent({
|
||||
return {
|
||||
service: undefined,
|
||||
apis: [],
|
||||
proxies: [],
|
||||
application: undefined,
|
||||
loading: false,
|
||||
loadingApis: false,
|
||||
loadingProxies: false,
|
||||
activeTab: 'introduction',
|
||||
applicationType: IApplicationType
|
||||
};
|
||||
@@ -136,6 +169,7 @@ export default defineComponent({
|
||||
async mounted() {
|
||||
this.onFetchService();
|
||||
this.onFetchApis();
|
||||
this.onFetchProxies();
|
||||
},
|
||||
methods: {
|
||||
onFetchService() {
|
||||
@@ -146,10 +180,27 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
onFetchApis() {
|
||||
this.loading = true;
|
||||
apiOperator.getAllForService(this.id).then(({ data: data }: { data: IApiListResponse }) => {
|
||||
this.apis = data.items;
|
||||
});
|
||||
this.loadingApis = true;
|
||||
apiOperator
|
||||
.getAllForService(this.id)
|
||||
.then(({ data: data }: { data: IApiListResponse }) => {
|
||||
this.apis = data.items;
|
||||
this.loadingApis = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadingApis = false;
|
||||
});
|
||||
},
|
||||
onFetchProxies() {
|
||||
this.loadingProxies = true;
|
||||
proxyOperator
|
||||
.getAllForService(this.id)
|
||||
.then(({ data: data }: { data: IProxyListResponse }) => {
|
||||
this.proxies = data.items;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadingProxies = false;
|
||||
});
|
||||
},
|
||||
onToApis() {
|
||||
window.scrollTo({
|
||||
@@ -158,7 +209,7 @@ export default defineComponent({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
},
|
||||
onApply(obj: IApi, type: IApplicationType) {
|
||||
onApply(obj: IApi | IProxy, type: IApplicationType) {
|
||||
applicationOperator
|
||||
.create({
|
||||
type,
|
||||
|
||||
Reference in new issue
Block a user