mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
feat: 修改 AppStatus 状态条
This commit is contained in:
parent
dab0fe78b1
commit
df31f71879
@ -3,7 +3,7 @@
|
|||||||
<div class="app-content" v-if="data.isExist">
|
<div class="app-content" v-if="data.isExist">
|
||||||
<el-card class="app-card" v-loading="loading">
|
<el-card class="app-card" v-loading="loading">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :lg="2" :xl="1">
|
<el-col :lg="3" :xl="2">
|
||||||
<div>
|
<div>
|
||||||
<el-tag effect="dark" type="success">{{ data.app }}</el-tag>
|
<el-tag effect="dark" type="success">{{ data.app }}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
@ -18,18 +18,20 @@
|
|||||||
<div>
|
<div>
|
||||||
{{ $t('commons.table.status') }}:
|
{{ $t('commons.table.status') }}:
|
||||||
<el-tag type="info">
|
<el-tag type="info">
|
||||||
<Status :status="data.status"></Status>
|
<Status :key="refresh" :status="data.status"></Status>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="6" :xl="4">
|
|
||||||
<div>
|
|
||||||
{{ $t('website.lastBackupAt') }}:
|
|
||||||
<el-tag v-if="data.lastBackupAt != ''" type="info">{{ data.lastBackupAt }}</el-tag>
|
|
||||||
<span v-else>{{ $t('website.null') }}</span>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :lg="4" :xl="6">
|
<el-col :lg="4" :xl="6">
|
||||||
|
<el-button type="primary" v-if="data.status != 'Running'" link @click="onOperate('up')">
|
||||||
|
{{ $t('app.up') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" v-if="data.status === 'Running'" link @click="onOperate('down')">
|
||||||
|
{{ $t('app.down') }}
|
||||||
|
</el-button>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-button type="primary" link @click="onOperate('restart')">{{ $t('app.restart') }}</el-button>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
<el-button type="primary" link @click="setting">{{ $t('commons.button.set') }}</el-button>
|
<el-button type="primary" link @click="setting">{{ $t('commons.button.set') }}</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -45,10 +47,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { CheckAppInstalled } from '@/api/modules/app';
|
import { CheckAppInstalled, InstalledOp } from '@/api/modules/app';
|
||||||
import router from '@/routers';
|
import router from '@/routers';
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import Status from '@/components/status/index.vue';
|
import Status from '@/components/status/index.vue';
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
|
import i18n from '@/lang';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
appKey: {
|
appKey: {
|
||||||
@ -72,6 +76,7 @@ let operateReq = reactive({
|
|||||||
installId: 0,
|
installId: 0,
|
||||||
operate: '',
|
operate: '',
|
||||||
});
|
});
|
||||||
|
let refresh = ref(1);
|
||||||
|
|
||||||
const em = defineEmits(['setting', 'isExist']);
|
const em = defineEmits(['setting', 'isExist']);
|
||||||
const setting = () => {
|
const setting = () => {
|
||||||
@ -89,6 +94,30 @@ const onCheck = async () => {
|
|||||||
em('isExist', res.data);
|
em('isExist', res.data);
|
||||||
operateReq.installId = res.data.appInstallId;
|
operateReq.installId = res.data.appInstallId;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
refresh.value++;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onOperate = async (operation: string) => {
|
||||||
|
operateReq.operate = operation;
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
i18n.global.t('app.operatorHelper', [i18n.global.t('app.' + operation)]),
|
||||||
|
i18n.global.t('app.' + operation),
|
||||||
|
{
|
||||||
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||||
|
type: 'info',
|
||||||
|
},
|
||||||
|
).then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
InstalledOp(operateReq)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
|
onCheck();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -876,7 +876,9 @@ export default {
|
|||||||
reading: '请求数(Reading)',
|
reading: '请求数(Reading)',
|
||||||
writing: '响应数(Writing)',
|
writing: '响应数(Writing)',
|
||||||
waiting: '驻留进程(Waiting)',
|
waiting: '驻留进程(Waiting)',
|
||||||
status: '负载状态',
|
status: '当前状态',
|
||||||
|
nginxConfig: 'OpenResty 设置',
|
||||||
|
configResource: '配置修改',
|
||||||
},
|
},
|
||||||
ssl: {
|
ssl: {
|
||||||
provider: '类型',
|
provider: '类型',
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
.input-help {
|
.input-help {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
color: #4A4B4D;
|
color: #4a4b4d;
|
||||||
transform: scale(0.9);
|
transform: scale(0.9);
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
width: 110%;
|
width: 110%;
|
||||||
@ -133,7 +133,7 @@
|
|||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
width: 110%;
|
width: 110%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.myTable {
|
.myTable {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@ -150,7 +150,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.myTable td div {
|
.myTable td div {
|
||||||
margin-top: 2px
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.myTable th {
|
.myTable th {
|
||||||
@ -169,3 +169,20 @@
|
|||||||
.myTable tr td:nth-child(even) {
|
.myTable tr td:nth-child(even) {
|
||||||
color: #85888e;
|
color: #85888e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mask {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0.4;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mask-prompt {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 9999;
|
||||||
|
top: 20%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<AppStatus :app-key="'nginx'" @setting="setting" @is-exist="checkExist"></AppStatus>
|
<AppStatus :app-key="'nginx'" @setting="setting" @is-exist="checkExist"></AppStatus>
|
||||||
<LayoutContent v-if="nginxIsExist">
|
<div v-if="nginxIsExist" :class="{ mask: nginxStatus != 'Running' }">
|
||||||
|
<LayoutContent>
|
||||||
<br />
|
<br />
|
||||||
<el-card v-if="!openNginxConfig">
|
<el-card v-if="!openNginxConfig">
|
||||||
<LayoutContent :header="$t('website.website')">
|
<LayoutContent :header="$t('website.website')">
|
||||||
@ -19,7 +20,9 @@
|
|||||||
prop="primaryDomain"
|
prop="primaryDomain"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-link type="primary" @click="openConfig(row.id)">{{ row.primaryDomain }}</el-link>
|
<el-link type="primary" @click="openConfig(row.id)">
|
||||||
|
{{ row.primaryDomain }}
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.table.type')" fix prop="type">
|
<el-table-column :label="$t('commons.table.type')" fix prop="type">
|
||||||
@ -51,9 +54,6 @@
|
|||||||
</ComplexTable>
|
</ComplexTable>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card v-if="openNginxConfig">
|
|
||||||
<NginxConfig :containerName="containerName"></NginxConfig>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<CreateWebSite ref="createRef" @close="search"></CreateWebSite>
|
<CreateWebSite ref="createRef" @close="search"></CreateWebSite>
|
||||||
<DeleteWebsite ref="deleteRef" @close="search"></DeleteWebsite>
|
<DeleteWebsite ref="deleteRef" @close="search"></DeleteWebsite>
|
||||||
@ -62,6 +62,13 @@
|
|||||||
<BackupRecords ref="dialogBackupRef" />
|
<BackupRecords ref="dialogBackupRef" />
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
</div>
|
</div>
|
||||||
|
<el-card width="30%" v-if="nginxStatus != 'Running'" class="mask-prompt">
|
||||||
|
<span style="font-size: 14px">当前未启动 OpenResty 服务</span>
|
||||||
|
</el-card>
|
||||||
|
<el-card v-if="openNginxConfig">
|
||||||
|
<NginxConfig :containerName="containerName" :status="nginxStatus"></NginxConfig>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@ -90,6 +97,7 @@ const groupRef = ref();
|
|||||||
let openNginxConfig = ref(false);
|
let openNginxConfig = ref(false);
|
||||||
let nginxIsExist = ref(false);
|
let nginxIsExist = ref(false);
|
||||||
let containerName = ref('');
|
let containerName = ref('');
|
||||||
|
let nginxStatus = ref('');
|
||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -172,6 +180,7 @@ const openGroup = () => {
|
|||||||
const checkExist = (data: App.CheckInstalled) => {
|
const checkExist = (data: App.CheckInstalled) => {
|
||||||
nginxIsExist.value = data.isExist;
|
nginxIsExist.value = data.isExist;
|
||||||
containerName.value = data.containerName;
|
containerName.value = data.containerName;
|
||||||
|
nginxStatus.value = data.status;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<LayoutContent :header="$t('website.nginxConfig')" :reload="true">
|
<LayoutContent :header="$t('nginx.nginxConfig')" :reload="true">
|
||||||
<el-collapse v-model="activeName" accordion>
|
<el-collapse v-model="activeName" accordion>
|
||||||
<el-collapse-item :title="$t('website.source')" name="1">
|
<el-collapse-item :title="$t('nginx.configResource')" name="1">
|
||||||
<Source></Source>
|
<Source v-if="activeName === '1'"></Source>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="$t('website.log')" name="2">
|
<el-collapse-item :title="$t('nginx.status')" name="2">
|
||||||
<ContainerLog ref="dialogContainerLogRef" />
|
<Status v-if="activeName === '2'" :status="status" />
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="$t('website.nginxPer')" name="3">
|
<el-collapse-item :title="$t('website.nginxPer')" name="3">
|
||||||
<NginxPer />
|
<NginxPer v-if="activeName === '3'" />
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="$t('nginx.status')" name="4">
|
<el-collapse-item :title="$t('website.log')" name="4">
|
||||||
<Status />
|
<ContainerLog ref="dialogContainerLogRef" />
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
@ -33,12 +33,16 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
status: {
|
||||||
|
type: String,
|
||||||
|
default: 'Running',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
activeName,
|
activeName,
|
||||||
(newvalue) => {
|
(newvalue) => {
|
||||||
if (newvalue === '2') {
|
if (newvalue === '4') {
|
||||||
dialogContainerLogRef.value!.acceptParams({
|
dialogContainerLogRef.value!.acceptParams({
|
||||||
containerID: props.containerName,
|
containerID: props.containerName,
|
||||||
container: props.containerName,
|
container: props.containerName,
|
||||||
|
@ -21,6 +21,13 @@ import { Nginx } from '@/api/interface/nginx';
|
|||||||
import { GetNginxStatus } from '@/api/modules/nginx';
|
import { GetNginxStatus } from '@/api/modules/nginx';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
status: {
|
||||||
|
type: String,
|
||||||
|
default: 'Running',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
let data = ref<Nginx.NginxStatus>({
|
let data = ref<Nginx.NginxStatus>({
|
||||||
accepts: '',
|
accepts: '',
|
||||||
handled: '',
|
handled: '',
|
||||||
@ -32,6 +39,9 @@ let data = ref<Nginx.NginxStatus>({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const get = async () => {
|
const get = async () => {
|
||||||
|
if (props.status != 'Running') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const res = await GetNginxStatus();
|
const res = await GetNginxStatus();
|
||||||
data.value = res.data;
|
data.value = res.data;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user