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/04/26 06:18:01 UTC
[29/39] incubator-kylin git commit: KYLIN-722 format local js
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/directives/directives.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/directives.js b/webapp/app/js/directives/directives.js
index f30e8ae..346cd93 100644
--- a/webapp/app/js/directives/directives.js
+++ b/webapp/app/js/directives/directives.js
@@ -14,183 +14,183 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
'use strict';
/* Directives */
KylinApp.directive('kylinPagination', function ($parse, $q) {
- return {
- restrict: 'E',
- scope: {},
- templateUrl: 'partials/directives/pagination.html',
- link: function (scope, element, attrs) {
- var _this = this;
- scope.limit = 15;
- scope.hasMore = false;
- scope.data = $parse(attrs.data)(scope.$parent);
- scope.action = $parse(attrs.action)(scope.$parent);
- scope.loadFunc = $parse(attrs.loadFunc)(scope.$parent);
- scope.autoLoad = true;
-
-
- scope.$watch("action.reload", function (newValue, oldValue) {
- if (newValue != oldValue) {
- scope.reload();
- }
- });
-
- var autoLoad = $parse(attrs.autoLoad)(scope.$parent);
- if (autoLoad==false) {
- scope.autoLoad = autoLoad;
- }
-
- scope.getLength = function (object) {
- if (!object) {
- return 0;
- }
- if (Object.prototype.toString.call(object) === '[object Array]') {
- return object.length;
- }
- else {
- var size = 0, key;
- for (key in object) {
- if (object.hasOwnProperty(key) && key != 'reload') size++;
- }
-
- return size;
- }
- }
-
- scope.reload = function () {
- var length = scope.getLength(scope.data);
- scope.loadFunc(0, scope.limit).then(function (dataLength) {
- scope.data = $parse(attrs.data)(scope.$parent);
- scope.hasMore = dataLength == scope.limit;
-
- return scope.data;
- });
- }
-
- if (scope.autoLoad) {
- scope.reload();
- }
-
- scope.loaded = true;
- return scope.showMore = function () {
- var loadPromise,
- _this = this;
- scope.loaded = false;
- var promises = [];
- var length = scope.getLength(scope.data);
- loadPromise = scope.loadFunc(length, scope.limit).then(function (dataLength) {
- scope.data = $parse(attrs.data)(scope.$parent);
- scope.hasMore = (dataLength == scope.limit);
-
- return scope.data;
- });
- promises.push(loadPromise);
-
- return $q.all(promises).then(function () {
- return scope.loaded = true;
- });
- };
+ return {
+ restrict: 'E',
+ scope: {},
+ templateUrl: 'partials/directives/pagination.html',
+ link: function (scope, element, attrs) {
+ var _this = this;
+ scope.limit = 15;
+ scope.hasMore = false;
+ scope.data = $parse(attrs.data)(scope.$parent);
+ scope.action = $parse(attrs.action)(scope.$parent);
+ scope.loadFunc = $parse(attrs.loadFunc)(scope.$parent);
+ scope.autoLoad = true;
+
+
+ scope.$watch("action.reload", function (newValue, oldValue) {
+ if (newValue != oldValue) {
+ scope.reload();
}
- };
+ });
+
+ var autoLoad = $parse(attrs.autoLoad)(scope.$parent);
+ if (autoLoad == false) {
+ scope.autoLoad = autoLoad;
+ }
+
+ scope.getLength = function (object) {
+ if (!object) {
+ return 0;
+ }
+ if (Object.prototype.toString.call(object) === '[object Array]') {
+ return object.length;
+ }
+ else {
+ var size = 0, key;
+ for (key in object) {
+ if (object.hasOwnProperty(key) && key != 'reload') size++;
+ }
+
+ return size;
+ }
+ }
+
+ scope.reload = function () {
+ var length = scope.getLength(scope.data);
+ scope.loadFunc(0, scope.limit).then(function (dataLength) {
+ scope.data = $parse(attrs.data)(scope.$parent);
+ scope.hasMore = dataLength == scope.limit;
+
+ return scope.data;
+ });
+ }
+
+ if (scope.autoLoad) {
+ scope.reload();
+ }
+
+ scope.loaded = true;
+ return scope.showMore = function () {
+ var loadPromise,
+ _this = this;
+ scope.loaded = false;
+ var promises = [];
+ var length = scope.getLength(scope.data);
+ loadPromise = scope.loadFunc(length, scope.limit).then(function (dataLength) {
+ scope.data = $parse(attrs.data)(scope.$parent);
+ scope.hasMore = (dataLength == scope.limit);
+
+ return scope.data;
+ });
+ promises.push(loadPromise);
+
+ return $q.all(promises).then(function () {
+ return scope.loaded = true;
+ });
+ };
+ }
+ };
})
- .directive('loading', function ($parse, $q) {
- return {
- restrict: 'E',
- scope: {},
- templateUrl: 'partials/directives/loading.html',
- link: function (scope, element, attrs) {
- scope.text = (!!!attrs.text) ? 'Loading...' : attrs.text;
- }
+ .directive('loading', function ($parse, $q) {
+ return {
+ restrict: 'E',
+ scope: {},
+ templateUrl: 'partials/directives/loading.html',
+ link: function (scope, element, attrs) {
+ scope.text = (!!!attrs.text) ? 'Loading...' : attrs.text;
+ }
+ };
+ })
+ .directive('noResult', function ($parse, $q) {
+ return {
+ scope: {},
+ templateUrl: 'partials/directives/noResult.html',
+ link: function (scope, element, attrs) {
+ scope.text = (!!!attrs.text) ? 'No Result.' : attrs.text;
+ }
+ };
+ })
+ .directive('typeahead', function ($timeout, $filter) {
+ return {
+ restrict: 'AEC',
+ scope: {
+ items: '=',
+ prompt: '@',
+ title: '@',
+ model: '=',
+ required: '@'
+ },
+ templateUrl: 'partials/directives/typeahead.html',
+ link: function (scope, elem, attrs) {
+ scope.current = null;
+ scope.selected = true; // hides the list initially
+
+ scope.handleSelection = function () {
+ scope.model = scope.current[scope.title];
+ scope.current = null;
+ scope.selected = true;
};
- })
- .directive('noResult', function ($parse, $q) {
- return {
- scope: {},
- templateUrl: 'partials/directives/noResult.html',
- link: function (scope, element, attrs) {
- scope.text = (!!!attrs.text) ? 'No Result.' : attrs.text;
- }
+ scope.isCurrent = function (item) {
+ return scope.current == item;
};
- })
- .directive('typeahead', function ($timeout, $filter) {
- return {
- restrict: 'AEC',
- scope: {
- items: '=',
- prompt: '@',
- title: '@',
- model: '=',
- required: '@'
- },
- templateUrl: 'partials/directives/typeahead.html',
- link: function (scope, elem, attrs) {
- scope.current = null;
- scope.selected = true; // hides the list initially
-
- scope.handleSelection = function () {
- scope.model = scope.current[scope.title];
- scope.current = null;
- scope.selected = true;
- };
- scope.isCurrent = function (item) {
- return scope.current == item;
- };
- scope.setCurrent = function (item) {
- scope.current = item;
- };
- scope.keyListener = function (event) {
- var list, idx;
- switch (event.keyCode) {
- case 13:
- scope.handleSelection();
- break;
- case 38:
- list = $filter('filter')(scope.items, {name: scope.model});
- scope.candidates = $filter('orderBy')(list, 'name');
- idx = scope.candidates.indexOf(scope.current);
- if (idx > 0) {
- scope.setCurrent(scope.candidates[idx - 1]);
- } else if (idx == 0) {
- scope.setCurrent(scope.candidates[scope.candidates.length - 1]);
- }
- break;
- case 40:
- list = $filter('filter')(scope.items, {name: scope.model});
- scope.candidates = $filter('orderBy')(list, 'name');
- idx = scope.candidates.indexOf(scope.current);
- if (idx < scope.candidates.length - 1) {
- scope.setCurrent(scope.candidates[idx + 1]);
- } else if (idx == scope.candidates.length - 1) {
- scope.setCurrent(scope.candidates[0]);
- }
- break;
- default:
- break;
- }
- };
-
- }
+ scope.setCurrent = function (item) {
+ scope.current = item;
};
- })
- .directive('autoFillSync', function($timeout) {
- return {
- require: 'ngModel',
- link: function(scope, elem, attrs, ngModel) {
- var origVal = elem.val();
- $timeout(function () {
- var newVal = elem.val();
- if(ngModel.$pristine && origVal !== newVal) {
- ngModel.$setViewValue(newVal);
- }
- }, 500);
- }
- }
- })
+ scope.keyListener = function (event) {
+ var list, idx;
+ switch (event.keyCode) {
+ case 13:
+ scope.handleSelection();
+ break;
+ case 38:
+ list = $filter('filter')(scope.items, {name: scope.model});
+ scope.candidates = $filter('orderBy')(list, 'name');
+ idx = scope.candidates.indexOf(scope.current);
+ if (idx > 0) {
+ scope.setCurrent(scope.candidates[idx - 1]);
+ } else if (idx == 0) {
+ scope.setCurrent(scope.candidates[scope.candidates.length - 1]);
+ }
+ break;
+ case 40:
+ list = $filter('filter')(scope.items, {name: scope.model});
+ scope.candidates = $filter('orderBy')(list, 'name');
+ idx = scope.candidates.indexOf(scope.current);
+ if (idx < scope.candidates.length - 1) {
+ scope.setCurrent(scope.candidates[idx + 1]);
+ } else if (idx == scope.candidates.length - 1) {
+ scope.setCurrent(scope.candidates[0]);
+ }
+ break;
+ default:
+ break;
+ }
+ };
+
+ }
+ };
+ })
+ .directive('autoFillSync', function ($timeout) {
+ return {
+ require: 'ngModel',
+ link: function (scope, elem, attrs, ngModel) {
+ var origVal = elem.val();
+ $timeout(function () {
+ var newVal = elem.val();
+ if (ngModel.$pristine && origVal !== newVal) {
+ ngModel.$setViewValue(newVal);
+ }
+ }, 500);
+ }
+ }
+ })
;
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/factories/graph.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/factories/graph.js b/webapp/app/js/factories/graph.js
index 0ce25cc..e02e13a 100644
--- a/webapp/app/js/factories/graph.js
+++ b/webapp/app/js/factories/graph.js
@@ -14,64 +14,64 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('GraphBuilder', function () {
- var graphBuilder = {};
+ var graphBuilder = {};
- graphBuilder.buildLineGraph = function (dimension, metrics, aggregatedData) {
- var values = [];
- angular.forEach(getSortedKeys(aggregatedData), function (sortedKey, index) {
- values.push([(dimension.type == 'date') ? moment(sortedKey).unix() : sortedKey, aggregatedData[sortedKey]]);
- });
+ graphBuilder.buildLineGraph = function (dimension, metrics, aggregatedData) {
+ var values = [];
+ angular.forEach(getSortedKeys(aggregatedData), function (sortedKey, index) {
+ values.push([(dimension.type == 'date') ? moment(sortedKey).unix() : sortedKey, aggregatedData[sortedKey]]);
+ });
- var newGraph = [
- {
- "key": metrics.column.label,
- "values": values
- }
- ];
+ var newGraph = [
+ {
+ "key": metrics.column.label,
+ "values": values
+ }
+ ];
- return newGraph;
- }
+ return newGraph;
+ }
- graphBuilder.buildBarGraph = function (dimension, metrics, aggregatedData) {
- var newGraph = [];
- angular.forEach(getSortedKeys(aggregatedData), function (sortedKey, index) {
- newGraph.push({
- key: sortedKey,
- values: [
- [sortedKey, aggregatedData[sortedKey]]
- ]
- });
- });
+ graphBuilder.buildBarGraph = function (dimension, metrics, aggregatedData) {
+ var newGraph = [];
+ angular.forEach(getSortedKeys(aggregatedData), function (sortedKey, index) {
+ newGraph.push({
+ key: sortedKey,
+ values: [
+ [sortedKey, aggregatedData[sortedKey]]
+ ]
+ });
+ });
- return newGraph;
- }
+ return newGraph;
+ }
- graphBuilder.buildPieGraph = function (dimension, metrics, aggregatedData) {
- var newGraph = [];
- angular.forEach(getSortedKeys(aggregatedData), function (sortedKey, index) {
- newGraph.push({
- key: sortedKey,
- y: aggregatedData[sortedKey]
- });
- });
+ graphBuilder.buildPieGraph = function (dimension, metrics, aggregatedData) {
+ var newGraph = [];
+ angular.forEach(getSortedKeys(aggregatedData), function (sortedKey, index) {
+ newGraph.push({
+ key: sortedKey,
+ y: aggregatedData[sortedKey]
+ });
+ });
- return newGraph;
- }
+ return newGraph;
+ }
- function getSortedKeys(results) {
- var sortedKeys = [];
- for (var k in results) {
- if (results.hasOwnProperty(k)) {
- sortedKeys.push(k);
- }
- }
- sortedKeys.sort();
-
- return sortedKeys;
+ function getSortedKeys(results) {
+ var sortedKeys = [];
+ for (var k in results) {
+ if (results.hasOwnProperty(k)) {
+ sortedKeys.push(k);
+ }
}
+ sortedKeys.sort();
+
+ return sortedKeys;
+ }
- return graphBuilder;
+ return graphBuilder;
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/filters/filter.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/filters/filter.js b/webapp/app/js/filters/filter.js
index 555e31d..7dff440 100755
--- a/webapp/app/js/filters/filter.js
+++ b/webapp/app/js/filters/filter.js
@@ -14,147 +14,149 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
'use strict';
/* Filters */
KylinApp
- .filter('orderObjectBy', function () {
- return function (input, attribute, reverse) {
- if (!angular.isObject(input)) return input;
+ .filter('orderObjectBy', function () {
+ return function (input, attribute, reverse) {
+ if (!angular.isObject(input)) return input;
- var array = [];
- for (var objectKey in input) {
- array.push(input[objectKey]);
- }
+ var array = [];
+ for (var objectKey in input) {
+ array.push(input[objectKey]);
+ }
- array.sort(function (a, b) {
- if (!attribute)
- {
- return 0;
- }
- var result = 0;
- var attriOfA = a, attriOfB = b;
- var temps = attribute.split(".");
- if (temps.length > 1) {
- angular.forEach(temps, function (temp, index) {
- attriOfA = attriOfA[temp];
- attriOfB = attriOfB[temp];
- });
- }
- else {
- attriOfA = a[attribute];
- attriOfB = b[attribute];
- }
-
- if (!attriOfA) {
- result = -1;
- }
- else if (!attriOfB) {
- result = 1;
- }
- else {
- result = attriOfA > attriOfB ? 1 : attriOfA < attriOfB ? -1 : 0;
- }
- return reverse ? -result : result;
- });
- return array;
+ array.sort(function (a, b) {
+ if (!attribute) {
+ return 0;
}
- })
-
- .filter('reverse', function () {
- return function (items) {
- if (items) {
- return items.slice().reverse();
- } else {
- return items;
- }
+ var result = 0;
+ var attriOfA = a, attriOfB = b;
+ var temps = attribute.split(".");
+ if (temps.length > 1) {
+ angular.forEach(temps, function (temp, index) {
+ attriOfA = attriOfA[temp];
+ attriOfB = attriOfB[temp];
+ });
}
- })
- .filter('range', function () {
- return function (input, total) {
- total = parseInt(total);
- for (var i = 0; i < total; i++)
- input.push(i);
- return input;
+ else {
+ attriOfA = a[attribute];
+ attriOfB = b[attribute];
}
- })
- // Convert bytes into human readable format.
- .filter('bytes', function() {
- return function(bytes, precision) {
- if (bytes === 0) { return '0 bytes' };
- if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) {
- return '-';
- }
-
- if (typeof precision === 'undefined') {
- precision = 1;
- }
- var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
- number = Math.floor(Math.log(bytes) / Math.log(1024));
- return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
+ if (!attriOfA) {
+ result = -1;
}
- }).filter('resizePieHeight',function(){
- return function(item){
- if(item<150){
- return 1300;
- }
- return 1300;
+ else if (!attriOfB) {
+ result = 1;
}
- }).filter('utcToConfigTimeZone',function($filter,kylinConfig){
+ else {
+ result = attriOfA > attriOfB ? 1 : attriOfA < attriOfB ? -1 : 0;
+ }
+ return reverse ? -result : result;
+ });
+ return array;
+ }
+ })
- var gmttimezone;
- //convert GMT+0 time to specified Timezone
- return function(item,timezone,format){
+ .filter('reverse', function () {
+ return function (items) {
+ if (items) {
+ return items.slice().reverse();
+ } else {
+ return items;
+ }
+ }
+ })
+ .filter('range', function () {
+ return function (input, total) {
+ total = parseInt(total);
+ for (var i = 0; i < total; i++)
+ input.push(i);
+ return input;
+ }
+ })
+ // Convert bytes into human readable format.
+ .filter('bytes', function () {
+ return function (bytes, precision) {
+ if (bytes === 0) {
+ return '0 bytes'
+ }
+ ;
+ if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) {
+ return '-';
+ }
- // undefined and 0 is not necessary to show
- if(angular.isUndefined(item)||item===0){
- return "";
- }
+ if (typeof precision === 'undefined') {
+ precision = 1;
+ }
- if(angular.isUndefined(timezone)||timezone===''){
- timezone = kylinConfig.getTimeZone()==""?'PST':kylinConfig.getTimeZone();
- }
- if(angular.isUndefined(format)||format===''){
- format ="yyyy-MM-dd HH:mm:ss";
- }
+ var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
+ number = Math.floor(Math.log(bytes) / Math.log(1024));
+ return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
+ }
+ }).filter('resizePieHeight', function () {
+ return function (item) {
+ if (item < 150) {
+ return 1300;
+ }
+ return 1300;
+ }
+ }).filter('utcToConfigTimeZone', function ($filter, kylinConfig) {
- //convert short name timezone to GMT
- switch(timezone){
- //convert PST to GMT
- case "PST":
- gmttimezone= "GMT-8";
- break;
- default:
- gmttimezone = timezone;
- }
+ var gmttimezone;
+ //convert GMT+0 time to specified Timezone
+ return function (item, timezone, format) {
- var localOffset = new Date().getTimezoneOffset();
- var convertedMillis = item;
- if(gmttimezone.indexOf("GMT+")!=-1){
- var offset = gmttimezone.substr(4,1);
- convertedMillis= item+offset*60*60000+localOffset*60000;
- }
- else if(gmttimezone.indexOf("GMT-")!=-1){
- var offset = gmttimezone.substr(4,1);
- convertedMillis= item-offset*60*60000+localOffset*60000;
- }
- else{
- // return PST by default
- timezone="PST";
- convertedMillis = item-8*60*60000+localOffset*60000;
- }
- return $filter('date')(convertedMillis, format)+ " "+timezone;
+ // undefined and 0 is not necessary to show
+ if (angular.isUndefined(item) || item === 0) {
+ return "";
+ }
- }
- }).filter('reverseToGMT0',function($filter){
- //backend store GMT+0 timezone ,by default front will show local,so convert to GMT+0 Date String format
- return function(item) {
- if(item||item==0){
- item += new Date().getTimezoneOffset() * 60000;
- return $filter('date')(item, "yyyy-MM-dd HH:mm:ss");
- }
- }
- });
+ if (angular.isUndefined(timezone) || timezone === '') {
+ timezone = kylinConfig.getTimeZone() == "" ? 'PST' : kylinConfig.getTimeZone();
+ }
+ if (angular.isUndefined(format) || format === '') {
+ format = "yyyy-MM-dd HH:mm:ss";
+ }
+
+ //convert short name timezone to GMT
+ switch (timezone) {
+ //convert PST to GMT
+ case "PST":
+ gmttimezone = "GMT-8";
+ break;
+ default:
+ gmttimezone = timezone;
+ }
+
+ var localOffset = new Date().getTimezoneOffset();
+ var convertedMillis = item;
+ if (gmttimezone.indexOf("GMT+") != -1) {
+ var offset = gmttimezone.substr(4, 1);
+ convertedMillis = item + offset * 60 * 60000 + localOffset * 60000;
+ }
+ else if (gmttimezone.indexOf("GMT-") != -1) {
+ var offset = gmttimezone.substr(4, 1);
+ convertedMillis = item - offset * 60 * 60000 + localOffset * 60000;
+ }
+ else {
+ // return PST by default
+ timezone = "PST";
+ convertedMillis = item - 8 * 60 * 60000 + localOffset * 60000;
+ }
+ return $filter('date')(convertedMillis, format) + " " + timezone;
+
+ }
+ }).filter('reverseToGMT0', function ($filter) {
+ //backend store GMT+0 timezone ,by default front will show local,so convert to GMT+0 Date String format
+ return function (item) {
+ if (item || item == 0) {
+ item += new Date().getTimezoneOffset() * 60000;
+ return $filter('date')(item, "yyyy-MM-dd HH:mm:ss");
+ }
+ }
+ });
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/listeners.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/listeners.js b/webapp/app/js/listeners.js
index 4524696..08a9bf9 100644
--- a/webapp/app/js/listeners.js
+++ b/webapp/app/js/listeners.js
@@ -14,82 +14,82 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
-KylinApp.run(function ($rootScope,$http, $location, UserService, AuthenticationService, MessageService,loadingRequest,SweetAlert) {
+KylinApp.run(function ($rootScope, $http, $location, UserService, AuthenticationService, MessageService, loadingRequest, SweetAlert) {
- $rootScope.permissions = {
- READ: {name: 'CUBE QUERY', value: 'READ', mask: 1},
- MANAGEMENT: {name: 'CUBE EDIT', value: 'MANAGEMENT', mask: 32},
- OPERATION: {name: 'CUBE OPERATION', value: 'OPERATION', mask: 64},
- ADMINISTRATION: {name: 'CUBE ADMIN', value: 'ADMINISTRATION', mask: 16}
- };
+ $rootScope.permissions = {
+ READ: {name: 'CUBE QUERY', value: 'READ', mask: 1},
+ MANAGEMENT: {name: 'CUBE EDIT', value: 'MANAGEMENT', mask: 32},
+ OPERATION: {name: 'CUBE OPERATION', value: 'OPERATION', mask: 64},
+ ADMINISTRATION: {name: 'CUBE ADMIN', value: 'ADMINISTRATION', mask: 16}
+ };
- $rootScope.$on("$routeChangeStart", function () {
- AuthenticationService.ping(function (data) {
- UserService.setCurUser(data);
- });
-
- if ($location.url() == '' || $location.url() == '/') {
- AuthenticationService.ping(function (data) {
- UserService.setCurUser(data);
- $location.path(UserService.getHomePage());
- });
- return;
- }
- });
-
- /**
- * Holds all the requests which failed due to 401 response.
- */
- $rootScope.requests401 = [];
-
- $rootScope.$on('event:loginRequired', function () {
- $rootScope.requests401 = [];
- $location.path('/login');
- loadingRequest.hide();
+ $rootScope.$on("$routeChangeStart", function () {
+ AuthenticationService.ping(function (data) {
+ UserService.setCurUser(data);
});
- /**
- * On 'event:loginConfirmed', resend all the 401 requests.
- */
- $rootScope.$on('event:loginConfirmed', function () {
- var i,
- requests = $rootScope.requests401,
- retry = function (req) {
- $http(req.config).then(function (response) {
- req.deferred.resolve(response);
- });
- };
+ if ($location.url() == '' || $location.url() == '/') {
+ AuthenticationService.ping(function (data) {
+ UserService.setCurUser(data);
+ $location.path(UserService.getHomePage());
+ });
+ return;
+ }
+ });
- for (i = 0; i < requests.length; i += 1) {
- retry(requests[i]);
- }
- $rootScope.requests401 = [];
- });
+ /**
+ * Holds all the requests which failed due to 401 response.
+ */
+ $rootScope.requests401 = [];
- /**
- * On 'logoutRequest' invoke logout on the server.
- */
- $rootScope.$on('event:logoutRequest', function () {
- httpHeaders.common['Authorization'] = null;
- });
+ $rootScope.$on('event:loginRequired', function () {
+ $rootScope.requests401 = [];
+ $location.path('/login');
+ loadingRequest.hide();
+ });
- if ($location.url() == '' || $location.url() == '/') {
- AuthenticationService.ping(function (data) {
- UserService.setCurUser(data);
- $location.path(UserService.getHomePage());
+ /**
+ * On 'event:loginConfirmed', resend all the 401 requests.
+ */
+ $rootScope.$on('event:loginConfirmed', function () {
+ var i,
+ requests = $rootScope.requests401,
+ retry = function (req) {
+ $http(req.config).then(function (response) {
+ req.deferred.resolve(response);
});
- return;
+ };
+
+ for (i = 0; i < requests.length; i += 1) {
+ retry(requests[i]);
}
+ $rootScope.requests401 = [];
+ });
- /**
- * On 'event:forbidden', resend all the 403 requests.
- */
- $rootScope.$on('event:forbidden', function (event, message) {
- var msg = !!(message) ? message : 'You don\' have right to take the action.';
- SweetAlert.swal('Oops...', 'Permission Denied: ' + msg, 'error');
+ /**
+ * On 'logoutRequest' invoke logout on the server.
+ */
+ $rootScope.$on('event:logoutRequest', function () {
+ httpHeaders.common['Authorization'] = null;
+ });
+ if ($location.url() == '' || $location.url() == '/') {
+ AuthenticationService.ping(function (data) {
+ UserService.setCurUser(data);
+ $location.path(UserService.getHomePage());
});
+ return;
+ }
+
+ /**
+ * On 'event:forbidden', resend all the 403 requests.
+ */
+ $rootScope.$on('event:forbidden', function (event, message) {
+ var msg = !!(message) ? message : 'You don\' have right to take the action.';
+ SweetAlert.swal('Oops...', 'Permission Denied: ' + msg, 'error');
+
+ });
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/cubeConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeConfig.js b/webapp/app/js/model/cubeConfig.js
index ecdd316..d284f00 100644
--- a/webapp/app/js/model/cubeConfig.js
+++ b/webapp/app/js/model/cubeConfig.js
@@ -1,74 +1,74 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-KylinApp.constant('cubeConfig', {
-
- //~ Define metadata & class
- measureParamType : ['column', 'constant'],
- measureExpressions : ['SUM', 'MIN', 'MAX', 'COUNT', 'COUNT_DISTINCT'],
- dimensionDataTypes : ["string", "tinyint", "int", "bigint", "date"],
- cubeCapacities : ["SMALL", "MEDIUM","LARGE"],
-// cubePartitionTypes : ['APPEND', 'UPDATE_INSERT'],
- cubePartitionTypes : ['APPEND'],
- joinTypes : [
- {name: 'Left', value: 'left'},
- {name: 'Inner', value: 'inner'},
- {name: 'Right', value: 'right'}
- ],
- queryPriorities : [
- {name: 'NORMAL', value: 50},
- {name: 'LOW', value: 70},
- {name: 'HIGH', value: 30}
- ],
- measureDataTypes : [
- {name: 'INT', value: 'int'},
- {name: 'BIGINT', value: 'bigint'},
- {name: 'DECIMAL', value: 'decimal'},
- {name: 'DOUBLE', value: 'double'},
- {name: 'DATE', value: 'date'},
- {name: 'STRING', value: 'string'}
- ],
- distinctDataTypes : [
- {name: 'Error Rate < 9.75%', value: 'hllc10'},
- {name: 'Error Rate < 4.88%', value: 'hllc12'},
- {name: 'Error Rate < 2.44%', value: 'hllc14'},
- {name: 'Error Rate < 1.72%', value: 'hllc15'},
- {name: 'Error Rate < 1.22%', value: 'hllc16'}
- ],
- dftSelections : {
- measureExpression: 'SUM',
- measureParamType: 'column',
- measureDataType: {name: 'BIGINT', value: 'bigint'},
- distinctDataType: {name: 'Error Rate < 4.88%', value: 'hllc12'},
- cubeCapacity: 'MEDIUM',
- queryPriority: {name: 'NORMAL', value: 50},
- cubePartitionType: 'APPEND'
- },
- dictionaries : ["true", "false"],
-
-// cubes config
- theaditems : [
- {attr: 'name', name: 'Name'},
- {attr: 'status', name: 'Status'},
- {attr: 'size_kb', name: 'Cube Size'},
- {attr: 'source_records_count', name: 'Source Records'},
- {attr: 'last_build_time', name: 'Last Build Time'},
- {attr: 'owner', name: 'Owner'},
- {attr: 'create_time', name: 'Create Time'}
- ]
- });
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+KylinApp.constant('cubeConfig', {
+
+ //~ Define metadata & class
+ measureParamType: ['column', 'constant'],
+ measureExpressions: ['SUM', 'MIN', 'MAX', 'COUNT', 'COUNT_DISTINCT'],
+ dimensionDataTypes: ["string", "tinyint", "int", "bigint", "date"],
+ cubeCapacities: ["SMALL", "MEDIUM", "LARGE"],
+// cubePartitionTypes : ['APPEND', 'UPDATE_INSERT'],
+ cubePartitionTypes: ['APPEND'],
+ joinTypes: [
+ {name: 'Left', value: 'left'},
+ {name: 'Inner', value: 'inner'},
+ {name: 'Right', value: 'right'}
+ ],
+ queryPriorities: [
+ {name: 'NORMAL', value: 50},
+ {name: 'LOW', value: 70},
+ {name: 'HIGH', value: 30}
+ ],
+ measureDataTypes: [
+ {name: 'INT', value: 'int'},
+ {name: 'BIGINT', value: 'bigint'},
+ {name: 'DECIMAL', value: 'decimal'},
+ {name: 'DOUBLE', value: 'double'},
+ {name: 'DATE', value: 'date'},
+ {name: 'STRING', value: 'string'}
+ ],
+ distinctDataTypes: [
+ {name: 'Error Rate < 9.75%', value: 'hllc10'},
+ {name: 'Error Rate < 4.88%', value: 'hllc12'},
+ {name: 'Error Rate < 2.44%', value: 'hllc14'},
+ {name: 'Error Rate < 1.72%', value: 'hllc15'},
+ {name: 'Error Rate < 1.22%', value: 'hllc16'}
+ ],
+ dftSelections: {
+ measureExpression: 'SUM',
+ measureParamType: 'column',
+ measureDataType: {name: 'BIGINT', value: 'bigint'},
+ distinctDataType: {name: 'Error Rate < 4.88%', value: 'hllc12'},
+ cubeCapacity: 'MEDIUM',
+ queryPriority: {name: 'NORMAL', value: 50},
+ cubePartitionType: 'APPEND'
+ },
+ dictionaries: ["true", "false"],
+
+// cubes config
+ theaditems: [
+ {attr: 'name', name: 'Name'},
+ {attr: 'status', name: 'Status'},
+ {attr: 'size_kb', name: 'Cube Size'},
+ {attr: 'source_records_count', name: 'Source Records'},
+ {attr: 'last_build_time', name: 'Last Build Time'},
+ {attr: 'owner', name: 'Owner'},
+ {attr: 'create_time', name: 'Create Time'}
+ ]
+});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/cubeDescModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeDescModel.js b/webapp/app/js/model/cubeDescModel.js
index 773ce95..a8c827b 100644
--- a/webapp/app/js/model/cubeDescModel.js
+++ b/webapp/app/js/model/cubeDescModel.js
@@ -1,73 +1,74 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-KylinApp.service('CubeDescModel',function(){
-
- this.cubeMetaFrame = {};
-
- //
- this.createNew = function () {
- var cubeMeta = {
- "name": "",
- "description": "",
- "dimensions": [],
- "measures": [
- { "id": 1,
- "name": "_COUNT_",
- "function": {
- "expression": "COUNT",
- "returntype": "bigint",
- "parameter": {
- "type": "constant",
- "value": "1"
- }
- }
- }
- ],
- "rowkey": {
- "rowkey_columns": [],
- "aggregation_groups": []
- },
- "notify_list": [],
- "capacity": "",
- "hbase_mapping": {
- "column_family": []
- }
- };
-
- return cubeMeta;
- };
-
- this.createMeasure = function (){
- var measure = {
- "id": "",
- "name": "",
- "function": {
- "expression": "",
- "returntype": "",
- "parameter": {
- "type": "",
- "value": ""
- }
- }
- };
-
- return measure;
- }
-
-})
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+KylinApp.service('CubeDescModel', function () {
+
+ this.cubeMetaFrame = {};
+
+ //
+ this.createNew = function () {
+ var cubeMeta = {
+ "name": "",
+ "description": "",
+ "dimensions": [],
+ "measures": [
+ {
+ "id": 1,
+ "name": "_COUNT_",
+ "function": {
+ "expression": "COUNT",
+ "returntype": "bigint",
+ "parameter": {
+ "type": "constant",
+ "value": "1"
+ }
+ }
+ }
+ ],
+ "rowkey": {
+ "rowkey_columns": [],
+ "aggregation_groups": []
+ },
+ "notify_list": [],
+ "capacity": "",
+ "hbase_mapping": {
+ "column_family": []
+ }
+ };
+
+ return cubeMeta;
+ };
+
+ this.createMeasure = function () {
+ var measure = {
+ "id": "",
+ "name": "",
+ "function": {
+ "expression": "",
+ "returntype": "",
+ "parameter": {
+ "type": "",
+ "value": ""
+ }
+ }
+ };
+
+ return measure;
+ }
+
+})
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/cubeListModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeListModel.js b/webapp/app/js/model/cubeListModel.js
index 3cd1b2b..d385c8b 100755
--- a/webapp/app/js/model/cubeListModel.js
+++ b/webapp/app/js/model/cubeListModel.js
@@ -14,52 +14,54 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
-KylinApp.service('CubeList',function(CubeService,$q){
- var cubes=[];
- var _this = this;
+KylinApp.service('CubeList', function (CubeService, $q) {
+ var cubes = [];
+ var _this = this;
- this.list = function(queryParam){
+ this.list = function (queryParam) {
- var defer = $q.defer();
- CubeService.list(queryParam, function (_cubes) {
- angular.forEach(_cubes, function (cube, index) {
- if(cube.name){
+ var defer = $q.defer();
+ CubeService.list(queryParam, function (_cubes) {
+ angular.forEach(_cubes, function (cube, index) {
+ if (cube.name) {
// $scope.listAccess(cube, 'CubeInstance');
- if (cube.segments && cube.segments.length > 0) {
- for(var i= cube.segments.length-1;i>=0;i--){
- if(cube.segments[i].status==="READY"){
- cube.last_build_time = cube.segments[i].last_build_time;
- break;
- }else if(i===0){
- cube.last_build_time = cube.create_time_utc;
- }
- }
- } else {
- cube.last_build_time = cube.create_time_utc;
- }
- }
- });
- _cubes = _.filter(_cubes,function(cube){return cube.name!=undefined});
- _this.cubes = _this.cubes.concat(_cubes);
- defer.resolve(_this.cubes.length);
- },function(){
- defer.reject("Failed to load cubes");
- });
- return defer.promise;
+ if (cube.segments && cube.segments.length > 0) {
+ for (var i = cube.segments.length - 1; i >= 0; i--) {
+ if (cube.segments[i].status === "READY") {
+ cube.last_build_time = cube.segments[i].last_build_time;
+ break;
+ } else if (i === 0) {
+ cube.last_build_time = cube.create_time_utc;
+ }
+ }
+ } else {
+ cube.last_build_time = cube.create_time_utc;
+ }
+ }
+ });
+ _cubes = _.filter(_cubes, function (cube) {
+ return cube.name != undefined
+ });
+ _this.cubes = _this.cubes.concat(_cubes);
+ defer.resolve(_this.cubes.length);
+ }, function () {
+ defer.reject("Failed to load cubes");
+ });
+ return defer.promise;
- };
+ };
- this.removeCube = function(cube){
- var cubeIndex = _this.cubes.indexOf(cube);
- if (cubeIndex > -1) {
- _this.cubes.splice(cubeIndex, 1);
- }
+ this.removeCube = function (cube) {
+ var cubeIndex = _this.cubes.indexOf(cube);
+ if (cubeIndex > -1) {
+ _this.cubes.splice(cubeIndex, 1);
}
+ }
- this.removeAll = function(){
- _this.cubes=[];
- };
+ this.removeAll = function () {
+ _this.cubes = [];
+ };
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/cubesManager.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubesManager.js b/webapp/app/js/model/cubesManager.js
index 6ba303f..236d036 100644
--- a/webapp/app/js/model/cubesManager.js
+++ b/webapp/app/js/model/cubesManager.js
@@ -17,6 +17,6 @@
*/
// TODO add cubes manager
-KylinApp.service('cubesManager',function(){
+KylinApp.service('cubesManager', function () {
})
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/jobConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/jobConfig.js b/webapp/app/js/model/jobConfig.js
index 0d59762..2e74845 100644
--- a/webapp/app/js/model/jobConfig.js
+++ b/webapp/app/js/model/jobConfig.js
@@ -14,23 +14,23 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.constant('jobConfig', {
- allStatus : [
- {name: 'NEW', value: 0},
- {name: 'PENDING', value: 1},
- {name: 'RUNNING', value: 2},
- {name: 'FINISHED', value: 4},
- {name: 'ERROR', value: 8},
- {name: 'DISCARDED', value: 16}
- ],
- theaditems : [
- {attr: 'name', name: 'Job Name'},
- {attr: 'related_cube', name: 'Cube'},
- {attr: 'progress', name: 'Progress'},
- {attr: 'last_modified', name: 'Last Modified Time'},
- {attr: 'duration', name: 'Duration'}
- ]
+ allStatus: [
+ {name: 'NEW', value: 0},
+ {name: 'PENDING', value: 1},
+ {name: 'RUNNING', value: 2},
+ {name: 'FINISHED', value: 4},
+ {name: 'ERROR', value: 8},
+ {name: 'DISCARDED', value: 16}
+ ],
+ theaditems: [
+ {attr: 'name', name: 'Job Name'},
+ {attr: 'related_cube', name: 'Cube'},
+ {attr: 'progress', name: 'Progress'},
+ {attr: 'last_modified', name: 'Last Modified Time'},
+ {attr: 'duration', name: 'Duration'}
+ ]
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/jobListModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/jobListModel.js b/webapp/app/js/model/jobListModel.js
index 764791a..61c5cc3 100755
--- a/webapp/app/js/model/jobListModel.js
+++ b/webapp/app/js/model/jobListModel.js
@@ -14,37 +14,37 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
-
-KylinApp.service('JobList',function(JobService,$q){
- var _this = this;
- this.jobs=[];
-
- this.list = function(jobRequest){
-
- var defer = $q.defer();
- JobService.list(jobRequest, function (jobs) {
- angular.forEach(jobs, function (job) {
- var id = job.uuid;
- if (angular.isDefined(_this.jobs[id])) {
- if (job.last_modified != _this.jobs[id].last_modified) {
- _this.jobs[id] = job;
- } else {
- }
- } else {
- _this.jobs[id] = job;
- }
- });
-
- defer.resolve(jobs.length);
- });
-
- return defer.promise;
-
- };
-
- this.removeAll = function(){
- _this.jobs=[];
- };
+ */
+
+KylinApp.service('JobList', function (JobService, $q) {
+ var _this = this;
+ this.jobs = [];
+
+ this.list = function (jobRequest) {
+
+ var defer = $q.defer();
+ JobService.list(jobRequest, function (jobs) {
+ angular.forEach(jobs, function (job) {
+ var id = job.uuid;
+ if (angular.isDefined(_this.jobs[id])) {
+ if (job.last_modified != _this.jobs[id].last_modified) {
+ _this.jobs[id] = job;
+ } else {
+ }
+ } else {
+ _this.jobs[id] = job;
+ }
+ });
+
+ defer.resolve(jobs.length);
+ });
+
+ return defer.promise;
+
+ };
+
+ this.removeAll = function () {
+ _this.jobs = [];
+ };
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/metaModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/metaModel.js b/webapp/app/js/model/metaModel.js
index a21c83c..e63576c 100644
--- a/webapp/app/js/model/metaModel.js
+++ b/webapp/app/js/model/metaModel.js
@@ -1,84 +1,84 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-KylinApp.service('MetaModel',function(){
-
- //data model when edit model
- this.model={
- name: null,
- fact_table: null,
- lookups: [],
- filter_condition:null,
- capacity:null,
- "partition_desc" : {
- "partition_date_column" : '',
- "partition_date_start" : 0,
- "partition_type" : 'APPEND'
- },
- last_modified:0
- };
-
- this.setMetaModel =function(model){
- var _model = {};
- _model.name = model.name;
- _model.fact_table = model.fact_table;
- _model.lookups =model.lookups;
- _model.filter_condition = model.filter_condition;
- _model.capacity = model.capacity;
- _model.partition_desc = model.partition_desc;
- _model.last_modified = model.last_modified;
- this.model = _model;
- };
-
- this.initModel = function(){
- this.model = this.createNew();
- }
-
- this.getMetaModel = function(){
- return this.model;
- };
-
- this.setFactTable = function(fact_table) {
- this.model.fact_table =fact_table;
- };
-
-
- this.converDateToGMT = function(){
- if(this.model.partition_desc&&this.model.partition_desc.partition_date_start){
- this.model.partition_desc.partition_date_start+=new Date().getTimezoneOffset()*60000;
- }
- };
- //
- this.createNew = function () {
- var metaModel = {
- name: '',
- fact_table: '',
- lookups: [],
- filter_condition:'',
- capacity:'MEDIUM',
- "partition_desc" : {
- "partition_date_column" : '',
- "partition_date_start" : 0,
- "partition_type" : 'APPEND'
- },
- last_modified:0
- };
-
- return metaModel;
- }
-})
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+KylinApp.service('MetaModel', function () {
+
+ //data model when edit model
+ this.model = {
+ name: null,
+ fact_table: null,
+ lookups: [],
+ filter_condition: null,
+ capacity: null,
+ "partition_desc": {
+ "partition_date_column": '',
+ "partition_date_start": 0,
+ "partition_type": 'APPEND'
+ },
+ last_modified: 0
+ };
+
+ this.setMetaModel = function (model) {
+ var _model = {};
+ _model.name = model.name;
+ _model.fact_table = model.fact_table;
+ _model.lookups = model.lookups;
+ _model.filter_condition = model.filter_condition;
+ _model.capacity = model.capacity;
+ _model.partition_desc = model.partition_desc;
+ _model.last_modified = model.last_modified;
+ this.model = _model;
+ };
+
+ this.initModel = function () {
+ this.model = this.createNew();
+ }
+
+ this.getMetaModel = function () {
+ return this.model;
+ };
+
+ this.setFactTable = function (fact_table) {
+ this.model.fact_table = fact_table;
+ };
+
+
+ this.converDateToGMT = function () {
+ if (this.model.partition_desc && this.model.partition_desc.partition_date_start) {
+ this.model.partition_desc.partition_date_start += new Date().getTimezoneOffset() * 60000;
+ }
+ };
+ //
+ this.createNew = function () {
+ var metaModel = {
+ name: '',
+ fact_table: '',
+ lookups: [],
+ filter_condition: '',
+ capacity: 'MEDIUM',
+ "partition_desc": {
+ "partition_date_column": '',
+ "partition_date_start": 0,
+ "partition_type": 'APPEND'
+ },
+ last_modified: 0
+ };
+
+ return metaModel;
+ }
+})
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/projectConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/projectConfig.js b/webapp/app/js/model/projectConfig.js
index aba9909..270eb7a 100644
--- a/webapp/app/js/model/projectConfig.js
+++ b/webapp/app/js/model/projectConfig.js
@@ -14,14 +14,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.constant('projectConfig', {
- theaditems : [
- {attr: 'name', name: 'Name'},
- {attr: 'owner', name: 'Owner'},
- {attr: 'description', name: 'Description'},
- {attr: 'create_time', name: 'Create Time'}
- ]
+ theaditems: [
+ {attr: 'name', name: 'Name'},
+ {attr: 'owner', name: 'Owner'},
+ {attr: 'description', name: 'Description'},
+ {attr: 'create_time', name: 'Create Time'}
+ ]
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/projectModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/projectModel.js b/webapp/app/js/model/projectModel.js
index b0c05fe..7a94766 100644
--- a/webapp/app/js/model/projectModel.js
+++ b/webapp/app/js/model/projectModel.js
@@ -1,69 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-KylinApp.service('ProjectModel',function(){
-
- this.projects = [];
- this.selectedProject =null;
-
-
- this.setSelectedProject = function(project) {
- if(this.projects.indexOf(project) > -1) {
- this.selectedProject = project;
- }
- };
- this.getSelectedProject = function(project) {
- return this.selectedProject;
- };
-
- this.setProjects = function(projects){
- if(projects.length){
- this.projects = projects;
- }
- }
-
- this.addProject = function(project){
- this.projects.push(project);
- this.sortProjects();
- }
-
- this.removeProject = function(project){
- var index =this.projects.indexOf(project);
- if(index>-1){
- this.projects.splice(index,1);
- }
- this.selectedProject = this.projects[0];
- this.sortProjects();
- }
-
- this.updateProject = function (_new,_old) {
- var index =this.projects.indexOf(_old);
- if(index>-1){
- this.projects[index] = _new;
- }
- }
-
- this.getProjects = function(){
- return this.projects;
- }
-
- this.sortProjects = function (){
- this.projects = _.sortBy(this.projects, function (i) { return i.toLowerCase(); });
- }
-
-})
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+KylinApp.service('ProjectModel', function () {
+
+ this.projects = [];
+ this.selectedProject = null;
+
+
+ this.setSelectedProject = function (project) {
+ if (this.projects.indexOf(project) > -1) {
+ this.selectedProject = project;
+ }
+ };
+ this.getSelectedProject = function (project) {
+ return this.selectedProject;
+ };
+
+ this.setProjects = function (projects) {
+ if (projects.length) {
+ this.projects = projects;
+ }
+ }
+
+ this.addProject = function (project) {
+ this.projects.push(project);
+ this.sortProjects();
+ }
+
+ this.removeProject = function (project) {
+ var index = this.projects.indexOf(project);
+ if (index > -1) {
+ this.projects.splice(index, 1);
+ }
+ this.selectedProject = this.projects[0];
+ this.sortProjects();
+ }
+
+ this.updateProject = function (_new, _old) {
+ var index = this.projects.indexOf(_old);
+ if (index > -1) {
+ this.projects[index] = _new;
+ }
+ }
+
+ this.getProjects = function () {
+ return this.projects;
+ }
+
+ this.sortProjects = function () {
+ this.projects = _.sortBy(this.projects, function (i) {
+ return i.toLowerCase();
+ });
+ }
+
+})
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/tableConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/tableConfig.js b/webapp/app/js/model/tableConfig.js
index 90f76aa..f994b09 100644
--- a/webapp/app/js/model/tableConfig.js
+++ b/webapp/app/js/model/tableConfig.js
@@ -14,14 +14,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.constant('tableConfig', {
- theaditems : [
- {attr: 'id', name: 'ID'},
- {attr: 'name', name: 'Name'},
- {attr: 'datatype', name: 'Data Type'},
- {attr: 'cardinality', name: 'Cardinality'}
- ]
+ theaditems: [
+ {attr: 'id', name: 'ID'},
+ {attr: 'name', name: 'Name'},
+ {attr: 'datatype', name: 'Data Type'},
+ {attr: 'cardinality', name: 'Cardinality'}
+ ]
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/model/tableModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/tableModel.js b/webapp/app/js/model/tableModel.js
index 687acb5..18967bb 100755
--- a/webapp/app/js/model/tableModel.js
+++ b/webapp/app/js/model/tableModel.js
@@ -14,112 +14,112 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
-KylinApp.service('TableModel', function(ProjectModel,$q,TableService) {
+KylinApp.service('TableModel', function (ProjectModel, $q, TableService) {
- var _this = this;
- //for tables in cubeDesigner
+ var _this = this;
+ //for tables in cubeDesigner
+ this.selectProjectTables = [];
+
+ this.initTables = function () {
this.selectProjectTables = [];
+ }
- this.initTables = function(){
- this.selectProjectTables = [];
- }
+ this.addTable = function (table) {
+ this.selectProjectTables.push(table);
+ }
- this.addTable = function(table){
- this.selectProjectTables.push(table);
- }
-
- this.setSelectedProjectTables = function(tables) {
- this.selectProjectTables = tables;
- }
+ this.setSelectedProjectTables = function (tables) {
+ this.selectProjectTables = tables;
+ }
// for load table page
+ this.selectedSrcDb = [];
+ this.selectedSrcTable = {};
+
+ this.init = function () {
this.selectedSrcDb = [];
this.selectedSrcTable = {};
-
- this.init = function(){
- this.selectedSrcDb = [];
- this.selectedSrcTable = {};
+ }
+
+
+ this.treeOptions = {
+ nodeChildren: "columns",
+ injectClasses: {
+ ul: "a1",
+ li: "a2",
+ liSelected: "a7",
+ iExpanded: "a3",
+ iCollapsed: "a4",
+ iLeaf: "a5",
+ label: "a6",
+ labelSelected: "a8"
}
+ };
+ this.aceSrcTbLoaded = function (forceLoad) {
+ _this.selectedSrcDb = [];
- this.treeOptions = {
- nodeChildren: "columns",
- injectClasses: {
- ul: "a1",
- li: "a2",
- liSelected: "a7",
- iExpanded: "a3",
- iCollapsed: "a4",
- iLeaf: "a5",
- label: "a6",
- labelSelected: "a8"
- }
- };
+ _this.selectedSrcTable = {};
+ var defer = $q.defer();
- this.aceSrcTbLoaded = function (forceLoad) {
- _this.selectedSrcDb = [];
-
- _this.selectedSrcTable = {};
- var defer = $q.defer();
+ var param = {
+ ext: true,
+ project: ProjectModel.selectedProject
+ };
- var param = {
- ext: true,
- project:ProjectModel.selectedProject
- };
+ if (!ProjectModel.selectedProject) {
+ defer.resolve();
+ return defer.promise;
+ }
- if(!ProjectModel.selectedProject){
- defer.resolve();
- return defer.promise;
+ TableService.list(param, function (tables) {
+ var tableMap = [];
+ angular.forEach(tables, function (table) {
+ if (!tableMap[table.database]) {
+ tableMap[table.database] = [];
}
-
- TableService.list(param, function (tables) {
- var tableMap = [];
- angular.forEach(tables, function (table) {
- if (!tableMap[table.database]) {
- tableMap[table.database] = [];
- }
- angular.forEach(table.columns, function (column) {
- if(table.cardinality[column.name]) {
- column.cardinality = table.cardinality[column.name];
- }else{
- column.cardinality = null;
- }
- column.id = parseInt(column.id);
- });
- tableMap[table.database].push(table);
- });
+ angular.forEach(table.columns, function (column) {
+ if (table.cardinality[column.name]) {
+ column.cardinality = table.cardinality[column.name];
+ } else {
+ column.cardinality = null;
+ }
+ column.id = parseInt(column.id);
+ });
+ tableMap[table.database].push(table);
+ });
// Sort Table
- for (var key in tableMap) {
- var obj = tableMap[key];
- obj.sort(_this.innerSort);
- }
-
- _this.selectedSrcDb = [];
- for (var key in tableMap) {
- var tables = tableMap[key];
- _this.selectedSrcDb.push({
- "name": key,
- "columns": tables
- });
- }
- defer.resolve();
+ for (var key in tableMap) {
+ var obj = tableMap[key];
+ obj.sort(_this.innerSort);
+ }
+
+ _this.selectedSrcDb = [];
+ for (var key in tableMap) {
+ var tables = tableMap[key];
+ _this.selectedSrcDb.push({
+ "name": key,
+ "columns": tables
});
-
- return defer.promise;
- };
- this.innerSort =function(a, b) {
- var nameA = a.name.toLowerCase(), nameB = b.name.toLowerCase();
- if (nameA < nameB) //sort string ascending
- return -1;
- if (nameA > nameB)
- return 1;
- return 0; //default return value (no sorting)
- };
+ }
+ defer.resolve();
+ });
+
+ return defer.promise;
+ };
+ this.innerSort = function (a, b) {
+ var nameA = a.name.toLowerCase(), nameB = b.name.toLowerCase();
+ if (nameA < nameB) //sort string ascending
+ return -1;
+ if (nameA > nameB)
+ return 1;
+ return 0; //default return value (no sorting)
+ };
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/access.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/access.js b/webapp/app/js/services/access.js
index cdb74f5..5dabaa4 100644
--- a/webapp/app/js/services/access.js
+++ b/webapp/app/js/services/access.js
@@ -14,13 +14,13 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('AccessService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'access/:type/:uuid', {}, {
- list: {method: 'GET', params: {}, isArray: true},
- grant: {method: 'POST', params: {}, isArray: true},
- update: {method: 'PUT', params: {}, isArray: true},
- revoke: {method: 'DELETE', params: {}, isArray: false}
- });
+ return $resource(Config.service.url + 'access/:type/:uuid', {}, {
+ list: {method: 'GET', params: {}, isArray: true},
+ grant: {method: 'POST', params: {}, isArray: true},
+ update: {method: 'PUT', params: {}, isArray: true},
+ revoke: {method: 'DELETE', params: {}, isArray: false}
+ });
}]);
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/admin.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/admin.js b/webapp/app/js/services/admin.js
index ac57bd1..47dce92 100644
--- a/webapp/app/js/services/admin.js
+++ b/webapp/app/js/services/admin.js
@@ -14,13 +14,13 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('AdminService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'admin/:action', {}, {
- env: {method: 'GET', params: {action: 'env'}, isArray: false},
- config: {method: 'GET', params: {action: 'config'}, isArray: false},
- cleanStorage: {method: 'DELETE', params:{action: 'storage'}, isArray: false},
- updateConfig: {method: 'PUT', params:{action: 'config'}, isArray:false}
- });
+ return $resource(Config.service.url + 'admin/:action', {}, {
+ env: {method: 'GET', params: {action: 'env'}, isArray: false},
+ config: {method: 'GET', params: {action: 'config'}, isArray: false},
+ cleanStorage: {method: 'DELETE', params: {action: 'storage'}, isArray: false},
+ updateConfig: {method: 'PUT', params: {action: 'config'}, isArray: false}
+ });
}]);
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/auth.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/auth.js b/webapp/app/js/services/auth.js
index b639c58..3970b0d 100644
--- a/webapp/app/js/services/auth.js
+++ b/webapp/app/js/services/auth.js
@@ -14,12 +14,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('AuthenticationService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'user/authentication/:action', {}, {
- ping: {method: 'GET', params: {}, isArray: false},
- login: {method: 'POST', params: {}, isArray: false},
- authorities: {method: 'GET', params: {action: 'authorities'}, cache: true, isArray: false}
- });
+ return $resource(Config.service.url + 'user/authentication/:action', {}, {
+ ping: {method: 'GET', params: {}, isArray: false},
+ login: {method: 'POST', params: {}, isArray: false},
+ authorities: {method: 'GET', params: {action: 'authorities'}, cache: true, isArray: false}
+ });
}]);
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/cache.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/cache.js b/webapp/app/js/services/cache.js
index b8481c4..b61a179 100644
--- a/webapp/app/js/services/cache.js
+++ b/webapp/app/js/services/cache.js
@@ -14,10 +14,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('CacheService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'cache/:type/:name/:action', {}, {
- clean: {method: 'PUT', params: {type:'all', name:'all', action: 'update'}, isArray: false}
- });
+ return $resource(Config.service.url + 'cache/:type/:name/:action', {}, {
+ clean: {method: 'PUT', params: {type: 'all', name: 'all', action: 'update'}, isArray: false}
+ });
}]);
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/cubeDesc.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/cubeDesc.js b/webapp/app/js/services/cubeDesc.js
index b101dae..09700c1 100644
--- a/webapp/app/js/services/cubeDesc.js
+++ b/webapp/app/js/services/cubeDesc.js
@@ -14,10 +14,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('CubeDescService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'cube_desc/:cube_name/:propName/:propValue/:action', {}, {
- get: {method: 'GET', params: {}, isArray: true}
- });
+ return $resource(Config.service.url + 'cube_desc/:cube_name/:propName/:propValue/:action', {}, {
+ get: {method: 'GET', params: {}, isArray: true}
+ });
}])
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/cubes.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/cubes.js b/webapp/app/js/services/cubes.js
index d5782d2..3431c9a 100644
--- a/webapp/app/js/services/cubes.js
+++ b/webapp/app/js/services/cubes.js
@@ -14,22 +14,22 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('CubeService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'cubes/:cubeId/:propName/:propValue/:action', {}, {
- list: {method: 'GET', params: {}, isArray: true},
- getSql: {method: 'GET', params: {propName: 'segs', action: 'sql'}, isArray: false},
- updateNotifyList: {method: 'PUT', params: {propName: 'notify_list'}, isArray: false},
- cost: {method: 'PUT', params: {action: 'cost'}, isArray: false},
- rebuildLookUp: {method: 'PUT', params: {propName: 'segs', action: 'refresh_lookup'}, isArray: false},
- rebuildCube: {method: 'PUT', params: {action: 'rebuild'}, isArray: false},
- disable: {method: 'PUT', params: {action: 'disable'}, isArray: false},
- enable: {method: 'PUT', params: {action: 'enable'}, isArray: false},
- purge: {method: 'PUT', params: {action: 'purge'}, isArray: false},
- drop: {method: 'DELETE', params: {}, isArray: false},
- save: {method: 'POST', params: {}, isArray: false},
- update: {method: 'PUT', params: {}, isArray: false},
- getHbaseInfo: {method: 'GET', params: {propName: 'hbase'}, isArray: true}
- });
+ return $resource(Config.service.url + 'cubes/:cubeId/:propName/:propValue/:action', {}, {
+ list: {method: 'GET', params: {}, isArray: true},
+ getSql: {method: 'GET', params: {propName: 'segs', action: 'sql'}, isArray: false},
+ updateNotifyList: {method: 'PUT', params: {propName: 'notify_list'}, isArray: false},
+ cost: {method: 'PUT', params: {action: 'cost'}, isArray: false},
+ rebuildLookUp: {method: 'PUT', params: {propName: 'segs', action: 'refresh_lookup'}, isArray: false},
+ rebuildCube: {method: 'PUT', params: {action: 'rebuild'}, isArray: false},
+ disable: {method: 'PUT', params: {action: 'disable'}, isArray: false},
+ enable: {method: 'PUT', params: {action: 'enable'}, isArray: false},
+ purge: {method: 'PUT', params: {action: 'purge'}, isArray: false},
+ drop: {method: 'DELETE', params: {}, isArray: false},
+ save: {method: 'POST', params: {}, isArray: false},
+ update: {method: 'PUT', params: {}, isArray: false},
+ getHbaseInfo: {method: 'GET', params: {propName: 'hbase'}, isArray: true}
+ });
}]);
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/graph.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/graph.js b/webapp/app/js/services/graph.js
index fb98ad1..b191c50 100644
--- a/webapp/app/js/services/graph.js
+++ b/webapp/app/js/services/graph.js
@@ -14,33 +14,33 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.service('GraphService', function (GraphBuilder) {
- this.buildGraph = function (query) {
- var graphData = null;
- var dimension = query.graph.state.dimensions;
+ this.buildGraph = function (query) {
+ var graphData = null;
+ var dimension = query.graph.state.dimensions;
- if (dimension && query.graph.type.dimension.types.indexOf(dimension.type) > -1) {
- var metricsList = [];
- metricsList = metricsList.concat(query.graph.state.metrics);
- angular.forEach(metricsList, function (metrics, index) {
- var aggregatedData = {};
- angular.forEach(query.result.results, function (data, index) {
- aggregatedData[data[dimension.index]] = (!!aggregatedData[data[dimension.index]] ? aggregatedData[data[dimension.index]] : 0)
- + parseFloat(data[metrics.index].replace(/[^\d\.\-]/g, ""));
- });
+ if (dimension && query.graph.type.dimension.types.indexOf(dimension.type) > -1) {
+ var metricsList = [];
+ metricsList = metricsList.concat(query.graph.state.metrics);
+ angular.forEach(metricsList, function (metrics, index) {
+ var aggregatedData = {};
+ angular.forEach(query.result.results, function (data, index) {
+ aggregatedData[data[dimension.index]] = (!!aggregatedData[data[dimension.index]] ? aggregatedData[data[dimension.index]] : 0)
+ + parseFloat(data[metrics.index].replace(/[^\d\.\-]/g, ""));
+ });
- var newData = GraphBuilder["build" + capitaliseFirstLetter(query.graph.type.value) + "Graph"](dimension, metrics, aggregatedData);
- graphData = (!!graphData) ? graphData.concat(newData) : newData;
- });
- }
-
- return graphData;
+ var newData = GraphBuilder["build" + capitaliseFirstLetter(query.graph.type.value) + "Graph"](dimension, metrics, aggregatedData);
+ graphData = (!!graphData) ? graphData.concat(newData) : newData;
+ });
}
- function capitaliseFirstLetter(string) {
- return string.charAt(0).toUpperCase() + string.slice(1);
- }
+ return graphData;
+ }
+
+ function capitaliseFirstLetter(string) {
+ return string.charAt(0).toUpperCase() + string.slice(1);
+ }
});
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/jobs.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/jobs.js b/webapp/app/js/services/jobs.js
index 55d2248..c0f297b 100644
--- a/webapp/app/js/services/jobs.js
+++ b/webapp/app/js/services/jobs.js
@@ -14,14 +14,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
KylinApp.factory('JobService', ['$resource', function ($resource, config) {
- return $resource(Config.service.url + 'jobs/:jobId/:propName/:propValue/:action', {}, {
- list: {method: 'GET', params: {}, isArray: true},
- get: {method: 'GET', params: {}, isArray: false},
- stepOutput: {method: 'GET', params: {propName: 'steps', action: 'output'}, isArray: false},
- resume: {method: 'PUT', params: {action: 'resume'}, isArray: false},
- cancel: {method: 'PUT', params: {action: 'cancel'}, isArray: false}
- });
+ return $resource(Config.service.url + 'jobs/:jobId/:propName/:propValue/:action', {}, {
+ list: {method: 'GET', params: {}, isArray: true},
+ get: {method: 'GET', params: {}, isArray: false},
+ stepOutput: {method: 'GET', params: {propName: 'steps', action: 'output'}, isArray: false},
+ resume: {method: 'PUT', params: {action: 'resume'}, isArray: false},
+ cancel: {method: 'PUT', params: {action: 'cancel'}, isArray: false}
+ });
}]);
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/ba9592c8/webapp/app/js/services/kylinProperties.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/kylinProperties.js b/webapp/app/js/services/kylinProperties.js
index 0f8129b..76b8087 100644
--- a/webapp/app/js/services/kylinProperties.js
+++ b/webapp/app/js/services/kylinProperties.js
@@ -1,78 +1,78 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-KylinApp.service('kylinConfig', function(AdminService,$log) {
- var _config;
- var timezone;
- var deployEnv;
-
-
- this.init = function (){
- return 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();
- }
-
- //fill config info for Config from backend
- this.initWebConfigInfo = function(){
-
- try{
- Config.reference_links.hadoop.link = this.getProperty("kylin.web.hadoop").trim();
- Config.reference_links.diagnostic.link = this.getProperty("kylin.web.diagnostic").trim();
- Config.contact_mail = this.getProperty("kylin.web.contact_mail").trim();
- var doc_length = this.getProperty("kylin.web.help.length").trim();
- for(var i=0;i<doc_length;i++){
- var _doc = {};
- _doc.name = this.getProperty("kylin.web.help."+i).trim().split("|")[0];
- _doc.displayName = this.getProperty("kylin.web.help."+i).trim().split("|")[1];
- _doc.link = this.getProperty("kylin.web.help."+i).trim().split("|")[2];
- Config.documents.push(_doc);
- }
- }catch(e){
- $log.error("failed to load kylin web info");
- }
- }
-
-});
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+KylinApp.service('kylinConfig', function (AdminService, $log) {
+ var _config;
+ var timezone;
+ var deployEnv;
+
+
+ this.init = function () {
+ return 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();
+ }
+
+ //fill config info for Config from backend
+ this.initWebConfigInfo = function () {
+
+ try {
+ Config.reference_links.hadoop.link = this.getProperty("kylin.web.hadoop").trim();
+ Config.reference_links.diagnostic.link = this.getProperty("kylin.web.diagnostic").trim();
+ Config.contact_mail = this.getProperty("kylin.web.contact_mail").trim();
+ var doc_length = this.getProperty("kylin.web.help.length").trim();
+ for (var i = 0; i < doc_length; i++) {
+ var _doc = {};
+ _doc.name = this.getProperty("kylin.web.help." + i).trim().split("|")[0];
+ _doc.displayName = this.getProperty("kylin.web.help." + i).trim().split("|")[1];
+ _doc.link = this.getProperty("kylin.web.help." + i).trim().split("|")[2];
+ Config.documents.push(_doc);
+ }
+ } catch (e) {
+ $log.error("failed to load kylin web info");
+ }
+ }
+
+});
+