You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2017/02/06 10:55:01 UTC
kylin git commit: minor,update reload and unload table style
Repository: kylin
Updated Branches:
refs/heads/master 1f444681d -> 7a6dd1ca3
minor,update reload and unload table style
Signed-off-by: zhongjian <ji...@163.com>
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/7a6dd1ca
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/7a6dd1ca
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/7a6dd1ca
Branch: refs/heads/master
Commit: 7a6dd1ca3a35bb2a0223b7df0762f922c341d0af
Parents: 1f44468
Author: chenzhx <34...@qq.com>
Authored: Mon Feb 6 18:19:49 2017 +0800
Committer: zhongjian <ji...@163.com>
Committed: Mon Feb 6 18:54:47 2017 +0800
----------------------------------------------------------------------
webapp/app/css/AdminLTE.css | 26 ------
webapp/app/js/controllers/sourceMeta.js | 96 +++++++++++---------
.../js/directives/kylin_abn_tree_directive.js | 6 +-
.../app/partials/tables/source_table_tree.html | 4 -
webapp/app/partials/tables/table_detail.html | 3 +-
5 files changed, 57 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/7a6dd1ca/webapp/app/css/AdminLTE.css
----------------------------------------------------------------------
diff --git a/webapp/app/css/AdminLTE.css b/webapp/app/css/AdminLTE.css
index c7740d1..34e94e5 100644
--- a/webapp/app/css/AdminLTE.css
+++ b/webapp/app/css/AdminLTE.css
@@ -4801,29 +4801,3 @@ Gradient Background colors
}
}
-.abn-tree .abn-tree-row .tree-table-btn{
- width: 4%;
- float: right;
- border-radius: 5px;
- margin-right: 5px;
- padding: 3px 16px 2px 5px;
- color: #ffffff;
- position:static;
-}
-.abn-tree .abn-tree-row .tree-table-btn .tooltip{
- overflow:visible;
-}
-.abn-tree .abn-tree-row .btn-info:hover{
- background-color:#269abc;
-}
-.abn-tree > .abn-tree-row.active > .btn-info{
- background-color:#269abc;
- border-left-color:#269abc;
-}
-.abn-tree .abn-tree-row .btn-success:hover{
- background-color:#008d4c;
-}
-.abn-tree > .abn-tree-row.active > .btn-success{
- background-color:#008d4c;
- border-left-color:#008d4c;
-}
http://git-wip-us.apache.org/repos/asf/kylin/blob/7a6dd1ca/webapp/app/js/controllers/sourceMeta.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/sourceMeta.js b/webapp/app/js/controllers/sourceMeta.js
index 5421673..e2fdd66 100755
--- a/webapp/app/js/controllers/sourceMeta.js
+++ b/webapp/app/js/controllers/sourceMeta.js
@@ -132,9 +132,10 @@ KylinApp
});
};
- $scope.reloadTable = function (tableName,projectName){
+ $scope.reloadTable = function (tableName){
+ var delay = $q.defer();
loadingRequest.show();
- TableService.loadHiveTable({tableName: tableName, action: projectName}, {calculate: $scope.isCalculate}, function (result) {
+ TableService.loadHiveTable({tableName: tableName, action: $scope.projectModel.selectedProject}, {calculate: $scope.isCalculate}, function (result) {
var loadTableInfo = "";
angular.forEach(result['result.loaded'], function (table) {
loadTableInfo += "\n" + table;
@@ -153,7 +154,7 @@ KylinApp
SweetAlert.swal('Partial loaded!', 'The following table(s) have been successfully loaded: ' + loadTableInfo + "\n\n Failed to load following table(s):" + unloadedTableInfo, 'warning');
}
loadingRequest.hide();
- $scope.aceSrcTbLoaded(true);
+ delay.resolve("");
}, function (e) {
if (e.data && e.data.exception) {
var message = e.data.exception;
@@ -164,49 +165,58 @@ KylinApp
}
loadingRequest.hide();
})
+ return delay.promise;
}
- $scope.removeList = function (tableName,projectName) {
- if (tableName.trim() === "") {
- SweetAlert.swal('', 'Please input table(s) you want to unload.', 'info');
- return;
- }
- if (!projectName) {
- SweetAlert.swal('', 'Please choose your project first!.', 'info');
- return;
- }
- loadingRequest.show();
- TableService.unLoadHiveTable({tableName: tableName, action: projectName}, {}, function (result) {
- var removedTableInfo = "";
- angular.forEach(result['result.unload.success'], function (table) {
- removedTableInfo += "\n" + table;
- })
- var unRemovedTableInfo = "";
- angular.forEach(result['result.unload.fail'], function (table) {
- unRemovedTableInfo += "\n" + table;
- })
- if (result['result.unload.fail'].length != 0 && result['result.unload.success'].length == 0) {
- SweetAlert.swal('Failed!', 'Failed to unload following table(s): ' + unRemovedTableInfo, 'error');
- }
- if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length == 0) {
- SweetAlert.swal('Success!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo, 'success');
- }
- if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length != 0) {
- SweetAlert.swal('Partial unloaded!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo + "\n\n Failed to unload following table(s):" + unRemovedTableInfo, 'warning');
- }
- loadingRequest.hide();
- $scope.aceSrcTbLoaded(true);
- }, function (e) {
- if (e.data && e.data.exception) {
- var message = e.data.exception;
- var msg = !!(message) ? message : 'Failed to take action.';
- SweetAlert.swal('Oops...', msg, 'error');
- } else {
- SweetAlert.swal('Oops...', "Failed to take action.", 'error');
+ $scope.unloadTable = function (tableName) {
+ SweetAlert.swal({
+ title: "",
+ text: "Are you sure to unload this table?",
+ showCancelButton: true,
+ confirmButtonColor: '#DD6B55',
+ confirmButtonText: "Yes",
+ cancelButtonText: "No",
+ closeOnConfirm: true
+ }, function (isConfirm) {
+ if (isConfirm) {
+ if (!$scope.projectModel.selectedProject) {
+ SweetAlert.swal('', 'Please choose your project first!.', 'info');
+ return;
+ }
+ loadingRequest.show();
+ TableService.unLoadHiveTable({tableName: tableName, action: $scope.projectModel.selectedProject}, {}, function (result) {
+ var removedTableInfo = "";
+ angular.forEach(result['result.unload.success'], function (table) {
+ removedTableInfo += "\n" + table;
+ })
+ var unRemovedTableInfo = "";
+ angular.forEach(result['result.unload.fail'], function (table) {
+ unRemovedTableInfo += "\n" + table;
+ })
+ if (result['result.unload.fail'].length != 0 && result['result.unload.success'].length == 0) {
+ SweetAlert.swal('Failed!', 'Failed to unload following table(s): ' + unRemovedTableInfo, 'error');
+ }
+ if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length == 0) {
+ SweetAlert.swal('Success!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo, 'success');
+ }
+ if (result['result.unload.success'].length != 0 && result['result.unload.fail'].length != 0) {
+ SweetAlert.swal('Partial unloaded!', 'The following table(s) have been successfully unloaded: ' + removedTableInfo + "\n\n Failed to unload following table(s):" + unRemovedTableInfo, 'warning');
+ }
+ loadingRequest.hide();
+ $scope.aceSrcTbLoaded(true);
+ }, function (e) {
+ if (e.data && e.data.exception) {
+ var message = e.data.exception;
+ var msg = !!(message) ? message : 'Failed to take action.';
+ SweetAlert.swal('Oops...', msg, 'error');
+ } else {
+ SweetAlert.swal('Oops...', "Failed to take action.", 'error');
+ }
+ loadingRequest.hide();
+ })
}
- loadingRequest.hide();
})
}
@@ -392,7 +402,9 @@ KylinApp
}
$scope.cancel();
- scope.reloadTable ($scope.tableNames,projectName);
+ scope.reloadTable($scope.tableNames).then(function(){
+ scope.aceSrcTbLoaded(true);
+ });
}
http://git-wip-us.apache.org/repos/asf/kylin/blob/7a6dd1ca/webapp/app/js/directives/kylin_abn_tree_directive.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/kylin_abn_tree_directive.js b/webapp/app/js/directives/kylin_abn_tree_directive.js
index 7545666..9466b6a 100644
--- a/webapp/app/js/directives/kylin_abn_tree_directive.js
+++ b/webapp/app/js/directives/kylin_abn_tree_directive.js
@@ -31,13 +31,9 @@
'$timeout', function($timeout) {
return {
restrict: 'E',
- template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n <li data=\"{{row.branch.fullName}}\" ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\" ><a ng-click=\"user_clicks_branch(row.branch)\" ng-dblclick=\"user_dbClicks_branch(row.branch)\" style=\"width:80%;float:left;\"><i ng-class=\"row.tree_icon\" class=\"indented tree-icon\" > </i><span class=\"indented tree-label\">{{ row.label }} </span></a> <a class=\"btn btn-xs btn-info tree-table-btn\" ng-if=\"row.branch.data.exd&&row.level==2&&userService.hasRole('ROLE_ADMIN')&&row.branch.data.source_type==0 \" tooltip=\"UnLoad Hive Table\" tooltip-placement=\"left\" ng-click=\"unloadTable({tableName:row.branch.label,projectName:projectName})\" ><i class=\"fa fa-remove\"></i></a> <a class=\"btn btn-xs btn-success tree-ta
ble-btn\" tooltip-placement=\"left\" tooltip=\"ReLoad Hive Table\" ng-if=\"row.level==2&&userService.hasRole('ROLE_ADMIN')&&row.branch.data.source_type==0\" ng-click=\"reloadTable({tableName:row.branch.label,projectName:projectName})\"><i class=\"fa fa-download\"></i></a> </li>\n</ul>",
+ template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n <li ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\"><a ng-click=\"user_clicks_branch(row.branch)\" ng-dblclick=\"user_dbClicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\" class=\"indented tree-icon\"> </i><span class=\"indented tree-label\">{{ row.label }} </span></a></li>\n</ul>",
replace: true,
scope: {
- userService:'=',
- reloadTable:'&',
- unloadTable:'&',
- projectName:'@',
treeData: '=',
onSelect: '&',
onDblclick:'&',
http://git-wip-us.apache.org/repos/asf/kylin/blob/7a6dd1ca/webapp/app/partials/tables/source_table_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_table_tree.html b/webapp/app/partials/tables/source_table_tree.html
index eb1ad79..e8ec286 100755
--- a/webapp/app/partials/tables/source_table_tree.html
+++ b/webapp/app/partials/tables/source_table_tree.html
@@ -36,10 +36,6 @@
<!--tree-->
<div style="width:100%; height:{{window}}px; overflow:auto;">
<abn-tree
- user-service = "userService"
- reload-table = "reloadTable(tableName,projectName)"
- unload-table = "removeList(tableName,projectName)"
- project-name = "{{projectModel.selectedProject}}"
tree-data = "tableModel.selectedSrcDb"
tree-control = "my_tree"
icon-leaf = "fa fa-columns"
http://git-wip-us.apache.org/repos/asf/kylin/blob/7a6dd1ca/webapp/app/partials/tables/table_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/table_detail.html b/webapp/app/partials/tables/table_detail.html
index f227826..7f299b4 100644
--- a/webapp/app/partials/tables/table_detail.html
+++ b/webapp/app/partials/tables/table_detail.html
@@ -19,7 +19,8 @@
<div ng-controller="SourceMetaCtrl" class="nav-tabs-custom">
<div class="col-xs-12" ng-show="tableModel.selectedSrcDb&&tableModel.selectedSrcTable.name">
<h3 class="text-info">Table Schema:{{ tableModel.selectedSrcTable.name}}</h3>
-
+ <a class="btn btn-primary pull-right" ng-if="userService.hasRole('ROLE_ADMIN')" ng-click="unloadTable(tableModel.selectedSrcTable.database+'.'+tableModel.selectedSrcTable.name)" style="margin-left:10px;" ><span class="fa fa-remove"></span> Unload Table</a>
+ <a class="btn btn-success pull-right" ng-if="tableModel.selectedSrcTable.source_type==0&&userService.hasRole('ROLE_ADMIN')" ng-click="reloadTable(tableModel.selectedSrcTable.database+'.'+tableModel.selectedSrcTable.name)" style="margin-left:10px;" ><span class="fa fa-download"></span> Reload Table</a>
<div class="tabbable nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">