增加检索功能

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", "urijs": "~1.17.0",
"hawtio-kubernetes-api": "~2.0.0", "hawtio-kubernetes-api": "~2.0.0",
"human-date": "^1.3.2", "human-date": "^1.3.2",
"js-yaml": "^3.5.4" "js-yaml": "^3.5.4",
"ng-table": "^1.0.0"
}, },
"overrides": { "overrides": {
"term.js": { "term.js": {

View File

@ -16,4 +16,5 @@ declare module Configs {
function shareInit($scope: any, $location: any, $routeParams: any): void; function shareInit($scope: any, $location: any, $routeParams: any): void;
function createNewObejct(array: Array<any>, obj: any): any[]; function createNewObejct(array: Array<any>, obj: any): any[];
function oracleInfoOperate($http: any, url: string, operate: string, resource: any, fn?: (data, status) => void): void; 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 { class ConfigsModelService {
cluster: Array<volume>; cluster: Array<volume>;
oracleParam: Array<oracleParam>; oracleParam: Array<oracleParam>;
systemInfo: Array<any>;
regionalismInfo: Array<any>;
constructor(); constructor();
updateAllData(): void; updateAllData(): void;
updateVolumeData(): void; updateVolumeData(): void;
updateCodeInfo(): void;
updateOracleParam(): void; updateOracleParam(): void;
getFolderByVolumeName(name: string): any[]; getFolderByVolumeName(name: string): any[];
} }

View File

@ -1,4 +1,5 @@
/// <reference path="../../includes.d.ts" /> /// <reference path="../../includes.d.ts" />
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
declare module Developer { declare module Developer {
var context: string; var context: string;
var hash: 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/includes.d.ts"/>
/// <reference path="d.ts/configs/ts/configPlugin.d.ts"/> /// <reference path="d.ts/configs/ts/configPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/developerNavigation.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/developerHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/> /// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/configs/ts/ConfigsHelper.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/configsUtils.d.ts"/>
/// <reference path="d.ts/configs/ts/glusterfsSetting.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/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/configs/ts/shareController.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/> /// <reference path="d.ts/configs/ts/systemCodeSearch.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/developerPlugin.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/dataManagerModel.d.ts"/>
/// <reference path="d.ts/developer/ts/developerEnrichers.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", proto: "http",
port: "8080", port: "8080",
hostname: "192.168.0.101", hostname: "192.168.0.181",
path: '/java/console/api', path: '/java/console/api',
targetPath: "/" targetPath: "/"
}]; }];

View File

@ -22,11 +22,15 @@
<link rel="stylesheet" href="libs/hawtio-forms/dist/hawtio-forms.css" /> <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/hawtio-forms/dist/bootstrap-combobox.css" />
<link rel="stylesheet" href="libs/kubernetes-container-terminal/dist/container-terminal.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 --> <!-- 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-attribute.css">
<link rel="stylesheet" type="text/css" href="libs/angular-tree-control/css/tree-control.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" 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 --> <!-- bower:js -->
<script src="libs/jquery/dist/jquery.js"></script> <script src="libs/jquery/dist/jquery.js"></script>
<script src="libs/angular/angular.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/properties/properties.js"></script>
<script type="text/javascript" src="libs/codemirror/mode/clike/clike.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> <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 --> <!-- link for js when using the tree as -->
<script type="text/javascript" src="libs/angular-tree-control/angular-tree-control.js"></script> <script type="text/javascript" src="libs/angular-tree-control/angular-tree-control.js"></script>
<script src="libs/bootstrap/dist/js/bootstrap.js"></script> <script src="libs/bootstrap/dist/js/bootstrap.js"></script>
@ -101,6 +108,7 @@
<script src="libs/hawtio-preferences/dist/hawtio-preferences.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! --> <!-- 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> <style>
.navbar-brand > img { .navbar-brand > img {
height: 20px; height: 20px;
@ -134,6 +142,11 @@
<a href="/" class="log fl sj_logo"><img src="new/images/logo.png" class="log-img"></a> <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-primary sj_topnav " hawtio-main-nav></ul>
<ul class="nav navbar-nav navbar-utility sj_setting"> <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"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-cog"></span> 配置<b class="caret"></b> <span class="glyphicon glyphicon-cog"></span> 配置<b class="caret"></b>

View File

@ -99,7 +99,6 @@ module Configs{
method: "POST", method: "POST",
url: RESTfulUrl, url: RESTfulUrl,
params: resource, params: resource,
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
transformRequest: function(obj) { transformRequest: function(obj) {
var str = []; var str = [];
for(var p in obj) for(var p in obj)
@ -117,4 +116,19 @@ module Configs{
}); });
} }
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 context = "/config";
export var pluginPath = 'plugins/configs/'; export var pluginPath = 'plugins/configs/';
export var templatePath = pluginPath + 'html/'; 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 route = PluginHelpers.createRoutingFunction(templatePath);
export var controller = PluginHelpers.createControllerFunction(_module, pluginName); export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
_module.config(['$provide', '$routeProvider', ($provide, $routeProvider) =>{ _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, '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')}); .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")); var template = $templateCache.get<string>(UrlHelpers.join(templatePath, "configMenuItem.html"));
return $compile(template)($scope); return $compile(template)($scope);
}); });
viewRegistry['config'] = templatePath + "shareLayout.html"; viewRegistry['config'] = templatePath + "shareLayout.html";
}]); }]);

View File

@ -41,6 +41,8 @@ module Configs{
export class ConfigsModelService{ export class ConfigsModelService{
public cluster: Array<volume>=[]; public cluster: Array<volume>=[];
public oracleParam: Array<oracleParam>=[]; public oracleParam: Array<oracleParam>=[];
public systemInfo: Array<any> =[];
public regionalismInfo: Array<any> = [];
public constructor(){ public constructor(){
this.updateAllData(); this.updateAllData();
@ -49,6 +51,7 @@ module Configs{
public updateAllData(){ public updateAllData(){
this.updateVolumeData(); this.updateVolumeData();
this.updateOracleParam(); this.updateOracleParam();
this.updateCodeInfo();
} }
public updateVolumeData(){ public updateVolumeData(){
var result=null; 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(){ public updateOracleParam(){
var result=null; var result=null;
$.ajax({ $.ajax({

View File

@ -6,10 +6,10 @@
<div hawtio-tabs></div> <div hawtio-tabs></div>
</div> </div>
<div class="container-content "> <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> <p class="alert alert-info">当前没有可以查看的任务列表!</p>
</div> </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" /> <table class="table table-bordered table-striped sj_content_table" hawtio-simple-table="tableConfig" />
</div> </div>
</div> </div>

View File

@ -44,7 +44,6 @@ module Developer{
version: "版本"+version version: "版本"+version
} }
} }
function createKey(regionalismCode, systemId, version){ function createKey(regionalismCode, systemId, version){
return regionalismCode + "-" + systemId + "-" + version; return regionalismCode + "-" + systemId + "-" + version;
} }
@ -99,6 +98,21 @@ module Developer{
return options.createParamData(); 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{ export class DataModelService{
public data:Array<any> = []; public data:Array<any> = [];
public paramOptions: OptionsParams = new OptionsParams(); public paramOptions: OptionsParams = new OptionsParams();
@ -164,7 +178,7 @@ module Developer{
} }
} }
}); });
this.transferTasks = result; this.transferTasks = formatTask(result);
},1500); },1500);
timer.then(() =>{ timer.then(() =>{

View File

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

View File

@ -7,13 +7,9 @@ module Developer {
export var KubeTaskController = controller("KubeTaskController", ["$scope", "$http", "$location", "$routeParams", "DataModel", "$templateCache", ($scope, $http, $location, $routeParams, DataModel, $templateCache) => { export var KubeTaskController = controller("KubeTaskController", ["$scope", "$http", "$location", "$routeParams", "DataModel", "$templateCache", ($scope, $http, $location, $routeParams, DataModel, $templateCache) => {
$scope.model = DataModel; $scope.model = DataModel;
$scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams); $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.tableConfig = { $scope.tableConfig = {
data: 'model.data', data: 'model.transferTasks',
showSelectionCheckbox: false, showSelectionCheckbox: false,
enableRowClickSelection: false, enableRowClickSelection: false,
multiSelect: true, multiSelect: true,
@ -68,10 +64,13 @@ module Developer {
$scope.$on("deleteRow", (event, data) =>{ $scope.$on("deleteRow", (event, data) =>{
console.log("确认删除");
console.log(data);
if(data.status === 1) if(data.status === 1)
console.log("无法删除"); console.log("无法删除");
else{ 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) if(status === 200)
console.log("删除成功"); console.log("删除成功");
}); });

View File

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

View File

@ -209,9 +209,16 @@
</script> </script>
<script type="text/ng-template" id="taskEdit.html"> <script type="text/ng-template" id="taskEdit.html">
<div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.TaskEdit"> <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;删除 <span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
</button> </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> </div>
</script> </script>
<!-- 迁移进度条 --> <!-- 迁移进度条 -->
@ -239,6 +246,12 @@
{{row.entity.$creationDate.relative()}} {{row.entity.$creationDate.relative()}}
</div> </div>
</script> </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 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="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> <div class="row kubernetes-view" ng-view></div>

View File

@ -115,6 +115,25 @@ module Kubernetes {
}]); }]);
export var TaskEdit = controller('TaskEdit', ['$scope', ($scope) => { 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.deleteRow = (entity) =>{
$scope.$emit('deleteRow', entity); $scope.$emit('deleteRow', entity);
} }