1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

feat: 增加文件夹跳转

This commit is contained in:
zhengkunwang223 2022-12-27 15:36:09 +08:00 committed by zhengkunwang223
parent 68228305f8
commit aa9f6f0f2b
6 changed files with 40 additions and 18 deletions

View File

@ -13,6 +13,7 @@ const hostRouter = {
{ {
path: '/hosts/files', path: '/hosts/files',
name: 'File', name: 'File',
props: true,
component: () => import('@/views/host/file-management/index.vue'), component: () => import('@/views/host/file-management/index.vue'),
meta: { meta: {
title: 'menu.files', title: 'menu.files',

View File

@ -117,7 +117,7 @@ const handleParams = () => {
} else { } else {
rules[p.envKey] = [Rules.requiredInput]; rules[p.envKey] = [Rules.requiredInput];
if (p.envKey === 'PANEL_DB_NAME') { if (p.envKey === 'PANEL_DB_NAME') {
rules[p.envKey].push(Rules.linuxName); rules[p.envKey].push(Rules.dbName);
} }
} }
} }

View File

@ -209,7 +209,9 @@ import Download from './download/index.vue';
import { Mimetypes } from '@/global/mimetype'; import { Mimetypes } from '@/global/mimetype';
import Process from './process/index.vue'; import Process from './process/index.vue';
import Detail from './detail/index.vue'; import Detail from './detail/index.vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const data = ref(); const data = ref();
let selects = ref<any>([]); let selects = ref<any>([]);
let req = reactive({ path: '/', expand: true, showHidden: false, page: 1, pageSize: 100 }); let req = reactive({ path: '/', expand: true, showHidden: false, page: 1, pageSize: 100 });
@ -454,7 +456,6 @@ const openWget = () => {
}; };
const closeWget = (submit: any) => { const closeWget = (submit: any) => {
console.log(submit);
wgetPage.open = false; wgetPage.open = false;
search(); search();
if (submit) { if (submit) {
@ -568,6 +569,9 @@ const buttons = [
]; ];
onMounted(() => { onMounted(() => {
if (router.currentRoute.value.query.path) {
req.path = String(router.currentRoute.value.query.path);
}
search(); search();
}); });
</script> </script>

View File

@ -1,22 +1,22 @@
<template> <template>
<el-tabs tab-position="left" type="border-card" v-model="index"> <el-tabs tab-position="left" type="border-card" v-model="tabIndex">
<el-tab-pane :label="$t('website.domainConfig')"> <el-tab-pane :label="$t('website.domainConfig')">
<Doamin :id="id" v-if="index == '0'"></Doamin> <Doamin :id="id" v-if="tabIndex == '0'"></Doamin>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.sitePath')"> <el-tab-pane :label="$t('website.sitePath')">
<SitePath :id="id" v-if="index == '1'"></SitePath> <SitePath :id="id" v-if="tabIndex == '1'"></SitePath>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.defaultDoc')"> <el-tab-pane :label="$t('website.defaultDoc')">
<Default :id="id" v-if="index == '2'"></Default> <Default :id="id" v-if="tabIndex == '2'"></Default>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.rate')"> <el-tab-pane :label="$t('website.rate')">
<LimitConn :id="id" v-if="index == '3'"></LimitConn> <LimitConn :id="id" v-if="tabIndex == '3'"></LimitConn>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="'HTTPS'"> <el-tab-pane :label="'HTTPS'">
<HTTPS :id="id" v-if="index == '4'"></HTTPS> <HTTPS :id="id" v-if="tabIndex == '4'"></HTTPS>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.other')"> <el-tab-pane :label="$t('website.other')">
<Other :id="id" v-if="index == '5'"></Other> <Other :id="id" v-if="tabIndex == '5'"></Other>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
@ -42,5 +42,5 @@ const id = computed(() => {
return props.id; return props.id;
}); });
let index = ref('0'); let tabIndex = ref('0');
</script> </script>

View File

@ -4,7 +4,12 @@
<br /> <br />
<el-descriptions :column="1" border v-loading="loading"> <el-descriptions :column="1" border v-loading="loading">
<el-descriptions-item :label="$t('website.siteAlias')">{{ website.alias }}</el-descriptions-item> <el-descriptions-item :label="$t('website.siteAlias')">{{ website.alias }}</el-descriptions-item>
<el-descriptions-item :label="$t('website.primaryPath')">{{ website.sitePath }}</el-descriptions-item> <el-descriptions-item :label="$t('website.primaryPath')">
{{ website.sitePath }}
<el-button type="primary" link @click="toFolder(website.sitePath)">
<el-icon><CopyDocument /></el-icon>
</el-button>
</el-descriptions-item>
</el-descriptions> </el-descriptions>
<br /> <br />
@ -20,6 +25,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { GetWebsite } from '@/api/modules/website'; import { GetWebsite } from '@/api/modules/website';
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const props = defineProps({ const props = defineProps({
id: { id: {
@ -44,6 +51,10 @@ const search = () => {
}); });
}; };
const toFolder = (folder: string) => {
router.push({ path: '/hosts/files', query: { path: folder } });
};
onMounted(() => { onMounted(() => {
search(); search();
}); });

View File

@ -1,18 +1,18 @@
<template> <template>
<el-card> <el-card>
<LayoutContent :header="$t('website.websiteConfig')" :back-name="'Website'"> <LayoutContent :header="$t('website.websiteConfig')" :back-name="'Website'">
<el-tabs v-model="index" @click="changeTab(index)"> <el-tabs v-model="index">
<el-tab-pane :label="$t('website.basic')" name="basic"> <el-tab-pane :label="$t('website.basic')" name="basic">
<Basic :key="id" :id="id" v-if="index === 'basic'"></Basic> <Basic :id="id" v-if="index === 'basic'"></Basic>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.security')" name="safety"> <el-tab-pane :label="$t('website.security')" name="safety">
<Safety :key="id" :id="id" v-if="index === 'safety'"></Safety> <Safety :id="id" v-if="index === 'safety'"></Safety>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.log')" name="log"> <el-tab-pane :label="$t('website.log')" name="log">
<Log :key="id" :id="id" v-if="index === 'log'"></Log> <Log :id="id" v-if="index === 'log'"></Log>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('website.source')" name="resource"> <el-tab-pane :label="$t('website.source')" name="resource">
<Resource :key="id" :id="id" v-if="index === 'resource'"></Resource> <Resource :id="id" v-if="index === 'resource'"></Resource>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</LayoutContent> </LayoutContent>
@ -21,7 +21,7 @@
<script setup lang="ts"> <script setup lang="ts">
import LayoutContent from '@/layout/layout-content.vue'; import LayoutContent from '@/layout/layout-content.vue';
import { onMounted, ref } from 'vue'; import { onMounted, ref, watch } from 'vue';
import Basic from './basic/index.vue'; import Basic from './basic/index.vue';
import Safety from './safety/index.vue'; import Safety from './safety/index.vue';
import Resource from './resource/index.vue'; import Resource from './resource/index.vue';
@ -42,8 +42,14 @@ const props = defineProps({
let id = ref(0); let id = ref(0);
let index = ref('basic'); let index = ref('basic');
watch(index, (curr, old) => {
if (curr != old) {
changeTab(curr);
}
});
const changeTab = (index: string) => { const changeTab = (index: string) => {
router.replace({ name: 'WebsiteConfig', params: { id: id.value, tab: index } }); router.push({ name: 'WebsiteConfig', params: { id: id.value, tab: index } });
}; };
onMounted(() => { onMounted(() => {