增加检索功能

This commit is contained in:
wu ming 2016-09-18 18:51:04 +08:00
parent 32ac1beeda
commit 267f87a09e
18 changed files with 999 additions and 763 deletions

View File

@ -36,7 +36,8 @@
"urijs": "~1.17.0",
"hawtio-kubernetes-api": "~2.0.0",
"human-date": "^1.3.2",
"js-yaml": "^3.5.4"
"js-yaml": "^3.5.4",
"ng-table": "^1.0.0"
},
"overrides": {
"term.js": {

View File

@ -16,4 +16,5 @@ declare module Configs {
function shareInit($scope: any, $location: any, $routeParams: any): void;
function createNewObejct(array: Array<any>, obj: any): any[];
function oracleInfoOperate($http: any, url: string, operate: string, resource: any, fn?: (data, status) => void): void;
function createConfigHelperNavBar($scope: any, $location: any, $routeParams: any): any;
}

View File

@ -24,9 +24,12 @@ declare module Configs {
class ConfigsModelService {
cluster: Array<volume>;
oracleParam: Array<oracleParam>;
systemInfo: Array<any>;
regionalismInfo: Array<any>;
constructor();
updateAllData(): void;
updateVolumeData(): void;
updateCodeInfo(): void;
updateOracleParam(): void;
getFolderByVolumeName(name: string): any[];
}

View File

@ -1,4 +1,5 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
declare module Developer {
var context: string;
var hash: string;

10
defs.d.ts vendored
View File

@ -1,6 +1,10 @@
/// <reference path="d.ts/includes.d.ts"/>
/// <reference path="d.ts/configs/ts/configPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/utilHelpers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/readPlacedivision.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/configs/ts/ConfigsHelper.d.ts"/>
@ -8,11 +12,9 @@
/// <reference path="d.ts/configs/ts/configsUtils.d.ts"/>
/// <reference path="d.ts/configs/ts/glusterfsSetting.d.ts"/>
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
/// <reference path="d.ts/configs/ts/regionalismCodeSearch.d.ts"/>
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/utilHelpers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/readPlacedivision.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
/// <reference path="d.ts/configs/ts/systemCodeSearch.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"/>

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.181",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="libs/patternfly/dist/css/patternfly.css" />
<link rel="stylesheet" href="libs/patternfly/dist/css/patternfly-additions.css" />
<!--<link rel="stylesheet" type="text/css" href="style.css" />
<!-- bower:css -->
<link rel="stylesheet" href="libs/nvd3/build/nv.d3.css" />
<link rel="stylesheet" href="libs/codemirror/lib/codemirror.css" />
@ -22,11 +22,15 @@
<link rel="stylesheet" href="libs/hawtio-forms/dist/hawtio-forms.css" />
<link rel="stylesheet" href="libs/hawtio-forms/dist/bootstrap-combobox.css" />
<link rel="stylesheet" href="libs/kubernetes-container-terminal/dist/container-terminal.css" />
<link rel="stylesheet" href="libs/ng-table/dist/ng-table.css" />
<!-- endbower -->
<link rel="stylesheet" type="text/css" href="libs/angular-tree-control/css/tree-control-attribute.css">
<link rel="stylesheet" type="text/css" href="libs/angular-tree-control/css/tree-control.css">
<link rel="stylesheet" href="dist/hawtio-kubernetes.css" />
<link rel="stylesheet" type="text/css" href="new/sj_style.css">
<link rel="stylesheet" type="text/css" href="new/sj_style.css">
<!-- ng-table-->
<link rel="stylesheet" href="libs/ng-table/dist/ng-table.min.css">
<!-- bower:js -->
<script src="libs/jquery/dist/jquery.js"></script>
<script src="libs/angular/angular.js"></script>
@ -93,6 +97,9 @@
<script type="text/javascript" src="libs/codemirror/mode/properties/properties.js"></script>
<script type="text/javascript" src="libs/codemirror/mode/clike/clike.js"></script>
<script type="text/javascript" src="libs/codemirror/mode/yaml/yaml.js"></script>
<!-- ng-table-->
<script type="text/javascript" src="libs/ng-table/dist/ng-table.js"></script>
<!-- link for js when using the tree as -->
<script type="text/javascript" src="libs/angular-tree-control/angular-tree-control.js"></script>
<script src="libs/bootstrap/dist/js/bootstrap.js"></script>
@ -100,7 +107,8 @@
<script src="libs/hawtio-extension-service/dist/hawtio-extension-service.js"></script>
<script src="libs/hawtio-preferences/dist/hawtio-preferences.js"></script>
<!-- NOTE we need to make sure this is loaded much later than d3.js! -->
<script src="libs/nvd3/build/nv.d3.js"></script>
<script src="libs/nvd3/build/nv.d3.js"></script>
<style>
.navbar-brand > img {
height: 20px;
@ -134,6 +142,11 @@
<a href="/" class="log fl sj_logo"><img src="new/images/logo.png" class="log-img"></a>
<ul class="nav navbar-nav navbar-primary sj_topnav " hawtio-main-nav></ul>
<ul class="nav navbar-nav navbar-utility sj_setting">
<li class="">
<a href="/config/regionalism-code/searching" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-search"></span> 帮助
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-cog"></span> 配置<b class="caret"></b>

View File

@ -23,7 +23,7 @@ module Configs{
label: "服务集群配置",
title: "配置服务集群信息",
href: UrlHelpers.join(context, "/kube-cluster/setting")
}]
}]
}]);
function createConfigBreadcrumbs($scope, $location, $routeParams){
@ -37,7 +37,7 @@ module Configs{
case "/config/kube-cluster/setting":
label = "服务集群配置";
title= "配置服务集群信息";
break;
break;
default:
break;
}
@ -98,8 +98,7 @@ module Configs{
$http({
method: "POST",
url: RESTfulUrl,
params: resource,
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
params: resource,
transformRequest: function(obj) {
var str = [];
for(var p in obj)
@ -115,6 +114,21 @@ module Configs{
if(angular.isFunction(fn))
fn(data, status);
});
}
export function createConfigHelperNavBar($scope, $location, $routeParams){
return Developer.activateCurrent([
{
href: UrlHelpers.join(context, "regionalism-code/searching"),
label: "行政区划检索",
title: "检索行政区划代码"
},
{
href: UrlHelpers.join(context,"system-code/searching"),
label: "系统编码检索",
title: "检索系统编码"
}
]);
}
}

View File

@ -6,13 +6,15 @@ module Configs {
export var context = "/config";
export var pluginPath = 'plugins/configs/';
export var templatePath = pluginPath + 'html/';
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3']);
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'ngTable']);
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))
$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, 'regionalism-code/searching'), route('regionalismCodeSearch.html', false))
.when(UrlHelpers.join(context, 'system-code/searching'), route('systemCodeSearch.html', false))
.when(context, {redirectTo: UrlHelpers.join(context, '/kube-cluster/setting')});
}]);
@ -21,6 +23,7 @@ module Configs {
var template = $templateCache.get<string>(UrlHelpers.join(templatePath, "configMenuItem.html"));
return $compile(template)($scope);
});
viewRegistry['config'] = templatePath + "shareLayout.html";
}]);

View File

@ -41,6 +41,8 @@ module Configs{
export class ConfigsModelService{
public cluster: Array<volume>=[];
public oracleParam: Array<oracleParam>=[];
public systemInfo: Array<any> =[];
public regionalismInfo: Array<any> = [];
public constructor(){
this.updateAllData();
@ -49,6 +51,7 @@ module Configs{
public updateAllData(){
this.updateVolumeData();
this.updateOracleParam();
this.updateCodeInfo();
}
public updateVolumeData(){
var result=null;
@ -67,6 +70,22 @@ module Configs{
}
public updateCodeInfo(){
var result=null;
$.ajax({
async: false,
type : "POST",
url : "/java/console/api/code/list",
success : function(data) {
if(data){
result = data;
}
}
});
this.regionalismInfo = result.regionalism;
this.systemInfo = result.system;
}
public updateOracleParam(){
var result=null;
$.ajax({

View File

@ -6,10 +6,10 @@
<div hawtio-tabs></div>
</div>
<div class="container-content ">
<div class="row align-center mb10" ng-hide="true">
<div class="row align-center mb10" ng-hide="model.transferTasks.length">
<p class="alert alert-info">当前没有可以查看的任务列表!</p>
</div>
<div class="row mb10" ng-show="model.data.length">
<div class="row mb10" ng-show="model.transferTasks.length">
<table class="table table-bordered table-striped sj_content_table" hawtio-simple-table="tableConfig" />
</div>
</div>

View File

@ -44,7 +44,6 @@ module Developer{
version: "版本"+version
}
}
function createKey(regionalismCode, systemId, version){
return regionalismCode + "-" + systemId + "-" + version;
}
@ -99,6 +98,21 @@ module Developer{
return options.createParamData();
}
function formatTask(items:Array<any>){
var result = [];
angular.forEach(items, (item) => {
result.push({
id: item.id,
_key: item.regionalismCode + "-" + item.systemCode + "-" + item.dataVersion,
name: item.cityName+ "-" + item.districtName,
systemName: item.systemName,
status: item.completeStatus,
process: item.rate
});
});
return result;
}
export class DataModelService{
public data:Array<any> = [];
public paramOptions: OptionsParams = new OptionsParams();
@ -160,11 +174,11 @@ module Developer{
url : "/java/console/api/task/transfer/list",
success : function(data) {
if(data){
result = data;
result = data;
}
}
});
this.transferTasks = result;
this.transferTasks = formatTask(result);
},1500);
timer.then(() =>{
@ -174,7 +188,7 @@ module Developer{
}, () =>{
console.log("每次都更新");
});
}
}
}
//创建数据模型服务

View File

@ -1,4 +1,6 @@
/// <reference path="../../includes.ts"/>
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts" />
module Developer {
export var context = '/workspaces';

View File

@ -6,14 +6,10 @@
module Developer {
export var KubeTaskController = controller("KubeTaskController", ["$scope", "$http", "$location", "$routeParams", "DataModel", "$templateCache", ($scope, $http, $location, $routeParams, DataModel, $templateCache) => {
$scope.model = DataModel;
$scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
$scope.model.data = [{_key: 2, name: "南京市-玄武区", labels:{system: 34, batch: 2}, status: 1, process:75},
{_key: 4, name: "南京市-雨花区", labels:{system: 14, batch: 1}, status: 0, process:0},
{_key: 5, name: "南京市-六合区", labels:{system: 76, batch: 1}, status: 2, process:100},
{_key: 6, name: "南京市-浦口区", labels:{system: 76, batch: 1}, status: 3, process:97}];
$scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
$scope.tableConfig = {
data: 'model.data',
data: 'model.transferTasks',
showSelectionCheckbox: false,
enableRowClickSelection: false,
multiSelect: true,
@ -68,10 +64,13 @@ module Developer {
$scope.$on("deleteRow", (event, data) =>{
console.log("确认删除");
console.log(data);
if(data.status === 1)
console.log("无法删除");
else{
Configs.oracleInfoOperate($http, "/java/console/api/task", Configs.OperateType.DELETE, data, (data, status) =>{
Configs.oracleInfoOperate($http, "/java/console/api/task/transfer", Configs.OperateType.DELETE, data, (data, status) =>{
if(status === 200)
console.log("删除成功");
});

View File

@ -72,8 +72,9 @@ module Developer {
displayName: '采集时间'
},
{
field: "collectorName",
displayName: '汇总状态'
field: "extractStatus",
displayName: '汇总状态',
cellTemplate: $templateCache.get("dataExtractTemplate.html")
}
]
};
@ -185,6 +186,8 @@ module Developer {
dialog: new UI.Dialog(),
onOk: () => {
var migrationClick = $scope.migrationClick;
console.log($scope.tableConfig.selectedItems);
console.log($scope.selectNode);
Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE,
{
"name": migrationClick.selectedItem.name,

View File

@ -209,18 +209,25 @@
</script>
<script type="text/ng-template" id="taskEdit.html">
<div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.TaskEdit">
<button class="btn sj_btn" ng-click="deleteRow(entity)">
<button class="btn sj_btn" ng-click="showDeleteOne.open(entity)">
<span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
</button>
<div hawtio-confirm-dialog="showDeleteOne.show" title="是否删除任务?" ok-button-text="确认" cancel-button-text="取消" on-cancel="showDeleteOne.onCancelled()" on-ok="showDeleteOne.onOk()">
<div class="dialog-body">
<p>
Are you sure you want to delete all the stuff?
</p>
</div>
</div>
</div>
</script>
<!-- 迁移进度条 -->
<script type="text/ng-template" id="taskProcess.html">
<div class="ngCellText progress" ng-init="entity=row.entity">
<div ng-show="entity.status!==3" class="progress-bar progress-bar-success active sj_progress_bar " role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<div ng-show="entity.status!==3" class="progress-bar progress-bar-success active sj_progress_bar " role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sj_progress_font">{{entity.process}}%</span>
</div>
<div ng-show="entity.status ===3" class="progress-bar progress-bar-danger active sj_progress_bar" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<div ng-show="entity.status ===3" class="progress-bar progress-bar-danger active sj_progress_bar" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sj_progress_font">{{entity.process}}%</span>
</div>
</div>
@ -239,6 +246,12 @@
{{row.entity.$creationDate.relative()}}
</div>
</script>
<script type="text/ng-template" id="dataExtractTemplate.html">
<div class="ngCellText" ng-init="entity=row.entity">
<span ng-show="entity.extractStatus==00"></span>
<span ng-show="entity.extractStatus===1"></span>
</div>
</script>
<div ng-controller="Kubernetes.TopLevel">
<div class="wiki-icon-view" ng-controller="Kubernetes.FileDropController" nv-file-drop nv-file-over uploader="uploader" over-class="ready-drop">
<div class="row kubernetes-view" ng-view></div>

View File

@ -115,6 +115,25 @@ module Kubernetes {
}]);
export var TaskEdit = controller('TaskEdit', ['$scope', ($scope) => {
$scope.showDeleteOne = {
show: false,
item: null,
open: (entity) => {
var showDeleteOne = $scope.showDeleteOne;
showDeleteOne.show = true;
showDeleteOne.item = entity;
},
onOk: () => {
var showDeleteOne = $scope.showDeleteOne;
$scope.$emit('deleteRow', showDeleteOne.item);
},
onCancel: ()=>{
var showDeleteOne = $scope.showDeleteOne;
showDeleteOne.show = false;
showDeleteOne.item = null;
}
};
$scope.deleteRow = (entity) =>{
$scope.$emit('deleteRow', entity);
}