You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/01/31 12:57:45 UTC
[47/53] [abbrv] incubator-kylin git commit: hide create proj in prod
hide create proj in prod
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/69395e74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/69395e74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/69395e74
Branch: refs/heads/master
Commit: 69395e7442683f81e43a02475b6e0da84defebda
Parents: 52f7f1b
Author: jiazhong <ji...@ebay.com>
Authored: Mon Jan 26 00:36:31 2015 -0800
Committer: jiazhong <ji...@ebay.com>
Committed: Mon Jan 26 00:36:31 2015 -0800
----------------------------------------------------------------------
.../java/com/kylinolap/rest/DebugTomcat.java | 9 +++--
webapp/app/index.html | 1 +
webapp/app/js/controllers/page.js | 5 ++-
webapp/app/js/directives/directives.js | 3 ++
webapp/app/js/services/kylinProperties.js | 39 ++++++++++++++++++++
webapp/app/partials/cubes/cubes.html | 2 +-
webapp/app/partials/home.html | 2 +-
webapp/app/partials/projects/projects.html | 2 +-
webapp/app/partials/query/query.html | 2 +-
webapp/app/partials/tables/source_metadata.html | 2 +-
10 files changed, 58 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/server/src/main/java/com/kylinolap/rest/DebugTomcat.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/com/kylinolap/rest/DebugTomcat.java b/server/src/main/java/com/kylinolap/rest/DebugTomcat.java
index ea5813d..87028ec 100644
--- a/server/src/main/java/com/kylinolap/rest/DebugTomcat.java
+++ b/server/src/main/java/com/kylinolap/rest/DebugTomcat.java
@@ -38,7 +38,10 @@ public class DebugTomcat {
ClasspathUtil.addClasspath(new File("../examples/test_case_data/sandbox").getAbsolutePath());
String webBase = new File("../webapp/app").getAbsolutePath();
- String apiBase = new File("src/main/webapp").getAbsolutePath();
+// String apiBase = new File("src/main/webapp").getAbsolutePath();
+ if (new File(webBase, "WEB-INF").exists() == false) {
+ throw new RuntimeException("In order to launch Kylin web app from IDE, please make a symblink from webapp/app/WEB-INF to server/src/main/webapp/WEB-INF");
+ }
Tomcat tomcat = new Tomcat();
tomcat.setPort(port);
@@ -49,8 +52,8 @@ public class DebugTomcat {
AprLifecycleListener listener = new AprLifecycleListener();
server.addLifecycleListener(listener);
- tomcat.addWebapp("/kylin", apiBase);
- Context webContext = tomcat.addWebapp("/", webBase);
+// tomcat.addWebapp("/kylin", apiBase);
+ Context webContext = tomcat.addWebapp("/kylin", webBase);
ErrorPage notFound = new ErrorPage();
notFound.setErrorCode(404);
notFound.setLocation("/index.html");
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/webapp/app/index.html b/webapp/app/index.html
index f3cf21a..b1fb25a 100644
--- a/webapp/app/index.html
+++ b/webapp/app/index.html
@@ -90,6 +90,7 @@
<script src="js/directives/directives.js"></script>
<script src="js/factories/graph.js"></script>
<script src="js/services/cache.js"></script>
+<script src="js/services/kylinProperties.js"></script>
<script src="js/services/message.js"></script>
<script src="js/services/access.js"></script>
<script src="js/services/admin.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/js/controllers/page.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/page.js b/webapp/app/js/controllers/page.js
index 3fbf045..6419517 100644
--- a/webapp/app/js/controllers/page.js
+++ b/webapp/app/js/controllers/page.js
@@ -1,6 +1,9 @@
'use strict';
-KylinApp.controller('PageCtrl', function ($scope, $q, AccessService,$modal, $location, $rootScope, $routeParams, $http, UserService,ProjectService,SweetAlert,$cookieStore,$log) {
+KylinApp.controller('PageCtrl', function ($scope, $q, AccessService,$modal, $location, $rootScope, $routeParams, $http, UserService,ProjectService,SweetAlert,$cookieStore,$log,kylinConfig) {
+
+ kylinConfig.init();
+ $scope.kylinConfig = kylinConfig;
$scope.header = {show: true};
$scope.footer = {
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/js/directives/directives.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/directives.js b/webapp/app/js/directives/directives.js
index 264cb05..723567f 100644
--- a/webapp/app/js/directives/directives.js
+++ b/webapp/app/js/directives/directives.js
@@ -47,6 +47,9 @@ KylinApp.directive('kylinPagination', function ($parse, $q) {
scope.reload = function () {
var length = scope.getLength(scope.data);
+ if(!length){
+ return;
+ }
scope.loadFunc(0, scope.limit).then(function (dataLength) {
scope.data = $parse(attrs.data)(scope.$parent);
scope.hasMore = dataLength == scope.limit;
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/js/services/kylinProperties.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/kylinProperties.js b/webapp/app/js/services/kylinProperties.js
new file mode 100644
index 0000000..787aa71
--- /dev/null
+++ b/webapp/app/js/services/kylinProperties.js
@@ -0,0 +1,39 @@
+/**
+* Created by jiazhong on 2015/1/19.
+*/
+KylinApp.service('kylinConfig', function(AdminService,$log) {
+ var _config;
+ var timezone;
+ var deployEnv;
+ this.init = function (){
+ AdminService.config({}, function(config){
+ _config = config.config;
+ },function(e){
+ $log.error("failed to load kylin.properties"+e);
+ });
+ };
+
+ this.getProperty = function(name){
+ var keyIndex = _config.indexOf(name);
+ var keyLength = name.length;
+ var partialResult = _config.substr(keyIndex);
+ var preValueIndex = partialResult.indexOf("=");
+ var sufValueIndex = partialResult.indexOf("\n");
+ return partialResult.substring(preValueIndex+1,sufValueIndex);
+
+ }
+
+ this.getTimeZone = function(){
+ if(!this.timezone){
+ this.timezone = this.getProperty("kylin.rest.timezone").trim();
+ }
+ return this.timezone;
+ }
+
+ this.getDeployEnv = function(){
+ if(!this.deployEnv){
+ this.deployEnv = this.getProperty("deploy.env").trim();
+ }
+ return this.deployEnv.toUpperCase();
+ }
+});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/partials/cubes/cubes.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cubes.html b/webapp/app/partials/cubes/cubes.html
index 21954e0..46b6931 100644
--- a/webapp/app/partials/cubes/cubes.html
+++ b/webapp/app/partials/cubes/cubes.html
@@ -13,7 +13,7 @@
</select>
<!--Project-->
<a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
- <a class="btn btn-xs btn-primary" style="width: 29px" ng-if="userService.hasRole('ROLE_MODELER')" tooltip="Add Project" ng-click="toCreateProj()">
+ <a class="btn btn-xs btn-primary" style="width: 29px" ng-if="userService.hasRole('ROLE_ADMIN')||userService.hasRole('ROLE_MODELER')&&kylinConfig.getDeployEnv()!=='PROD'" tooltip="Add Project" ng-click="toCreateProj()">
<i class="fa fa-plus"></i>
</a>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/partials/home.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/home.html b/webapp/app/partials/home.html
index 2e2c933..9977101 100644
--- a/webapp/app/partials/home.html
+++ b/webapp/app/partials/home.html
@@ -1,6 +1,6 @@
<!--Big Background Image-->
<div class="bg-holder">
- <img src="/image/Himg.png" />
+ <img src="image/Himg.png" />
</div>
<!--Carousel Part-->
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/partials/projects/projects.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/projects/projects.html b/webapp/app/partials/projects/projects.html
index 6a27e2c..c7642e0 100644
--- a/webapp/app/partials/projects/projects.html
+++ b/webapp/app/partials/projects/projects.html
@@ -1,5 +1,5 @@
<div class="page-header">
- <button class="btn btn-primary btn-sm" ng-if="userService.hasRole('ROLE_MODELER')" ng-click="toCreateProj()"><i class="fa fa-plus"></i> Project</button>
+ <button class="btn btn-primary btn-sm" ng-if="userService.hasRole('ROLE_ADMIN')||userService.hasRole('ROLE_MODELER')&&kylinConfig.getDeployEnv()!=='PROD'" ng-click="toCreateProj()"><i class="fa fa-plus"></i> Project</button>
</div>
<div ng-if="!loading && projects.length == 0">
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/partials/query/query.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/query/query.html b/webapp/app/partials/query/query.html
index 71dd33e..4ea775f 100644
--- a/webapp/app/partials/query/query.html
+++ b/webapp/app/partials/query/query.html
@@ -12,7 +12,7 @@
</select>
<!--Project-->
<a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
- <a class="btn btn-xs btn-primary" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
+ <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_ADMIN')||userService.hasRole('ROLE_MODELER')&&kylinConfig.getDeployEnv()!=='PROD'" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
<i class="fa fa-plus"></i>
</a>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/69395e74/webapp/app/partials/tables/source_metadata.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_metadata.html b/webapp/app/partials/tables/source_metadata.html
index d1d18f6..71eaada 100644
--- a/webapp/app/partials/tables/source_metadata.html
+++ b/webapp/app/partials/tables/source_metadata.html
@@ -12,7 +12,7 @@
</select>
<!--Project-->
<a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
- <a class="btn btn-xs btn-primary" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
+ <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_ADMIN')||userService.hasRole('ROLE_MODELER')&&kylinConfig.getDeployEnv()!=='PROD'" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
<i class="fa fa-plus"></i>
</a>