mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 10:55:51 +02:00
bug fix #29
This commit is contained in:
parent
7155821366
commit
b112ee05b4
5 changed files with 61 additions and 12 deletions
|
@ -12,7 +12,7 @@ import {useRouter} from 'vue-router'
|
||||||
const {$gettext, interpolate} = useGettext()
|
const {$gettext, interpolate} = useGettext()
|
||||||
|
|
||||||
const config = reactive({name: ''})
|
const config = reactive({name: ''})
|
||||||
let ngx_config = reactive({
|
const ngx_config = reactive({
|
||||||
servers: [{
|
servers: [{
|
||||||
directives: [],
|
directives: [],
|
||||||
locations: []
|
locations: []
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import CodeEditor from '@/components/CodeEditor'
|
import CodeEditor from '@/components/CodeEditor'
|
||||||
import {useGettext} from 'vue3-gettext'
|
import {useGettext} from 'vue3-gettext'
|
||||||
import {reactive, ref} from 'vue'
|
import {reactive, ref} from 'vue'
|
||||||
|
import {DeleteOutlined} from '@ant-design/icons-vue'
|
||||||
|
|
||||||
const {$gettext} = useGettext()
|
const {$gettext} = useGettext()
|
||||||
|
|
||||||
|
@ -24,7 +25,9 @@ function add() {
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
adding.value = false
|
adding.value = false
|
||||||
props.locations?.push(location)
|
props.locations?.push({
|
||||||
|
...location
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove(index: number) {
|
function remove(index: number) {
|
||||||
|
@ -45,7 +48,19 @@ function remove(index: number) {
|
||||||
<a-input addon-before="location" v-model:value="v.path"/>
|
<a-input addon-before="location" v-model:value="v.path"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="$gettext('Content')">
|
<a-form-item :label="$gettext('Content')">
|
||||||
<code-editor v-model:content="v.content" default-height="200px"/>
|
<div class="input-wrapper">
|
||||||
|
<code-editor v-model:content="v.content" default-height="200px" style="width: 100%;"/>
|
||||||
|
<a-popconfirm @confirm="remove(k)"
|
||||||
|
:title="$gettext('Are you sure you want to remove this location?')"
|
||||||
|
:ok-text="$gettext('Yes')"
|
||||||
|
:cancel-text="$gettext('No')">
|
||||||
|
<a-button>
|
||||||
|
<template #icon>
|
||||||
|
<DeleteOutlined style="font-size: 14px;"/>
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
@ -73,5 +88,12 @@ function remove(index: number) {
|
||||||
.ant-card {
|
.ant-card {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
box-shadow: unset;
|
box-shadow: unset;
|
||||||
|
|
||||||
|
.input-wrapper {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -20,6 +20,7 @@ const name = ref(route.params.name)
|
||||||
function change_tls(r: any) {
|
function change_tls(r: any) {
|
||||||
if (r) {
|
if (r) {
|
||||||
// deep copy servers[0] to servers[1]
|
// deep copy servers[0] to servers[1]
|
||||||
|
console.log(props.ngx_config)
|
||||||
const server = JSON.parse(JSON.stringify(props.ngx_config.servers[0]))
|
const server = JSON.parse(JSON.stringify(props.ngx_config.servers[0]))
|
||||||
|
|
||||||
props.ngx_config.servers.push(server)
|
props.ngx_config.servers.push(server)
|
||||||
|
@ -143,7 +144,7 @@ const autoCertRef = computed({
|
||||||
<template v-if="current_support_ssl&&enabled">
|
<template v-if="current_support_ssl&&enabled">
|
||||||
<cert
|
<cert
|
||||||
v-if="current_support_ssl"
|
v-if="current_support_ssl"
|
||||||
:cert_info="props.cert_info[k]"
|
:cert_info="props.cert_info?.[k]"
|
||||||
:current_server_directives="current_server_directives"
|
:current_server_directives="current_server_directives"
|
||||||
:directives-map="directivesMap"
|
:directives-map="directivesMap"
|
||||||
v-model:enabled="autoCertRef"
|
v-model:enabled="autoCertRef"
|
||||||
|
|
|
@ -50,7 +50,7 @@ function onSave(idx: number) {
|
||||||
|
|
||||||
<a-input v-else
|
<a-input v-else
|
||||||
:addon-before="directive.directive"
|
:addon-before="directive.directive"
|
||||||
v-model:value="directive.params" @click="current_idx=index"/>
|
v-model:value="directive.params" @click="current_idx=index" @blur="current_idx=-1"/>
|
||||||
|
|
||||||
<a-popconfirm @confirm="remove(index)"
|
<a-popconfirm @confirm="remove(index)"
|
||||||
:title="$gettext('Are you sure you want to remove this directive?')"
|
:title="$gettext('Are you sure you want to remove this directive?')"
|
||||||
|
@ -88,7 +88,8 @@ function onSave(idx: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
.slide-enter-active, .slide-leave-active {
|
.slide-enter-active, .slide-leave-active {
|
||||||
transition: max-height .3s ease;
|
transition: max-height .2s ease;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slide-enter-from, .slide-leave-to {
|
.slide-enter-from, .slide-leave-to {
|
||||||
|
|
|
@ -33,14 +33,39 @@ func GetConfigs(c *gin.Context) {
|
||||||
file := configFiles[i]
|
file := configFiles[i]
|
||||||
fileInfo, _ := file.Info()
|
fileInfo, _ := file.Info()
|
||||||
|
|
||||||
if !file.IsDir() && "." != file.Name()[0:1] {
|
switch mode := fileInfo.Mode(); {
|
||||||
|
case mode.IsRegular(): // regular file, not a hidden file
|
||||||
|
if "." == file.Name()[0:1] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
case mode&os.ModeSymlink != 0: // is a symbol
|
||||||
|
var targetPath string
|
||||||
|
targetPath, err = os.Readlink(nginx.GetNginxConfPath(file.Name()))
|
||||||
|
if err != nil {
|
||||||
|
log.Println("GetConfigs Read Symlink Error", targetPath, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var targetInfo os.FileInfo
|
||||||
|
targetInfo, err = os.Stat(targetPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("GetConfigs Stat Error", targetPath, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// but target file is not a dir
|
||||||
|
if targetInfo.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
configs = append(configs, gin.H{
|
configs = append(configs, gin.H{
|
||||||
"name": file.Name(),
|
"name": file.Name(),
|
||||||
"size": fileInfo.Size(),
|
"size": fileInfo.Size(),
|
||||||
"modify": fileInfo.ModTime(),
|
"modify": fileInfo.ModTime(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
configs = config_list.Sort(orderBy, sort, mySort[orderBy], configs)
|
configs = config_list.Sort(orderBy, sort, mySort[orderBy], configs)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue