mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-14 01:34:47 +08:00
feat: 统一状态显示
This commit is contained in:
parent
26039cc19d
commit
880ac3ec55
@ -17,7 +17,9 @@
|
|||||||
<el-col :lg="4" :xl="2">
|
<el-col :lg="4" :xl="2">
|
||||||
<div>
|
<div>
|
||||||
{{ $t('commons.table.status') }}:
|
{{ $t('commons.table.status') }}:
|
||||||
<el-tag type="success">{{ data.status }}</el-tag>
|
<el-tag type="info">
|
||||||
|
<Status :status="data.status"></Status>
|
||||||
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="8" :xl="4">
|
<el-col :lg="8" :xl="4">
|
||||||
@ -50,6 +52,7 @@ import i18n from '@/lang';
|
|||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import Status from '@/components/status/index.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
appKey: {
|
appKey: {
|
||||||
|
32
frontend/src/components/status/index.vue
Normal file
32
frontend/src/components/status/index.vue
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<span :style="{ color: getColor(status) }">
|
||||||
|
{{ $t('commons.status.' + status) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
status: {
|
||||||
|
type: String,
|
||||||
|
default: 'runnning',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
let status = ref('');
|
||||||
|
|
||||||
|
const getColor = (status: string) => {
|
||||||
|
switch (status) {
|
||||||
|
case 'running':
|
||||||
|
return '#00c957';
|
||||||
|
case 'error':
|
||||||
|
return '#ff0000';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
status.value = props.status.toLocaleLowerCase();
|
||||||
|
});
|
||||||
|
</script>
|
@ -128,6 +128,11 @@ export default {
|
|||||||
changePassword: '修改密码',
|
changePassword: '修改密码',
|
||||||
logout: '退出登录',
|
logout: '退出登录',
|
||||||
},
|
},
|
||||||
|
status: {
|
||||||
|
running: '已启动',
|
||||||
|
stopped: '已停止',
|
||||||
|
error: '失败',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
home: '概览',
|
home: '概览',
|
||||||
|
@ -27,7 +27,11 @@
|
|||||||
{{ $t('website.' + row.type) }}
|
{{ $t('website.' + row.type) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.table.status')" prop="status"></el-table-column>
|
<el-table-column :label="$t('commons.table.status')" prop="status">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<Status :status="row.status"></Status>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column :label="$t('website.remark')" prop="remark"></el-table-column>
|
<el-table-column :label="$t('website.remark')" prop="remark"></el-table-column>
|
||||||
<el-table-column :label="$t('website.protocol')" prop="protocol"></el-table-column>
|
<el-table-column :label="$t('website.protocol')" prop="protocol"></el-table-column>
|
||||||
<el-table-column :label="$t('website.expireDate')">
|
<el-table-column :label="$t('website.expireDate')">
|
||||||
@ -74,6 +78,7 @@ import { WebSite } from '@/api/interface/website';
|
|||||||
import AppStatus from '@/components/app-status/index.vue';
|
import AppStatus from '@/components/app-status/index.vue';
|
||||||
import NginxConfig from './nginx/index.vue';
|
import NginxConfig from './nginx/index.vue';
|
||||||
import { dateFromat } from '@/utils/util';
|
import { dateFromat } from '@/utils/util';
|
||||||
|
import Status from '@/components/status/index.vue';
|
||||||
|
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user