mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	将API设置URL从/api改为/settings/api
This commit is contained in:
		@@ -2,7 +2,7 @@ package api
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/api/node"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/api/node"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
 | 
			
		||||
	"github.com/iwind/TeaGo"
 | 
			
		||||
@@ -14,7 +14,7 @@ func init() {
 | 
			
		||||
			Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeSetting)).
 | 
			
		||||
			Helper(NewHelper()).
 | 
			
		||||
			Helper(settingutils.NewAdvancedHelper("apiNodes")).
 | 
			
		||||
			Prefix("/api").
 | 
			
		||||
			Prefix("/settings/api").
 | 
			
		||||
			Get("", new(IndexAction)).
 | 
			
		||||
			Get("/methodStats", new(MethodStatsAction)).
 | 
			
		||||
			GetPost("/node/createPopup", new(node.CreatePopupAction)).
 | 
			
		||||
@@ -12,7 +12,7 @@ func init() {
 | 
			
		||||
		server.
 | 
			
		||||
			Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeSetting)).
 | 
			
		||||
			Helper(settingutils.NewAdvancedHelper("apiNodes")).
 | 
			
		||||
			Prefix("/api/node").
 | 
			
		||||
			Prefix("/settings/api/node").
 | 
			
		||||
 | 
			
		||||
			// 这里不受Helper的约束
 | 
			
		||||
			GetPost("/createAddrPopup", new(CreateAddrPopupAction)).
 | 
			
		||||
@@ -33,7 +33,7 @@ func (this *AdvancedHelper) BeforeAction(actionPtr actions.ActionWrapper) (goNex
 | 
			
		||||
	var adminId = session.GetInt64("adminId")
 | 
			
		||||
	if configloaders.AllowModule(adminId, configloaders.AdminModuleCodeSetting) {
 | 
			
		||||
		tabbar.Add("数据库", "", "/settings/database", "", this.tab == "database")
 | 
			
		||||
		tabbar.Add("API节点", "", "/api", "", this.tab == "apiNodes")
 | 
			
		||||
		tabbar.Add("API节点", "", "/settings/api", "", this.tab == "apiNodes")
 | 
			
		||||
		tabbar.Add("日志数据库", "", "/db", "", this.tab == "dbNodes")
 | 
			
		||||
		tabbar.Add("迁移", "", "/settings/transfer", "", this.tab == "transfer")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,8 @@ import (
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/admins"
 | 
			
		||||
 | 
			
		||||
	// API节点
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/api"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/api/node"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/api"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/api/node"
 | 
			
		||||
 | 
			
		||||
	// 节点集群
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters"
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ Vue.component("api-node-addresses-box", {
 | 
			
		||||
		// 添加IP地址
 | 
			
		||||
		addAddr: function () {
 | 
			
		||||
			let that = this;
 | 
			
		||||
			teaweb.popup("/api/node/createAddrPopup", {
 | 
			
		||||
			teaweb.popup("/settings/api/node/createAddrPopup", {
 | 
			
		||||
				height: "16em",
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					that.addrs.push(resp.data.addr);
 | 
			
		||||
@@ -25,7 +25,7 @@ Vue.component("api-node-addresses-box", {
 | 
			
		||||
		updateAddr: function (index, addr) {
 | 
			
		||||
			let that = this;
 | 
			
		||||
			window.UPDATING_ADDR = addr
 | 
			
		||||
			teaweb.popup("/api/node/updateAddrPopup?addressId=", {
 | 
			
		||||
			teaweb.popup("/settings/api/node/updateAddrPopup?addressId=", {
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					Vue.set(that.addrs, index, resp.data.addr);
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<menu-item href="/api">节点列表</menu-item>
 | 
			
		||||
	<span class="item">|</span>
 | 
			
		||||
	<menu-item :href="'/api/node?nodeId=' + node.id" code="index">"{{node.name}}"详情</menu-item>
 | 
			
		||||
    <menu-item :href="'/api/node/logs?nodeId=' + node.id" code="log">运行日志</menu-item>
 | 
			
		||||
	<menu-item :href="'/api/node/install?nodeId=' + node.id" code="install">安装节点</menu-item>
 | 
			
		||||
	<menu-item :href="'/api/node/update?nodeId=' + node.id" code="update">修改节点</menu-item>
 | 
			
		||||
</first-menu>
 | 
			
		||||
@@ -146,7 +146,7 @@ Tea.context(function () {
 | 
			
		||||
						return
 | 
			
		||||
					case "RPC_TEST_FAILED":
 | 
			
		||||
						teaweb.confirm("html:要安装的节点到API服务之间的RPC通讯测试失败,具体错误:" + errMsg + ",<br/>现在修改API信息?", function () {
 | 
			
		||||
							window.location = "/api"
 | 
			
		||||
							window.location = "/settings/api"
 | 
			
		||||
						})
 | 
			
		||||
						return
 | 
			
		||||
					default:
 | 
			
		||||
 
 | 
			
		||||
@@ -142,7 +142,7 @@ Tea.context(function () {
 | 
			
		||||
                                        return
 | 
			
		||||
                                    case "RPC_TEST_FAILED":
 | 
			
		||||
                                        teaweb.confirm("html:要安装的节点到API服务之间的RPC通讯测试失败,具体错误:" + errMsg + ",<br/>现在修改API信息?", function () {
 | 
			
		||||
                                            window.location = "/api"
 | 
			
		||||
                                            window.location = "/settings/api"
 | 
			
		||||
                                        })
 | 
			
		||||
                                        return
 | 
			
		||||
                                    default:
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ Tea.context(function () {
 | 
			
		||||
                        return
 | 
			
		||||
                    case "RPC_TEST_FAILED":
 | 
			
		||||
                        teaweb.confirm("html:要安装的节点到API服务之间的RPC通讯测试失败,具体错误:" + errMsg + ",<br/>现在修改API信息?", function () {
 | 
			
		||||
                            window.location = "/api"
 | 
			
		||||
                            window.location = "/settings/api"
 | 
			
		||||
                        })
 | 
			
		||||
                        return
 | 
			
		||||
                    default:
 | 
			
		||||
 
 | 
			
		||||
@@ -132,7 +132,7 @@ Tea.context(function () {
 | 
			
		||||
                                        return
 | 
			
		||||
                                    case "RPC_TEST_FAILED":
 | 
			
		||||
                                        teaweb.confirm("html:要升级的节点到API服务之间的RPC通讯测试失败,具体错误:" + errMsg + ",<br/>现在修改API信息?", function () {
 | 
			
		||||
                                            window.location = "/api"
 | 
			
		||||
                                            window.location = "/settings/api"
 | 
			
		||||
                                        })
 | 
			
		||||
                                        return
 | 
			
		||||
                                    default:
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@
 | 
			
		||||
<!-- API节点升级提醒 -->
 | 
			
		||||
<div class="ui icon message error" v-if="!isLoading && apiNodeUpgradeInfo.count > 0">
 | 
			
		||||
    <i class="icon warning circle"></i>
 | 
			
		||||
    <a href="/api">升级提醒:有 {{apiNodeUpgradeInfo.count}} 个API节点需要升级到 v{{apiNodeUpgradeInfo.version}} 版本;如果已经升级,请尝试重启API节点进程。</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
 | 
			
		||||
    <a href="/settings/api">升级提醒:有 {{apiNodeUpgradeInfo.count}} 个API节点需要升级到 v{{apiNodeUpgradeInfo.version}} 版本;如果已经升级,请尝试重启API节点进程。</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<!-- 本地API节点 -->
 | 
			
		||||
@@ -72,9 +72,9 @@
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="ui column with-border">
 | 
			
		||||
        <h4>API节点<link-icon href="/api" v-if="dashboard.canGoSettings"></link-icon></h4>
 | 
			
		||||
        <h4>API节点<link-icon href="/settings/api" v-if="dashboard.canGoSettings"></link-icon></h4>
 | 
			
		||||
        <div class="value"><span>{{dashboard.countAPINodes}}</span>个
 | 
			
		||||
            <span style="font-size: 1em" v-if="dashboard.countOfflineAPINodes > 0">/ <a href="/api" v-if="dashboard.canGoSettings"><span class="red" style="font-size: 1em">{{dashboard.countOfflineAPINodes}}离线</span></a><span class="red" style="font-size: 1em" v-else>{{dashboard.countOfflineAPINodes}}离线</span></span>
 | 
			
		||||
            <span style="font-size: 1em" v-if="dashboard.countOfflineAPINodes > 0">/ <a href="/settings/api" v-if="dashboard.canGoSettings"><span class="red" style="font-size: 1em">{{dashboard.countOfflineAPINodes}}离线</span></a><span class="red" style="font-size: 1em" v-else>{{dashboard.countOfflineAPINodes}}离线</span></span>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<a href="" class="item" @click.prevent="createNode()">[添加节点]</a>
 | 
			
		||||
    <a href="/api/methodStats" class="item" v-if="hasMethodStats">用时统计</a>
 | 
			
		||||
    <a href="/settings/api/methodStats" class="item" v-if="hasMethodStats">用时统计</a>
 | 
			
		||||
</first-menu>
 | 
			
		||||
 | 
			
		||||
<p class="comment" v-if="nodes.length == 0">暂时还没有节点。</p>
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tr v-for="node in nodes">
 | 
			
		||||
            <td><a :href="'/api/node?nodeId=' + node.id">{{node.name}}</a>
 | 
			
		||||
            <td><a :href="'/settings/api/node?nodeId=' + node.id">{{node.name}}</a>
 | 
			
		||||
                <div v-if="node.isPrimary">
 | 
			
		||||
                    <grey-label v-if="node.isPrimary">主节点</grey-label>
 | 
			
		||||
                </div>
 | 
			
		||||
@@ -67,7 +67,7 @@
 | 
			
		||||
                <span v-else-if="node.status.updatedAt == 0" class="red">未连接</span>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <a :href="'/api/node?nodeId=' + node.id">详情</a>  
 | 
			
		||||
                <a :href="'/settings/api/node?nodeId=' + node.id">详情</a>  
 | 
			
		||||
                <a href="" @click.prevent="deleteNode(node.id)">删除</a>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
 | 
			
		||||
<div class="margin"></div>
 | 
			
		||||
<form method="get" action="/api/methodStats" class="ui form">
 | 
			
		||||
<form method="get" action="/settings/api/methodStats" class="ui form">
 | 
			
		||||
    <div class="ui fields inline">
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <input type="text" name="method" v-model="method" placeholder="方法"/>
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <button class="ui button" type="submit">搜索</button>
 | 
			
		||||
             
 | 
			
		||||
            <a href="/api/methodStats" v-if="method.length > 0 || tag.length > 0 || order.length > 0">清除条件</a>
 | 
			
		||||
            <a href="/settings/api/methodStats" v-if="method.length > 0 || tag.length > 0 || order.length > 0">清除条件</a>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										8
									
								
								web/views/@default/settings/api/node/@menu.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								web/views/@default/settings/api/node/@menu.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<menu-item href="/settings/api">节点列表</menu-item>
 | 
			
		||||
	<span class="item">|</span>
 | 
			
		||||
	<menu-item :href="'/settings/api/node?nodeId=' + node.id" code="index">"{{node.name}}"详情</menu-item>
 | 
			
		||||
    <menu-item :href="'/settings/api/node/logs?nodeId=' + node.id" code="log">运行日志</menu-item>
 | 
			
		||||
	<menu-item :href="'/settings/api/node/install?nodeId=' + node.id" code="install">安装节点</menu-item>
 | 
			
		||||
	<menu-item :href="'/settings/api/node/update?nodeId=' + node.id" code="update">修改节点</menu-item>
 | 
			
		||||
</first-menu>
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
{$template "/datepicker"}
 | 
			
		||||
 | 
			
		||||
<div class="margin"></div>
 | 
			
		||||
<form method="get" action="/api/node/logs" class="ui form" autocomplete="off">
 | 
			
		||||
<form method="get" action="/settings/api/node/logs" class="ui form" autocomplete="off">
 | 
			
		||||
    <input type="hidden" name="nodeId" :value="nodeId"/>
 | 
			
		||||
    <div class="ui fields inline">
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
            <button type="submit" class="ui button">查询</button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field" v-if="dayFrom.length > 0 || dayTo.length > 0 || keyword.length > 0 || level.length > 0">
 | 
			
		||||
            <a :href="'/api/node/logs?nodeId=' + nodeId">[清除条件]</a>
 | 
			
		||||
            <a :href="'/settings/api/node/logs?nodeId=' + nodeId">[清除条件]</a>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifySuccess("保存成功", "/api/node?nodeId=" + this.node.id)
 | 
			
		||||
	this.success = NotifySuccess("保存成功", "/settings/api/node?nodeId=" + this.node.id)
 | 
			
		||||
 | 
			
		||||
	this.hasHTTPS = this.node.listens.$any(function (k, v) {
 | 
			
		||||
		return v.protocol == "https"
 | 
			
		||||
		Reference in New Issue
	
	Block a user