添加服务集群配置界面

This commit is contained in:
wu ming 2016-09-08 22:56:43 +08:00
parent 2570630a36
commit 3aec8f7361
18 changed files with 1141 additions and 954 deletions

View File

@ -1,4 +1,7 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="configPlugin.d.ts" />
/// <reference path="../../developer/ts/developerNavigation.d.ts" />
declare module Configs {
function shareInit($scope: any, $location: any, $routeParams: any): void;
function createNewObejct(array: Array<any>, obj: any): any[];
}

View File

@ -9,4 +9,5 @@ declare module Configs {
templateUrl: string;
reloadOnSearch: boolean;
};
var controller: (name: string, inlineAnnotatedConstructor: any[]) => ng.IModule;
}

View File

@ -1,4 +1,5 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="developerNavigation.d.ts" />
declare module Developer {
function createCurrentSubNavBar($scope: any, $location: any, $routeParams: any): any;
}

View File

@ -60,4 +60,5 @@ declare module Developer {
function environmentInstanceLink(env: any, projectName?: any): string;
function namespaceLink($scope: any, $routeParams: any, path?: any): string;
function normalizeHref(href: string): string;
function activateCurrent(navBarItems: any): any;
}

View File

@ -1,5 +1,6 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="developerHelpers.d.ts" />
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
declare module Developer {
var _module: ng.IModule;
var controller: (name: string, inlineAnnotatedConstructor: any[]) => ng.IModule;

View File

@ -1,5 +1,6 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
/// <reference path="../../kubernetes/ts/kubernetesModel.d.ts" />
/// <reference path="developerEnrichers.d.ts" />
/// <reference path="developerHelpers.d.ts" />
/// <reference path="dataManagerHelper.d.ts" />

11
defs.d.ts vendored
View File

@ -1,15 +1,18 @@
/// <reference path="d.ts/includes.d.ts"/>
/// <reference path="d.ts/configs/ts/configPlugin.d.ts"/>
/// <reference path="d.ts/configs/ts/ConfigsHelper.d.ts"/>
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/configs/ts/configsHelper.d.ts"/>
/// <reference path="d.ts/configs/ts/configsUtils.d.ts"/>
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
/// <reference path="d.ts/developer/ts/developerEnrichers.d.ts"/>
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/developer/ts/environmentPanel.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/home.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJob.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJobs.d.ts"/>

File diff suppressed because one or more lines are too long

View File

@ -249,7 +249,7 @@ gulp.task('connect', ['watch'], function() {
}, {
proto: "http",
port: "8080",
hostname: "192.168.0.101",
hostname: "192.168.0.102",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -1,5 +1,5 @@
<ul ng-controller="Configs.MenuItemController" class="nav nav-pills" role="tablist">
<li ng-repeat="item in menuItem" role="presentation">
<a href="{{item.href}}"><span class="{{item.icon}}"></span> {{item.title}}</a>
<a href="{{item.href}}"><span class="{{item.icon}}"></span> {{item.label}}</a>
</li>
</ul>

View File

@ -1 +1,8 @@
<div class="">hello</div>
<div>
<div class="row">
<div hawtio-breadcrumbs></div>
</div>
<div class="row">
<div hawtio-tabs></div>
</div>
</div>

View File

@ -1 +1,41 @@
<div class="c"> cccc</div>
<div ng-controller="Configs.KubeController">
<div class="row">
<div hawtio-breadcrumbs></div>
</div>
<div class="row">
<div hawtio-tabs></div>
</div>
<div class="container-content container-fluid sj_content">
<div class="row">
<table class="table" hawtio-simple-table="tableConfig" />
</div>
<div class="row">
<div class="col-md-1">
<button class="btn pull-right" ng-click="create()">
<span class="glyphicon glyphicon-plus"></span> 添加
</button>
</div>
</div>
<hr>
<div class="row" ng-show="tableForm.length>=0 && (edit || add)">
<h3 ng-show="edit">编辑汇总库连接信息:</h3>
<h3 ng-show="add">添加汇总库信息:</h3>
<div class="col-md-6 col-md-offset-1">
<form class="form-horizontal" ng-submit="onSubmit(validForm.$valid)" novalidate="novalidate" name="validForm">
<div class="form-group" ng-repeat="item in tableForm">
<label class="col-sm-2 control-label">{{item.name}}</label>
<div class="col-sm-10">
<input type="text" ng-model="item.value">
</div>
</div>
<div class="form-group">
<button class="btn" type='submit'>
<span class="glyphicon glyphicon-save"></span> 保存
</button>
</div>
</form>
</div>
</div>
<hr>
</div>
</div>

View File

@ -1,16 +1,69 @@
/// <reference path="../../includes.ts"/>
/// <reference path="configPlugin.ts"/>
/// <reference path="../../developer/ts/developerNavigation.ts"/>
module Configs{
_module.controller('Configs.MenuItemController',['$scope', '$location', ($scope, $location) => {
$scope.menuItem=[{
icon:"glyphicon glyphicon-cloud-upload",
title:"数据管理配置",
icon: "glyphicon glyphicon-cloud-upload",
label: "数据管理配置",
title: "配置数据存储信息",
href: UrlHelpers.join(context, "/gluster-fs/setting")
},
{
icon:"glyphicon glyphicon-th-list",
title:"服务集群配置",
icon: "glyphicon glyphicon-th-list",
label: "服务集群配置",
title: "配置服务集群信息",
href: UrlHelpers.join(context, "/kube-cluster/setting")
}]
}]);
function createConfigBreadcrumbs($scope, $location, $routeParams){
var url = $location.url();
var label, title;
switch (url) {
case "/config/gluster-fs/setting":
label = "数据管理配置";
title= "配置数据存储信息";
break;
case "/config/kube-cluster/setting":
label = "服务集群配置";
title= "配置服务集群信息";
break;
default:
break;
}
return Developer.activateCurrent([{
href: url,
label: label,//item.label,
title: title//item.title
}]);
}
export function shareInit($scope, $location, $routeParams){
$scope.subTabConfig = createConfigBreadcrumbs($scope, $location, $routeParams);
}
export function createNewObejct(array:Array<any>, obj){
var result =[];
if(obj){
angular.forEach(array, (arr) =>{
result.push({
field: arr.field,
name: arr.displayName,
value: obj[arr.field]
});
});
}else{
angular.forEach(array, (arr) =>{
result.push({
field: arr.field,
name: arr.displayName,
value: null
});
});
}
return result;
}
}

View File

@ -8,17 +8,20 @@ module Configs {
export var templatePath = pluginPath + 'html/';
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3']);
export var route = PluginHelpers.createRoutingFunction(templatePath);
export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
_module.config(['$provide', '$routeProvider', ($provide, $routeProvider) =>{
$routeProvider.when(UrlHelpers.join(context, '/gluster-fs/setting'), route('glusterfsSetting.html', false))
.when(UrlHelpers.join(context, '/kube-cluster/setting'), route('kubeClusterSetting.html', false));
.when(UrlHelpers.join(context, 'kube-cluster/setting'), route('kubeClusterSetting.html', false))
.when(context, {redirectTo: UrlHelpers.join(context, '/kube-cluster/setting')});
}]);
_module.run(['$templateCache', 'HawtioExtension', '$compile', ($templateCache:ng.ITemplateCacheService, ext, $compile:ng.ICompileService) => {
_module.run(['viewRegistry', '$templateCache', 'HawtioExtension', '$compile', (viewRegistry, $templateCache:ng.ITemplateCacheService, ext, $compile:ng.ICompileService) => {
ext.add('config-setting', ($scope) => {
var template = $templateCache.get<string>(UrlHelpers.join(templatePath, "configMenuItem.html"));
return $compile(template)($scope);
});
viewRegistry['config'] = templatePath + "shareLayout.html";
}]);
hawtioPluginLoader.addModule(pluginName);

View File

@ -1,4 +1,5 @@
/// <reference path="../../includes.ts"/>
/// <reference path="developerNavigation.ts"/>
module Developer{
var log = Logger.get('developer-navigation');
export function createCurrentSubNavBar($scope, $location, $routeParams){
@ -45,72 +46,4 @@ module Developer{
}
]);
}
function activateCurrent(navBarItems) {
navBarItems = _.compact(navBarItems);
var injector = HawtioCore.injector;
var $location = injector ? injector.get<ng.ILocationService>("$location") : null;
if ($location) {
var path = normalizeHref(trimQuery($location.path()));
var found = false;
function makeActive(item) {
item.active = true;
found = true;
}
function getHref(item) {
var href = item.href;
var trimHref = trimQuery(href);
return normalizeHref(trimHref);
}
angular.forEach(navBarItems, (item) => {
if (!found && item) {
if (angular.isFunction(item.isActive)) {
if (item.isActive(item, path)) {
makeActive(item);
}
} else {
var trimHref = getHref(item);
if (!trimHref) {
return;
}
if (trimHref === path) {
makeActive(item);
}
}
}
});
// Maybe it's a sub-item of a tab, let's fall back to that maybe
if (!found) {
angular.forEach(navBarItems, (item) => {
if (!found) {
if (!angular.isFunction(item.isActive)) {
var trimHref = getHref(item);
if (!trimHref) {
return;
}
if (_.startsWith(path, trimHref)) {
makeActive(item);
}
}
}
});
}
// still not found, let's log it
if (!found) {
log.debug("No navigation tab found for path:", path);
}
}
return navBarItems;
}
function trimQuery(text) {
if (text) {
var idx = text.indexOf("?");
if (idx >= 0) {
return text.substring(0, idx);
}
}
return text;
}
}

View File

@ -645,7 +645,7 @@ module Developer {
return href.replace(regex, '/');
}
function activateCurrent(navBarItems) {
export function activateCurrent(navBarItems) {
navBarItems = _.compact(navBarItems);
var injector = HawtioCore.injector;
var $location = injector ? injector.get<ng.ILocationService>("$location") : null;

View File

@ -1,6 +1,6 @@
/// <reference path="../../includes.ts"/>
/// <reference path="developerHelpers.ts"/>
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
module Developer {
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'treeControl']);
@ -13,7 +13,6 @@ module Developer {
.when(UrlHelpers.join(context, 'Overview/:type/data-type/all'), route('workspaces.html', false))
.when(UrlHelpers.join(context, 'Overview/:type/data-type/financial'), route('workspaces.html', false))
.when(UrlHelpers.join(context, 'Overview/:type/data-type/social-security'), route('workspaces.html', false))
.when(UrlHelpers.join(context, 'task'), route('apps.html', false))
.otherwise(context);
}]);

View File

@ -1,6 +1,6 @@
/// <reference path="../../includes.ts"/>
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
/// <reference path="../../kubernetes/ts/kubernetesModel.ts"/>
/// <reference path="developerEnrichers.ts"/>
/// <reference path="developerHelpers.ts"/>
/// <reference path="dataManagerHelper.ts"/>
@ -8,9 +8,10 @@
module Developer {
export var WorkspacesController = controller("WorkspacesController", ["$scope", "KubernetesModel", "DataModel","KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL", "$element",
($scope, KubernetesModel:Kubernetes.KubernetesModelService, DataModel:Developer.DataModelService, KubernetesState, $templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL, $element) => {
init($scope,location,$routeParams);
($scope, KubernetesModel: Kubernetes.KubernetesModelService, DataModel:Developer.DataModelService, KubernetesState, $templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL, $element) => {
init($scope, $location, $routeParams);
console.log($location.url());
$scope.model=DataModel;
$scope.model.initParamOptions();
$scope.options = DataModel.paramOptions;