Browse Source

feat: 网站列表增加网站目录跳转功能 (#892)

pull/895/head
zhengkunwang223 2 years ago committed by GitHub
parent
commit
7f1f758e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      backend/app/service/website.go
  2. 13
      frontend/src/views/website/website/index.vue

6
backend/app/service/website.go

@ -96,6 +96,10 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
if err != nil { if err != nil {
return 0, nil, err return 0, nil, err
} }
nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)
if err != nil {
return 0, nil, err
}
for _, web := range websites { for _, web := range websites {
var ( var (
appName string appName string
@ -115,10 +119,12 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
} }
runtimeName = runtime.Name runtimeName = runtime.Name
} }
sitePath := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", web.Alias)
websiteDTOs = append(websiteDTOs, response.WebsiteDTO{ websiteDTOs = append(websiteDTOs, response.WebsiteDTO{
Website: web, Website: web,
AppName: appName, AppName: appName,
RuntimeName: runtimeName, RuntimeName: runtimeName,
SitePath: sitePath,
}) })
} }
return total, websiteDTOs, nil return total, websiteDTOs, nil

13
frontend/src/views/website/website/index.vue

@ -79,6 +79,15 @@
<span v-if="row.type === 'runtime'">[{{ row.runtimeName }}]</span> <span v-if="row.type === 'runtime'">[{{ row.runtimeName }}]</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('website.sitePath')" prop="sitePath">
<template #default="{ row }">
<el-button type="primary" link @click="toFolder(row.sitePath)">
<el-icon>
<FolderOpened />
</el-icon>
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.status')" prop="status" width="100px"> <el-table-column :label="$t('commons.table.status')" prop="status" width="100px">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button
@ -404,6 +413,10 @@ const opWebsite = (op: string, id: number) => {
}); });
}; };
const toFolder = (folder: string) => {
router.push({ path: '/hosts/files', query: { path: folder } });
};
onMounted(() => { onMounted(() => {
search(); search();
listGroup(); listGroup();

Loading…
Cancel
Save