mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
feat: Remove Unnecessary Code Segments (#7420)
This commit is contained in:
parent
524c7144d3
commit
05a92f0b0d
@ -240,6 +240,7 @@ sql: 'SQL Injection'
|
||||
cc: 'Access Frequency Limit'
|
||||
defaultUrlBlack: 'URL Rules'
|
||||
sqlInject: 'SQL Injection'
|
||||
ErrDBNotExist: "Database does not exist"
|
||||
|
||||
#task
|
||||
TaskStart: "{{.name}} Start [START]"
|
||||
|
@ -241,6 +241,7 @@ sql: 'SQL 注入'
|
||||
cc: '訪問頻率限制'
|
||||
defaultUrlBlack: 'URL 規則'
|
||||
sqlInject: 'SQL 注入'
|
||||
ErrDBNotExist: "數據庫不存在"
|
||||
|
||||
#task
|
||||
TaskStart: "{{.name}} 開始 [START]"
|
||||
|
@ -239,6 +239,7 @@ sql: 'SQL 注入'
|
||||
cc: '访问频率限制'
|
||||
defaultUrlBlack: 'URL 规则'
|
||||
sqlInject: 'SQL 注入'
|
||||
ErrDBNotExist: "数据库不存在"
|
||||
|
||||
#task
|
||||
TaskStart: "{{.name}} 任务开始 [START]"
|
||||
|
@ -52,6 +52,7 @@ var AddTable = &gormigrate.Migration{
|
||||
&model.WebsiteDnsAccount{},
|
||||
&model.WebsiteDomain{},
|
||||
&model.WebsiteSSL{},
|
||||
&model.Task{},
|
||||
)
|
||||
},
|
||||
}
|
||||
@ -202,7 +203,7 @@ var InitDefaultCA = &gormigrate.Migration{
|
||||
var InitPHPExtensions = &gormigrate.Migration{
|
||||
ID: "20240722-add-php-extensions",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
if err := tx.Create(&model.PHPExtensions{Name: "默认", Extensions: "bcmath,gd,gettext,intl,pcntl,shmop,soap,sockets,sysvsem,xmlrpc,zip"}).Error; err != nil {
|
||||
if err := tx.Create(&model.PHPExtensions{Name: "Default", Extensions: "bcmath,gd,gettext,intl,pcntl,shmop,soap,sockets,sysvsem,xmlrpc,zip"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Create(&model.PHPExtensions{Name: "WordPress", Extensions: "exif,igbinary,imagick,intl,zip,apcu,memcached,opcache,redis,bc,image,shmop,mysqli,pdo_mysql,gd"}).Error; err != nil {
|
||||
@ -211,9 +212,6 @@ var InitPHPExtensions = &gormigrate.Migration{
|
||||
if err := tx.Create(&model.PHPExtensions{Name: "Flarum", Extensions: "curl,gd,pdo_mysql,mysqli,bz2,exif,yaf,imap"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Create(&model.PHPExtensions{Name: "苹果CMS-V10", Extensions: "mysqli,pdo_mysql,zip,gd,redis,memcache,memcached"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Create(&model.PHPExtensions{Name: "SeaCMS", Extensions: "mysqli,pdo_mysql,gd,curl"}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
@ -221,61 +219,6 @@ var InitPHPExtensions = &gormigrate.Migration{
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateWebsite = &gormigrate.Migration{
|
||||
ID: "20240812-update-website",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&model.Website{})
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateWebsiteDomain = &gormigrate.Migration{
|
||||
ID: "20240808-update-website-domain",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&model.WebsiteDomain{})
|
||||
},
|
||||
}
|
||||
|
||||
var AddTaskDB = &gormigrate.Migration{
|
||||
ID: "20240822-add-task-table",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return global.TaskDB.AutoMigrate(
|
||||
&model.Task{},
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateApp = &gormigrate.Migration{
|
||||
ID: "20240826-update-app",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&model.App{})
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateAppInstall = &gormigrate.Migration{
|
||||
ID: "20240828-update-app-install",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&model.AppInstall{})
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateSnapshot = &gormigrate.Migration{
|
||||
ID: "20240926-update-snapshot",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(&model.Snapshot{})
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateCronjob = &gormigrate.Migration{
|
||||
ID: "20241017-update-cronjob",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(&model.Cronjob{}, &model.JobRecords{})
|
||||
},
|
||||
}
|
||||
|
||||
var InitBaseDir = &gormigrate.Migration{
|
||||
ID: "20241122-init-setting",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
|
@ -1,113 +1,91 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="app-status" v-if="data.isExist">
|
||||
<el-card>
|
||||
<div class="flex w-full flex-col gap-4 md:flex-row">
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<el-tag effect="dark" type="success">{{ data.app }}</el-tag>
|
||||
<Status :key="refresh" :status="data.status"></Status>
|
||||
<el-tag>{{ $t('app.version') }}{{ $t('commons.colon') }}{{ data.version }}</el-tag>
|
||||
</div>
|
||||
|
||||
<div class="mt-0.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="data.status != 'Running'"
|
||||
link
|
||||
@click="onOperate('start')"
|
||||
:disabled="data.status === 'Installing'"
|
||||
>
|
||||
{{ $t('app.start') }}
|
||||
</el-button>
|
||||
<el-button type="primary" v-if="data.status === 'Running'" link @click="onOperate('stop')">
|
||||
{{ $t('app.stop') }}
|
||||
</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:disabled="data.status === 'Installing'"
|
||||
@click="onOperate('restart')"
|
||||
>
|
||||
{{ $t('app.restart') }}
|
||||
</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
v-if="data.app === 'OpenResty'"
|
||||
@click="onOperate('reload')"
|
||||
:disabled="data.status !== 'Running'"
|
||||
>
|
||||
{{ $t('app.reload') }}
|
||||
</el-button>
|
||||
<el-divider v-if="data.app === 'OpenResty'" direction="vertical" />
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="setting"
|
||||
link
|
||||
:disabled="
|
||||
data.status === 'Installing' || (data.status !== 'Running' && data.app === 'OpenResty')
|
||||
"
|
||||
>
|
||||
{{ $t('commons.button.set') }}
|
||||
</el-button>
|
||||
<el-divider v-if="data.app === 'OpenResty'" direction="vertical" />
|
||||
<el-button
|
||||
v-if="data.app === 'OpenResty'"
|
||||
type="primary"
|
||||
@click="clear"
|
||||
link
|
||||
:disabled="
|
||||
data.status === 'Installing' || (data.status !== 'Running' && data.app === 'OpenResty')
|
||||
"
|
||||
>
|
||||
{{ $t('nginx.clearProxyCache') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="ml-5" v-if="key === 'openresty' && (httpPort != 80 || httpsPort != 443)">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$t('website.openrestyHelper', [httpPort, httpsPort])"
|
||||
placement="top-start"
|
||||
>
|
||||
<el-alert
|
||||
:title="$t('app.checkTitle')"
|
||||
:closable="false"
|
||||
center
|
||||
type="warning"
|
||||
show-icon
|
||||
class="h-6 check-title"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class="app-status" v-if="data.isExist">
|
||||
<el-card>
|
||||
<div class="flex w-full flex-col gap-4 md:flex-row">
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<el-tag effect="dark" type="success">{{ data.app }}</el-tag>
|
||||
<Status :key="refresh" :status="data.status"></Status>
|
||||
<el-tag>{{ $t('app.version') }}{{ $t('commons.colon') }}{{ data.version }}</el-tag>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<div v-if="!data.isExist && !isDB()">
|
||||
<LayoutContent :title="getTitle(key)" :divider="true">
|
||||
<template #main>
|
||||
<div class="app-warn">
|
||||
<div class="flex flex-col gap-2 items-center justify-center w-full sm:flex-row">
|
||||
<div>{{ $t('app.checkInstalledWarn', [data.app]) }}</div>
|
||||
<span @click="goRouter(key)" class="flex items-center justify-center gap-0.5">
|
||||
<el-icon><Position /></el-icon>
|
||||
{{ $t('database.goInstall') }}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<img src="@/assets/images/no_app.svg" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</LayoutContent>
|
||||
</div>
|
||||
|
||||
<div class="mt-0.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="data.status != 'Running'"
|
||||
link
|
||||
@click="onOperate('start')"
|
||||
:disabled="data.status === 'Installing'"
|
||||
>
|
||||
{{ $t('app.start') }}
|
||||
</el-button>
|
||||
<el-button type="primary" v-if="data.status === 'Running'" link @click="onOperate('stop')">
|
||||
{{ $t('app.stop') }}
|
||||
</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:disabled="data.status === 'Installing'"
|
||||
@click="onOperate('restart')"
|
||||
>
|
||||
{{ $t('app.restart') }}
|
||||
</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
v-if="data.app === 'OpenResty'"
|
||||
@click="onOperate('reload')"
|
||||
:disabled="data.status !== 'Running'"
|
||||
>
|
||||
{{ $t('app.reload') }}
|
||||
</el-button>
|
||||
<el-divider v-if="data.app === 'OpenResty'" direction="vertical" />
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="setting"
|
||||
link
|
||||
:disabled="
|
||||
data.status === 'Installing' || (data.status !== 'Running' && data.app === 'OpenResty')
|
||||
"
|
||||
>
|
||||
{{ $t('commons.button.set') }}
|
||||
</el-button>
|
||||
<el-divider v-if="data.app === 'OpenResty'" direction="vertical" />
|
||||
<el-button
|
||||
v-if="data.app === 'OpenResty'"
|
||||
type="primary"
|
||||
@click="clear"
|
||||
link
|
||||
:disabled="
|
||||
data.status === 'Installing' || (data.status !== 'Running' && data.app === 'OpenResty')
|
||||
"
|
||||
>
|
||||
{{ $t('nginx.clearProxyCache') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="ml-5" v-if="key === 'openresty' && (httpPort != 80 || httpsPort != 443)">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$t('website.openrestyHelper', [httpPort, httpsPort])"
|
||||
placement="top-start"
|
||||
>
|
||||
<el-alert
|
||||
:title="$t('app.checkTitle')"
|
||||
:closable="false"
|
||||
center
|
||||
type="warning"
|
||||
show-icon
|
||||
class="h-6 check-title"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { CheckAppInstalled, InstalledOp } from '@/api/modules/app';
|
||||
import router from '@/routers';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import Status from '@/components/status/index.vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
@ -151,14 +129,6 @@ const setting = () => {
|
||||
em('setting', false);
|
||||
};
|
||||
|
||||
const goRouter = async (key: string) => {
|
||||
router.push({ name: 'AppAll', query: { install: key } });
|
||||
};
|
||||
|
||||
const isDB = () => {
|
||||
return key.value === 'mysql' || key.value === 'mariadb' || key.value === 'postgresql';
|
||||
};
|
||||
|
||||
const onCheck = async (key: any, name: any) => {
|
||||
await CheckAppInstalled(key, name)
|
||||
.then((res) => {
|
||||
@ -214,19 +184,6 @@ const onOperate = async (operation: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const getTitle = (key: string) => {
|
||||
switch (key) {
|
||||
case 'openresty':
|
||||
return i18n.global.t('website.website', 2);
|
||||
case 'mysql':
|
||||
return 'MySQL ' + i18n.global.t('menu.database').toLowerCase();
|
||||
case 'postgresql':
|
||||
return 'PostgreSQL ' + i18n.global.t('menu.database').toLowerCase();
|
||||
case 'redis':
|
||||
return 'Redis ' + i18n.global.t('menu.database').toLowerCase();
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
key.value = props.appKey;
|
||||
name.value = props.appName;
|
||||
|
@ -1,11 +1,5 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="localOpenPage"
|
||||
:destroy-on-close="true"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:size="size"
|
||||
>
|
||||
<el-drawer v-model="localOpenPage" :destroy-on-close="true" :close-on-click-modal="false" :size="size">
|
||||
<template #header>
|
||||
<el-page-header @back="handleBack">
|
||||
<template #content>
|
||||
|
@ -44,8 +44,6 @@
|
||||
<div v-else>
|
||||
<div class="flex flex-wrap gap-4 sm:justify-between">
|
||||
<div class="flex gap-2 flex-wrap items-center justify-start">
|
||||
{{ title }}
|
||||
<el-divider direction="vertical" v-if="slots.leftToolBar || slots.buttons" />
|
||||
<slot name="leftToolBar" v-if="slots.leftToolBar"></slot>
|
||||
<slot name="buttons" v-if="slots.buttons"></slot>
|
||||
</div>
|
||||
@ -79,7 +77,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, useSlots } from 'vue';
|
||||
// import BackButton from '@/components/back-button/index.vue';
|
||||
import FormButton from './form-button.vue';
|
||||
defineOptions({ name: 'LayoutContent' });
|
||||
const slots = useSlots();
|
||||
|
@ -62,7 +62,7 @@ function toggleFullscreen() {
|
||||
}
|
||||
|
||||
const loadTooltip = () => {
|
||||
return i18n.global.t('commons.button.' + (globalStore.isFullScreen ? 'quitFullscreen' : 'fullscreen'));
|
||||
return i18n.global.t('commons.button.' + (globalStore.isFullScreen ? 'quitFullscreen' : 'fullscreen'));
|
||||
};
|
||||
|
||||
const acceptParams = (props: LogProps) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user