feat: 统一抽屉样式 (#6650)
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run

This commit is contained in:
zhengkunwang 2024-10-08 14:54:04 +08:00 committed by GitHub
parent 5beb93dde2
commit 6c3311ba3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 203 additions and 255 deletions

View file

@ -181,7 +181,7 @@ func handleWebsiteRecover(website *model.Website, recoverFile string, isRollback
}
taskName := i18n.GetMsgByKey("TaskRecover") + i18n.GetMsgByKey("websiteDir")
t.Log(taskName)
if err = handleUnTar(fmt.Sprintf("%s/%s.web.tar.gz", tmpPath, website.Alias), GetWebSiteRootDir(), ""); err != nil {
if err = handleUnTar(fmt.Sprintf("%s/%s.web.tar.gz", tmpPath, website.Alias), GetSitePath(*website, SiteDir), ""); err != nil {
t.LogFailedWithErr(taskName, err)
return err
}

View file

@ -769,8 +769,7 @@ func (u *ContainerService) ContainerLogs(wsConn *websocket.Conn, containerType,
commandName := "docker"
commandArg := []string{"logs", container}
if containerType == "compose" {
commandName = "docker compose"
commandArg = []string{"-f", container, "logs"}
commandArg = []string{"compose", "-f", container, "logs"}
}
if tail != "0" {
commandArg = append(commandArg, "--tail")

View file

@ -10,6 +10,7 @@ import (
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"github.com/1Panel-dev/1Panel/agent/utils/common"
"log"
"math/big"
"net"
@ -26,7 +27,6 @@ import (
"github.com/1Panel-dev/1Panel/agent/global"
"github.com/1Panel-dev/1Panel/agent/i18n"
"github.com/1Panel-dev/1Panel/agent/utils/cmd"
"github.com/1Panel-dev/1Panel/agent/utils/common"
"github.com/1Panel-dev/1Panel/agent/utils/files"
"github.com/1Panel-dev/1Panel/agent/utils/ssl"
"github.com/go-acme/lego/v4/certcrypto"
@ -218,17 +218,16 @@ func (w WebsiteCAService) ObtainSSL(req request.WebsiteCAObtain) (*model.Website
if req.Domains != "" {
domainArray := strings.Split(req.Domains, "\n")
for _, domain := range domainArray {
if ipAddress := net.ParseIP(domain); ipAddress == nil {
if !common.IsValidDomain(domain) {
err = buserr.WithName("ErrDomainFormat", domain)
return nil, err
} else {
if ipAddress := net.ParseIP(domain); ipAddress == nil {
}
domains = append(domains, domain)
} else {
ips = append(ips, ipAddress)
}
}
}
if len(domains) > 0 {
websiteSSL.PrimaryDomain = domains[0]
websiteSSL.Domains = strings.Join(domains[1:], ",")

View file

@ -1206,6 +1206,7 @@ const (
SiteRedirectDir = "SiteRedirectDir"
SiteCacheDir = "SiteCacheDir"
SiteConfDir = "SiteConfDir"
SitesRootDir = "SitesRootDir"
)
func GetSitePath(website model.Website, confType string) string {
@ -1234,6 +1235,8 @@ func GetSitePath(website model.Website, confType string) string {
return path.Join(GteSiteDir(website.Alias), "redirect")
case SiteConfDir:
return path.Join(GetWebSiteRootDir(), "conf.d")
case SitesRootDir:
return path.Join(GetWebSiteRootDir(), "sites")
}
return ""
}

View file

@ -1,20 +1,17 @@
<template>
<el-drawer
<DrawerPro
v-model="open"
:size="globalStore.isFullScreen ? '100%' : '50%'"
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="handleClose"
:header="$t('commons.button.log')"
:back="handleClose"
:size="globalStore.isFullScreen ? 'full' : 'large'"
:resource="resource"
>
<template #header>
<DrawerHeader :header="$t('commons.button.log')" :resource="resource" :back="handleClose">
<template #extra v-if="!mobile">
<el-tooltip :content="loadTooltip()" placement="top">
<el-button @click="toggleFullscreen" class="fullScreen" icon="FullScreen" plain></el-button>
</el-tooltip>
</template>
</DrawerHeader>
</template>
<template #content>
<div class="flex flex-wrap">
<el-select @change="searchLogs" v-model="logSearch.mode" class="selectWidth">
<template #prefix>{{ $t('container.fetch') }}</template>
@ -40,7 +37,6 @@
<div class="mt-2.5">
<highlightjs
v-if="showLog"
ref="editorRef"
class="editor-main"
language="JavaScript"
@ -48,7 +44,8 @@
:code="logInfo"
></highlightjs>
</div>
</el-drawer>
</template>
</DrawerPro>
</template>
<script lang="ts" setup>
@ -66,7 +63,6 @@ const open = ref(false);
const resource = ref('');
const globalStore = GlobalStore();
const logVisible = ref(false);
const showLog = ref(false);
const editorRef = ref();
const scrollerElement = ref<HTMLElement | null>(null);
@ -136,6 +132,7 @@ const searchLogs = async () => {
terminalSocket.value.onmessage = (event) => {
logInfo.value += event.data;
nextTick(() => {
console.log(scrollerElement.value);
scrollerElement.value.scrollTop = scrollerElement.value.scrollHeight;
});
};
@ -189,23 +186,20 @@ const acceptParams = (props: DialogProps): void => {
globalStore.isFullScreen = screenfull.isFullscreen;
});
}
nextTick(() => {
if (editorRef.value) {
scrollerElement.value = editorRef.value.$el as HTMLElement;
let hljsDom = scrollerElement.value.querySelector('.hljs') as HTMLElement;
hljsDom.style['min-height'] = '300px';
hljsDom.style['flex-grow'] = 1;
}
});
};
onBeforeUnmount(() => {
handleClose();
});
onMounted(async () => {
await nextTick(() => {
showLog.value = true;
});
if (editorRef.value) {
scrollerElement.value = editorRef.value.$el as HTMLElement;
let hljsDom = scrollerElement.value.querySelector('.hljs') as HTMLElement;
hljsDom.style['min-height'] = '500px';
}
});
defineExpose({
acceptParams,
});
@ -217,9 +211,8 @@ defineExpose({
}
.editor-main {
height: calc(100vh - 100px);
width: 100%;
min-height: 600px;
overflow: auto;
display: flex;
flex-direction: column;
height: 80vh;
}
</style>

View file

@ -1,14 +1,5 @@
<template>
<el-drawer
v-model="open"
:destroy-on-close="true"
:close-on-click-modal="false"
:close-on-press-escape="false"
size="50%"
>
<template #header>
<DrawerHeader :header="$t('app.detail')" :back="handleClose" />
</template>
<DrawerPro v-model="open" :header="$t('app.detail')" :back="handleClose" size="large">
<div class="brief" v-loading="loadingApp">
<div class="detail flex">
<div class="w-12 h-12 rounded p-1 shadow-md icon">
@ -70,7 +61,7 @@
</div>
</div>
<MdEditor previewOnly v-model="app.readMe" :theme="isDarkTheme ? 'dark' : 'light'" />
</el-drawer>
</DrawerPro>
<Install ref="installRef"></Install>
</template>

View file

@ -235,7 +235,6 @@
<el-button
v-if="installed.httpPort > 0"
@click="goDashboard(installed.httpPort, 'http')"
class="tagMargin"
plain
size="small"
@ -245,7 +244,6 @@
<el-button
v-if="installed.httpsPort > 0"
@click="goDashboard(installed.httpsPort, 'https')"
class="tagMargin"
plain
size="small"
@ -497,10 +495,6 @@ const search = async () => {
});
};
const goDashboard = async (port: any, protocol: string) => {
dialogPortJumpRef.value.acceptParams({ port: port, protocol: protocol });
};
const openOperate = (row: any, op: string) => {
operateReq.installId = row.id;
operateReq.operate = op;

View file

@ -1,5 +1,4 @@
<template>
<div>
<DrawerPro
v-model="logVisible"
:header="$t('commons.button.log')"
@ -16,12 +15,7 @@
<div>
<el-select @change="searchLogs" class="fetchClass" v-model="logSearch.mode">
<template #prefix>{{ $t('container.fetch') }}</template>
<el-option
v-for="item in timeOptions"
:key="item.label"
:value="item.value"
:label="item.label"
/>
<el-option v-for="item in timeOptions" :key="item.label" :value="item.value" :label="item.label" />
</el-select>
<el-select @change="searchLogs" class="tailClass" v-model.number="logSearch.tail">
<template #prefix>{{ $t('container.lines') }}</template>
@ -51,7 +45,6 @@
</span>
</template>
</DrawerPro>
</div>
</template>
<script lang="ts" setup>

View file

@ -1,8 +1,5 @@
<template>
<el-drawer :close-on-click-modal="false" :close-on-press-escape="false" v-model="open" size="50%">
<template #header>
<DrawerHeader :header="$t('ssl.organizationDetail')" :back="handleClose" />
</template>
<DrawerPro v-model="open" :header="$t('ssl.organizationDetail')" :back="handleClose" size="large">
<div v-loading="loading">
<el-radio-group v-model="curr">
<el-radio-button value="detail">{{ $t('ssl.organizationDetail') }}</el-radio-button>
@ -49,7 +46,7 @@
</div>
</div>
</div>
</el-drawer>
</DrawerPro>
</template>
<script lang="ts" setup>
import DrawerHeader from '@/components/drawer-header/index.vue';

View file

@ -1,17 +1,6 @@
<template>
<el-drawer
v-model="open"
:close-on-click-modal="false"
:close-on-press-escape="false"
size="40%"
:before-close="handleClose"
>
<template #header>
<DrawerHeader :header="$t('commons.button.' + proxy.operate)" :back="handleClose" />
</template>
<el-row v-loading="loading">
<el-col :span="22" :offset="1">
<el-form ref="proxyForm" label-position="top" :model="proxy" :rules="rules">
<DrawerPro v-model="open" :header="$t('commons.button.' + proxy.operate)" :back="handleClose" size="normal">
<el-form ref="proxyForm" label-position="top" :model="proxy" :rules="rules" v-loading="loading">
<el-form-item :label="$t('commons.table.name')" prop="name">
<el-input v-model.trim="proxy.name" :disabled="proxy.operate === 'edit'"></el-input>
</el-form-item>
@ -79,16 +68,10 @@
<div style="width: 100%" v-for="(replace, index) in replaces" :key="index">
<el-row :gutter="10">
<el-col :span="10">
<el-input
v-model.trim="replace.key"
:placeholder="$t('website.replaced')"
></el-input>
<el-input v-model.trim="replace.key" :placeholder="$t('website.replaced')"></el-input>
</el-col>
<el-col :span="10">
<el-input
v-model.trim="replace.value"
:placeholder="$t('website.replaceText')"
></el-input>
<el-input v-model.trim="replace.value" :placeholder="$t('website.replaceText')"></el-input>
</el-col>
<el-col :span="2">
<el-button link @click="removeReplace(index)" type="danger">
@ -104,17 +87,13 @@
</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" @click="submit(proxyForm)" :disabled="loading">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
</template>
</el-drawer>
</DrawerPro>
</template>
<script lang="ts" setup>