安装过程中可以选择自动在本机安装MySQL

This commit is contained in:
GoEdgeLab
2023-03-11 18:52:40 +08:00
parent 6d34de12da
commit 83e7a5dc14
22 changed files with 1287 additions and 164 deletions

View File

@@ -0,0 +1,32 @@
td {
vertical-align: top;
}
td.title {
width: 10em;
}
.result-box .row {
line-height: 1.8;
}
.result-box .button-box {
margin-top: 1em;
}
.logs-box {
max-height: 12em;
overflow-y: auto;
}
.logs-box .row {
line-height: 1.8;
}
.logs-box::-webkit-scrollbar {
width: 6px;
}
h4 {
font-weight: normal !important;
}
.green {
color: #21ba45;
}
.red {
color: #db2828;
}
/*# sourceMappingURL=installPopup.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["installPopup.less"],"names":[],"mappings":"AAAA;EACC,mBAAA;;AAGD,EAAE;EACD,WAAA;;AAGD,WACC;EACC,gBAAA;;AAFF,WAKC;EACC,eAAA;;AAIF;EACC,gBAAA;EACA,gBAAA;;AAFD,SAIC;EACC,gBAAA;;AAIF,SAAS;EACR,UAAA;;AAGD;EACC,8BAAA;;AAGD;EACC,cAAA;;AAGD;EACC,cAAA","file":"installPopup.css"}

View File

@@ -0,0 +1,74 @@
<!doctype html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="/images/favicon.png"/>
<title>安装GoEdge管理系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="/_/@default/@layout_popup.css"/>
<link rel="stylesheet" type="text/css" href="/css/semantic.iframe.min.css?v=bRafhK" media="all"/>
{$TEA.VUE}
<link rel="stylesheet" type="text/css" href="/_/@default/@layout_override.css" media="all"/>
<script type="text/javascript" src="/js/md5.min.js"></script>
<script type="text/javascript" src="/js/utils.js"></script>
<script type="text/javascript" src="/js/sweetalert2/dist/sweetalert2.all.min.js"></script>
<script type="text/javascript" src="/js/components.js"></script>
</head>
<body>
<div>
<div class="margin"></div>
<h4>方法1使用命令安装MySQL</h4>
<table class="ui table selectable">
<tr>
<td>可以在你要安装MySQL的服务器上运行以下命令<span class="grey">目前仅支持Linux系统和X86架构服务器安装后的MySQL版本是8.x.x</span></td>
</tr>
<tr>
<td>sudo sh -c &quot;$(wget https://goedge.cn/install-mysql.sh -O -)&quot;</td>
</tr>
</table>
<h4>方法2在本机自动安装MySQL</h4>
<table class="ui table selectable">
<tr>
<td colspan="2">如果你想在当前管理系统所在服务器上安装MySQL可以点击下面的按钮自动开始尝试安装如果安装不成功请自行安装<span class="grey">(建议仅在小流量应用场景或测试期间使用此功能)</span></td>
</tr>
<tr v-show="!result.isInstalling">
<td colspan="2">
<button class="ui button small" type="button" @click.prevent="install" v-if="!result.isInstalled">尝试在本机安装</button>
<button class="ui button small" type="button" @click.prevent="install" v-if="result.isInstalled && !result.isOk">重新尝试安装</button>
</td>
</tr>
<tr v-show="result.isInstalled">
<td class="title">安装结果</td>
<td>
<div v-if="result.isOk" class="green result-box">
<div class="row">安装成功请使用记事本或其他工具记录下面MySQL信息防止以后忘记</div>
<div class="row">安装目录:{{result.dir}}</div>
<div class="row">用户:{{result.user}}</div>
<div class="row">密码:{{result.password}}</div>
<div class="button-box">
<button class="ui button small" type="button" @click.prevent="finish">我已完成记录</button>
</div>
</div>
<div v-if="!result.isOk" class="red">
<div>
安装失败:{{result.err}}
</div>
<div class="ui divider"></div>
<div>请将以上错误信息报告给开发者并改用其他方式安装MySQL。</div>
</div>
</td>
</tr>
<tr v-show="result.isInstalling || (result.isInstalled && !result.isOk)">
<td class="title">安装过程</td>
<td>
<div class="logs-box">
<div v-for="log in result.logs" class="row">{{log}}</div>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@@ -0,0 +1,65 @@
Tea.context(function () {
this.result = {
isInstalling: false,
isInstalled: false,
isOk: false,
err: "",
user: "",
password: "",
dir: "",
logs: []
}
this.$delay(function () {
this.checkStatus()
})
this.install = function () {
this.result.isInstalling = true
this.result.isInstalled = false
this.result.logs = []
this.$post(".installPopup")
.timeout(3600)
.success(function (resp) {
this.result.isOk = resp.data.isOk
if (!resp.data.isOk) {
this.result.err = resp.data.err
} else {
this.result.user = resp.data.user
this.result.password = resp.data.password
this.result.dir = resp.data.dir
}
this.result.isInstalled = true
this.result.isInstalling = false
})
}
this.checkStatus = function () {
if (!this.result.isInstalling) {
this.$delay(function () {
this.checkStatus()
}, 1000)
return
}
this.$post(".installLogs")
.success(function (resp) {
let that = this
resp.data.logs.forEach(function (log) {
that.result.logs.unshift(log)
})
})
.done(function () {
this.$delay(function () {
this.checkStatus()
}, 2000)
})
}
this.finish = function () {
teaweb.closePopup()
}
})

View File

@@ -0,0 +1,42 @@
td {
vertical-align: top;
}
td.title {
width: 10em;
}
.result-box {
.row {
line-height: 1.8;
}
.button-box {
margin-top: 1em;
}
}
.logs-box {
max-height: 12em;
overflow-y: auto;
.row {
line-height: 1.8;
}
}
.logs-box::-webkit-scrollbar {
width: 6px;
}
h4 {
font-weight: normal !important;
}
.green {
color: #21ba45;
}
.red {
color: #db2828;
}