You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by ah...@apache.org on 2017/04/20 04:52:47 UTC
[8/8] zeppelin git commit: [ZEPPELIN-1940] lint rule set is NOT
applied at all.
[ZEPPELIN-1940] lint rule set is NOT applied at all.
### What is this PR for?
eslint ruleset is NOT applied at all due to invalid `.eslintrc`.
This PR includes
- fixes which are automatically done by eslint (`eslint --fix src`)
- modification in `.eslintrc`, `package.json`
- while removing eslint conf in `gruntfile.js`
As a result of this PR, we can have more strict and modernized rulesets which can help us to prevent bugs.
### What type of PR is it?
[Improvement]
### Todos
* [x] - Setup rules
* [x] - Remove grunt eslint config
* [x] - Ignore useless rules
* [x] - Fix code for applied rules
### What is the Jira issue?
[ZEPPELIN-1940](https://issues.apache.org/jira/browse/ZEPPELIN-1940)
### How should this be tested?
- `cd zeppelin-web`
- `npm install` (or `yarn install` if you have yarn)
- `npm run lint:once`
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? - NO
* Is there breaking changes for older versions? - NO
* Does this needs documentation? - NO
Author: 1ambda <1a...@gmail.com>
Closes #2252 from 1ambda/ZEPPELIN-1940/apply-lint-rule-set and squashes the following commits:
d3e6c0a [1ambda] fix: eslint errors for #2245
013d7ca [1ambda] fix: eslint errors for #2244
6feb158 [1ambda] fix: eslint errors for #2133
02545c7 [1ambda] fix: eslint for #2203, #2248
4ab8a39 [1ambda] fix: eslint errors for #2228
cc874d2 [1ambda] fix: semi
d4a8082 [1ambda] fix: lint for src/app/tabledata/advanced-
4d991a2 [1ambda] fix: ignore array-bracket-spacing
d69113a [1ambda] fix: ignore space-before-function-paren
526dbeb [1ambda] fix: no-var
3fd91fe [1ambda] fix: no-redeclare
a5947da [1ambda] fix: prefer-spread
a20d20e [1ambda] fix: prefer-rest-params
e3f9641 [1ambda] fix: no-unused-expressions
bd981d7 [1ambda] fix: ignore no-unneeded-ternary
c52b095 [1ambda] fix: no-useless-constructor
83d6789 [1ambda] fix: no-eval
7a740b5 [1ambda] fix: ignore comma-dangle
7d3b393 [1ambda] fix: ignore standard/object-curly-even-spacing
a3f1264 [1ambda] fix: padded-blocks
5d19c6f [1ambda] fix: space-infix-ops
eac6b43 [1ambda] fix: no-extra-semi
bfd7984 [1ambda] fix: ignore arrow-parens
3c91566 [1ambda] fix: ignore object-curly-spacing
6e44e96 [1ambda] fix: space-before-function-paren
59c3996 [1ambda] fix: indent
40125e9 [1ambda] fix: no-multiple-empty-lines
3a6626f [1ambda] fix: no-trailing-spaces
ca94341 [1ambda] fix: spaced-comment
d65c47b [1ambda] fix: comma-spacing
9150539 [1ambda] fix: operator-linebreak
925dc7b [1ambda] fix: block-spacing
021f9e7 [1ambda] fix: space-before-blocks
a896442 [1ambda] fix: keyword-spacing
5948d97 [1ambda] fix: space-in-parens
b094fff [1ambda] fix: no-empty
131c901 [1ambda] fix: no-multi-spaces
1de9a8d [1ambda] fix: one-var
7aa4b1a [1ambda] fix: brace-style
cde8a2d [1ambda] fix: dot-location
d62af8d [1ambda] fix: object-property-newline
70cb63b [1ambda] fix: no-extra-boolean-cast
a5c7842 [1ambda] fix: semi-spacing
3abfc7c [1ambda] fix: no-mixed-spaces-and-tabs
8d5a3d9 [1ambda] fix: yoda
4b36afb [1ambda] fix: ignore all rules
7840ca5 [1ambda] fix: Set ignored, warn lint rules
5566911 [1ambda] fix: Remove invalid visdev
4baadbb [1ambda] fix: Use eslint instead of grunt-eslint
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/19b0f30f
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/19b0f30f
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/19b0f30f
Branch: refs/heads/master
Commit: 19b0f30f8df5e65e11d1384d588ee62538930b23
Parents: 13aabe3
Author: 1ambda <1a...@gmail.com>
Authored: Thu Apr 20 12:03:56 2017 +0900
Committer: ahyoungryu <ah...@apache.org>
Committed: Thu Apr 20 13:52:34 2017 +0900
----------------------------------------------------------------------
zeppelin-web/.eslintrc | 16 +-
zeppelin-web/Gruntfile.js | 27 -
zeppelin-web/package.json | 19 +-
zeppelin-web/src/app/app.controller.js | 53 +-
zeppelin-web/src/app/app.controller.test.js | 43 +-
zeppelin-web/src/app/app.js | 89 +-
.../configuration/configuration.controller.js | 46 +-
.../src/app/credential/credential.controller.js | 219 ++-
.../src/app/handsontable/handsonHelper.js | 192 +--
zeppelin-web/src/app/helium/helium.config.js | 79 +-
.../src/app/helium/helium.controller.js | 354 ++--
zeppelin-web/src/app/helium/index.js | 5 +-
zeppelin-web/src/app/home/home.controller.js | 168 +-
.../app/interpreter/interpreter.controller.js | 770 ++++-----
.../src/app/interpreter/interpreter.filter.js | 12 +-
.../src/app/jobmanager/jobmanager.controller.js | 219 ++-
.../src/app/jobmanager/jobmanager.filter.js | 43 +-
.../src/app/jobmanager/jobs/job.controller.js | 87 +-
.../src/app/notebook/notebook.controller.js | 1100 ++++++-------
.../app/notebook/notebook.controller.test.js | 250 +--
.../notebook/paragraph/paragraph.controller.js | 1534 +++++++++---------
.../paragraph/paragraph.controller.test.js | 63 +-
.../app/notebook/paragraph/paragraph.status.js | 12 +-
.../paragraph/result/result.controller.js | 937 ++++++-----
.../notebookRepos/notebookRepos.controller.js | 89 +-
.../src/app/search/result-list.controller.js | 135 +-
zeppelin-web/src/app/spell/index.js | 4 +-
zeppelin-web/src/app/spell/spell-base.js | 18 +-
zeppelin-web/src/app/spell/spell-result.js | 167 +-
.../tabledata/advanced-transformation-util.js | 286 ++--
.../advanced-transformation-util.test.js | 75 +-
.../app/tabledata/advanced-transformation.js | 35 +-
.../src/app/tabledata/columnselector.js | 62 +-
zeppelin-web/src/app/tabledata/passthrough.js | 15 +-
zeppelin-web/src/app/tabledata/pivot.js | 243 +--
zeppelin-web/src/app/tabledata/tabledata.js | 68 +-
.../src/app/tabledata/tabledata.test.js | 38 +-
.../src/app/tabledata/transformation.js | 84 +-
.../builtins/visualization-areachart.js | 73 +-
.../builtins/visualization-barchart.js | 122 +-
.../builtins/visualization-linechart.js | 94 +-
.../builtins/visualization-nvd3chart.js | 243 ++-
.../builtins/visualization-piechart.js | 68 +-
.../builtins/visualization-scatterchart.js | 390 +++--
.../builtins/visualization-table.js | 67 +-
.../src/app/visualization/visualization.js | 130 +-
.../arrayOrderingSrv/arrayOrdering.service.js | 25 +-
.../src/components/baseUrl/baseUrl.service.js | 41 +-
.../browser-detect/browserDetect.service.js | 27 +-
.../clipboard/clipboard.controller.js | 36 +-
.../dropdowninput/dropdowninput.directive.js | 15 +-
.../components/editor/codeEditor.directive.js | 23 +-
.../elasticInputCtrl/elasticInput.controller.js | 11 +-
.../expandCollapse/expandCollapse.directive.js | 25 +-
.../src/components/helium/helium-conf.js | 75 +-
.../src/components/helium/helium-package.js | 24 +-
.../src/components/helium/helium.service.js | 245 ++-
.../interpreter/interpreter.directive.js | 19 +-
.../src/components/login/login.controller.js | 88 +-
.../src/components/navbar/navbar.controller.js | 178 +-
.../components/navbar/navbar.controller.test.js | 26 +-
.../src/components/ngenter/ngenter.directive.js | 21 +-
.../ngenter/ngenter.directive.test.js | 31 +-
.../components/ngescape/ngescape.directive.js | 21 +-
.../components/noteAction/noteAction.service.js | 126 +-
.../noteListDataFactory/noteList.datafactory.js | 63 +-
.../noteList.datafactory.test.js | 124 +-
.../noteName-create/notename.controller.js | 127 +-
.../noteName-create/notename.controller.test.js | 53 +-
.../noteName-create/visible.directive.js | 37 +-
.../notenameImport.controller.js | 174 +-
.../notevarshareService/notevarshare.service.js | 36 +-
.../popover-html-unsafe-popup.directive.js | 7 +-
.../popover-html-unsafe.directive.js | 9 +-
.../src/components/rename/rename.controller.js | 45 +-
.../src/components/rename/rename.service.js | 14 +-
.../components/resizable/resizable.directive.js | 63 +-
.../src/components/saveAs/saveAs.service.js | 57 +-
.../components/searchService/search.service.js | 25 +-
.../websocketEvents/websocketEvents.factory.js | 188 ++-
.../websocketEvents/websocketMsg.service.js | 201 ++-
zeppelin-web/src/index.js | 120 +-
82 files changed, 5591 insertions(+), 5652 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/.eslintrc
----------------------------------------------------------------------
diff --git a/zeppelin-web/.eslintrc b/zeppelin-web/.eslintrc
index 3981770..1fe3fa5 100644
--- a/zeppelin-web/.eslintrc
+++ b/zeppelin-web/.eslintrc
@@ -1,5 +1,5 @@
{
- "preset": "google",
+ "extends": ["eslint:recommended", "google", "standard"],
"env": {
"browser": true,
"jasmine": true,
@@ -31,6 +31,20 @@
"process": false
},
"rules": {
+ "array-bracket-spacing": 0,
+ "space-before-function-paren": 0,
+ "no-unneeded-ternary": 0,
+ "comma-dangle": 0,
+ "object-curly-spacing": 0,
+ "standard/object-curly-even-spacing": 0,
+ "arrow-parens": 0,
+ "require-jsdoc": 0,
+ "valid-jsdoc": 0,
+ "no-invalid-this": 0,
+ "no-console": 0,
+ "guard-for-in": 0,
+ "no-mixed-operators": 1,
+ "no-useless-escape": 1,
"no-bitwise": 2,
"camelcase": 2,
"curly": 2,
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/Gruntfile.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/Gruntfile.js b/zeppelin-web/Gruntfile.js
index b6c1859..764bbc2 100644
--- a/zeppelin-web/Gruntfile.js
+++ b/zeppelin-web/Gruntfile.js
@@ -104,13 +104,6 @@ module.exports = function(grunt) {
files: ['bower.json'],
tasks: ['wiredep']
},
- js: {
- files: [
- '<%= yeoman.app %>/app/**/*.js',
- '<%= yeoman.app %>/components/**/*.js'
- ],
- tasks: ['newer:eslint:all'],
- },
html: {
files: [
'<%= yeoman.app %>/**/*.html'
@@ -120,7 +113,6 @@ module.exports = function(grunt) {
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: [
- 'newer:eslint:test',
'karma'
]
},
@@ -148,24 +140,6 @@ module.exports = function(grunt) {
}
},
- eslint: {
- all: {
- src: [
- 'Gruntfile.js',
- '<%= yeoman.app %>/app/**/*.js',
- '<%= yeoman.app %>/components/**/*.js'
- ]
- },
- test: {
- options: {
- rules: {
- 'no-undef': 0
- }
- },
- src: ['test/spec/{,*/}*.js']
- }
- },
-
// Add vendor prefixed styles
postcss: {
options: {
@@ -430,7 +404,6 @@ module.exports = function(grunt) {
]);
grunt.registerTask('pre-webpack-dist', [
- 'eslint',
'htmlhint',
'wiredep',
]);
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/package.json
----------------------------------------------------------------------
diff --git a/zeppelin-web/package.json b/zeppelin-web/package.json
index 99dc058..17bcb8d 100644
--- a/zeppelin-web/package.json
+++ b/zeppelin-web/package.json
@@ -8,14 +8,15 @@
"scripts": {
"clean": "rimraf dist && rimraf .tmp",
"postinstall": "bower install --silent",
- "prebuild": "npm-run-all clean",
+ "prebuild": "npm-run-all clean lint:once",
"build": "grunt pre-webpack-dist && webpack && grunt post-webpack-dist",
+ "lint:watch": "esw --watch src",
+ "lint:once": "eslint src",
"predev": "grunt pre-webpack-dev",
"dev:server": "webpack-dev-server --hot",
"dev:helium": "HELIUM_BUNDLE_DEV=true webpack-dev-server --hot",
"dev:watch": "grunt watch-webpack-dev",
- "dev": "npm-run-all --parallel dev:server dev:watch",
- "visdev": "npm-run-all --parallel visdev:server dev:watch",
+ "dev": "npm-run-all --parallel dev:server lint:watch dev:watch",
"pretest": "npm install karma-phantomjs-launcher babel-polyfill",
"test": "karma start karma.conf.js"
},
@@ -33,7 +34,14 @@
"bower": "^1.8.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.26.1",
+ "eslint": "^3.19.0",
"eslint-config-google": "^0.7.1",
+ "eslint-config-standard": "^10.2.0",
+ "eslint-plugin-import": "^2.2.0",
+ "eslint-plugin-node": "^4.2.2",
+ "eslint-plugin-promise": "^3.5.0",
+ "eslint-plugin-standard": "^3.0.1",
+ "eslint-watch": "^3.1.0",
"express": "^4.14.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
@@ -47,7 +55,6 @@
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
- "grunt-eslint": "^19.0.0",
"grunt-filerev": "^0.2.1",
"grunt-htmlhint": "^0.9.13",
"grunt-newer": "^0.7.0",
@@ -70,11 +77,11 @@
"postcss-loader": "^1.2.1",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
+ "string-replace-webpack-plugin": "^0.1.3",
"style-loader": "^0.13.1",
"time-grunt": "^0.3.1",
"webpack": "^1.14.0",
- "webpack-dev-server": "^1.16.2",
- "string-replace-webpack-plugin": "^0.1.3"
+ "webpack-dev-server": "^1.16.2"
},
"repository": {
"type": "git",
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/app.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/app.controller.js b/zeppelin-web/src/app/app.controller.js
index 30c96a1..6c64a33 100644
--- a/zeppelin-web/src/app/app.controller.js
+++ b/zeppelin-web/src/app/app.controller.js
@@ -12,49 +12,48 @@
* limitations under the License.
*/
-angular.module('zeppelinWebApp').controller('MainCtrl', MainCtrl);
+angular.module('zeppelinWebApp').controller('MainCtrl', MainCtrl)
-function MainCtrl($scope, $rootScope, $window, arrayOrderingSrv) {
- 'ngInject';
+function MainCtrl ($scope, $rootScope, $window, arrayOrderingSrv) {
+ 'ngInject'
- $scope.looknfeel = 'default';
+ $scope.looknfeel = 'default'
- var init = function() {
- $scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false);
- };
+ let init = function () {
+ $scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false)
+ }
- init();
+ init()
- $rootScope.$on('setIframe', function(event, data) {
+ $rootScope.$on('setIframe', function (event, data) {
if (!event.defaultPrevented) {
- $scope.asIframe = data;
- event.preventDefault();
+ $scope.asIframe = data
+ event.preventDefault()
}
- });
+ })
- $rootScope.$on('setLookAndFeel', function(event, data) {
+ $rootScope.$on('setLookAndFeel', function (event, data) {
if (!event.defaultPrevented && data && data !== '' && data !== $scope.looknfeel) {
- $scope.looknfeel = data;
- event.preventDefault();
+ $scope.looknfeel = data
+ event.preventDefault()
}
- });
+ })
// Set The lookAndFeel to default on every page
- $rootScope.$on('$routeChangeStart', function(event, next, current) {
- $rootScope.$broadcast('setLookAndFeel', 'default');
- });
+ $rootScope.$on('$routeChangeStart', function (event, next, current) {
+ $rootScope.$broadcast('setLookAndFeel', 'default')
+ })
- $rootScope.noteName = function(note) {
+ $rootScope.noteName = function (note) {
if (!_.isEmpty(note)) {
- return arrayOrderingSrv.getNoteName(note);
+ return arrayOrderingSrv.getNoteName(note)
}
- };
+ }
- BootstrapDialog.defaultOptions.onshown = function() {
- angular.element('#' + this.id).find('.btn:last').focus();
- };
+ BootstrapDialog.defaultOptions.onshown = function () {
+ angular.element('#' + this.id).find('.btn:last').focus()
+ }
// Remove BootstrapDialog animation
- BootstrapDialog.configDefaultOptions({animate: false});
+ BootstrapDialog.configDefaultOptions({animate: false})
}
-
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/app.controller.test.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/app.controller.test.js b/zeppelin-web/src/app/app.controller.test.js
index 329fb21..67d5034 100644
--- a/zeppelin-web/src/app/app.controller.test.js
+++ b/zeppelin-web/src/app/app.controller.test.js
@@ -1,29 +1,28 @@
-describe('Controller: MainCtrl', function() {
- beforeEach(angular.mock.module('zeppelinWebApp'));
+describe('Controller: MainCtrl', function () {
+ beforeEach(angular.mock.module('zeppelinWebApp'))
- var scope;
- var rootScope;
+ let scope
+ let rootScope
- beforeEach(inject(function($controller, $rootScope) {
- rootScope = $rootScope;
- scope = $rootScope.$new();
+ beforeEach(inject(function ($controller, $rootScope) {
+ rootScope = $rootScope
+ scope = $rootScope.$new()
$controller('MainCtrl', {
$scope: scope
- });
- }));
+ })
+ }))
- it('should attach "asIframe" to the scope and the default value should be false', function() {
- expect(scope.asIframe).toBeDefined();
- expect(scope.asIframe).toEqual(false);
- });
+ it('should attach "asIframe" to the scope and the default value should be false', function () {
+ expect(scope.asIframe).toBeDefined()
+ expect(scope.asIframe).toEqual(false)
+ })
- it('should set the default value of "looknfeel to "default"', function() {
- expect(scope.looknfeel).toEqual('default');
- });
+ it('should set the default value of "looknfeel to "default"', function () {
+ expect(scope.looknfeel).toEqual('default')
+ })
- it('should set "asIframe" flag to true when a controller broadcasts setIframe event', function() {
- rootScope.$broadcast('setIframe', true);
- expect(scope.asIframe).toEqual(true);
- });
-
-});
+ it('should set "asIframe" flag to true when a controller broadcasts setIframe event', function () {
+ rootScope.$broadcast('setIframe', true)
+ expect(scope.asIframe).toEqual(true)
+ })
+})
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/app.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js
index 40b19c1..0775d38 100644
--- a/zeppelin-web/src/app/app.js
+++ b/zeppelin-web/src/app/app.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-var zeppelinWebApp = angular.module('zeppelinWebApp', [
+let zeppelinWebApp = angular.module('zeppelinWebApp', [
'ngCookies',
'ngAnimate',
'ngRoute',
@@ -35,22 +35,23 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
'ngResource',
'ngclipboard'
])
- .filter('breakFilter', function() {
- return function(text) {
+ .filter('breakFilter', function () {
+ return function (text) {
+ // eslint-disable-next-line no-extra-boolean-cast
if (!!text) {
- return text.replace(/\n/g, '<br />');
+ return text.replace(/\n/g, '<br />')
}
- };
+ }
})
- .config(function($httpProvider, $routeProvider, ngToastProvider) {
+ .config(function ($httpProvider, $routeProvider, ngToastProvider) {
// withCredentials when running locally via grunt
- $httpProvider.defaults.withCredentials = true;
+ $httpProvider.defaults.withCredentials = true
- var visBundleLoad = {
- load: ['heliumService', function(heliumService) {
- return heliumService.load;
+ let visBundleLoad = {
+ load: ['heliumService', function (heliumService) {
+ return heliumService.load
}]
- };
+ }
$routeProvider
.when('/', {
@@ -107,67 +108,67 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
})
.otherwise({
redirectTo: '/'
- });
+ })
ngToastProvider.configure({
dismissButton: true,
dismissOnClick: false,
combineDuplications: true,
timeout: 6000
- });
+ })
})
- //handel logout on API failure
+ // handel logout on API failure
.config(function ($httpProvider, $provide) {
$provide.factory('httpInterceptor', function ($q, $rootScope) {
return {
'responseError': function (rejection) {
if (rejection.status === 405) {
- var data = {};
- data.info = '';
- $rootScope.$broadcast('session_logout', data);
+ let data = {}
+ data.info = ''
+ $rootScope.$broadcast('session_logout', data)
}
- $rootScope.$broadcast('httpResponseError', rejection);
- return $q.reject(rejection);
+ $rootScope.$broadcast('httpResponseError', rejection)
+ return $q.reject(rejection)
}
- };
- });
- $httpProvider.interceptors.push('httpInterceptor');
+ }
+ })
+ $httpProvider.interceptors.push('httpInterceptor')
})
- .constant('TRASH_FOLDER_ID', '~Trash');
+ .constant('TRASH_FOLDER_ID', '~Trash')
-function auth() {
- var $http = angular.injector(['ng']).get('$http');
- var baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv');
+function auth () {
+ let $http = angular.injector(['ng']).get('$http')
+ let baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv')
// withCredentials when running locally via grunt
- $http.defaults.withCredentials = true;
+ $http.defaults.withCredentials = true
jQuery.ajaxSetup({
dataType: 'json',
xhrFields: {
withCredentials: true
},
crossDomain: true
- });
- return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function(response) {
- zeppelinWebApp.run(function($rootScope) {
- $rootScope.ticket = angular.fromJson(response.data).body;
- });
- }, function(errorResponse) {
+ })
+ return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function (response) {
+ zeppelinWebApp.run(function ($rootScope) {
+ $rootScope.ticket = angular.fromJson(response.data).body
+ })
+ }, function (errorResponse) {
// Handle error case
- });
+ })
}
-function bootstrapApplication() {
- zeppelinWebApp.run(function($rootScope, $location) {
- $rootScope.$on('$routeChangeStart', function(event, next, current) {
+function bootstrapApplication () {
+ zeppelinWebApp.run(function ($rootScope, $location) {
+ $rootScope.$on('$routeChangeStart', function (event, next, current) {
if (!$rootScope.ticket && next.$$route && !next.$$route.publicAccess) {
- $location.path('/');
+ $location.path('/')
}
- });
- });
- angular.bootstrap(document, ['zeppelinWebApp']);
+ })
+ })
+ angular.bootstrap(document, ['zeppelinWebApp'])
}
-angular.element(document).ready(function() {
- auth().then(bootstrapApplication);
-});
+angular.element(document).ready(function () {
+ auth().then(bootstrapApplication)
+})
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/configuration/configuration.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/configuration/configuration.controller.js b/zeppelin-web/src/app/configuration/configuration.controller.js
index 70c9fe0..e4f4e5d 100644
--- a/zeppelin-web/src/app/configuration/configuration.controller.js
+++ b/zeppelin-web/src/app/configuration/configuration.controller.js
@@ -12,38 +12,38 @@
* limitations under the License.
*/
-angular.module('zeppelinWebApp').controller('ConfigurationCtrl', ConfigurationCtrl);
+angular.module('zeppelinWebApp').controller('ConfigurationCtrl', ConfigurationCtrl)
-function ConfigurationCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
- 'ngInject';
+function ConfigurationCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
+ 'ngInject'
- $scope.configrations = [];
- $scope._ = _;
- ngToast.dismiss();
+ $scope.configrations = []
+ $scope._ = _
+ ngToast.dismiss()
- var getConfigurations = function() {
- $http.get(baseUrlSrv.getRestApiBase() + '/configurations/all').
- success(function(data, status, headers, config) {
- $scope.configurations = data.body;
- }).
- error(function(data, status, headers, config) {
+ let getConfigurations = function () {
+ $http.get(baseUrlSrv.getRestApiBase() + '/configurations/all')
+ .success(function (data, status, headers, config) {
+ $scope.configurations = data.body
+ })
+ .error(function (data, status, headers, config) {
if (status === 401) {
ngToast.danger({
content: 'You don\'t have permission on this page',
verticalPosition: 'bottom',
timeout: '3000'
- });
- setTimeout(function() {
- window.location.replace('/');
- }, 3000);
+ })
+ setTimeout(function () {
+ window.location.replace('/')
+ }, 3000)
}
- console.log('Error %o %o', status, data.message);
- });
- };
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- var init = function() {
- getConfigurations();
- };
+ let init = function () {
+ getConfigurations()
+ }
- init();
+ init()
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/credential/credential.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/credential/credential.controller.js b/zeppelin-web/src/app/credential/credential.controller.js
index 30edfe9..eb649c8 100644
--- a/zeppelin-web/src/app/credential/credential.controller.js
+++ b/zeppelin-web/src/app/credential/credential.controller.js
@@ -12,179 +12,178 @@
* limitations under the License.
*/
-angular.module('zeppelinWebApp').controller('CredentialCtrl', CredentialCtrl);
-
-function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
- 'ngInject';
-
- $scope._ = _;
- ngToast.dismiss();
-
- $scope.credentialInfo = [];
- $scope.showAddNewCredentialInfo = false;
- $scope.availableInterpreters = [];
-
- var getCredentialInfo = function() {
- $http.get(baseUrlSrv.getRestApiBase() + '/credential').
- success(function(data, status, headers, config) {
- $scope.credentialInfo = _.map(data.body.userCredentials, function(value, prop) {
- return {entity: prop, password: value.password, username: value.username};
- });
- console.log('Success %o %o', status, $scope.credentialInfo);
- }).
- error(function(data, status, headers, config) {
+angular.module('zeppelinWebApp').controller('CredentialCtrl', CredentialCtrl)
+
+function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
+ 'ngInject'
+
+ $scope._ = _
+ ngToast.dismiss()
+
+ $scope.credentialInfo = []
+ $scope.showAddNewCredentialInfo = false
+ $scope.availableInterpreters = []
+
+ let getCredentialInfo = function () {
+ $http.get(baseUrlSrv.getRestApiBase() + '/credential')
+ .success(function (data, status, headers, config) {
+ $scope.credentialInfo = _.map(data.body.userCredentials, function (value, prop) {
+ return {entity: prop, password: value.password, username: value.username}
+ })
+ console.log('Success %o %o', status, $scope.credentialInfo)
+ })
+ .error(function (data, status, headers, config) {
if (status === 401) {
ngToast.danger({
content: 'You don\'t have permission on this page',
verticalPosition: 'bottom',
timeout: '3000'
- });
- setTimeout(function() {
- window.location.replace('/');
- }, 3000);
+ })
+ setTimeout(function () {
+ window.location.replace('/')
+ }, 3000)
}
- console.log('Error %o %o', status, data.message);
- });
- };
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- $scope.addNewCredentialInfo = function() {
+ $scope.addNewCredentialInfo = function () {
if ($scope.entity && _.isEmpty($scope.entity.trim()) &&
$scope.username && _.isEmpty($scope.username.trim())) {
ngToast.danger({
content: 'Username \\ Entity can not be empty.',
verticalPosition: 'bottom',
timeout: '3000'
- });
- return;
+ })
+ return
}
- var newCredential = {
+ let newCredential = {
'entity': $scope.entity,
'username': $scope.username,
'password': $scope.password
- };
+ }
- $http.put(baseUrlSrv.getRestApiBase() + '/credential', newCredential).
- success(function(data, status, headers, config) {
+ $http.put(baseUrlSrv.getRestApiBase() + '/credential', newCredential)
+ .success(function (data, status, headers, config) {
ngToast.success({
content: 'Successfully saved credentials.',
verticalPosition: 'bottom',
timeout: '3000'
- });
- $scope.credentialInfo.push(newCredential);
- resetCredentialInfo();
- $scope.showAddNewCredentialInfo = false;
- console.log('Success %o %o', status, data.message);
- }).
- error(function(data, status, headers, config) {
+ })
+ $scope.credentialInfo.push(newCredential)
+ resetCredentialInfo()
+ $scope.showAddNewCredentialInfo = false
+ console.log('Success %o %o', status, data.message)
+ })
+ .error(function (data, status, headers, config) {
ngToast.danger({
content: 'Error saving credentials',
verticalPosition: 'bottom',
timeout: '3000'
- });
- console.log('Error %o %o', status, data.message);
- });
- };
+ })
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- var getAvailableInterpreters = function() {
+ let getAvailableInterpreters = function () {
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
- .success(function(data, status, headers, config) {
- for (var setting = 0; setting < data.body.length; setting++) {
+ .success(function (data, status, headers, config) {
+ for (let setting = 0; setting < data.body.length; setting++) {
$scope.availableInterpreters.push(
- data.body[setting].group + '.' + data.body[setting].name);
+ data.body[setting].group + '.' + data.body[setting].name)
}
angular.element('#entityname').autocomplete({
source: $scope.availableInterpreters,
- select: function(event, selected) {
- $scope.entity = selected.item.value;
- return false;
+ select: function (event, selected) {
+ $scope.entity = selected.item.value
+ return false
}
- });
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
- };
+ })
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- $scope.toggleAddNewCredentialInfo = function() {
+ $scope.toggleAddNewCredentialInfo = function () {
if ($scope.showAddNewCredentialInfo) {
- $scope.showAddNewCredentialInfo = false;
+ $scope.showAddNewCredentialInfo = false
} else {
- $scope.showAddNewCredentialInfo = true;
+ $scope.showAddNewCredentialInfo = true
}
- };
+ }
- $scope.cancelCredentialInfo = function() {
- $scope.showAddNewCredentialInfo = false;
- resetCredentialInfo();
- };
+ $scope.cancelCredentialInfo = function () {
+ $scope.showAddNewCredentialInfo = false
+ resetCredentialInfo()
+ }
- var resetCredentialInfo = function() {
- $scope.entity = '';
- $scope.username = '';
- $scope.password = '';
- };
+ const resetCredentialInfo = function () {
+ $scope.entity = ''
+ $scope.username = ''
+ $scope.password = ''
+ }
- $scope.copyOriginCredentialsInfo = function() {
+ $scope.copyOriginCredentialsInfo = function () {
ngToast.info({
content: 'Since entity is a unique key, you can edit only username & password',
verticalPosition: 'bottom',
timeout: '3000'
- });
- };
+ })
+ }
- $scope.updateCredentialInfo = function(form, data, entity) {
- var request = {
+ $scope.updateCredentialInfo = function (form, data, entity) {
+ let request = {
entity: entity,
username: data.username,
password: data.password
- };
-
- $http.put(baseUrlSrv.getRestApiBase() + '/credential/', request).
- success(function(data, status, headers, config) {
- var index = _.findIndex($scope.credentialInfo, {'entity': entity});
- $scope.credentialInfo[index] = request;
- return true;
- }).
- error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
+ }
+
+ $http.put(baseUrlSrv.getRestApiBase() + '/credential/', request)
+ .success(function (data, status, headers, config) {
+ let index = _.findIndex($scope.credentialInfo, {'entity': entity})
+ $scope.credentialInfo[index] = request
+ return true
+ })
+ .error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
ngToast.danger({
content: 'We couldn\'t save the credential',
verticalPosition: 'bottom',
timeout: '3000'
- });
- form.$show();
- });
- return false;
- };
+ })
+ form.$show()
+ })
+ return false
+ }
- $scope.removeCredentialInfo = function(entity) {
+ $scope.removeCredentialInfo = function (entity) {
BootstrapDialog.confirm({
closable: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: '',
message: 'Do you want to delete this credential information?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- $http.delete(baseUrlSrv.getRestApiBase() + '/credential/' + entity).
- success(function(data, status, headers, config) {
- var index = _.findIndex($scope.credentialInfo, {'entity': entity});
- $scope.credentialInfo.splice(index, 1);
- console.log('Success %o %o', status, data.message);
- }).
- error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
+ $http.delete(baseUrlSrv.getRestApiBase() + '/credential/' + entity)
+ .success(function (data, status, headers, config) {
+ let index = _.findIndex($scope.credentialInfo, {'entity': entity})
+ $scope.credentialInfo.splice(index, 1)
+ console.log('Success %o %o', status, data.message)
+ })
+ .error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
}
}
- });
- };
+ })
+ }
- var init = function() {
- getAvailableInterpreters();
- getCredentialInfo();
- };
+ let init = function () {
+ getAvailableInterpreters()
+ getCredentialInfo()
+ }
- init();
+ init()
}
-
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/handsontable/handsonHelper.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/handsontable/handsonHelper.js b/zeppelin-web/src/app/handsontable/handsonHelper.js
index ccfa87a..8d724c0 100644
--- a/zeppelin-web/src/app/handsontable/handsonHelper.js
+++ b/zeppelin-web/src/app/handsontable/handsonHelper.js
@@ -16,15 +16,15 @@
* HandsonHelper class
*/
export default class HandsonHelper {
- constructor(columns, rows, comment) {
- this.columns = columns || [];
- this.rows = rows || [];
- this.comment = comment || '';
- this._numericValidator = this._numericValidator.bind(this);
- };
-
- getHandsonTableConfig(columns, columnNames, resultRows) {
- var self = this;
+ constructor (columns, rows, comment) {
+ this.columns = columns || []
+ this.rows = rows || []
+ this.comment = comment || ''
+ this._numericValidator = this._numericValidator.bind(this)
+ }
+
+ getHandsonTableConfig (columns, columnNames, resultRows) {
+ let self = this
return {
colHeaders: columnNames,
data: resultRows,
@@ -41,159 +41,161 @@ export default class HandsonHelper {
fillHandle: false,
fragmentSelection: true,
disableVisualSelection: true,
- cells: function(ro, co, pro) {
- var cellProperties = {};
- var colType = columns[co].type;
- cellProperties.renderer = function(instance, td, row, col, prop, value, cellProperties) {
- self._cellRenderer(instance, td, row, col, prop, value, cellProperties, colType);
- };
- return cellProperties;
+ cells: function (ro, co, pro) {
+ let cellProperties = {}
+ let colType = columns[co].type
+ cellProperties.renderer = function (instance, td, row, col, prop, value, cellProperties) {
+ self._cellRenderer(instance, td, row, col, prop, value, cellProperties, colType)
+ }
+ return cellProperties
},
- afterGetColHeader: function(col, TH) {
- var instance = this;
- var menu = self._buildDropDownMenu(columns[col].type);
- var button = self._buildTypeSwitchButton();
+ afterGetColHeader: function (col, TH) {
+ let instance = this
+ let menu = self._buildDropDownMenu(columns[col].type)
+ let button = self._buildTypeSwitchButton()
- self._addButtonMenuEvent(button, menu);
+ self._addButtonMenuEvent(button, menu)
- Handsontable.Dom.addEvent(menu, 'click', function(event) {
+ Handsontable.Dom.addEvent(menu, 'click', function (event) {
if (event.target.nodeName === 'LI') {
- self._setColumnType(columns, event.target.data.colType, instance, col);
+ self._setColumnType(columns, event.target.data.colType, instance, col)
}
- });
+ })
if (TH.firstChild.lastChild.nodeName === 'BUTTON') {
- TH.firstChild.removeChild(TH.firstChild.lastChild);
+ TH.firstChild.removeChild(TH.firstChild.lastChild)
}
- TH.firstChild.appendChild(button);
- TH.style['white-space'] = 'normal';
+ TH.firstChild.appendChild(button)
+ TH.style['white-space'] = 'normal'
}
- };
- };
+ }
+ }
/*
** Private Service Functions
*/
- _addButtonMenuEvent(button, menu) {
- Handsontable.Dom.addEvent(button, 'click', function(event) {
- var changeTypeMenu;
- var position;
- var removeMenu;
+ _addButtonMenuEvent (button, menu) {
+ Handsontable.Dom.addEvent(button, 'click', function (event) {
+ let changeTypeMenu
+ let position
+ let removeMenu
- document.body.appendChild(menu);
+ document.body.appendChild(menu)
- event.preventDefault();
- event.stopImmediatePropagation();
+ event.preventDefault()
+ event.stopImmediatePropagation()
- changeTypeMenu = document.querySelectorAll('.changeTypeMenu');
+ changeTypeMenu = document.querySelectorAll('.changeTypeMenu')
- for (var i = 0, len = changeTypeMenu.length; i < len; i++) {
- changeTypeMenu[i].style.display = 'none';
+ for (let i = 0, len = changeTypeMenu.length; i < len; i++) {
+ changeTypeMenu[i].style.display = 'none'
}
- menu.style.display = 'block';
- position = button.getBoundingClientRect();
+ menu.style.display = 'block'
+ position = button.getBoundingClientRect()
- menu.style.top = (position.top + (window.scrollY || window.pageYOffset)) + 2 + 'px';
- menu.style.left = (position.left) + 'px';
+ menu.style.top = (position.top + (window.scrollY || window.pageYOffset)) + 2 + 'px'
+ menu.style.left = (position.left) + 'px'
- removeMenu = function(event) {
+ removeMenu = function (event) {
if (menu.parentNode) {
- menu.parentNode.removeChild(menu);
+ menu.parentNode.removeChild(menu)
}
- };
- Handsontable.Dom.removeEvent(document, 'click', removeMenu);
- Handsontable.Dom.addEvent(document, 'click', removeMenu);
- });
+ }
+ Handsontable.Dom.removeEvent(document, 'click', removeMenu)
+ Handsontable.Dom.addEvent(document, 'click', removeMenu)
+ })
}
- _buildDropDownMenu(activeCellType) {
- var menu = document.createElement('UL');
- var types = ['text', 'numeric', 'date'];
- var item;
+ _buildDropDownMenu (activeCellType) {
+ let menu = document.createElement('UL')
+ let types = ['text', 'numeric', 'date']
+ let item
- menu.className = 'changeTypeMenu';
+ menu.className = 'changeTypeMenu'
- for (var i = 0, len = types.length; i < len; i++) {
- item = document.createElement('LI');
+ for (let i = 0, len = types.length; i < len; i++) {
+ item = document.createElement('LI')
if ('innerText' in item) {
- item.innerText = types[i];
+ item.innerText = types[i]
} else {
- item.textContent = types[i];
+ item.textContent = types[i]
}
- item.data = {'colType': types[i]};
+ item.data = {'colType': types[i]}
if (activeCellType === types[i]) {
- item.className = 'active';
+ item.className = 'active'
}
- menu.appendChild(item);
+ menu.appendChild(item)
}
- return menu;
+ return menu
}
- _buildTypeSwitchButton() {
- var button = document.createElement('BUTTON');
+ _buildTypeSwitchButton () {
+ let button = document.createElement('BUTTON')
- button.innerHTML = '\u25BC';
- button.className = 'changeType';
+ button.innerHTML = '\u25BC'
+ button.className = 'changeType'
- return button;
+ return button
}
- _isNumeric(value) {
+ _isNumeric (value) {
if (!isNaN(value)) {
if (value.length !== 0) {
if (Number(value) <= Number.MAX_SAFE_INTEGER && Number(value) >= Number.MIN_SAFE_INTEGER) {
- return true;
+ return true
}
}
}
- return false;
+ return false
}
- _cellRenderer(instance, td, row, col, prop, value, cellProperties, colType) {
+ _cellRenderer (instance, td, row, col, prop, value, cellProperties, colType) {
if (colType === 'numeric' && this._isNumeric(value)) {
- cellProperties.format = '0,0.[00000]';
- td.style.textAlign = 'left';
- Handsontable.renderers.NumericRenderer.apply(this, arguments);
- } else if (value.length > '%html'.length && '%html ' === value.substring(0, '%html '.length)) {
- td.innerHTML = value.substring('%html'.length);
+ cellProperties.format = '0,0.[00000]'
+ td.style.textAlign = 'left'
+ // eslint-disable-next-line prefer-rest-params
+ Handsontable.renderers.NumericRenderer.apply(this, arguments)
+ } else if (value.length > '%html'.length && value.substring(0, '%html '.length) === '%html ') {
+ td.innerHTML = value.substring('%html'.length)
} else {
- Handsontable.renderers.TextRenderer.apply(this, arguments);
+ // eslint-disable-next-line prefer-rest-params
+ Handsontable.renderers.TextRenderer.apply(this, arguments)
}
}
- _dateValidator(value, callback) {
- var d = moment(value);
- return callback(d.isValid());
+ _dateValidator (value, callback) {
+ let d = moment(value)
+ return callback(d.isValid())
}
- _numericValidator(value, callback) {
- return callback(this._isNumeric(value));
+ _numericValidator (value, callback) {
+ return callback(this._isNumeric(value))
}
- _setColumnType(columns, type, instance, col) {
- columns[col].type = type;
- this._setColumnValidator(columns, col);
- instance.updateSettings({columns: columns});
- instance.validateCells(null);
+ _setColumnType (columns, type, instance, col) {
+ columns[col].type = type
+ this._setColumnValidator(columns, col)
+ instance.updateSettings({columns: columns})
+ instance.validateCells(null)
if (this._isColumnSorted(instance, col)) {
- instance.sort(col, instance.sortOrder);
+ instance.sort(col, instance.sortOrder)
}
}
- _isColumnSorted(instance, col) {
- return instance.sortingEnabled && instance.sortColumn === col;
+ _isColumnSorted (instance, col) {
+ return instance.sortingEnabled && instance.sortColumn === col
}
- _setColumnValidator(columns, col) {
+ _setColumnValidator (columns, col) {
if (columns[col].type === 'numeric') {
- columns[col].validator = this._numericValidator;
+ columns[col].validator = this._numericValidator
} else if (columns[col].type === 'date') {
- columns[col].validator = this._dateValidator;
+ columns[col].validator = this._dateValidator
} else {
- columns[col].validator = null;
+ columns[col].validator = null
}
}
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/helium/helium.config.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/helium/helium.config.js b/zeppelin-web/src/app/helium/helium.config.js
index e21fe19..ace7136 100644
--- a/zeppelin-web/src/app/helium/helium.config.js
+++ b/zeppelin-web/src/app/helium/helium.config.js
@@ -16,85 +16,86 @@ export const HeliumConfFieldType = {
NUMBER: 'number',
JSON: 'json',
STRING: 'string',
-};
+}
/**
* @param persisted <Object> including `type`, `description`, `defaultValue` for each conf key
* @param spec <Object> including `value` for each conf key
*/
-export function mergePersistedConfWithSpec(persisted, spec) {
- const confs = [];
+export function mergePersistedConfWithSpec (persisted, spec) {
+ const confs = []
- for(let name in spec) {
- const specField = spec[name];
- const persistedValue = persisted[name];
+ for (let name in spec) {
+ const specField = spec[name]
+ const persistedValue = persisted[name]
- const value = (persistedValue) ? persistedValue : specField.defaultValue;
+ const value = (persistedValue) ? persistedValue : specField.defaultValue
const merged = {
- name: name, type: specField.type, description: specField.description,
- value: value, defaultValue: specField.defaultValue,
- };
+ name: name,
+ type: specField.type,
+ description: specField.description,
+ value: value,
+ defaultValue: specField.defaultValue,
+ }
- confs.push(merged);
+ confs.push(merged)
}
- return confs;
+ return confs
}
-export function createPackageConf(defaultPackages, persistedPackacgeConfs) {
- let packageConfs = {};
+export function createPackageConf (defaultPackages, persistedPackacgeConfs) {
+ let packageConfs = {}
for (let name in defaultPackages) {
- const pkgInfo = defaultPackages[name];
+ const pkgInfo = defaultPackages[name]
- const configSpec = pkgInfo.pkg.config;
- if (!configSpec) { continue; }
+ const configSpec = pkgInfo.pkg.config
+ if (!configSpec) { continue }
- const version = pkgInfo.pkg.version;
- if (!version) { continue; }
+ const version = pkgInfo.pkg.version
+ if (!version) { continue }
- let config = {};
+ let config = {}
if (persistedPackacgeConfs[name] && persistedPackacgeConfs[name][version]) {
- config = persistedPackacgeConfs[name][version];
+ config = persistedPackacgeConfs[name][version]
}
- const confs = mergePersistedConfWithSpec(config, configSpec);
- packageConfs[name] = confs;
+ const confs = mergePersistedConfWithSpec(config, configSpec)
+ packageConfs[name] = confs
}
- return packageConfs;
+ return packageConfs
}
-export function parseConfigValue(type, stringified) {
- let value = stringified;
+export function parseConfigValue (type, stringified) {
+ let value = stringified
try {
if (HeliumConfFieldType.NUMBER === type) {
- value = parseFloat(stringified);
+ value = parseFloat(stringified)
} else if (HeliumConfFieldType.JSON === type) {
- value = JSON.parse(stringified);
+ value = JSON.parse(stringified)
}
- } catch(error) {
+ } catch (error) {
// return just the stringified one
- console.error(`Failed to parse conf type ${type}, value ${value}`);
+ console.error(`Failed to parse conf type ${type}, value ${value}`)
}
- return value;
+ return value
}
/**
* create persistable config object
*/
-export function createPersistableConfig(currentConf) {
+export function createPersistableConfig (currentConf) {
// persist key-value only
// since other info (e.g type, desc) can be provided by default config
const filtered = currentConf.reduce((acc, c) => {
- let value = parseConfigValue(c.type, c.value);
- acc[c.name] = value;
- return acc;
- }, {});
+ let value = parseConfigValue(c.type, c.value)
+ acc[c.name] = value
+ return acc
+ }, {})
- return filtered;
+ return filtered
}
-
-
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/helium/helium.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/helium/helium.controller.js b/zeppelin-web/src/app/helium/helium.controller.js
index 615f811..7a112e2 100644
--- a/zeppelin-web/src/app/helium/helium.controller.js
+++ b/zeppelin-web/src/app/helium/helium.controller.js
@@ -12,17 +12,17 @@
* limitations under the License.
*/
-import { HeliumType, } from '../../components/helium/helium-type';
+import { HeliumType, } from '../../components/helium/helium-type'
-export default function HeliumCtrl($scope, $rootScope, $sce,
+export default function HeliumCtrl ($scope, $rootScope, $sce,
baseUrlSrv, ngToast, heliumService) {
- 'ngInject';
+ 'ngInject'
- $scope.pkgSearchResults = {};
- $scope.defaultPackages = {};
- $scope.showVersions = {};
- $scope.bundleOrder = [];
- $scope.bundleOrderChanged = false;
+ $scope.pkgSearchResults = {}
+ $scope.defaultPackages = {}
+ $scope.showVersions = {}
+ $scope.bundleOrder = []
+ $scope.bundleOrderChanged = false
$scope.vizTypePkg = {}
$scope.spellTypePkg = {}
$scope.intpTypePkg = {}
@@ -30,168 +30,168 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
$scope.numberOfEachPackageByType = {}
$scope.allPackageTypes = [HeliumType][0]
$scope.pkgListByType = 'VISUALIZATION'
- $scope.defaultPackageConfigs = {}; // { pkgName, [{name, type, desc, value, defaultValue}] }
- $scope.intpDefaultIcon = $sce.trustAsHtml('<img src="../assets/images/maven_default_icon.png" style="width: 12px"/>');
+ $scope.defaultPackageConfigs = {} // { pkgName, [{name, type, desc, value, defaultValue}] }
+ $scope.intpDefaultIcon = $sce.trustAsHtml('<img src="../assets/images/maven_default_icon.png" style="width: 12px"/>')
- function init() {
+ function init () {
// get all package info and set config
heliumService.getAllPackageInfoAndDefaultPackages()
.then(({ pkgSearchResults, defaultPackages }) => {
// pagination
- $scope.itemsPerPage = 10;
- $scope.currentPage = 1;
- $scope.maxSize = 5;
-
- $scope.pkgSearchResults = pkgSearchResults;
- $scope.defaultPackages = defaultPackages;
- classifyPkgType($scope.defaultPackages);
-
+ $scope.itemsPerPage = 10
+ $scope.currentPage = 1
+ $scope.maxSize = 5
+
+ $scope.pkgSearchResults = pkgSearchResults
+ $scope.defaultPackages = defaultPackages
+ classifyPkgType($scope.defaultPackages)
+
return heliumService.getAllPackageConfigs()
})
.then(defaultPackageConfigs => {
- $scope.defaultPackageConfigs = defaultPackageConfigs;
- });
+ $scope.defaultPackageConfigs = defaultPackageConfigs
+ })
// 2. get vis package order
heliumService.getVisualizationPackageOrder()
.then(visPackageOrder => {
- $scope.bundleOrder = visPackageOrder;
- $scope.bundleOrderChanged = false;
- });
- };
+ $scope.bundleOrder = visPackageOrder
+ $scope.bundleOrderChanged = false
+ })
+ }
- var orderPackageByPubDate = function(a, b) {
+ let orderPackageByPubDate = function (a, b) {
if (!a.pkg.published) {
// Because local registry pkgs don't have 'published' field, put current time instead to show them first
a.pkg.published = new Date().getTime()
}
- return new Date(a.pkg.published).getTime() - new Date(b.pkg.published).getTime();
- };
+ return new Date(a.pkg.published).getTime() - new Date(b.pkg.published).getTime()
+ }
- var classifyPkgType = function(packageInfo) {
- var allTypesOfPkg = {};
- var vizTypePkg = [];
- var spellTypePkg = [];
- var intpTypePkg = [];
- var appTypePkg = [];
+ const classifyPkgType = function (packageInfo) {
+ let allTypesOfPkg = {}
+ let vizTypePkg = []
+ let spellTypePkg = []
+ let intpTypePkg = []
+ let appTypePkg = []
- var packageInfoArr = Object.keys(packageInfo).map(key => packageInfo[key])
- packageInfoArr = packageInfoArr.sort(orderPackageByPubDate).reverse();
+ let packageInfoArr = Object.keys(packageInfo).map(key => packageInfo[key])
+ packageInfoArr = packageInfoArr.sort(orderPackageByPubDate).reverse()
- for (var name in packageInfoArr) {
- var pkgs = packageInfoArr[name];
- var pkgType = pkgs.pkg.type;
+ for (let name in packageInfoArr) {
+ let pkgs = packageInfoArr[name]
+ let pkgType = pkgs.pkg.type
switch (pkgType) {
case HeliumType.VISUALIZATION:
- vizTypePkg.push(pkgs);
- break;
+ vizTypePkg.push(pkgs)
+ break
case HeliumType.SPELL:
- spellTypePkg.push(pkgs);
- break;
+ spellTypePkg.push(pkgs)
+ break
case HeliumType.INTERPRETER:
- intpTypePkg.push(pkgs);
- break;
+ intpTypePkg.push(pkgs)
+ break
case HeliumType.APPLICATION:
- appTypePkg.push(pkgs);
- break;
+ appTypePkg.push(pkgs)
+ break
}
}
- var pkgsArr = [
+ let pkgsArr = [
vizTypePkg,
spellTypePkg,
intpTypePkg,
appTypePkg
]
- for (var idx in _.keys(HeliumType)) {
- allTypesOfPkg[_.keys(HeliumType)[idx]] = pkgsArr[idx];
+ for (let idx in _.keys(HeliumType)) {
+ allTypesOfPkg[_.keys(HeliumType)[idx]] = pkgsArr[idx]
}
-
- $scope.allTypesOfPkg = allTypesOfPkg;
- };
+
+ $scope.allTypesOfPkg = allTypesOfPkg
+ }
$scope.bundleOrderListeners = {
- accept: function(sourceItemHandleScope, destSortableScope) {return true;},
- itemMoved: function(event) {},
- orderChanged: function(event) {
- $scope.bundleOrderChanged = true;
+ accept: function (sourceItemHandleScope, destSortableScope) { return true },
+ itemMoved: function (event) {},
+ orderChanged: function (event) {
+ $scope.bundleOrderChanged = true
}
- };
+ }
- $scope.saveBundleOrder = function() {
- var confirm = BootstrapDialog.confirm({
+ $scope.saveBundleOrder = function () {
+ const confirm = BootstrapDialog.confirm({
closable: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: '',
message: 'Save changes?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- confirm.$modalFooter.find('button').addClass('disabled');
+ confirm.$modalFooter.find('button').addClass('disabled')
confirm.$modalFooter.find('button:contains("OK")')
- .html('<i class="fa fa-circle-o-notch fa-spin"></i> Enabling');
- heliumService.setVisualizationPackageOrder($scope.bundleOrder).
- success(function(data, status) {
- init();
- confirm.close();
- }).
- error(function(data, status) {
- confirm.close();
- console.log('Failed to save order');
+ .html('<i class="fa fa-circle-o-notch fa-spin"></i> Enabling')
+ heliumService.setVisualizationPackageOrder($scope.bundleOrder)
+ .success(function (data, status) {
+ init()
+ confirm.close()
+ })
+ .error(function (data, status) {
+ confirm.close()
+ console.log('Failed to save order')
BootstrapDialog.show({
title: 'Error on saving order ',
message: data.message
- });
- });
- return false;
+ })
+ })
+ return false
}
}
- });
- };
+ })
+ }
- var getLicense = function(name, artifact) {
- var filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function(p) {
- return p.artifact === artifact;
- });
+ let getLicense = function (name, artifact) {
+ let filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function (p) {
+ return p.artifact === artifact
+ })
- var license;
+ let license
if (filteredPkgSearchResults.length === 0) {
- filteredPkgSearchResults = _.filter($scope.pkgSearchResults[name], function(p) {
- return p.pkg.artifact === artifact;
- });
+ filteredPkgSearchResults = _.filter($scope.pkgSearchResults[name], function (p) {
+ return p.pkg.artifact === artifact
+ })
if (filteredPkgSearchResults.length > 0) {
- license = filteredPkgSearchResults[0].pkg.license;
+ license = filteredPkgSearchResults[0].pkg.license
}
} else {
- license = filteredPkgSearchResults[0].license;
+ license = filteredPkgSearchResults[0].license
}
if (!license) {
- license = 'Unknown';
+ license = 'Unknown'
}
- return license;
+ return license
}
- const getHeliumTypeText = function(type) {
+ const getHeliumTypeText = function (type) {
if (type === HeliumType.VISUALIZATION) {
- return `<a target="_blank" href="https://zeppelin.apache.org/docs/${$rootScope.zeppelinVersion}/development/writingzeppelinvisualization.html">${type}</a>`; // eslint-disable-line max-len
+ return `<a target="_blank" href="https://zeppelin.apache.org/docs/${$rootScope.zeppelinVersion}/development/writingzeppelinvisualization.html">${type}</a>` // eslint-disable-line max-len
} else if (type === HeliumType.SPELL) {
- return `<a target="_blank" href="https://zeppelin.apache.org/docs/${$rootScope.zeppelinVersion}/development/writingzeppelinspell.html">${type}</a>`; // eslint-disable-line max-len
+ return `<a target="_blank" href="https://zeppelin.apache.org/docs/${$rootScope.zeppelinVersion}/development/writingzeppelinspell.html">${type}</a>` // eslint-disable-line max-len
} else {
- return type;
+ return type
}
}
- $scope.enable = function(name, artifact, type, groupId, description) {
- var license = getLicense(name, artifact);
- var mavenArtifactInfoToHTML = groupId +':'+ artifact.split('@')[0] + ':' + artifact.split('@')[1];
- var zeppelinVersion = $rootScope.zeppelinVersion;
- var url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/manual/interpreterinstallation.html';
+ $scope.enable = function (name, artifact, type, groupId, description) {
+ let license = getLicense(name, artifact)
+ let mavenArtifactInfoToHTML = groupId + ':' + artifact.split('@')[0] + ':' + artifact.split('@')[1]
+ let zeppelinVersion = $rootScope.zeppelinVersion
+ let url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/manual/interpreterinstallation.html'
- var confirm = ''
+ let confirm = ''
if (type === HeliumType.INTERPRETER) {
confirm = BootstrapDialog.show({
title: '',
@@ -201,11 +201,11 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
' and all of its transitive dependencies into interpreter/interpreter-name directory.<p>' +
'<div class="highlight"><pre><code class="text language-text" data-lang="text" style="font-size: 11.5px">' +
'./bin/install-interpreter.sh --name "interpreter-name" --artifact ' +
- mavenArtifactInfoToHTML +' </code></pre>' +
+ mavenArtifactInfoToHTML + ' </code></pre>' +
'<p>After restart Zeppelin, create interpreter setting and bind it with your note. ' +
'For more detailed information, see <a target="_blank" href=' +
url + '>Interpreter Installation.</a></p>'
- });
+ })
} else {
confirm = BootstrapDialog.confirm({
closable: false,
@@ -226,136 +226,136 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
`<div style="color:gray">${license}</div>`,
callback: function (result) {
if (result) {
- confirm.$modalFooter.find('button').addClass('disabled');
+ confirm.$modalFooter.find('button').addClass('disabled')
confirm.$modalFooter.find('button:contains("OK")')
- .html('<i class="fa fa-circle-o-notch fa-spin"></i> Enabling');
+ .html('<i class="fa fa-circle-o-notch fa-spin"></i> Enabling')
heliumService.enable(name, artifact, type).success(function (data, status) {
- init();
- confirm.close();
+ init()
+ confirm.close()
}).error(function (data, status) {
- confirm.close();
- console.log('Failed to enable package %o %o. %o', name, artifact, data);
+ confirm.close()
+ console.log('Failed to enable package %o %o. %o', name, artifact, data)
BootstrapDialog.show({
title: 'Error on enabling ' + name,
message: data.message
- });
- });
- return false;
+ })
+ })
+ return false
}
}
- });
+ })
}
- };
+ }
- $scope.disable = function(name, artifact) {
- var confirm = BootstrapDialog.confirm({
+ $scope.disable = function (name, artifact) {
+ const confirm = BootstrapDialog.confirm({
closable: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: '<div style="font-weight: 300;">Do you want to disable Helium Package?</div>',
message: artifact,
- callback: function(result) {
+ callback: function (result) {
if (result) {
- confirm.$modalFooter.find('button').addClass('disabled');
+ confirm.$modalFooter.find('button').addClass('disabled')
confirm.$modalFooter.find('button:contains("OK")')
- .html('<i class="fa fa-circle-o-notch fa-spin"></i> Disabling');
- heliumService.disable(name).
- success(function(data, status) {
- init();
- confirm.close();
- }).
- error(function(data, status) {
- confirm.close();
- console.log('Failed to disable package %o. %o', name, data);
+ .html('<i class="fa fa-circle-o-notch fa-spin"></i> Disabling')
+ heliumService.disable(name)
+ .success(function (data, status) {
+ init()
+ confirm.close()
+ })
+ .error(function (data, status) {
+ confirm.close()
+ console.log('Failed to disable package %o. %o', name, data)
BootstrapDialog.show({
title: 'Error on disabling ' + name,
message: data.message
- });
- });
- return false;
+ })
+ })
+ return false
}
}
- });
- };
+ })
+ }
- $scope.toggleVersions = function(pkgName) {
+ $scope.toggleVersions = function (pkgName) {
if ($scope.showVersions[pkgName]) {
- $scope.showVersions[pkgName] = false;
+ $scope.showVersions[pkgName] = false
} else {
- $scope.showVersions[pkgName] = true;
+ $scope.showVersions[pkgName] = true
}
- };
+ }
- $scope.isLocalPackage = function(pkgSearchResult) {
- const pkg = pkgSearchResult.pkg;
- return pkg.artifact && !pkg.artifact.includes('@');
- };
+ $scope.isLocalPackage = function (pkgSearchResult) {
+ const pkg = pkgSearchResult.pkg
+ return pkg.artifact && !pkg.artifact.includes('@')
+ }
- $scope.hasNpmLink = function(pkgSearchResult) {
- const pkg = pkgSearchResult.pkg;
+ $scope.hasNpmLink = function (pkgSearchResult) {
+ const pkg = pkgSearchResult.pkg
return (pkg.type === HeliumType.SPELL || pkg.type === HeliumType.VISUALIZATION) &&
- !$scope.isLocalPackage(pkgSearchResult);
- };
+ !$scope.isLocalPackage(pkgSearchResult)
+ }
- $scope.hasMavenLink = function(pkgSearchResult) {
- const pkg = pkgSearchResult.pkg;
+ $scope.hasMavenLink = function (pkgSearchResult) {
+ const pkg = pkgSearchResult.pkg
return (pkg.type === HeliumType.APPLICATION || pkg.type === HeliumType.INTERPRETER) &&
- !$scope.isLocalPackage(pkgSearchResult);
- };
+ !$scope.isLocalPackage(pkgSearchResult)
+ }
- $scope.getPackageSize = function(pkgSearchResult, targetPkgType) {
- var result = []
+ $scope.getPackageSize = function (pkgSearchResult, targetPkgType) {
+ let result = []
_.map(pkgSearchResult, function (pkg) {
result.push(_.find(pkg, {type: targetPkgType}))
})
return _.compact(result).length
}
- $scope.configExists = function(pkgSearchResult) {
+ $scope.configExists = function (pkgSearchResult) {
// helium package config is persisted per version
- return pkgSearchResult.pkg.config && pkgSearchResult.pkg.artifact;
- };
+ return pkgSearchResult.pkg.config && pkgSearchResult.pkg.artifact
+ }
- $scope.configOpened = function(pkgSearchResult) {
- return pkgSearchResult.configOpened && !pkgSearchResult.configFetching;
- };
+ $scope.configOpened = function (pkgSearchResult) {
+ return pkgSearchResult.configOpened && !pkgSearchResult.configFetching
+ }
- $scope.getConfigButtonClass = function(pkgSearchResult) {
- return (pkgSearchResult.configOpened && pkgSearchResult.configFetching) ?
- 'disabled' : '';
+ $scope.getConfigButtonClass = function (pkgSearchResult) {
+ return (pkgSearchResult.configOpened && pkgSearchResult.configFetching)
+ ? 'disabled' : ''
}
- $scope.toggleConfigButton = function(pkgSearchResult) {
+ $scope.toggleConfigButton = function (pkgSearchResult) {
if (pkgSearchResult.configOpened) {
- pkgSearchResult.configOpened = false;
- return;
+ pkgSearchResult.configOpened = false
+ return
}
- const pkg = pkgSearchResult.pkg;
- const pkgName = pkg.name;
- pkgSearchResult.configFetching = true;
- pkgSearchResult.configOpened = true;
+ const pkg = pkgSearchResult.pkg
+ const pkgName = pkg.name
+ pkgSearchResult.configFetching = true
+ pkgSearchResult.configOpened = true
heliumService.getSinglePackageConfigs(pkg)
.then(confs => {
- $scope.defaultPackageConfigs[pkgName] = confs;
- pkgSearchResult.configFetching = false;
- });
- };
+ $scope.defaultPackageConfigs[pkgName] = confs
+ pkgSearchResult.configFetching = false
+ })
+ }
- $scope.saveConfig = function(pkgSearchResult) {
- const pkgName = pkgSearchResult.pkg.name;
- const currentConf = $scope.defaultPackageConfigs[pkgName];
+ $scope.saveConfig = function (pkgSearchResult) {
+ const pkgName = pkgSearchResult.pkg.name
+ const currentConf = $scope.defaultPackageConfigs[pkgName]
heliumService.saveConfig(pkgSearchResult.pkg, currentConf, () => {
// close after config is saved
- pkgSearchResult.configOpened = false;
- });
- };
+ pkgSearchResult.configOpened = false
+ })
+ }
- $scope.getDescriptionText = function(pkgSearchResult) {
- return $sce.trustAsHtml(pkgSearchResult.pkg.description);
- };
+ $scope.getDescriptionText = function (pkgSearchResult) {
+ return $sce.trustAsHtml(pkgSearchResult.pkg.description)
+ }
- init();
+ init()
}
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/helium/index.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/helium/index.js b/zeppelin-web/src/app/helium/index.js
index 632969e..2b27d60 100644
--- a/zeppelin-web/src/app/helium/index.js
+++ b/zeppelin-web/src/app/helium/index.js
@@ -12,8 +12,7 @@
* limitations under the License.
*/
-import HeliumController from './helium.controller';
+import HeliumController from './helium.controller'
angular.module('zeppelinWebApp')
- .controller('HeliumCtrl', HeliumController);
-
+ .controller('HeliumCtrl', HeliumController)
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/app/home/home.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/home/home.controller.js b/zeppelin-web/src/app/home/home.controller.js
index 65332ce..e8fccb9 100644
--- a/zeppelin-web/src/app/home/home.controller.js
+++ b/zeppelin-web/src/app/home/home.controller.js
@@ -12,135 +12,135 @@
* limitations under the License.
*/
-angular.module('zeppelinWebApp').controller('HomeCtrl', HomeCtrl);
+angular.module('zeppelinWebApp').controller('HomeCtrl', HomeCtrl)
-function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arrayOrderingSrv,
+function HomeCtrl ($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arrayOrderingSrv,
ngToast, noteActionSrv, TRASH_FOLDER_ID) {
- 'ngInject';
+ 'ngInject'
- ngToast.dismiss();
- var vm = this;
- vm.notes = noteListDataFactory;
- vm.websocketMsgSrv = websocketMsgSrv;
- vm.arrayOrderingSrv = arrayOrderingSrv;
+ ngToast.dismiss()
+ let vm = this
+ vm.notes = noteListDataFactory
+ vm.websocketMsgSrv = websocketMsgSrv
+ vm.arrayOrderingSrv = arrayOrderingSrv
- vm.notebookHome = false;
- vm.noteCustomHome = true;
+ vm.notebookHome = false
+ vm.noteCustomHome = true
if ($rootScope.ticket !== undefined) {
- vm.staticHome = false;
+ vm.staticHome = false
} else {
- vm.staticHome = true;
+ vm.staticHome = true
}
- $scope.isReloading = false;
- $scope.TRASH_FOLDER_ID = TRASH_FOLDER_ID;
- $scope.query = {q: ''};
+ $scope.isReloading = false
+ $scope.TRASH_FOLDER_ID = TRASH_FOLDER_ID
+ $scope.query = {q: ''}
- $scope.initHome = function() {
- websocketMsgSrv.getHomeNote();
- vm.noteCustomHome = false;
- };
+ $scope.initHome = function () {
+ websocketMsgSrv.getHomeNote()
+ vm.noteCustomHome = false
+ }
- $scope.reloadNoteList = function() {
- websocketMsgSrv.reloadAllNotesFromRepo();
- $scope.isReloadingNotes = true;
- };
+ $scope.reloadNoteList = function () {
+ websocketMsgSrv.reloadAllNotesFromRepo()
+ $scope.isReloadingNotes = true
+ }
- $scope.toggleFolderNode = function(node) {
- node.hidden = !node.hidden;
- };
+ $scope.toggleFolderNode = function (node) {
+ node.hidden = !node.hidden
+ }
- angular.element('#loginModal').on('hidden.bs.modal', function(e) {
- $rootScope.$broadcast('initLoginValues');
- });
+ angular.element('#loginModal').on('hidden.bs.modal', function (e) {
+ $rootScope.$broadcast('initLoginValues')
+ })
/*
** $scope.$on functions below
*/
- $scope.$on('setNoteMenu', function(event, notes) {
- $scope.isReloadingNotes = false;
- });
+ $scope.$on('setNoteMenu', function (event, notes) {
+ $scope.isReloadingNotes = false
+ })
- $scope.$on('setNoteContent', function(event, note) {
+ $scope.$on('setNoteContent', function (event, note) {
if (vm.noteCustomHome) {
- return;
+ return
}
if (note) {
- vm.note = note;
+ vm.note = note
// initialize look And Feel
- $rootScope.$broadcast('setLookAndFeel', 'home');
+ $rootScope.$broadcast('setLookAndFeel', 'home')
// make it read only
- vm.viewOnly = true;
+ vm.viewOnly = true
- vm.notebookHome = true;
- vm.staticHome = false;
+ vm.notebookHome = true
+ vm.staticHome = false
} else {
- vm.staticHome = true;
- vm.notebookHome = false;
+ vm.staticHome = true
+ vm.notebookHome = false
}
- });
+ })
- $scope.renameNote = function(nodeId, nodePath) {
- noteActionSrv.renameNote(nodeId, nodePath);
- };
+ $scope.renameNote = function (nodeId, nodePath) {
+ noteActionSrv.renameNote(nodeId, nodePath)
+ }
- $scope.moveNoteToTrash = function(noteId) {
- noteActionSrv.moveNoteToTrash(noteId, false);
- };
+ $scope.moveNoteToTrash = function (noteId) {
+ noteActionSrv.moveNoteToTrash(noteId, false)
+ }
- $scope.moveFolderToTrash = function(folderId) {
- noteActionSrv.moveFolderToTrash(folderId);
- };
+ $scope.moveFolderToTrash = function (folderId) {
+ noteActionSrv.moveFolderToTrash(folderId)
+ }
- $scope.restoreNote = function(noteId) {
- websocketMsgSrv.restoreNote(noteId);
- };
+ $scope.restoreNote = function (noteId) {
+ websocketMsgSrv.restoreNote(noteId)
+ }
- $scope.restoreFolder = function(folderId) {
- websocketMsgSrv.restoreFolder(folderId);
- };
+ $scope.restoreFolder = function (folderId) {
+ websocketMsgSrv.restoreFolder(folderId)
+ }
- $scope.restoreAll = function() {
- noteActionSrv.restoreAll();
- };
+ $scope.restoreAll = function () {
+ noteActionSrv.restoreAll()
+ }
- $scope.renameFolder = function(node) {
- noteActionSrv.renameFolder(node.id);
- };
+ $scope.renameFolder = function (node) {
+ noteActionSrv.renameFolder(node.id)
+ }
- $scope.removeNote = function(noteId) {
- noteActionSrv.removeNote(noteId, false);
- };
+ $scope.removeNote = function (noteId) {
+ noteActionSrv.removeNote(noteId, false)
+ }
- $scope.removeFolder = function(folderId) {
- noteActionSrv.removeFolder(folderId);
- };
+ $scope.removeFolder = function (folderId) {
+ noteActionSrv.removeFolder(folderId)
+ }
- $scope.emptyTrash = function() {
- noteActionSrv.emptyTrash();
- };
+ $scope.emptyTrash = function () {
+ noteActionSrv.emptyTrash()
+ }
- $scope.clearAllParagraphOutput = function(noteId) {
- noteActionSrv.clearAllParagraphOutput(noteId);
- };
+ $scope.clearAllParagraphOutput = function (noteId) {
+ noteActionSrv.clearAllParagraphOutput(noteId)
+ }
- $scope.isFilterNote = function(note) {
+ $scope.isFilterNote = function (note) {
if (!$scope.query.q) {
- return true;
+ return true
}
- var noteName = note.name;
+ let noteName = note.name
if (noteName.toLowerCase().indexOf($scope.query.q.toLowerCase()) > -1) {
- return true;
+ return true
}
- return false;
- };
+ return false
+ }
- $scope.getNoteName = function(note) {
- return arrayOrderingSrv.getNoteName(note);
- };
+ $scope.getNoteName = function (note) {
+ return arrayOrderingSrv.getNoteName(note)
+ }
}