1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

fix: 创建静态网站增加路径提示

This commit is contained in:
zhengkunwang223 2022-12-21 17:36:14 +08:00 committed by zhengkunwang223
parent ea495aaa13
commit b72be7f8cc
6 changed files with 16 additions and 2 deletions

View File

@ -29,6 +29,7 @@ type AppInstalledCheck struct {
LastBackupAt string `json:"lastBackupAt"` LastBackupAt string `json:"lastBackupAt"`
AppInstallID uint `json:"appInstallId"` AppInstallID uint `json:"appInstallId"`
ContainerName string `json:"containerName"` ContainerName string `json:"containerName"`
InstallPath string `json:"installPath"`
} }
type AppDetailDTO struct { type AppDetailDTO struct {

View File

@ -74,6 +74,7 @@ func (a AppInstallService) CheckExist(key string) (*response.AppInstalledCheck,
res.Status = appInstall.Status res.Status = appInstall.Status
res.AppInstallID = appInstall.ID res.AppInstallID = appInstall.ID
res.IsExist = true res.IsExist = true
res.InstallPath = path.Join(constant.AppInstallDir, appInstall.Name)
if len(appInstall.Backups) > 0 { if len(appInstall.Backups) > 0 {
res.LastBackupAt = appInstall.Backups[0].CreatedAt.Format("2006-01-02 15:04:05") res.LastBackupAt = appInstall.Backups[0].CreatedAt.Format("2006-01-02 15:04:05")
} }

View File

@ -96,6 +96,7 @@ export namespace App {
lastBackupAt: string; lastBackupAt: string;
appInstallId: number; appInstallId: number;
containerName: string; containerName: string;
installPath: string;
} }
export interface AppInstallResource { export interface AppInstallResource {

View File

@ -895,6 +895,7 @@ export default {
deleteAppHelper: '同时删除关联应用以及应用备份', deleteAppHelper: '同时删除关联应用以及应用备份',
deleteBackupHelper: '同时删除网站备份', deleteBackupHelper: '同时删除网站备份',
deleteConfirmHelper: '删除操作无法回滚请输入 <span style="color:red"> "{0}" </span> 删除此网站', deleteConfirmHelper: '删除操作无法回滚请输入 <span style="color:red"> "{0}" </span> 删除此网站',
staticPath: '对应主目录:',
}, },
nginx: { nginx: {
serverNamesHashBucketSizeHelper: '服务器名字的hash表大小', serverNamesHashBucketSizeHelper: '服务器名字的hash表大小',

View File

@ -109,6 +109,11 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('website.alias')" prop="alias"> <el-form-item :label="$t('website.alias')" prop="alias">
<el-input v-model="website.alias" :placeholder="$t('website.aliasHelper')"></el-input> <el-input v-model="website.alias" :placeholder="$t('website.aliasHelper')"></el-input>
<div>
<span class="input-help">
{{ $t('website.staticPath') + staticPath + '/' + website.alias }}
</span>
</div>
</el-form-item> </el-form-item>
<el-form-item v-if="website.type === 'proxy'" :label="$t('website.proxyAddress')" prop="proxy"> <el-form-item v-if="website.type === 'proxy'" :label="$t('website.proxyAddress')" prop="proxy">
<el-input v-model="website.proxy" :placeholder="$t('website.proxyHelper')"></el-input> <el-input v-model="website.proxy" :placeholder="$t('website.proxyHelper')"></el-input>
@ -190,6 +195,7 @@ let appDetail = ref<App.AppDetail>();
let appParams = ref<App.AppParams>(); let appParams = ref<App.AppParams>();
let paramKey = ref(1); let paramKey = ref(1);
let preCheckRef = ref(); let preCheckRef = ref();
let staticPath = ref('');
const em = defineEmits(['close']); const em = defineEmits(['close']);
@ -236,10 +242,12 @@ const getAppDetail = (version: string) => {
}); });
}; };
const acceptParams = async () => { const acceptParams = async (installPath: string) => {
if (websiteForm.value) { if (websiteForm.value) {
websiteForm.value.resetFields(); websiteForm.value.resetFields();
} }
console.log(installPath);
staticPath.value = installPath + '/www/sites';
await ListGroups().then((res) => { await ListGroups().then((res) => {
groups.value = res.data; groups.value = res.data;

View File

@ -106,6 +106,7 @@ let openNginxConfig = ref(false);
let nginxIsExist = ref(false); let nginxIsExist = ref(false);
let containerName = ref(''); let containerName = ref('');
let nginxStatus = ref(''); let nginxStatus = ref('');
let installPath = ref('');
const paginationConfig = reactive({ const paginationConfig = reactive({
currentPage: 1, currentPage: 1,
@ -178,7 +179,7 @@ const openDelete = (website: Website.Website) => {
}; };
const openCreate = () => { const openCreate = () => {
createRef.value.acceptParams(); createRef.value.acceptParams(installPath.value);
}; };
const openGroup = () => { const openGroup = () => {
@ -189,6 +190,7 @@ 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; nginxStatus.value = data.status;
installPath.value = data.installPath;
}; };
onMounted(() => { onMounted(() => {