mirror of
https://gitee.com/fit2cloud-feizhiyun/1Panel.git
synced 2024-12-05 05:19:08 +08:00
feat: 增加nginx log日志
This commit is contained in:
parent
c30f39185e
commit
70c2185cf4
@ -41,14 +41,15 @@ type AppInstallRequest struct {
|
||||
}
|
||||
|
||||
type CheckInstalled struct {
|
||||
IsExist bool `json:"isExist"`
|
||||
Name string `json:"name"`
|
||||
App string `json:"app"`
|
||||
Version string `json:"version"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
LastBackupAt string `json:"lastBackupAt"`
|
||||
AppInstallID uint `json:"appInstallId"`
|
||||
IsExist bool `json:"isExist"`
|
||||
Name string `json:"name"`
|
||||
App string `json:"app"`
|
||||
Version string `json:"version"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
LastBackupAt string `json:"lastBackupAt"`
|
||||
AppInstallID uint `json:"appInstallId"`
|
||||
ContainerName string `json:"containerName"`
|
||||
}
|
||||
|
||||
type AppInstalled struct {
|
||||
|
@ -51,6 +51,7 @@ func (a AppInstallService) CheckExist(key string) (*dto.CheckInstalled, error) {
|
||||
if reflect.DeepEqual(appInstall, model.AppInstall{}) {
|
||||
return res, nil
|
||||
}
|
||||
res.ContainerName = appInstall.ContainerName
|
||||
res.Name = appInstall.Name
|
||||
res.Version = appInstall.Version
|
||||
res.CreatedAt = appInstall.CreatedAt
|
||||
|
@ -91,6 +91,7 @@ export namespace App {
|
||||
createdAt: string;
|
||||
lastBackupAt: string;
|
||||
appInstallId: number;
|
||||
containerName: string;
|
||||
}
|
||||
|
||||
export interface AppInstalledOp {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="app-card" v-loading="loading">
|
||||
<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-row :gutter="20">
|
||||
<el-col :span="1">
|
||||
<div>
|
||||
@ -32,22 +32,15 @@
|
||||
<el-button type="primary" link @click="setting">{{ $t('commons.button.set') }}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-row>
|
||||
<el-col :span="2">
|
||||
{{ $t('app.checkInstalledWarn', [data.app]) }}
|
||||
<el-tag effect="dark" type="success">{{ data.app }}</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-link icon="Position" @click="goRouter('/apps')" type="primary">
|
||||
{{ $t('database.goInstall') }}
|
||||
</el-link>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span></span>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-card>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-alert :closable="false" :title="$t('app.checkInstalledWarn', [data.app])" type="info">
|
||||
<el-link icon="Position" @click="goRouter('/apps')" type="primary">
|
||||
{{ $t('database.goInstall') }}
|
||||
</el-link>
|
||||
</el-alert>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@ -72,6 +65,7 @@ let data = ref({
|
||||
lastBackupAt: '',
|
||||
appInstallId: 0,
|
||||
isExist: false,
|
||||
containerName: '',
|
||||
});
|
||||
let loading = ref(false);
|
||||
let operateReq = reactive({
|
||||
@ -79,7 +73,7 @@ let operateReq = reactive({
|
||||
operate: '',
|
||||
});
|
||||
|
||||
const em = defineEmits(['setting']);
|
||||
const em = defineEmits(['setting', 'isExist']);
|
||||
const setting = () => {
|
||||
em('setting', false);
|
||||
};
|
||||
@ -92,6 +86,7 @@ const onCheck = async () => {
|
||||
loading.value = true;
|
||||
const res = await CheckAppInstalled(key.value);
|
||||
data.value = res.data;
|
||||
em('isExist', res.data);
|
||||
operateReq.installId = res.data.appInstallId;
|
||||
loading.value = false;
|
||||
};
|
||||
|
@ -687,7 +687,7 @@ export default {
|
||||
update: '升级',
|
||||
versioneSelect: '请选择版本',
|
||||
operatorHelper: '将对选中应用进行 {0} 操作,是否继续?',
|
||||
checkInstalledWarn: '未检测到',
|
||||
checkInstalledWarn: '未检测到 {0} ,请进入应用商店点击安装!',
|
||||
gotoInstalled: '去安装',
|
||||
},
|
||||
website: {
|
||||
@ -758,5 +758,6 @@ export default {
|
||||
source: '源文',
|
||||
security: '安全',
|
||||
backup: '备份',
|
||||
log: '日志',
|
||||
},
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<LayoutContent>
|
||||
<AppStatus :app-key="'nginx'" @setting="setting"></AppStatus>
|
||||
<AppStatus :app-key="'nginx'" @setting="setting" @is-exist="checkExist"></AppStatus>
|
||||
<LayoutContent v-if="nginxIsExist">
|
||||
<br />
|
||||
<el-card v-if="!openNginxConfig">
|
||||
<LayoutContent :header="$t('website.website')">
|
||||
@ -33,7 +33,7 @@
|
||||
</LayoutContent>
|
||||
</el-card>
|
||||
<el-card v-if="openNginxConfig">
|
||||
<NginxConfig></NginxConfig>
|
||||
<NginxConfig :containerName="containerName"></NginxConfig>
|
||||
</el-card>
|
||||
|
||||
<CreateWebSite ref="createRef" @close="search"></CreateWebSite>
|
||||
@ -56,11 +56,14 @@ import NginxConfig from './nginx/index.vue';
|
||||
|
||||
import i18n from '@/lang';
|
||||
import router from '@/routers';
|
||||
import { App } from '@/api/interface/app';
|
||||
|
||||
const createRef = ref();
|
||||
const deleteRef = ref();
|
||||
const groupRef = ref();
|
||||
let openNginxConfig = ref(false);
|
||||
let nginxIsExist = ref(false);
|
||||
let containerName = ref('');
|
||||
|
||||
const paginationConfig = reactive({
|
||||
currentPage: 1,
|
||||
@ -116,6 +119,11 @@ const openGroup = () => {
|
||||
groupRef.value.acceptParams();
|
||||
};
|
||||
|
||||
const checkExist = (data: App.CheckInstalled) => {
|
||||
nginxIsExist.value = data.isExist;
|
||||
containerName.value = data.containerName;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
search();
|
||||
});
|
||||
|
@ -4,6 +4,9 @@
|
||||
<el-collapse-item :title="$t('website.source')" name="1">
|
||||
<Source></Source>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item :title="$t('website.log')" name="2">
|
||||
<ContainerLog ref="dialogContainerLogRef" />
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</LayoutContent>
|
||||
</template>
|
||||
@ -11,7 +14,26 @@
|
||||
<script lang="ts" setup>
|
||||
import LayoutContent from '@/layout/layout-content.vue';
|
||||
import Source from './source/index.vue';
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import ContainerLog from '@/components/container-log/index.vue';
|
||||
|
||||
let activeName = ref('1');
|
||||
let dialogContainerLogRef = ref();
|
||||
|
||||
const props = defineProps({
|
||||
containerName: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
activeName,
|
||||
(newvalue) => {
|
||||
if (newvalue === '2') {
|
||||
dialogContainerLogRef.value!.acceptParams({ containerID: props.containerName });
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
@ -55,7 +55,6 @@ const getNginx = async () => {
|
||||
const res = await GetNginx();
|
||||
data.value = res.data;
|
||||
content.value = data.value.content;
|
||||
console.log(content.value);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user