mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
阶段性提交
This commit is contained in:
@@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
## 文档
|
## 文档
|
||||||
* [新手指南](https://edge.teaos.cn/docs/QuickStart/Index.md)
|
* [新手指南](https://edge.teaos.cn/docs/QuickStart/Index.md)
|
||||||
* [文档](http://edge.teaos.cn/docs)
|
* [完整文档](https://edge.teaos.cn/docs)
|
||||||
|
* [开发者指南](https://edge.teaos.cn/docs/Developer/Build.md)
|
||||||
|
|
||||||
## 架构
|
## 架构
|
||||||

|

|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package access
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunGet(params struct{}) {
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunPost(params struct {
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package access
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IndexAction struct {
|
type IndexAction struct {
|
||||||
@@ -16,7 +17,14 @@ func (this *IndexAction) Init() {
|
|||||||
func (this *IndexAction) RunGet(params struct {
|
func (this *IndexAction) RunGet(params struct {
|
||||||
ServerId int64
|
ServerId int64
|
||||||
}) {
|
}) {
|
||||||
// TODO
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["webId"] = webConfig.Id
|
||||||
|
this.Data["authConfig"] = webConfig.Auth
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ func init() {
|
|||||||
Helper(serverutils.NewServerHelper()).
|
Helper(serverutils.NewServerHelper()).
|
||||||
Prefix("/servers/server/settings/access").
|
Prefix("/servers/server/settings/access").
|
||||||
Get("", new(IndexAction)).
|
Get("", new(IndexAction)).
|
||||||
|
GetPost("/createPopup", new(CreatePopupAction)).
|
||||||
|
GetPost("/updatePopup", new(UpdatePopupAction)).
|
||||||
EndAll()
|
EndAll()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package access
|
||||||
|
|
||||||
|
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
|
||||||
|
type UpdatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) RunGet(params struct{}) {
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
@@ -191,7 +191,7 @@ func (this *InstallAction) RunPost(params struct {
|
|||||||
Username: adminMap.GetString("username"),
|
Username: adminMap.GetString("username"),
|
||||||
Password: adminMap.GetString("password"),
|
Password: adminMap.GetString("password"),
|
||||||
})
|
})
|
||||||
// 这里我们尝试多次是为了当代API节点启动完毕
|
// 这里我们尝试多次是为了等待API节点启动完毕
|
||||||
if err != nil {
|
if err != nil {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|||||||
81
web/public/js/components/server/http-auth-config-box.js
Normal file
81
web/public/js/components/server/http-auth-config-box.js
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
// 认证设置
|
||||||
|
Vue.component("http-auth-config-box", {
|
||||||
|
props: ["v-auth-config", "v-is-location"],
|
||||||
|
data: function () {
|
||||||
|
let authConfig = this.vAuthConfig
|
||||||
|
if (authConfig == null) {
|
||||||
|
authConfig = {
|
||||||
|
isPrior: false,
|
||||||
|
isOn: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (authConfig.policyRefs == null) {
|
||||||
|
authConfig.policyRefs = []
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
authConfig: authConfig
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isOn: function () {
|
||||||
|
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
let that = this
|
||||||
|
teaweb.popup("/servers/server/settings/access/createPopup", {
|
||||||
|
callback: function (resp) {
|
||||||
|
that.authConfig.policyRefs.push(resp.data.policyRef)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
update: function (index, policyId) {
|
||||||
|
let that = this
|
||||||
|
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
|
||||||
|
callback: function (resp) {
|
||||||
|
Vue.set(that.authConfig.policyRefs, index, resp.data.policyRef)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delete: function (index) {
|
||||||
|
that.authConfig.policyRefs.$remove(index)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: `<div>
|
||||||
|
<input type="text" name="authJSON" :value="JSON.stringify(authConfig)"/>
|
||||||
|
<table class="ui table selectable definition">
|
||||||
|
<prior-checkbox :v-config="authConfig" v-if="vIsLocation"></prior-checkbox>
|
||||||
|
<tbody v-show="!vIsLocation || authConfig.isPrior">
|
||||||
|
<tr>
|
||||||
|
<td class="title">启用认证</td>
|
||||||
|
<td>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input type="checkbox" v-model="authConfig.isOn"/>
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="margin"></div>
|
||||||
|
<!-- 认证方法 -->
|
||||||
|
<div>
|
||||||
|
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>认证方法</th>
|
||||||
|
<th>参数</th>
|
||||||
|
<th class="two wide">状态</th>
|
||||||
|
<th class="two op">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody v-for="ref in authConfig.policyRefs" :key="ref.authPolicyId">
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<button class="ui button small" type="button" @click.prevent="add">+添加认证</button>
|
||||||
|
</div>
|
||||||
|
<div class="margin"></div>
|
||||||
|
</div>`
|
||||||
|
})
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>创建认证</h3>
|
||||||
|
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
|
||||||
|
<table class="ui table definitions selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">名称 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" maxlength="50"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>类型 *</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- BasicAuth -->
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
<!-- SubRequest -->
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.success = NotifyPopup
|
||||||
|
})
|
||||||
@@ -3,5 +3,8 @@
|
|||||||
{$template "/left_menu"}
|
{$template "/left_menu"}
|
||||||
|
|
||||||
<div class="right-box">
|
<div class="right-box">
|
||||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<http-auth-config-box :v-auth-config="authConfig"></http-auth-config-box>
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user