mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-07 17:10:07 +08:00
fix: 解决安装 mysql 过程中,去数据库页面查看,导致异常的BUG
This commit is contained in:
parent
c55d6335af
commit
455d4117e7
@ -490,6 +490,9 @@ func syncById(installId uint) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if appInstall.Status == constant.Installing {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
containerNames, err := getContainerNames(appInstall)
|
containerNames, err := getContainerNames(appInstall)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -27,7 +27,6 @@ func GetPrivateKey(priKey crypto.PrivateKey) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRegisterClient(email string) (*AcmeClient, error) {
|
func NewRegisterClient(email string) (*AcmeClient, error) {
|
||||||
|
|
||||||
priKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
priKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -58,7 +57,6 @@ func NewRegisterClient(email string) (*AcmeClient, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewPrivateKeyClient(email string, privateKey string) (*AcmeClient, error) {
|
func NewPrivateKeyClient(email string, privateKey string) (*AcmeClient, error) {
|
||||||
|
|
||||||
block, _ := pem.Decode([]byte(privateKey))
|
block, _ := pem.Decode([]byte(privateKey))
|
||||||
priKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
|
priKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
package web
|
|
||||||
|
|
||||||
import "embed"
|
|
||||||
|
|
||||||
//go:embed index.html
|
|
||||||
var IndexHtml embed.FS
|
|
||||||
|
|
||||||
//go:embed assets/*
|
|
||||||
var Assets embed.FS
|
|
||||||
|
|
||||||
//go:embed index.html
|
|
||||||
var IndexByte []byte
|
|
||||||
|
|
||||||
//go:embed favicon.png
|
|
||||||
var Favicon embed.FS
|
|
6
frontend/auto-imports.d.ts
vendored
6
frontend/auto-imports.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
// Generated by 'unplugin-auto-import'
|
|
||||||
// We suggest you to commit this file into source control
|
|
||||||
declare global {
|
|
||||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'];
|
|
||||||
}
|
|
||||||
export {};
|
|
@ -8,14 +8,25 @@
|
|||||||
<el-tag class="status-content">{{ $t('app.version') }}:{{ data.version }}</el-tag>
|
<el-tag class="status-content">{{ $t('app.version') }}:{{ data.version }}</el-tag>
|
||||||
|
|
||||||
<span class="buttons">
|
<span class="buttons">
|
||||||
<el-button type="primary" v-if="data.status != 'Running'" link @click="onOperate('start')">
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
v-if="data.status != 'Running'"
|
||||||
|
link
|
||||||
|
@click="onOperate('start')"
|
||||||
|
:disabled="data.status === 'Installing'"
|
||||||
|
>
|
||||||
{{ $t('app.start') }}
|
{{ $t('app.start') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" v-if="data.status === 'Running'" link @click="onOperate('stop')">
|
<el-button type="primary" v-if="data.status === 'Running'" link @click="onOperate('stop')">
|
||||||
{{ $t('app.stop') }}
|
{{ $t('app.stop') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
<el-button type="primary" link @click="onOperate('restart')">
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
:disabled="data.status === 'Installing'"
|
||||||
|
@click="onOperate('restart')"
|
||||||
|
>
|
||||||
{{ $t('app.restart') }}
|
{{ $t('app.restart') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
@ -23,7 +34,9 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="setting"
|
@click="setting"
|
||||||
link
|
link
|
||||||
:disabled="data.status !== 'Running' && data.app === 'OpenResty'"
|
:disabled="
|
||||||
|
data.status === 'Installing' || (data.status !== 'Running' && data.app === 'OpenResty')
|
||||||
|
"
|
||||||
>
|
>
|
||||||
{{ $t('commons.button.set') }}
|
{{ $t('commons.button.set') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -128,7 +141,7 @@ const onOperate = async (operation: string) => {
|
|||||||
|
|
||||||
const getTitle = (key: string) => {
|
const getTitle = (key: string) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'nginx':
|
case 'openresty':
|
||||||
return i18n.global.t('website.website');
|
return i18n.global.t('website.website');
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
return 'MySQL ' + i18n.global.t('menu.database');
|
return 'MySQL ' + i18n.global.t('menu.database');
|
||||||
|
@ -1,199 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-drawer
|
|
||||||
v-model="drawerVisiable"
|
|
||||||
:destroy-on-close="true"
|
|
||||||
@close="onCloseLog"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
size="50%"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<DrawerHeader :header="$t('container.imageBuild')" :back="handleClose" />
|
|
||||||
</template>
|
|
||||||
<el-row type="flex" justify="center">
|
|
||||||
<el-col :span="22">
|
|
||||||
<el-form ref="formRef" label-position="top" :model="form" label-width="80px" :rules="rules">
|
|
||||||
<el-form-item :label="$t('container.name')" prop="name">
|
|
||||||
<el-input :placeholder="$t('container.imageNameHelper')" v-model.trim="form.name" clearable />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Dockerfile" prop="from">
|
|
||||||
<el-radio-group v-model="form.from">
|
|
||||||
<el-radio label="edit">{{ $t('commons.button.edit') }}</el-radio>
|
|
||||||
<el-radio label="path">{{ $t('container.pathSelect') }}</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item v-if="form.from === 'edit'" :rules="Rules.requiredInput">
|
|
||||||
<codemirror
|
|
||||||
: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 clearable v-model="form.dockerfile">
|
|
||||||
<template #prepend>
|
|
||||||
<FileList @choose="loadBuildDir"></FileList>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="$t('container.tag')">
|
|
||||||
<el-input
|
|
||||||
:placeholder="$t('container.tagHelper')"
|
|
||||||
type="textarea"
|
|
||||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
||||||
v-model="form.tagStr"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<codemirror
|
|
||||||
v-if="logVisiable"
|
|
||||||
:autofocus="true"
|
|
||||||
placeholder="Waiting for build output..."
|
|
||||||
:indent-with-tab="true"
|
|
||||||
:tabSize="4"
|
|
||||||
style="max-height: 300px"
|
|
||||||
:lineWrapping="true"
|
|
||||||
:matchBrackets="true"
|
|
||||||
theme="cobalt"
|
|
||||||
:styleActiveLine="true"
|
|
||||||
:extensions="extensions"
|
|
||||||
@ready="handleReady"
|
|
||||||
v-model="logInfo"
|
|
||||||
:readOnly="true"
|
|
||||||
/>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<span class="dialog-footer">
|
|
||||||
<el-button @click="drawerVisiable = false">
|
|
||||||
{{ $t('commons.button.cancel') }}
|
|
||||||
</el-button>
|
|
||||||
<el-button :disabled="buttonDisabled" type="primary" @click="onSubmit(formRef)">
|
|
||||||
{{ $t('commons.button.confirm') }}
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-drawer>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import FileList from '@/components/file-list/index.vue';
|
|
||||||
import { Codemirror } from 'vue-codemirror';
|
|
||||||
import { javascript } from '@codemirror/lang-javascript';
|
|
||||||
import { oneDark } from '@codemirror/theme-one-dark';
|
|
||||||
import { nextTick, reactive, ref, shallowRef } from 'vue';
|
|
||||||
import { Rules } from '@/global/form-rules';
|
|
||||||
import i18n from '@/lang';
|
|
||||||
import { ElForm, ElMessage } from 'element-plus';
|
|
||||||
import { imageBuild } from '@/api/modules/container';
|
|
||||||
import { LoadFile } from '@/api/modules/files';
|
|
||||||
import { formatImageStdout } from '@/utils/docker';
|
|
||||||
|
|
||||||
const logVisiable = ref<boolean>(false);
|
|
||||||
const logInfo = ref();
|
|
||||||
const view = shallowRef();
|
|
||||||
const handleReady = (payload) => {
|
|
||||||
view.value = payload.view;
|
|
||||||
};
|
|
||||||
const extensions = [javascript(), oneDark];
|
|
||||||
let timer: NodeJS.Timer | null = null;
|
|
||||||
|
|
||||||
const buttonDisabled = ref(false);
|
|
||||||
|
|
||||||
const drawerVisiable = ref(false);
|
|
||||||
const form = reactive({
|
|
||||||
from: 'path',
|
|
||||||
dockerfile: '',
|
|
||||||
name: '',
|
|
||||||
tagStr: '',
|
|
||||||
tags: [] as Array<string>,
|
|
||||||
});
|
|
||||||
const varifyPath = (rule: any, value: any, callback: any) => {
|
|
||||||
if (value.indexOf('docker-compose.yml') === -1) {
|
|
||||||
callback(new Error(i18n.global.t('commons.rule.selectHelper', ['Dockerfile'])));
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
};
|
|
||||||
const rules = reactive({
|
|
||||||
name: [Rules.requiredInput, Rules.imageName],
|
|
||||||
from: [Rules.requiredSelect],
|
|
||||||
dockerfile: [Rules.requiredInput, { validator: varifyPath, trigger: 'change', required: true }],
|
|
||||||
});
|
|
||||||
const acceptParams = async () => {
|
|
||||||
logVisiable.value = false;
|
|
||||||
drawerVisiable.value = true;
|
|
||||||
form.from = 'path';
|
|
||||||
form.dockerfile = '';
|
|
||||||
form.tagStr = '';
|
|
||||||
form.name = '';
|
|
||||||
logInfo.value = '';
|
|
||||||
buttonDisabled.value = false;
|
|
||||||
};
|
|
||||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
|
||||||
|
|
||||||
const handleClose = () => {
|
|
||||||
drawerVisiable.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
|
||||||
const formRef = ref<FormInstance>();
|
|
||||||
|
|
||||||
const onSubmit = async (formEl: FormInstance | undefined) => {
|
|
||||||
if (!formEl) return;
|
|
||||||
formEl.validate(async (valid) => {
|
|
||||||
if (!valid) return;
|
|
||||||
if (form.tagStr !== '') {
|
|
||||||
form.tags = form.tagStr.split('\n');
|
|
||||||
}
|
|
||||||
const res = await imageBuild(form);
|
|
||||||
buttonDisabled.value = true;
|
|
||||||
logVisiable.value = true;
|
|
||||||
loadLogs(res.data);
|
|
||||||
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadLogs = async (path: string) => {
|
|
||||||
timer = setInterval(async () => {
|
|
||||||
if (logVisiable.value) {
|
|
||||||
const res = await LoadFile({ path: path });
|
|
||||||
logInfo.value = formatImageStdout(res.data);
|
|
||||||
nextTick(() => {
|
|
||||||
const state = view.value.state;
|
|
||||||
view.value.dispatch({
|
|
||||||
selection: { anchor: state.doc.length, head: state.doc.length },
|
|
||||||
scrollIntoView: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (logInfo.value.endsWith('image build failed!') || logInfo.value.endsWith('image build successful!')) {
|
|
||||||
clearInterval(Number(timer));
|
|
||||||
timer = null;
|
|
||||||
buttonDisabled.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1000 * 3);
|
|
||||||
};
|
|
||||||
const onCloseLog = async () => {
|
|
||||||
emit('search');
|
|
||||||
clearInterval(Number(timer));
|
|
||||||
timer = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadBuildDir = async (path: string) => {
|
|
||||||
form.dockerfile = path;
|
|
||||||
};
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
acceptParams,
|
|
||||||
});
|
|
||||||
</script>
|
|
Loading…
x
Reference in New Issue
Block a user