Skip to content

Commit

Permalink
修复服务端首次运行,未及时更新服务路由造成令牌验证失败的问题和修复基于zookeeper订阅者注册失败的问题,以及新增身份验证界面 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
fanliang11 committed Oct 19, 2017
1 parent 52954c3 commit 6e458db
Show file tree
Hide file tree
Showing 23 changed files with 182 additions and 63 deletions.
16 changes: 16 additions & 0 deletions Surging.ApiGateway/Controllers/AuthenticationManageController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Surging.ApiGateway.Controllers
{
public class AuthenticationManageController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
4 changes: 2 additions & 2 deletions Surging.ApiGateway/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ private IServiceProvider RegisterAutofac(IServiceCollection services)
builder.AddMicroService(option =>
{
option.AddServiceRuntime();
//option.UseZooKeeperManager(new ConfigInfo("127.0.0.1:2181"));
option.UseConsulManager(new ConfigInfo("127.0.0.1:8500"));
//option.UseZooKeeperManager(new ConfigInfo("127.0.0.1:2181"));
option.UseConsulManager(new ConfigInfo("127.0.0.1:8500"));
option.UseDotNettyTransport();
option.AddApiGateWay();
builder.Register(p => new CPlatformContainer(ServiceLocator.Current));
Expand Down
68 changes: 68 additions & 0 deletions Surging.ApiGateway/Views/AuthenticationManage/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

@{
ViewBag.Title = "认证管理";
var isPjax = (!string.IsNullOrEmpty(Context.Request.Query["XPJAX"]) && bool.Parse(Context.Request.Query["XPJAX"]))
&& (!string.IsNullOrEmpty(Context.Request.Headers["X-PJAX"]) && bool.Parse(Context.Request.Headers["X-PJAX"]));
Layout = isPjax ? null : "_AuthenticationManage.cshtml";
}
<div class="page-header">
<h1>
认证管理
<small>
<i class="icon-double-angle-right"></i>
服务令牌
</small>
</h1>
<div class="ace-settings-container">
<a href="@Context.Request.Headers["Referer"]" class="btn btn-app btn-xs btn-warning ace-settings-btn" data-pjax=".page-content">
<i class="icon-back bigger-150"></i>
</a>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div id="sample-table-2_wrapper" class="dataTables_wrapper" role="grid">
<div class="row">
<div class="col-sm-6">
关键字:<input type="text" name="queryParam" id="queryParam" placeholder="机器名\服务Id">
<button id="btnSearch" class="btn btn-primary">搜&#12288;索</button>
</div>
</div>
<div>
<table id="dataService" class="table table-striped table-bordered table-hover dataTable">
<thead>
<tr role="row">
<th style="width: 6%"></th>
<th class="center" width="12%">机器名</th>
<th class="center" width="12%">状态</th>
<th class="center" width="12%">检查</th>
<th class="center">操作</th>
</tr>
</thead>
<tbody id=""></tbody>
</table>
</div>
</div>
</div>
</div>
@*@if (!isPjax)
{
@section SubFootJS
{
<script type="text/javascript">
seajs.use("apps_authmanage/view/address.guide.js", function(a) {
a.init({
});
});
</script>
}
}
else
{
<script type="text/javascript">
seajs.use("apps_authmanage/view/address.guide.js", function (a) {
a.init({
});
});
</script>
}*@
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
}
@section SubHeadCSS
{
<link href="~/apps/servicemange/assets/css/index.css" rel="stylesheet" />
<link href="~/apps/authmanage/assets/css/index.css" rel="stylesheet" />
}
<div class="app-frame app-board">
<div class="app-left-side menu-min">
<h4 class="app-title"><i class="icon-servicemange"></i> <span>身份认证</span></h4>
<h4 class="app-title"><i class="surging-icon-line"></i> <span>身份认证</span></h4>
<div style="position:relative;min-height:466px;" class="scrollbar">
<div class="content">
<nav class="app-left-nav">
<ul>
<li><a href="@Url.Action("Index",new { XPJAX=true})" title="服务令牌" class="board-group popup activate" data-pjax=".page-content"><i class="icon-service"></i><span class="nav-level-span">服务令牌</span></a></li>
<li><a href="javascript:void(0)" class="board-group" title="黑白名单"><i class="icon-ref-consume"></i><span class="nav-level-span">黑白名单</span></a></li>
<li><a href="@Url.Action("Index",new { XPJAX=true})" title="服务令牌" class="board-group popup active" data-pjax=".page-content"><i class="surging-icon-token"></i><span class="nav-level-span">服务令牌</span></a></li>
<li><a href="javascript:void(0)" class="board-group" title="黑白名单"><i class="surging-icon-blacklist"></i><span class="nav-level-span">黑白名单</span></a></li>
</ul>
</nav>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Surging.ApiGateway/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<a class="pc-app-btn pc-app-monitor" href="javascript:;" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
<a class="pc-app-btn pc-app-service" href="@Url.Action("Index","ServiceManage")" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
<a class="pc-app-btn pc-app-defend" href="javascript:;" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
<a class="pc-app-btn pc-app-identity" href="javascript:;" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
<a class="pc-app-btn pc-app-identity" href="@Url.Action("Index","AuthenticationManage")" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
<a class="pc-app-btn pc-app-flowrate " href="javascript:;" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
<a class="pc-app-btn pc-app-diversion" href="javascript:;" data-mode="apps" data-pjax="#app_wrap"><i class="app-icon"></i></a>
</div>
Expand Down
1 change: 1 addition & 0 deletions Surging.ApiGateway/Views/ServiceManage/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
var isPjax = (!string.IsNullOrEmpty(Context.Request.Query["XPJAX"]) && bool.Parse(Context.Request.Query["XPJAX"]))
&& (!string.IsNullOrEmpty(Context.Request.Headers["X-PJAX"]) && bool.Parse(Context.Request.Headers["X-PJAX"])) ;
Layout = isPjax ? null : "_ServiceManageLayout.cshtml";
ViewBag.Selected = "Index";
}
<div class="page-header">
<h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

@{
ViewBag.Title = "服务管理";
var isPjax = !string.IsNullOrEmpty(Context.Request.Headers["X-PJAX"]) && bool.Parse(Context.Request.Headers["X-PJAX"]); ;
var isPjax = !string.IsNullOrEmpty(Context.Request.Headers["X-PJAX"]) && bool.Parse(Context.Request.Headers["X-PJAX"]) ;
Layout = isPjax ? null : "_ServiceManageLayout.cshtml";
ViewBag.Selected="ServiceSubscriber";
}
<div class="page-header">
<h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<div class="content">
<nav class="app-left-nav">
<ul>
<li><a href="@Url.Action("Index",new { XPJAX=true})" title="服务管理" class="board-group popup activate" data-pjax=".page-content"><i class="icon-service"></i><span class="nav-level-span">服务管理</span></a></li>
<li><a href="@Url.Action("ServiceSubscriber",new { XPJAX=true})" class="board-group" title="关联消费"><i class="icon-ref-consume"></i><span class="nav-level-span">关联消费</span></a></li>
<li><a href="@Url.Action("Index",new { XPJAX=true})" title="服务管理" class="board-group @(ViewBag.Selected=="Index"?"popup active":"")" data-pjax=".page-content"><i class="icon-service"></i><span class="nav-level-span">服务管理</span></a></li>
<li><a href="@Url.Action("ServiceSubscriber",new { XPJAX=true})" class="board-group @(ViewBag.Selected=="ServiceSubscriber"?"popup active":"")" data-pjax=".page-content" title="关联消费"><i class="icon-ref-consume"></i><span class="nav-level-span">关联消费</span></a></li>
<li><a href="javascript:;" class="board-group popup " title="服务统计"><i class="icon-calculator"></i><span class="nav-level-span">服务统计</span></a></li>
</ul>
</nav>
Expand Down
33 changes: 19 additions & 14 deletions Surging.ApiGateway/wwwroot/apps/authmanage/assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,28 @@
}

.app-board .app-left-side .app-title {
border-bottom-color: #CCC
border-bottom-color: #CCC;

}

.app-board .app-left-side {
border: 1px solid #ccc;
width: 175px;
width: 200px;
}

.app-board .app-left-side .app-title > i {
margin-right: 5px;
margin-right: 10px;
}

.app-board .app-left-side, .app-board .app-right-side {
background-color: #f9f9f9;
background-color: #444c63;
}

.app-board .app-wrapper {
margin-right: 0;
margin-left: 0;
padding-bottom: 40px;
padding-left: 175px;
padding-left: 200px;
min-height: 100%;
background-color: #fff;
box-shadow: none;
Expand All @@ -66,17 +67,18 @@

.app-board .app-left-side .app-title,
.app-left-nav ul li.nav-subnav h4 {
color: #585858;
color: #fff;
}

.app-board .app-left-nav ul a {
padding: 12px 5px 12px 20px;
color: #585858;
color: #fff;
}

.app-board .app-left-nav ul a:hover, .app-board .app-left-nav ul .activate {
.app-board .app-left-nav ul a:hover, .app-board .app-left-nav ul .active {
color: #fff;
background-color: #3b75a5;
background-color: #27314c;
border-left: 3px solid #4489ca
}

.app-board .app-right-side {
Expand Down Expand Up @@ -113,7 +115,7 @@
padding: 10px 0;
text-align: center;
border-top: solid 1px #ccc;
background-color: #f2f2f2;
background-color: #444c63;
}

.app-left-side .sidebar-toggle:before {
Expand All @@ -133,10 +135,10 @@
position: relative;
padding: 2px 5px;
cursor: pointer;
color: #AAA;
color: #fff;
border: 1px solid #BBB;
border-radius: 100%;
background-color: #FFF;
background-color: #27314c;
}

.app-left-side .sidebar-toggle > .icon:hover {
Expand Down Expand Up @@ -180,9 +182,12 @@
height: 44px;
padding-left: 20px;
text-align: left;
background-color: #3b75a5;
background-color: #27314c;
}

.app-left-side .app-left-nav .nav-level-span {
position: absolute;
padding-left: 12px;
}
.app-board .app-left-side.menu-min .app-left-nav li a:hover .nav-level-span,
.app-board .app-left-side.menu-min .app-left-nav li a .nav-level-span:hover {
display: block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
define(function (require, exports, module) {
var $ = jQuery = require('jquery');
var init = function () {
$(".app-board").on("click", "#leftSide-toggle", function () {
var $this = $(this);
if ($this.is(".icon-double-angle-right")) {
$this.attr("class", "icon icon-double-angle-left");
$(".app-left-side").removeClass("menu-min");
} else {
$this.attr("class", "icon icon-double-angle-right");
$(".app-left-side").addClass("menu-min");
}

});
}
exports.init = init;
});
19 changes: 11 additions & 8 deletions Surging.ApiGateway/wwwroot/apps/servicemange/assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@

.app-board .app-left-side {
border: 1px solid #ccc;
width: 175px;
width: 200px;
}

.app-board .app-left-side .app-title > i {
margin-right: 5px;
margin-right: 10px;
}

.app-board .app-left-side, .app-board .app-right-side {
Expand All @@ -49,7 +49,7 @@
margin-right: 0;
margin-left: 0;
padding-bottom: 40px;
padding-left: 175px;
padding-left: 200px;
min-height: 100%;
background-color: #fff;
box-shadow: none;
Expand All @@ -74,10 +74,10 @@
color: #585858;
}

.app-board .app-left-nav ul a:hover, .app-board .app-left-nav ul .activate {
color: #fff;
background-color: #3b75a5;
}
.app-board .app-left-nav ul a:hover, .app-board .app-left-nav ul .active {
color: #fff;
background-color: #3b75a5;
}

.app-board .app-right-side {
background-color: #3b75a5;
Expand Down Expand Up @@ -182,7 +182,10 @@
text-align: left;
background-color: #3b75a5;
}

.app-left-side .app-left-nav .nav-level-span {
position: absolute;
padding-left: 12px;
}
.app-board .app-left-side.menu-min .app-left-nav li a:hover .nav-level-span,
.app-board .app-left-side.menu-min .app-left-nav li a .nav-level-span:hover {
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
}
@font-face {
font-family: 'surgingfonticon';
src: url('../../fonts/surgingfonticon.eot?i1nd9b');
src: url('../../fonts/surgingfonticon.eot?i1nd9b#iefix') format('embedded-opentype'),url('../../fonts/surgingfonticon.woff?i1nd9b') format('woff'),url('../../fonts/surgingfonticon.ttf?i1nd9b') format('truetype'),url('../../fonts/surgingfonticon.svg?i1nd9b#surgingfonticon') format('svg');
src: url('../../fonts/surgingfonticon.eot?i1nd11b');
src: url('../../fonts/surgingfonticon.eot?i1nd11b#iefix') format('embedded-opentype'),url('../../fonts/surgingfonticon.woff?i1nd11b') format('woff'),url('../../fonts/surgingfonticon.ttf?i1nd11b') format('truetype'),url('../../fonts/surgingfonticon.svg?i1nd11b#surgingfonticon') format('svg');
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -408,6 +408,15 @@ a .icon-rotate-90:before, a .icon-rotate-180:before, a .icon-rotate-270:before,
.surging-icon-home:before {
content: "\fd77";
}
.surging-icon-token:before {
content: "\e6b2";
}
.surging-icon-line:before {
content: "\e69c";
}
.surging-icon-blacklist:before {
content: "\e674";
}
.icon-servicemange:before {
content: "\fd69";
}
Expand Down
Binary file modified Surging.ApiGateway/wwwroot/assets/css/fonts/surgingfonticon.eot
Binary file not shown.
Loading

0 comments on commit 6e458db

Please sign in to comment.