mirror of https://github.com/halo-dev/halo
parent
6c28d2cab8
commit
5b2af2e468
|
@ -94,30 +94,6 @@ adminApi.updateAdminAssets = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
adminApi.getApplicationConfig = () => {
|
|
||||||
return service({
|
|
||||||
url: `${baseUrl}/spring/application.yaml`,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
adminApi.updateApplicationConfig = content => {
|
|
||||||
return service({
|
|
||||||
url: `${baseUrl}/spring/application.yaml`,
|
|
||||||
params: {
|
|
||||||
content: content
|
|
||||||
},
|
|
||||||
method: 'put'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
adminApi.restartApplication = () => {
|
|
||||||
return service({
|
|
||||||
url: `${baseUrl}/spring/restart`,
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
adminApi.getLogFiles = lines => {
|
adminApi.getLogFiles = lines => {
|
||||||
return service({
|
return service({
|
||||||
url: `${baseUrl}/halo/logfile`,
|
url: `${baseUrl}/halo/logfile`,
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
</span>
|
</span>
|
||||||
<OptionsList />
|
<OptionsList />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="applicationConfig">
|
|
||||||
<span slot="tab">
|
|
||||||
<a-icon type="file-protect" />配置文件
|
|
||||||
</span>
|
|
||||||
<ApplicationConfig />
|
|
||||||
</a-tab-pane>
|
|
||||||
<a-tab-pane key="staticStorage">
|
<a-tab-pane key="staticStorage">
|
||||||
<span slot="tab">
|
<span slot="tab">
|
||||||
<a-icon type="cloud" />静态存储
|
<a-icon type="cloud" />静态存储
|
||||||
|
@ -62,7 +56,6 @@ import Environment from './tabs/Environment'
|
||||||
import RuntimeLogs from './tabs/RuntimeLogs'
|
import RuntimeLogs from './tabs/RuntimeLogs'
|
||||||
import SettingsForm from './tabs/SettingsForm'
|
import SettingsForm from './tabs/SettingsForm'
|
||||||
import OptionsList from './tabs/OptionsList'
|
import OptionsList from './tabs/OptionsList'
|
||||||
import ApplicationConfig from './tabs/ApplicationConfig'
|
|
||||||
import StaticStorage from './tabs/StaticStorage'
|
import StaticStorage from './tabs/StaticStorage'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -70,7 +63,6 @@ export default {
|
||||||
RuntimeLogs,
|
RuntimeLogs,
|
||||||
SettingsForm,
|
SettingsForm,
|
||||||
OptionsList,
|
OptionsList,
|
||||||
ApplicationConfig,
|
|
||||||
StaticStorage
|
StaticStorage
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<a-alert
|
|
||||||
message="注意:配置文件严格要求代码格式,上下文必须对齐,属性与值之间必须以英文冒号和空格隔开。如格式有误,将无法启动。"
|
|
||||||
banner
|
|
||||||
closable
|
|
||||||
/>
|
|
||||||
<a-form layout="vertical">
|
|
||||||
<a-form-item>
|
|
||||||
<a-spin :spinning="loading">
|
|
||||||
<codemirror
|
|
||||||
v-model="content"
|
|
||||||
:options="codemirrorOptions"
|
|
||||||
></codemirror>
|
|
||||||
</a-spin>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item>
|
|
||||||
<a-space>
|
|
||||||
<a-popconfirm
|
|
||||||
:title="'修改配置文件之后需重启才能生效,是否继续?'"
|
|
||||||
okText="确定"
|
|
||||||
cancelText="取消"
|
|
||||||
@confirm="handleUpdateConfig()"
|
|
||||||
>
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
>保存</a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
<a-popconfirm
|
|
||||||
:title="'你确定要重启吗?'"
|
|
||||||
okText="确定"
|
|
||||||
cancelText="取消"
|
|
||||||
@confirm="handleRestartApplication()"
|
|
||||||
>
|
|
||||||
<a-button type="danger">重启</a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import { codemirror } from 'vue-codemirror-lite'
|
|
||||||
import 'codemirror/mode/yaml/yaml.js'
|
|
||||||
import adminApi from '@/api/admin'
|
|
||||||
export default {
|
|
||||||
name: 'ApplicationConfig',
|
|
||||||
components: {
|
|
||||||
codemirror
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
codemirrorOptions: {
|
|
||||||
tabSize: 4,
|
|
||||||
mode: 'text/x-yaml',
|
|
||||||
lineNumbers: true,
|
|
||||||
line: true
|
|
||||||
},
|
|
||||||
content: '',
|
|
||||||
loading: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.loadConfig()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
loadConfig() {
|
|
||||||
this.loading = true
|
|
||||||
adminApi
|
|
||||||
.getApplicationConfig()
|
|
||||||
.then(response => {
|
|
||||||
this.content = response.data.data
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.loading = false
|
|
||||||
}, 200)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleUpdateConfig() {
|
|
||||||
adminApi
|
|
||||||
.updateApplicationConfig(this.content)
|
|
||||||
.then(response => {
|
|
||||||
this.$message.success(`配置保存成功!`)
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
this.loadConfig()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleRestartApplication() {
|
|
||||||
adminApi.restartApplication().then(response => {
|
|
||||||
this.$message.info(`重启中...`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
Loading…
Reference in New Issue