mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-26 00:36:12 +08:00
style: 部分页面增加自适应 (#6127)
Some checks failed
sync2gitee / repo-sync (push) Failing after -7m51s
Some checks failed
sync2gitee / repo-sync (push) Failing after -7m51s
This commit is contained in:
parent
46fda7ecfb
commit
226bf9d8d2
15 changed files with 63 additions and 68 deletions
|
|
@ -136,7 +136,7 @@ func (a *AppInstallRepo) Create(ctx context.Context, install *model.AppInstall)
|
|||
}
|
||||
|
||||
func (a *AppInstallRepo) Save(ctx context.Context, install *model.AppInstall) error {
|
||||
return getTx(ctx).Debug().Omit("App").Save(&install).Error
|
||||
return getTx(ctx).Omit("App").Save(&install).Error
|
||||
}
|
||||
|
||||
func (a *AppInstallRepo) DeleteBy(opts ...DBOption) error {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ func (a AppService) GetAppDetail(appID uint, version, appType string) (response.
|
|||
|
||||
versionPath := filepath.Join(app.GetAppResourcePath(), detail.Version)
|
||||
if !fileOp.Stat(versionPath) || detail.Update {
|
||||
if err = downloadApp(app, detail, nil, nil); err != nil {
|
||||
if err = downloadApp(app, detail, nil, nil); err != nil && !fileOp.Stat(versionPath) {
|
||||
return appDetailDTO, err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,10 +201,7 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
|
|||
|
||||
func (w WebsiteService) GetWebsites() ([]response.WebsiteDTO, error) {
|
||||
var websiteDTOs []response.WebsiteDTO
|
||||
websites, err := websiteRepo.List(commonRepo.WithOrderRuleBy("primary_domain", "ascending"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
websites, _ := websiteRepo.List(commonRepo.WithOrderRuleBy("primary_domain", "ascending"))
|
||||
for _, web := range websites {
|
||||
res := response.WebsiteDTO{
|
||||
Website: web,
|
||||
|
|
@ -513,10 +510,7 @@ func (w WebsiteService) GetWebsiteOptions(req request.WebsiteOptionReq) ([]respo
|
|||
if len(req.Types) > 0 {
|
||||
options = append(options, websiteRepo.WithTypes(req.Types))
|
||||
}
|
||||
webs, err := websiteRepo.List(options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
webs, _ := websiteRepo.List(options...)
|
||||
var datas []response.WebsiteOption
|
||||
for _, web := range webs {
|
||||
var item response.WebsiteOption
|
||||
|
|
@ -2903,3 +2897,7 @@ func (w WebsiteService) UpdateDefaultHtml(req request.WebsiteHtmlUpdate) error {
|
|||
}
|
||||
return fileOp.SaveFile(resourcePath, req.Content, 0644)
|
||||
}
|
||||
|
||||
func (w WebsiteService) GetUpStreams() ([]dto.NginxUpstream, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package http
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
|
@ -35,6 +36,9 @@ func HandleGetWithTransport(url, method string, transport *http.Transport, timeo
|
|||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return 0, nil, errors.New(resp.Status)
|
||||
}
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ export const GetWebsite = (id: number) => {
|
|||
return http.get<Website.WebsiteDTO>(`/websites/${id}`);
|
||||
};
|
||||
|
||||
export const GetWebsiteOptions = () => {
|
||||
return http.get<any>(`/websites/options`);
|
||||
export const GetWebsiteOptions = (req: Website.OptionReq) => {
|
||||
return http.post<any>(`/websites/options`, req);
|
||||
};
|
||||
|
||||
export const GetWebsiteConfig = (id: number, type: string) => {
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@
|
|||
<template v-if="slots.leftToolBar" #buttons>
|
||||
<slot name="leftToolBar" v-if="slots.leftToolBar"></slot>
|
||||
</template>
|
||||
<!-- <template v-else-if="slots.buttons" #buttons>
|
||||
<slot name="buttons"></slot>
|
||||
</template> -->
|
||||
</back-button>
|
||||
<div>
|
||||
<slot name="rightToolBar" v-if="slots.rightToolBar"></slot>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
language="JavaScript"
|
||||
:autodetect="false"
|
||||
:code="content"
|
||||
:style="editorStyle"
|
||||
></highlightjs>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -37,6 +38,15 @@ interface LogProps {
|
|||
tail?: boolean;
|
||||
}
|
||||
|
||||
const editorStyle = computed(() => {
|
||||
const height = 'calc(100vh - ' + props.heightDiff + 'px)';
|
||||
return {
|
||||
height,
|
||||
width: '100%',
|
||||
overflow: 'auto',
|
||||
};
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
config: {
|
||||
type: Object as () => LogProps | null,
|
||||
|
|
@ -47,10 +57,6 @@ const props = defineProps({
|
|||
tail: false,
|
||||
}),
|
||||
},
|
||||
style: {
|
||||
type: String,
|
||||
default: 'height: calc(100vh - 200px); width: 100%; min-height: 400px; overflow: auto;',
|
||||
},
|
||||
defaultButton: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
|
@ -63,6 +69,10 @@ const props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
heightDiff: {
|
||||
type: Number,
|
||||
default: 500,
|
||||
},
|
||||
});
|
||||
const data = ref({
|
||||
enable: false,
|
||||
|
|
@ -246,7 +256,7 @@ const initCodemirror = () => {
|
|||
}
|
||||
});
|
||||
let hljsDom = scrollerElement.value.querySelector('.hljs') as HTMLElement;
|
||||
hljsDom.style['min-height'] = '100px';
|
||||
hljsDom.style.minHeight = '95%';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -264,9 +274,7 @@ defineExpose({ changeTail, onDownload, clearLog });
|
|||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.editor-main {
|
||||
height: calc(100vh - 480px);
|
||||
width: 100%;
|
||||
min-height: 600px;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,36 @@
|
|||
<template>
|
||||
<div class="overflow-y-auto overflow-x-hidden" :style="'height: ' + mainHeight + 'px'">
|
||||
<div class="main-div" :style="{ '--main-height': mainHeight + 'px' }">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
||||
const props = defineProps({
|
||||
heightDiff: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
const mainHeight = computed(() => windowHeight.value - props.heightDiff);
|
||||
|
||||
let mainHeight = ref(0);
|
||||
const updateHeight = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
let heightDiff = 300;
|
||||
if (props.heightDiff) {
|
||||
heightDiff = props.heightDiff;
|
||||
}
|
||||
|
||||
mainHeight.value = window.innerHeight - heightDiff;
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
mainHeight.value = window.innerHeight - heightDiff;
|
||||
})();
|
||||
};
|
||||
window.addEventListener('resize', updateHeight);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', updateHeight);
|
||||
});
|
||||
defineOptions({ name: 'MainDiv' });
|
||||
</script>
|
||||
<style scoped>
|
||||
.main-div {
|
||||
height: var(--main-height);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -49,17 +49,17 @@
|
|||
:heightDiff="400"
|
||||
></CodemirrorPro>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<LogFile
|
||||
ref="logRef"
|
||||
v-model:is-reading="isReading"
|
||||
:config="logConfig"
|
||||
:default-button="false"
|
||||
v-if="mode === 'log' && showLog"
|
||||
:style="'height: calc(100vh - 370px);min-height: 200px'"
|
||||
/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div class="w-full h-32">
|
||||
<LogFile
|
||||
ref="logRef"
|
||||
v-model:is-reading="isReading"
|
||||
:config="logConfig"
|
||||
:default-button="false"
|
||||
v-if="mode === 'log' && showLog"
|
||||
:height-diff="370"
|
||||
/>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
|
|
|
|||
|
|
@ -16,21 +16,6 @@
|
|||
mode="dockerfile"
|
||||
placeholder="#Define or paste the content of your Dockerfile here"
|
||||
></CodemirrorPro>
|
||||
<!-- <codemirror
|
||||
@change="onEdit()"
|
||||
:autofocus="true"
|
||||
placeholder="#Define or paste the content of your Dockerfile here"
|
||||
:indent-with-tab="true"
|
||||
:tabSize="4"
|
||||
style="width: 100%; height: calc(100vh - 520px)"
|
||||
:lineWrapping="true"
|
||||
:matchBrackets="true"
|
||||
theme="cobalt"
|
||||
:styleActiveLine="true"
|
||||
:extensions="extensions"
|
||||
v-model="form.dockerfile"
|
||||
:readOnly="true"
|
||||
/> -->
|
||||
</el-form-item>
|
||||
<el-form-item v-else :rules="Rules.requiredSelect" prop="dockerfile">
|
||||
<el-input @change="onEdit()" clearable v-model="form.dockerfile">
|
||||
|
|
@ -56,7 +41,7 @@
|
|||
:default-button="false"
|
||||
v-model:is-reading="isReading"
|
||||
v-if="logVisible"
|
||||
:style="'height: calc(100vh - 370px);min-height: 200px'"
|
||||
:height-diff="370"
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
:default-button="false"
|
||||
v-model:is-reading="isReading"
|
||||
v-if="showLog"
|
||||
:style="'height: calc(100vh - 397px);min-height: 200px'"
|
||||
:height-diff="420"
|
||||
/>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
:default-button="false"
|
||||
v-model:is-reading="isReading"
|
||||
v-if="logVisible"
|
||||
:style="'height: calc(100vh - 370px);min-height: 200px'"
|
||||
:height-diff="420"
|
||||
v-model:loading="loading"
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ const loadAppInstalls = async () => {
|
|||
};
|
||||
|
||||
const loadWebsites = async () => {
|
||||
const res = await GetWebsiteOptions();
|
||||
const res = await GetWebsiteOptions({});
|
||||
websiteOptions.value = res.data || [];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
v-if="showLog"
|
||||
v-model:loading="loading"
|
||||
v-model:hasContent="hasContent"
|
||||
:style="'height: calc(100vh - 370px);min-height: 200px'"
|
||||
:height-diff="330"
|
||||
/>
|
||||
</template>
|
||||
</LayoutContent>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<el-switch v-model="data.enable" @change="updateEnable"></el-switch>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<LogFile :config="{ id: id, type: 'website', name: logType }" :style="style" ref="logRef">
|
||||
<LogFile :config="{ id: id, type: 'website', name: logType }" ref="logRef">
|
||||
<template #button>
|
||||
<el-button @click="cleanLog" icon="Delete">
|
||||
{{ $t('commons.button.clean') }}
|
||||
|
|
@ -38,7 +38,6 @@ const logType = computed(() => {
|
|||
const id = computed(() => {
|
||||
return props.id;
|
||||
});
|
||||
const style = ref('height: calc(100vh - 402px); width: 100%; min-height: 300px');
|
||||
const loading = ref(false);
|
||||
const data = ref({
|
||||
enable: false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue