Commit 557f2937f550b5ca99e600f6e4bb81025832b7cc

Authored by xingyu
1 parent d604c6c5

refactor: IFrame

yudao-ui-admin-vue3/src/views/infra/dbDoc/index.vue
  1 +<template>
  2 + <ContentWrap title="数据库文档">
  3 + <!-- 操作工具栏 -->
  4 + <div class="mb-10px">
  5 + <XButton
  6 + type="primary"
  7 + preIcon="ep:download"
  8 + :title="t('action.export') + ' HTML'"
  9 + @click="handleExport('HTML')"
  10 + />
  11 + <XButton
  12 + type="primary"
  13 + preIcon="ep:download"
  14 + :title="t('action.export') + ' Word'"
  15 + @click="handleExport('Word')"
  16 + />
  17 + <XButton
  18 + type="primary"
  19 + preIcon="ep:download"
  20 + :title="t('action.export') + ' Markdown'"
  21 + @click="handleExport('Markdown')"
  22 + />
  23 + </div>
  24 + <IFrame v-if="!loding" v-loading="loding" :src="src" />
  25 + </ContentWrap>
  26 +</template>
1 <script setup lang="ts"> 27 <script setup lang="ts">
2 -import { IFrame } from '@/components/IFrame'  
3 -import * as DbDocApi from '@/api/infra/dbDoc'  
4 import { onMounted, ref } from 'vue' 28 import { onMounted, ref } from 'vue'
5 import download from '@/utils/download' 29 import download from '@/utils/download'
6 import { useI18n } from '@/hooks/web/useI18n' 30 import { useI18n } from '@/hooks/web/useI18n'
  31 +import { IFrame } from '@/components/IFrame'
  32 +import * as DbDocApi from '@/api/infra/dbDoc'
7 33
8 const { t } = useI18n() // 国际化 34 const { t } = useI18n() // 国际化
9 -const loding = ref(true)  
10 const src = ref('') 35 const src = ref('')
  36 +const loding = ref(true)
11 /** 页面加载 */ 37 /** 页面加载 */
12 const init = async () => { 38 const init = async () => {
13 const res = await DbDocApi.exportHtmlApi() 39 const res = await DbDocApi.exportHtmlApi()
@@ -16,40 +42,16 @@ const init = async () =&gt; { @@ -16,40 +42,16 @@ const init = async () =&gt; {
16 src.value = blobUrl 42 src.value = blobUrl
17 loding.value = false 43 loding.value = false
18 } 44 }
19 -/** 处理导出 HTML */  
20 -const handleExportHtml = async () => {  
21 - const res = await DbDocApi.exportHtmlApi()  
22 - download.html(res, '数据库文档.html')  
23 -}  
24 -/** 处理导出 Word */  
25 -const handleExportWord = async () => { 45 +/** 处理导出 */
  46 +const handleExport = async (type: string) => {
26 const res = await DbDocApi.exportHtmlApi() 47 const res = await DbDocApi.exportHtmlApi()
27 - download.word(res, '数据库文档.doc')  
28 -}  
29 -/** 处理导出 Markdown */  
30 -const handleExportMarkdown = async () => {  
31 - const res = await DbDocApi.exportHtmlApi()  
32 - download.markdown(res, '数据库文档.md') 48 + if (type === 'HTML') { download.html(res, '数据库文档.html') }
  49 + if (type === 'Word') { download.word(res, '数据库文档.doc') }
  50 + if(type === 'Markdown') {download.markdown(res, '数据库文档.md')}
  51 +
33 } 52 }
34 onMounted(async () => { 53 onMounted(async () => {
35 await init() 54 await init()
36 }) 55 })
37 </script> 56 </script>
38 57
39 -<template>  
40 - <ContentWrap title="数据库文档" message="https://doc.iocoder.cn/db-doc/">  
41 - <!-- 操作工具栏 -->  
42 - <div class="mb-10px">  
43 - <el-button type="primary" @click="handleExportHtml">  
44 - <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') + ' HTML' }}  
45 - </el-button>  
46 - <el-button type="primary" @click="handleExportWord">  
47 - <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') + ' Word' }}  
48 - </el-button>  
49 - <el-button type="primary" @click="handleExportMarkdown">  
50 - <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') + ' Markdown' }}  
51 - </el-button>  
52 - </div>  
53 - <IFrame v-if="!loding" v-loading="loding" :src="src" />  
54 - </ContentWrap>  
55 -</template>  
yudao-ui-admin-vue3/src/views/infra/druid/index.vue
  1 +<template>
  2 + <ContentWrap>
  3 + <IFrame :src="src" />
  4 + </ContentWrap>
  5 +</template>
1 <script setup lang="ts"> 6 <script setup lang="ts">
2 -import { IFrame } from '@/components/IFrame'  
3 import { ref } from 'vue' 7 import { ref } from 'vue'
  8 +import { IFrame } from '@/components/IFrame'
  9 +
4 const BASE_URL = import.meta.env.VITE_BASE_URL 10 const BASE_URL = import.meta.env.VITE_BASE_URL
5 const src = ref(BASE_URL + '/druid/index.html') 11 const src = ref(BASE_URL + '/druid/index.html')
6 </script> 12 </script>
7 13
8 -<template>  
9 - <ContentWrap>  
10 - <IFrame :src="src" />  
11 - </ContentWrap>  
12 -</template>  
yudao-ui-admin-vue3/src/views/infra/redis/index.vue
  1 +<template>
  2 + <el-scrollbar height="calc(100vh - 88px - 40px - 50px)">
  3 + <el-row>
  4 + <el-col :span="24" class="card-box" shadow="hover">
  5 + <el-card>
  6 + <el-descriptions title="基本信息" :column="6" border>
  7 + <el-descriptions-item label="Redis版本 :">
  8 + {{ cache?.info?.redis_version }}
  9 + </el-descriptions-item>
  10 + <el-descriptions-item label="运行模式 :">
  11 + {{ cache?.info?.redis_mode == 'standalone' ? '单机' : '集群' }}
  12 + </el-descriptions-item>
  13 + <el-descriptions-item label="端口 :">
  14 + {{ cache?.info?.tcp_port }}
  15 + </el-descriptions-item>
  16 + <el-descriptions-item label="客户端数 :">
  17 + {{ cache?.info?.connected_clients }}
  18 + </el-descriptions-item>
  19 + <el-descriptions-item label="运行时间(天) :">
  20 + {{ cache?.info?.uptime_in_days }}
  21 + </el-descriptions-item>
  22 + <el-descriptions-item label="使用内存 :">
  23 + {{ cache?.info?.used_memory_human }}
  24 + </el-descriptions-item>
  25 + <el-descriptions-item label="使用CPU :">
  26 + {{ cache?.info ? parseFloat(cache?.info?.used_cpu_user_children).toFixed(2) : '' }}
  27 + </el-descriptions-item>
  28 + <el-descriptions-item label="内存配置 :">
  29 + {{ cache?.info?.maxmemory_human }}
  30 + </el-descriptions-item>
  31 + <el-descriptions-item label="AOF是否开启 :">
  32 + {{ cache?.info?.aof_enabled == '0' ? '否' : '是' }}
  33 + </el-descriptions-item>
  34 + <el-descriptions-item label="RDB是否成功 :">
  35 + {{ cache?.info?.rdb_last_bgsave_status }}
  36 + </el-descriptions-item>
  37 + <el-descriptions-item label="Key数量 :">
  38 + {{ cache?.dbSize }}
  39 + </el-descriptions-item>
  40 + <el-descriptions-item label="网络入口/出口 :">
  41 + {{ cache?.info?.instantaneous_input_kbps }}kps/
  42 + {{ cache?.info?.instantaneous_output_kbps }}kps
  43 + </el-descriptions-item>
  44 + </el-descriptions>
  45 + </el-card>
  46 + </el-col>
  47 + <el-col :span="12" style="margin-top: 10px">
  48 + <el-card :gutter="12" shadow="hover">
  49 + <div ref="commandStatsRef" style="height: 350px"></div>
  50 + </el-card>
  51 + </el-col>
  52 + <el-col :span="12" style="margin-top: 10px">
  53 + <el-card style="margin-left: 10px" :gutter="12" shadow="hover">
  54 + <div ref="usedmemory" style="height: 350px"></div>
  55 + </el-card>
  56 + </el-col>
  57 + </el-row>
  58 + <el-row style="margin-top: 10px">
  59 + <el-col :span="24" class="card-box" shadow="hover">
  60 + <el-card>
  61 + <el-table
  62 + v-loading="keyListLoad"
  63 + :data="keyList"
  64 + row-key="id"
  65 + @row-click="openKeyTemplate"
  66 + >
  67 + <el-table-column prop="keyTemplate" label="Key 模板" width="200" />
  68 + <el-table-column prop="keyType" label="Key 类型" width="100" />
  69 + <el-table-column prop="valueType" label="Value 类型" />
  70 + <el-table-column prop="timeoutType" label="超时时间" width="200">
  71 + <template #default="{ row }">
  72 + <DictTag :type="DICT_TYPE.INFRA_REDIS_TIMEOUT_TYPE" :value="row?.timeoutType" />
  73 + <span v-if="row?.timeout > 0">({{ row?.timeout / 1000 }} 秒)</span>
  74 + </template>
  75 + </el-table-column>
  76 + <el-table-column prop="memo" label="备注" />
  77 + </el-table>
  78 + </el-card>
  79 + </el-col>
  80 + </el-row>
  81 + </el-scrollbar>
  82 + <XModal v-model="dialogVisible" :title="keyTemplate + ' 模板'">
  83 + <el-row>
  84 + <el-col :span="14" style="margin-top: 10px">
  85 + <el-card shadow="always">
  86 + <template #header>
  87 + <div class="card-header">
  88 + <span>键名列表</span>
  89 + </div>
  90 + </template>
  91 + <el-table :data="cacheKeys" style="width: 100%" @row-click="handleKeyValue">
  92 + <el-table-column label="缓存键名" align="center" :show-overflow-tooltip="true">
  93 + <template #default="{ row }">
  94 + {{ row }}
  95 + </template>
  96 + </el-table-column>
  97 + <el-table-column label="操作" align="right" width="60">
  98 + <template #default="{ row }">
  99 + <el-button link type="primary" @click="handleDeleteKey(row)">
  100 + <Icon icon="ep:delete" />
  101 + </el-button>
  102 + </template>
  103 + </el-table-column>
  104 + </el-table>
  105 + </el-card>
  106 + </el-col>
  107 + <el-col :span="10" style="margin-top: 10px">
  108 + <el-card shadow="always">
  109 + <template #header>
  110 + <div class="card-header">
  111 + <span>缓存内容</span>
  112 + <el-button
  113 + link
  114 + type="primary"
  115 + @click="handleDeleteKeys(keyTemplate)"
  116 + style="float: right; padding: 3px 0"
  117 + >
  118 + <Icon icon="ep:refresh" />清理全部
  119 + </el-button>
  120 + </div>
  121 + </template>
  122 + <el-descriptions :column="1">
  123 + <el-descriptions-item label="缓存键名:">{{ cacheForm.key }}</el-descriptions-item>
  124 + <el-descriptions-item label="缓存内容:">{{ cacheForm.value }}</el-descriptions-item>
  125 + </el-descriptions>
  126 + </el-card>
  127 + </el-col>
  128 + </el-row>
  129 + </XModal>
  130 +</template>
1 <script setup lang="ts"> 131 <script setup lang="ts">
2 import { onBeforeMount, ref } from 'vue' 132 import { onBeforeMount, ref } from 'vue'
3 -import * as RedisApi from '@/api/infra/redis'  
4 -import { DICT_TYPE } from '@/utils/dict'  
5 -import * as echarts from 'echarts'  
6 -import { RedisKeyInfo, RedisMonitorInfoVO } from '@/api/infra/redis/types'  
7 import { 133 import {
8 ElRow, 134 ElRow,
9 ElCard, 135 ElCard,
@@ -12,9 +138,17 @@ import { @@ -12,9 +138,17 @@ import {
12 ElTableColumn, 138 ElTableColumn,
13 ElScrollbar, 139 ElScrollbar,
14 ElDescriptions, 140 ElDescriptions,
15 - ElDescriptionsItem,  
16 - ElMessage 141 + ElDescriptionsItem
17 } from 'element-plus' 142 } from 'element-plus'
  143 +import * as echarts from 'echarts'
  144 +import { DICT_TYPE } from '@/utils/dict'
  145 +import { useI18n } from '@/hooks/web/useI18n'
  146 +import { useMessage } from '@/hooks/web/useMessage'
  147 +import * as RedisApi from '@/api/infra/redis'
  148 +import { RedisKeyInfo, RedisMonitorInfoVO } from '@/api/infra/redis/types'
  149 +
  150 +const { t } = useI18n() // 国际化
  151 +const message = useMessage() // 消息弹窗
18 const cache = ref<RedisMonitorInfoVO>() 152 const cache = ref<RedisMonitorInfoVO>()
19 const keyListLoad = ref(true) 153 const keyListLoad = ref(true)
20 const keyList = ref<RedisKeyInfo[]>([]) 154 const keyList = ref<RedisKeyInfo[]>([])
@@ -29,7 +163,6 @@ const readRedisInfo = async () =&gt; { @@ -29,7 +163,6 @@ const readRedisInfo = async () =&gt; {
29 } 163 }
30 // 图表 164 // 图表
31 const commandStatsRef = ref<HTMLElement>() 165 const commandStatsRef = ref<HTMLElement>()
32 -  
33 const usedmemory = ref<HTMLDivElement>() 166 const usedmemory = ref<HTMLDivElement>()
34 167
35 const loadEchartOptions = (stats) => { 168 const loadEchartOptions = (stats) => {
@@ -138,11 +271,11 @@ const openKeyTemplate = async (row: RedisKeyInfo) =&gt; { @@ -138,11 +271,11 @@ const openKeyTemplate = async (row: RedisKeyInfo) =&gt; {
138 } 271 }
139 const handleDeleteKey = async (row) => { 272 const handleDeleteKey = async (row) => {
140 RedisApi.deleteKeyApi(row) 273 RedisApi.deleteKeyApi(row)
141 - ElMessage.success('删除成功') 274 + message.success(t('common.delSuccess'))
142 } 275 }
143 const handleDeleteKeys = async (row) => { 276 const handleDeleteKeys = async (row) => {
144 RedisApi.deleteKeysApi(row) 277 RedisApi.deleteKeysApi(row)
145 - ElMessage.success('删除成功') 278 + message.success(t('common.delSuccess'))
146 } 279 }
147 const handleKeyValue = async (row) => { 280 const handleKeyValue = async (row) => {
148 const res = await RedisApi.getKeyValueApi(row) 281 const res = await RedisApi.getKeyValueApi(row)
@@ -152,136 +285,6 @@ onBeforeMount(() =&gt; { @@ -152,136 +285,6 @@ onBeforeMount(() =&gt; {
152 readRedisInfo() 285 readRedisInfo()
153 }) 286 })
154 </script> 287 </script>
155 -<template>  
156 - <el-scrollbar height="calc(100vh - 88px - 40px - 50px)">  
157 - <el-row>  
158 - <el-col :span="24" class="card-box" shadow="hover">  
159 - <el-card>  
160 - <el-descriptions title="基本信息" :column="6" border>  
161 - <el-descriptions-item label="Redis版本 :">  
162 - {{ cache?.info?.redis_version }}  
163 - </el-descriptions-item>  
164 - <el-descriptions-item label="运行模式 :">  
165 - {{ cache?.info?.redis_mode == 'standalone' ? '单机' : '集群' }}  
166 - </el-descriptions-item>  
167 - <el-descriptions-item label="端口 :">  
168 - {{ cache?.info?.tcp_port }}  
169 - </el-descriptions-item>  
170 - <el-descriptions-item label="客户端数 :">  
171 - {{ cache?.info?.connected_clients }}  
172 - </el-descriptions-item>  
173 - <el-descriptions-item label="运行时间(天) :">  
174 - {{ cache?.info?.uptime_in_days }}  
175 - </el-descriptions-item>  
176 - <el-descriptions-item label="使用内存 :">  
177 - {{ cache?.info?.used_memory_human }}  
178 - </el-descriptions-item>  
179 - <el-descriptions-item label="使用CPU :">  
180 - {{ cache?.info ? parseFloat(cache?.info?.used_cpu_user_children).toFixed(2) : '' }}  
181 - </el-descriptions-item>  
182 - <el-descriptions-item label="内存配置 :">  
183 - {{ cache?.info?.maxmemory_human }}  
184 - </el-descriptions-item>  
185 - <el-descriptions-item label="AOF是否开启 :">  
186 - {{ cache?.info?.aof_enabled == '0' ? '否' : '是' }}  
187 - </el-descriptions-item>  
188 - <el-descriptions-item label="RDB是否成功 :">  
189 - {{ cache?.info?.rdb_last_bgsave_status }}  
190 - </el-descriptions-item>  
191 - <el-descriptions-item label="Key数量 :">  
192 - {{ cache?.dbSize }}  
193 - </el-descriptions-item>  
194 - <el-descriptions-item label="网络入口/出口 :">  
195 - {{ cache?.info?.instantaneous_input_kbps }}kps/  
196 - {{ cache?.info?.instantaneous_output_kbps }}kps  
197 - </el-descriptions-item>  
198 - </el-descriptions>  
199 - </el-card>  
200 - </el-col>  
201 - <el-col :span="12" style="margin-top: 10px">  
202 - <el-card :gutter="12" shadow="hover">  
203 - <div ref="commandStatsRef" style="height: 350px"></div>  
204 - </el-card>  
205 - </el-col>  
206 - <el-col :span="12" style="margin-top: 10px">  
207 - <el-card style="margin-left: 10px" :gutter="12" shadow="hover">  
208 - <div ref="usedmemory" style="height: 350px"></div>  
209 - </el-card>  
210 - </el-col>  
211 - </el-row>  
212 - <el-row style="margin-top: 10px">  
213 - <el-col :span="24" class="card-box" shadow="hover">  
214 - <el-card>  
215 - <el-table  
216 - v-loading="keyListLoad"  
217 - :data="keyList"  
218 - row-key="id"  
219 - @row-click="openKeyTemplate"  
220 - >  
221 - <el-table-column prop="keyTemplate" label="Key 模板" width="200" />  
222 - <el-table-column prop="keyType" label="Key 类型" width="100" />  
223 - <el-table-column prop="valueType" label="Value 类型" />  
224 - <el-table-column prop="timeoutType" label="超时时间" width="200">  
225 - <template #default="{ row }">  
226 - <DictTag :type="DICT_TYPE.INFRA_REDIS_TIMEOUT_TYPE" :value="row?.timeoutType" />  
227 - <span v-if="row?.timeout > 0">({{ row?.timeout / 1000 }} 秒)</span>  
228 - </template>  
229 - </el-table-column>  
230 - <el-table-column prop="memo" label="备注" />  
231 - </el-table>  
232 - </el-card>  
233 - </el-col>  
234 - </el-row>  
235 - </el-scrollbar>  
236 - <XModal v-model="dialogVisible" :title="keyTemplate + ' 模板'">  
237 - <el-row>  
238 - <el-col :span="14" style="margin-top: 10px">  
239 - <el-card shadow="always">  
240 - <template #header>  
241 - <div class="card-header">  
242 - <span>键名列表</span>  
243 - </div>  
244 - </template>  
245 - <el-table :data="cacheKeys" style="width: 100%" @row-click="handleKeyValue">  
246 - <el-table-column label="缓存键名" align="center" :show-overflow-tooltip="true">  
247 - <template #default="{ row }">  
248 - {{ row }}  
249 - </template>  
250 - </el-table-column>  
251 - <el-table-column label="操作" align="right" width="60">  
252 - <template #default="{ row }">  
253 - <el-button link type="primary" @click="handleDeleteKey(row)">  
254 - <Icon icon="ep:delete" />  
255 - </el-button>  
256 - </template>  
257 - </el-table-column>  
258 - </el-table>  
259 - </el-card>  
260 - </el-col>  
261 - <el-col :span="10" style="margin-top: 10px">  
262 - <el-card shadow="always">  
263 - <template #header>  
264 - <div class="card-header">  
265 - <span>缓存内容</span>  
266 - <el-button  
267 - link  
268 - type="primary"  
269 - @click="handleDeleteKeys(keyTemplate)"  
270 - style="float: right; padding: 3px 0"  
271 - >  
272 - <Icon icon="ep:refresh" />清理全部  
273 - </el-button>  
274 - </div>  
275 - </template>  
276 - <el-descriptions :column="1">  
277 - <el-descriptions-item label="缓存键名:">{{ cacheForm.key }}</el-descriptions-item>  
278 - <el-descriptions-item label="缓存内容:">{{ cacheForm.value }}</el-descriptions-item>  
279 - </el-descriptions>  
280 - </el-card>  
281 - </el-col>  
282 - </el-row>  
283 - </XModal>  
284 -</template>  
285 <style scoped> 288 <style scoped>
286 .redis { 289 .redis {
287 height: 600px; 290 height: 600px;
yudao-ui-admin-vue3/src/views/infra/server/index.vue
1 -<script setup lang="ts">  
2 -import { IFrame } from '@/components/IFrame'  
3 -import { ref } from 'vue'  
4 -const BASE_URL = import.meta.env.VITE_BASE_URL  
5 -const src = ref(BASE_URL + '/admin/applications')  
6 -</script>  
7 -  
8 <template> 1 <template>
9 <ContentWrap> 2 <ContentWrap>
10 <IFrame :src="src" /> 3 <IFrame :src="src" />
11 </ContentWrap> 4 </ContentWrap>
12 </template> 5 </template>
  6 +<script setup lang="ts">
  7 +import { ref } from 'vue'
  8 +import { IFrame } from '@/components/IFrame'
  9 +
  10 +const BASE_URL = import.meta.env.VITE_BASE_URL
  11 +const src = ref(BASE_URL + '/admin/applications')
  12 +</script>
yudao-ui-admin-vue3/src/views/infra/skywalking/index.vue
1 -<script setup lang="ts">  
2 -import { IFrame } from '@/components/IFrame'  
3 -import { ref } from 'vue'  
4 -const src = ref('http://skywalking.shop.iocoder.cn')  
5 -</script>  
6 1
7 <template> 2 <template>
8 <ContentWrap> 3 <ContentWrap>
9 <IFrame :src="src" /> 4 <IFrame :src="src" />
10 </ContentWrap> 5 </ContentWrap>
11 </template> 6 </template>
  7 +<script setup lang="ts">
  8 +import { ref } from 'vue'
  9 +import { IFrame } from '@/components/IFrame'
  10 +
  11 +const src = ref('http://skywalking.shop.iocoder.cn')
  12 +</script>
yudao-ui-admin-vue3/src/views/infra/swagger/index.vue
  1 +<template>
  2 + <ContentWrap>
  3 + <IFrame :src="src" />
  4 + </ContentWrap>
  5 +</template>
1 <script setup lang="ts"> 6 <script setup lang="ts">
2 -import { IFrame } from '@/components/IFrame'  
3 import { ref } from 'vue' 7 import { ref } from 'vue'
  8 +import { IFrame } from '@/components/IFrame'
  9 +
4 const BASE_URL = import.meta.env.VITE_BASE_URL 10 const BASE_URL = import.meta.env.VITE_BASE_URL
5 const src = ref(BASE_URL + '/doc.html') 11 const src = ref(BASE_URL + '/doc.html')
6 </script> 12 </script>
7 13
8 -<template>  
9 - <ContentWrap>  
10 - <IFrame :src="src" />  
11 - </ContentWrap>  
12 -</template>