@@ -121,9 +121,13 @@
+
+
+
+
diff --git a/apollo-portal/src/main/resources/static/scripts/app.js b/apollo-portal/src/main/resources/static/scripts/app.js
index 52dc2b4135a07f4006253bf79c8e316589cd0e4b..20a84e0af4cbe500d3f82fa9608aeffaaa87cbb4 100644
--- a/apollo-portal/src/main/resources/static/scripts/app.js
+++ b/apollo-portal/src/main/resources/static/scripts/app.js
@@ -4,15 +4,20 @@ var appService = angular.module('app.service', ['ngResource']);
/**utils*/
var appUtil = angular.module('app.util', []);
+/** directive */
+var directive_module = angular.module('apollo.directive', ['app.service']);
+
/** page module 定义*/
// 首页
var index_module = angular.module('index', ['toastr', 'app.service', 'app.util', 'angular-loading-bar']);
//项目主页
-var application_module = angular.module('application', ['app.service', 'app.util', 'toastr', 'angular-loading-bar']);
+var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//创建项目页面
-var create_app_module = angular.module('create_app', ['ngResource', 'toastr', 'app.service', 'app.util', 'angular-loading-bar']);
+var create_app_module = angular.module('create_app', ['ngResource', 'apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar']);
//配置同步页面
-var sync_item_module = angular.module('sync_item', ['app.service', 'app.util', 'toastr', 'angular-loading-bar']);
+var sync_item_module = angular.module('sync_item', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
+//namespace
+var namespace_module = angular.module('namespace', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
diff --git a/apollo-portal/src/main/resources/static/scripts/controller/CreateAppController.js b/apollo-portal/src/main/resources/static/scripts/controller/CreateAppController.js
index 3fb55b18cb0d1180798f2d647f62f0705739ded0..505c838d7b43b17c6d7ff3f02b0710a2d775341a 100644
--- a/apollo-portal/src/main/resources/static/scripts/controller/CreateAppController.js
+++ b/apollo-portal/src/main/resources/static/scripts/controller/CreateAppController.js
@@ -5,7 +5,7 @@ create_app_module.controller('CreateAppController', ['$scope', '$window', 'toast
AppService.create('ALL', $scope.app).then(function (result) {
toastr.success('添加成功!');
setInterval(function () {
- $window.location.href = '/views/config.html?#appid=' + result.appId;
+ $window.location.href = '/config.html?#appid=' + result.appId;
}, 1000);
}, function (result) {
toastr.error(AppUtil.errorMsg(result), '添加失败!');
diff --git a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
index 328b9ff506dd64deced3fd334a857baefcccd5e4..080e3a303f8355aac7f56952cc8601f3932e60f1 100644
--- a/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
+++ b/apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
@@ -1,4 +1,4 @@
-application_module.controller("LinkNamespaceController",
+namespace_module.controller("LinkNamespaceController",
['$scope', '$location', '$window', 'toastr', 'AppService', 'AppUtil', 'NamespaceService',
function ($scope, $location, $window, toastr, AppService, AppUtil, NamespaceService) {
diff --git a/apollo-portal/src/main/resources/static/scripts/directive.js b/apollo-portal/src/main/resources/static/scripts/directive.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5e178500f0e95eca912e18295fcf97ce7522bc7
--- /dev/null
+++ b/apollo-portal/src/main/resources/static/scripts/directive.js
@@ -0,0 +1,115 @@
+directive_module.directive('apollonav', function ($compile, $window, AppService, EnvService) {
+ return {
+ restrict: 'E',
+ templateUrl: '../views/common/nav.html',
+ transclude: true,
+ replace: true,
+ link: function (scope, element, attrs) {
+
+ scope.sourceApps = [];
+ scope.copyedApps = [];
+
+ EnvService.find_all_envs().then(function (result) {
+ //default select first env
+ AppService.find_all_app(result[0]).then(function (result) {
+ result.forEach(function (app) {
+ app.selected = false;
+ scope.sourceApps.push(app);
+ });
+ scope.copyedApps = angular.copy(scope.sourceApps);
+ }, function (result) {
+ toastr.error(AppUtil.errorMsg(result), "load apps error");
+ });
+ }, function (result) {
+ toastr.error(AppUtil.errorMsg(result), "load env error");
+ });
+
+ scope.searchKey = '';
+ scope.shouldShowAppList = false;
+ var selectedApp = {};
+ scope.selectApp = function (app) {
+ select(app);
+ };
+
+ scope.changeSearchKey = function () {
+ scope.copyedApps = [];
+ scope.sourceApps.forEach(function (app) {
+ if (app.name.indexOf(scope.searchKey) > -1 || app.appId.indexOf(scope.searchKey) > -1) {
+ scope.copyedApps.push(app);
+ }
+ });
+ scope.shouldShowAppList = true;
+ };
+
+ scope.jumpToConfigPage = function () {
+ if (selectedApp.appId){
+ var needReloadPage = false;
+ if ($window.location.href.indexOf("config.html") > -1){
+ needReloadPage = true;
+ }
+ $window.location.href = '/config.html?#appid=' + selectedApp.appId;
+
+ if (needReloadPage){
+ $window.location.reload();
+ }
+ }
+ };
+
+ //up:38 down:40 enter:13
+ var selectedAppIdx = -1;
+ element.bind("keydown keypress", function (event) {
+
+ if (event.keyCode == 40) {
+ if (selectedAppIdx < scope.copyedApps.length - 1) {
+ clearAppsSelectedStatus();
+ scope.copyedApps[++selectedAppIdx].selected = true;
+ }
+ } else if (event.keyCode == 38) {
+ if (selectedAppIdx >= 1) {
+ clearAppsSelectedStatus();
+ scope.copyedApps[--selectedAppIdx].selected = true;
+ }
+ } else if (event.keyCode == 13) {
+ if (scope.shouldShowAppList){
+ select(scope.copyedApps[selectedAppIdx]);
+ event.preventDefault();
+ }else {
+ scope.jumpToConfigPage();
+ }
+
+ }
+ //强制刷新
+ scope.$apply(function () {
+ scope.copyedApps = scope.copyedApps;
+ });
+ });
+
+ $(".search-input").on("click", function (event) {
+ event.stopPropagation();
+ });
+
+ $(document).on('click', function () {
+ scope.$apply(function () {
+ scope.shouldShowAppList = false;
+ });
+ });
+
+ function clearAppsSelectedStatus() {
+ scope.copyedApps.forEach(function (app) {
+ app.selected = false;
+ })
+
+ }
+
+ function select(app) {
+ selectedApp = app;
+ scope.searchKey = app.name;
+ scope.shouldShowAppList = false;
+ clearAppsSelectedStatus();
+ selectedAppIdx = -1;
+
+ }
+ }
+ }
+
+});
diff --git a/apollo-portal/src/main/resources/static/styles/common-style.css b/apollo-portal/src/main/resources/static/styles/common-style.css
index 251e4d4cb294bb94a5cb623bb7c81ab0d3f8c27b..c2d14a94775b664f7777cf2f7cb6777d36dd4814 100644
--- a/apollo-portal/src/main/resources/static/styles/common-style.css
+++ b/apollo-portal/src/main/resources/static/styles/common-style.css
@@ -15,6 +15,12 @@ a {
cursor: pointer;
}
+.logo {
+ width: 150px;
+ height: 50px;
+ background: url('../img/logo.png') no-repeat
+}
+
.i-20 {
height: 20px;
width: 20px;
@@ -109,9 +115,10 @@ table th {
margin-top: 20px;
}
-.node-treeview{
+.node-treeview {
color: #797979;
}
+
.apps .apps-description {
color: gray;
font-family: "Apple Color Emoji";
@@ -184,9 +191,10 @@ table th {
padding-top: 19px;
}
-.config-item-container .panel{
+.config-item-container .panel {
border-radius: 0px;
}
+
.config-item-container .panel-heading b {
font-size: 18px;
}
@@ -285,3 +293,46 @@ table th {
font-size: 16px;
}
+/*搜索框*/
+::-webkit-scrollbar {
+ width: 0;
+ height: 0;
+ background: rgba(255, 255, 255, 0);
+}
+
+::-webkit-scrollbar-thumb:vertical {
+ background: rgba(255, 255, 255, 0);
+ border-radius: 10px;
+}
+
+::-webkit-scrollbar-thumb:vertical:hover {
+ background: rgba(255, 255, 255, 0);
+}
+
+.app-list {
+ width: 350px;
+ height: 200px;
+ position: absolute;
+ margin-left: 0px;
+ background: #ffffff;
+ border: 1px solid #ddd;
+ overflow-y: scroll;
+ z-index: 1000;
+}
+
+.app-list .app-item {
+ font-size: medium;
+ padding: 5px 10px;
+
+}
+
+.app-list .app-item:hover {
+ color: #ffffff;
+ background: #C3C3C3;
+}
+
+.app-list .app-selected {
+ color: #ffffff;
+ background: #c3c3c3;
+}
+
diff --git a/apollo-portal/src/main/resources/static/views/common/nav.html b/apollo-portal/src/main/resources/static/views/common/nav.html
index f83c2f98033f8369302653072b0b8de8332a44ac..4b3c6f8364664c803015e409737d2b251706650f 100644
--- a/apollo-portal/src/main/resources/static/views/common/nav.html
+++ b/apollo-portal/src/main/resources/static/views/common/nav.html
@@ -1,18 +1,28 @@