' +
'./bin/install-interpreter.sh --name "interpreter-name" --artifact ' +
- mavenArtifactInfoToHTML +'
' +
+ mavenArtifactInfoToHTML + ' ' +
'
After restart Zeppelin, create interpreter setting and bind it with your note. ' +
'For more detailed information, see Interpreter Installation.
'
- });
+ })
} else {
confirm = BootstrapDialog.confirm({
closable: false,
@@ -226,136 +226,136 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
`
${license}
`,
callback: function (result) {
if (result) {
- confirm.$modalFooter.find('button').addClass('disabled');
+ confirm.$modalFooter.find('button').addClass('disabled')
confirm.$modalFooter.find('button:contains("OK")')
- .html('
Enabling');
+ .html('
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: '
Do you want to disable Helium Package?
',
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('
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('
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;
- };
-
- $scope.configOpened = function(pkgSearchResult) {
- return pkgSearchResult.configOpened && !pkgSearchResult.configFetching;
- };
-
- $scope.getConfigButtonClass = function(pkgSearchResult) {
- return (pkgSearchResult.configOpened && pkgSearchResult.configFetching) ?
- 'disabled' : '';
+ return pkgSearchResult.pkg.config && pkgSearchResult.pkg.artifact
}
- $scope.toggleConfigButton = function(pkgSearchResult) {
+ $scope.configOpened = function (pkgSearchResult) {
+ return pkgSearchResult.configOpened && !pkgSearchResult.configFetching
+ }
+
+ $scope.getConfigButtonClass = function (pkgSearchResult) {
+ return (pkgSearchResult.configOpened && pkgSearchResult.configFetching)
+ ? 'disabled' : ''
+ }
+
+ $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()
}
diff --git a/zeppelin-web/src/app/helium/index.js b/zeppelin-web/src/app/helium/index.js
index 632969e236..2b27d6036c 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)
diff --git a/zeppelin-web/src/app/home/home.controller.js b/zeppelin-web/src/app/home/home.controller.js
index 65332ce308..e8fccb973d 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)
+ }
}
diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js
index 7140345ec2..032f74c50e 100644
--- a/zeppelin-web/src/app/interpreter/interpreter.controller.js
+++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js
@@ -12,53 +12,53 @@
* limitations under the License.
*/
-import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status';
+import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status'
-angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl);
+angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl)
-function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) {
- 'ngInject';
+function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) {
+ 'ngInject'
- var interpreterSettingsTmp = [];
- $scope.interpreterSettings = [];
- $scope.availableInterpreters = {};
- $scope.showAddNewSetting = false;
- $scope.showRepositoryInfo = false;
- $scope.searchInterpreter = '';
- $scope._ = _;
- $scope.interpreterPropertyWidgets = [];
- ngToast.dismiss();
+ var interpreterSettingsTmp = []
+ $scope.interpreterSettings = []
+ $scope.availableInterpreters = {}
+ $scope.showAddNewSetting = false
+ $scope.showRepositoryInfo = false
+ $scope.searchInterpreter = ''
+ $scope._ = _
+ $scope.interpreterPropertyWidgets = []
+ ngToast.dismiss()
- $scope.openPermissions = function() {
- $scope.showInterpreterAuth = true;
- };
+ $scope.openPermissions = function () {
+ $scope.showInterpreterAuth = true
+ }
- $scope.closePermissions = function() {
- $scope.showInterpreterAuth = false;
- };
+ $scope.closePermissions = function () {
+ $scope.showInterpreterAuth = false
+ }
- var getSelectJson = function() {
- var selectJson = {
+ let getSelectJson = function () {
+ let selectJson = {
tags: false,
multiple: true,
tokenSeparators: [',', ' '],
minimumInputLength: 2,
ajax: {
- url: function(params) {
+ url: function (params) {
if (!params.term) {
- return false;
+ return false
}
- return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term;
+ return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term
},
delay: 250,
- processResults: function(data, params) {
- var users = [];
+ processResults: function (data, params) {
+ let users = []
if (data.body.users.length !== 0) {
- for (var i = 0; i < data.body.users.length; i++) {
+ for (let i = 0; i < data.body.users.length; i++) {
users.push({
'id': data.body.users[i],
'text': data.body.users[i]
- });
+ })
}
}
return {
@@ -66,365 +66,366 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
pagination: {
more: false
}
- };
+ }
},
cache: false
}
- };
- return selectJson;
- };
+ }
+ return selectJson
+ }
- $scope.togglePermissions = function(intpName) {
- angular.element('#' + intpName + 'Users').select2(getSelectJson());
+ $scope.togglePermissions = function (intpName) {
+ angular.element('#' + intpName + 'Users').select2(getSelectJson())
if ($scope.showInterpreterAuth) {
- $scope.closePermissions();
+ $scope.closePermissions()
} else {
- $scope.openPermissions();
+ $scope.openPermissions()
}
- };
+ }
- $scope.$on('ngRenderFinished', function(event, data) {
- for (var setting = 0; setting < $scope.interpreterSettings.length; setting++) {
- angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson());
+ $scope.$on('ngRenderFinished', function (event, data) {
+ for (let setting = 0; setting < $scope.interpreterSettings.length; setting++) {
+ angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson())
}
- });
+ })
- var getInterpreterSettings = function() {
+ let getInterpreterSettings = function () {
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
- .success(function(data, status, headers, config) {
- $scope.interpreterSettings = data.body;
- checkDownloadingDependencies();
- }).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);
- }
- console.log('Error %o %o', status, data.message);
- });
- };
+ .success(function (data, status, headers, config) {
+ $scope.interpreterSettings = data.body
+ checkDownloadingDependencies()
+ }).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)
+ }
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- var checkDownloadingDependencies = function() {
- var isDownloading = false;
- for (var index = 0; index < $scope.interpreterSettings.length; index++) {
- var setting = $scope.interpreterSettings[index];
+ const checkDownloadingDependencies = function () {
+ let isDownloading = false
+ for (let index = 0; index < $scope.interpreterSettings.length; index++) {
+ let setting = $scope.interpreterSettings[index]
if (setting.status === 'DOWNLOADING_DEPENDENCIES') {
- isDownloading = true;
+ isDownloading = true
}
if (setting.status === ParagraphStatus.ERROR || setting.errorReason) {
ngToast.danger({content: 'Error setting properties for interpreter \'' +
setting.group + '.' + setting.name + '\': ' + setting.errorReason,
- verticalPosition: 'top', dismissOnTimeout: false});
+ verticalPosition: 'top',
+ dismissOnTimeout: false
+ })
}
}
if (isDownloading) {
- $timeout(function() {
+ $timeout(function () {
if ($route.current.$$route.originalPath === '/interpreter') {
- getInterpreterSettings();
+ getInterpreterSettings()
}
- }, 2000);
+ }, 2000)
}
- };
+ }
- var getAvailableInterpreters = function() {
- $http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function(data, status, headers, config) {
- $scope.availableInterpreters = data.body;
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
- };
+ let getAvailableInterpreters = function () {
+ $http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function (data, status, headers, config) {
+ $scope.availableInterpreters = data.body
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
+ }
var getAvailableInterpreterPropertyWidgets = function () {
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/widgets')
.success(function (data, status, headers, config) {
- $scope.interpreterPropertyWidgets = data.body;
+ $scope.interpreterPropertyWidgets = data.body
}).error(function (data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
- };
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- var emptyNewProperty = function(object) {
+ let emptyNewProperty = function(object) {
angular.extend(object, {propertyValue: '', propertyKey: '', propertyWidget: $scope.interpreterPropertyWidgets[0]});
- };
+ }
- var emptyNewDependency = function(object) {
- angular.extend(object, {depArtifact: '', depExclude: ''});
- };
+ let emptyNewDependency = function (object) {
+ angular.extend(object, {depArtifact: '', depExclude: ''})
+ }
- var removeTMPSettings = function(index) {
- interpreterSettingsTmp.splice(index, 1);
- };
+ let removeTMPSettings = function (index) {
+ interpreterSettingsTmp.splice(index, 1)
+ }
- $scope.copyOriginInterpreterSettingProperties = function(settingId) {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]);
- };
+ $scope.copyOriginInterpreterSettingProperties = function (settingId) {
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index])
+ }
- $scope.setPerNoteOption = function(settingId, sessionOption) {
- var option;
+ $scope.setPerNoteOption = function (settingId, sessionOption) {
+ let option
if (settingId === undefined) {
- option = $scope.newInterpreterSetting.option;
+ option = $scope.newInterpreterSetting.option
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
- option = setting.option;
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
+ option = setting.option
}
if (sessionOption === 'isolated') {
- option.perNote = sessionOption;
- option.session = false;
- option.process = true;
+ option.perNote = sessionOption
+ option.session = false
+ option.process = true
} else if (sessionOption === 'scoped') {
- option.perNote = sessionOption;
- option.session = true;
- option.process = false;
+ option.perNote = sessionOption
+ option.session = true
+ option.process = false
} else {
- option.perNote = 'shared';
- option.session = false;
- option.process = false;
+ option.perNote = 'shared'
+ option.session = false
+ option.process = false
}
- };
+ }
$scope.defaultValueByWidget = function(setting) {
if (setting.propertyWidget === 'checkbox') {
- setting.propertyValue = false;
- return;
+ setting.propertyValue = false
+ return
}
- setting.propertyValue = '';
+ setting.propertyValue = ''
};
$scope.setPerUserOption = function(settingId, sessionOption) {
- var option;
+ let option
if (settingId === undefined) {
- option = $scope.newInterpreterSetting.option;
+ option = $scope.newInterpreterSetting.option
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
- option = setting.option;
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
+ option = setting.option
}
if (sessionOption === 'isolated') {
- option.perUser = sessionOption;
- option.session = false;
- option.process = true;
+ option.perUser = sessionOption
+ option.session = false
+ option.process = true
} else if (sessionOption === 'scoped') {
- option.perUser = sessionOption;
- option.session = true;
- option.process = false;
+ option.perUser = sessionOption
+ option.session = true
+ option.process = false
} else {
- option.perUser = 'shared';
- option.session = false;
- option.process = false;
+ option.perUser = 'shared'
+ option.session = false
+ option.process = false
}
- };
+ }
- $scope.getPerNoteOption = function(settingId) {
- var option;
+ $scope.getPerNoteOption = function (settingId) {
+ let option
if (settingId === undefined) {
- option = $scope.newInterpreterSetting.option;
+ option = $scope.newInterpreterSetting.option
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
- option = setting.option;
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
+ option = setting.option
}
if (option.perNote === 'scoped') {
- return 'scoped';
+ return 'scoped'
} else if (option.perNote === 'isolated') {
- return 'isolated';
+ return 'isolated'
} else {
- return 'shared';
+ return 'shared'
}
- };
+ }
- $scope.getPerUserOption = function(settingId) {
- var option;
+ $scope.getPerUserOption = function (settingId) {
+ let option
if (settingId === undefined) {
- option = $scope.newInterpreterSetting.option;
+ option = $scope.newInterpreterSetting.option
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
- option = setting.option;
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
+ option = setting.option
}
if (option.perUser === 'scoped') {
- return 'scoped';
+ return 'scoped'
} else if (option.perUser === 'isolated') {
- return 'isolated';
+ return 'isolated'
} else {
- return 'shared';
+ return 'shared'
}
- };
+ }
- $scope.getInterpreterRunningOption = function(settingId) {
- var sharedModeName = 'shared';
+ $scope.getInterpreterRunningOption = function (settingId) {
+ let sharedModeName = 'shared'
- var globallyModeName = 'Globally';
- var perNoteModeName = 'Per Note';
- var perUserModeName = 'Per User';
+ let globallyModeName = 'Globally'
+ let perNoteModeName = 'Per Note'
+ let perUserModeName = 'Per User'
- var option;
+ let option
if (settingId === undefined) {
- option = $scope.newInterpreterSetting.option;
+ option = $scope.newInterpreterSetting.option
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
- option = setting.option;
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
+ option = setting.option
}
- var perNote = option.perNote;
- var perUser = option.perUser;
+ let perNote = option.perNote
+ let perUser = option.perUser
// Globally == shared_perNote + shared_perUser
if (perNote === sharedModeName && perUser === sharedModeName) {
- return globallyModeName;
+ return globallyModeName
}
if ($rootScope.ticket.ticket === 'anonymous' && $rootScope.ticket.roles === '[]') {
if (perNote !== undefined && typeof perNote === 'string' && perNote !== '') {
- return perNoteModeName;
+ return perNoteModeName
}
} else if ($rootScope.ticket.ticket !== 'anonymous') {
if (perNote !== undefined && typeof perNote === 'string' && perNote !== '') {
if (perUser !== undefined && typeof perUser === 'string' && perUser !== '') {
- return perUserModeName;
+ return perUserModeName
}
- return perNoteModeName;
+ return perNoteModeName
}
}
- option.perNote = sharedModeName;
- option.perUser = sharedModeName;
- return globallyModeName;
- };
+ option.perNote = sharedModeName
+ option.perUser = sharedModeName
+ return globallyModeName
+ }
- $scope.setInterpreterRunningOption = function(settingId, isPerNoteMode, isPerUserMode) {
- var option;
+ $scope.setInterpreterRunningOption = function (settingId, isPerNoteMode, isPerUserMode) {
+ let option
if (settingId === undefined) {
- option = $scope.newInterpreterSetting.option;
+ option = $scope.newInterpreterSetting.option
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
- option = setting.option;
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
+ option = setting.option
}
- option.perNote = isPerNoteMode;
- option.perUser = isPerUserMode;
- };
+ option.perNote = isPerNoteMode
+ option.perUser = isPerUserMode
+ }
- $scope.updateInterpreterSetting = function(form, settingId) {
- var thisConfirm = BootstrapDialog.confirm({
+ $scope.updateInterpreterSetting = function (form, settingId) {
+ const thisConfirm = BootstrapDialog.confirm({
closable: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: '',
message: 'Do you want to update this interpreter and restart with new settings?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
if (setting.propertyKey !== '' || setting.propertyKey) {
- $scope.addNewInterpreterProperty(settingId);
+ $scope.addNewInterpreterProperty(settingId)
}
if (setting.depArtifact !== '' || setting.depArtifact) {
- $scope.addNewInterpreterDependency(settingId);
+ $scope.addNewInterpreterDependency(settingId)
}
// add missing field of option
if (!setting.option) {
- setting.option = {};
+ setting.option = {}
}
if (setting.option.isExistingProcess === undefined) {
- setting.option.isExistingProcess = false;
+ setting.option.isExistingProcess = false
}
if (setting.option.setPermission === undefined) {
- setting.option.setPermission = false;
+ setting.option.setPermission = false
}
if (setting.option.isUserImpersonate === undefined) {
- setting.option.isUserImpersonate = false;
+ setting.option.isUserImpersonate = false
}
if (!($scope.getInterpreterRunningOption(settingId) === 'Per User' &&
$scope.getPerUserOption(settingId) === 'isolated')) {
- setting.option.isUserImpersonate = false;
+ setting.option.isUserImpersonate = false
}
if (setting.option.remote === undefined) {
// remote always true for now
- setting.option.remote = true;
+ setting.option.remote = true
}
- setting.option.users = angular.element('#' + setting.name + 'Users').val();
+ setting.option.users = angular.element('#' + setting.name + 'Users').val()
- var request = {
+ let request = {
option: angular.copy(setting.option),
properties: angular.copy(setting.properties),
dependencies: angular.copy(setting.dependencies)
- };
+ }
- thisConfirm.$modalFooter.find('button').addClass('disabled');
+ thisConfirm.$modalFooter.find('button').addClass('disabled')
thisConfirm.$modalFooter.find('button:contains("OK")')
- .html('
Saving Setting');
+ .html('
Saving Setting')
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId, request)
- .success(function(data, status, headers, config) {
- $scope.interpreterSettings[index] = data.body;
- removeTMPSettings(index);
- checkDownloadingDependencies();
- thisConfirm.close();
+ .success(function (data, status, headers, config) {
+ $scope.interpreterSettings[index] = data.body
+ removeTMPSettings(index)
+ checkDownloadingDependencies()
+ thisConfirm.close()
})
- .error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- ngToast.danger({content: data.message, verticalPosition: 'bottom'});
- form.$show();
- thisConfirm.close();
- });
- return false;
+ .error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ ngToast.danger({content: data.message, verticalPosition: 'bottom'})
+ form.$show()
+ thisConfirm.close()
+ })
+ return false
} else {
- form.$show();
+ form.$show()
}
}
- });
- };
+ })
+ }
- $scope.resetInterpreterSetting = function(settingId) {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
+ $scope.resetInterpreterSetting = function (settingId) {
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
// Set the old settings back
- $scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index]);
- removeTMPSettings(index);
- };
+ $scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index])
+ removeTMPSettings(index)
+ }
- $scope.removeInterpreterSetting = function(settingId) {
+ $scope.removeInterpreterSetting = function (settingId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Do you want to delete this interpreter setting?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
$http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId)
- .success(function(data, status, headers, config) {
-
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- $scope.interpreterSettings.splice(index, 1);
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
+ .success(function (data, status, headers, config) {
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ $scope.interpreterSettings.splice(index, 1)
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
}
}
- });
- };
+ })
+ }
- $scope.newInterpreterGroupChange = function() {
- var el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}),
- 'properties');
- var properties = {};
- for (var i = 0; i < el.length; i++) {
- var intpInfo = el[i];
- for (var key in intpInfo) {
+ $scope.newInterpreterGroupChange = function () {
+ let el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}),
+ 'properties')
+ let properties = {}
+ for (let i = 0; i < el.length; i++) {
+ let intpInfo = el[i]
+ for (let key in intpInfo) {
properties[key] = {
value: intpInfo[key].defaultValue,
description: intpInfo[key].description,
@@ -432,41 +433,41 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
};
}
}
- $scope.newInterpreterSetting.properties = properties;
- };
+ $scope.newInterpreterSetting.properties = properties
+ }
- $scope.restartInterpreterSetting = function(settingId) {
+ $scope.restartInterpreterSetting = function (settingId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Do you want to restart this interpreter?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId)
- .success(function(data, status, headers, config) {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- $scope.interpreterSettings[index] = data.body;
- ngToast.info('Interpreter stopped. Will be lazily started on next run.');
- }).error(function(data, status, headers, config) {
- var errorMsg = (data !== null) ? data.message : 'Could not connect to server.';
- console.log('Error %o %o', status, errorMsg);
- ngToast.danger(errorMsg);
- });
+ .success(function (data, status, headers, config) {
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ $scope.interpreterSettings[index] = data.body
+ ngToast.info('Interpreter stopped. Will be lazily started on next run.')
+ }).error(function (data, status, headers, config) {
+ let errorMsg = (data !== null) ? data.message : 'Could not connect to server.'
+ console.log('Error %o %o', status, errorMsg)
+ ngToast.danger(errorMsg)
+ })
}
}
- });
- };
+ })
+ }
- $scope.addNewInterpreterSetting = function() {
- //user input validation on interpreter creation
+ $scope.addNewInterpreterSetting = function () {
+ // user input validation on interpreter creation
if (!$scope.newInterpreterSetting.name ||
!$scope.newInterpreterSetting.name.trim() || !$scope.newInterpreterSetting.group) {
BootstrapDialog.alert({
closable: true,
title: 'Add interpreter',
message: 'Please fill in interpreter name and choose a group'
- });
- return;
+ })
+ return
}
if ($scope.newInterpreterSetting.name.indexOf('.') >= 0) {
@@ -474,8 +475,8 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
closable: true,
title: 'Add interpreter',
message: '\'.\' is invalid for interpreter name'
- });
- return;
+ })
+ return
}
if (_.findIndex($scope.interpreterSettings, {'name': $scope.newInterpreterSetting.name}) >= 0) {
@@ -483,51 +484,51 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
closable: true,
title: 'Add interpreter',
message: 'Name ' + $scope.newInterpreterSetting.name + ' already exists'
- });
- return;
+ })
+ return
}
- var newSetting = $scope.newInterpreterSetting;
+ let newSetting = $scope.newInterpreterSetting
if (newSetting.propertyKey !== '' || newSetting.propertyKey) {
- $scope.addNewInterpreterProperty();
+ $scope.addNewInterpreterProperty()
}
if (newSetting.depArtifact !== '' || newSetting.depArtifact) {
- $scope.addNewInterpreterDependency();
+ $scope.addNewInterpreterDependency()
}
if (newSetting.option.setPermission === undefined) {
- newSetting.option.setPermission = false;
+ newSetting.option.setPermission = false
}
- newSetting.option.users = angular.element('#newInterpreterUsers').val();
+ newSetting.option.users = angular.element('#newInterpreterUsers').val()
- var request = angular.copy($scope.newInterpreterSetting);
+ let request = angular.copy($scope.newInterpreterSetting)
// Change properties to proper request format
- var newProperties = {};
+ let newProperties = {}
- for (var p in newSetting.properties) {
- newProperties[p] = {value: newSetting.properties[p].value, widget: newSetting.properties[p].widget, name: p};
+ for (let p in newSetting.properties) {
+ newProperties[p] = {value: newSetting.properties[p].value, widget: newSetting.properties[p].widget, name: p}
}
request.properties = newProperties;
$http.post(baseUrlSrv.getRestApiBase() + '/interpreter/setting', request)
- .success(function(data, status, headers, config) {
- $scope.resetNewInterpreterSetting();
- getInterpreterSettings();
- $scope.showAddNewSetting = false;
- checkDownloadingDependencies();
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- ngToast.danger({content: data.message, verticalPosition: 'bottom'});
- });
- };
+ .success(function (data, status, headers, config) {
+ $scope.resetNewInterpreterSetting()
+ getInterpreterSettings()
+ $scope.showAddNewSetting = false
+ checkDownloadingDependencies()
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ ngToast.danger({content: data.message, verticalPosition: 'bottom'})
+ })
+ }
- $scope.cancelInterpreterSetting = function() {
- $scope.showAddNewSetting = false;
- $scope.resetNewInterpreterSetting();
- };
+ $scope.cancelInterpreterSetting = function () {
+ $scope.showAddNewSetting = false
+ $scope.resetNewInterpreterSetting()
+ }
- $scope.resetNewInterpreterSetting = function() {
+ $scope.resetNewInterpreterSetting = function () {
$scope.newInterpreterSetting = {
name: undefined,
group: undefined,
@@ -541,113 +542,113 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
process: false
}
- };
- emptyNewProperty($scope.newInterpreterSetting);
- };
-
- $scope.removeInterpreterProperty = function(key, settingId) {
- if (settingId === undefined) {
- delete $scope.newInterpreterSetting.properties[key];
- } else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- delete $scope.interpreterSettings[index].properties[key];
}
- };
+ emptyNewProperty($scope.newInterpreterSetting)
+ }
- $scope.removeInterpreterDependency = function(artifact, settingId) {
+ $scope.removeInterpreterProperty = function (key, settingId) {
+ if (settingId === undefined) {
+ delete $scope.newInterpreterSetting.properties[key]
+ } else {
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ delete $scope.interpreterSettings[index].properties[key]
+ }
+ }
+
+ $scope.removeInterpreterDependency = function (artifact, settingId) {
if (settingId === undefined) {
$scope.newInterpreterSetting.dependencies = _.reject($scope.newInterpreterSetting.dependencies,
- function(el) {
- return el.groupArtifactVersion === artifact;
- });
+ function (el) {
+ return el.groupArtifactVersion === artifact
+ })
} else {
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
$scope.interpreterSettings[index].dependencies = _.reject($scope.interpreterSettings[index].dependencies,
- function(el) {
- return el.groupArtifactVersion === artifact;
- });
+ function (el) {
+ return el.groupArtifactVersion === artifact
+ })
}
- };
+ }
- $scope.addNewInterpreterProperty = function(settingId) {
+ $scope.addNewInterpreterProperty = function (settingId) {
if (settingId === undefined) {
// Add new property from create form
if (!$scope.newInterpreterSetting.propertyKey || $scope.newInterpreterSetting.propertyKey === '') {
- return;
+ return
}
$scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = {
value: $scope.newInterpreterSetting.propertyValue,
widget: $scope.newInterpreterSetting.propertyWidget
};
- emptyNewProperty($scope.newInterpreterSetting);
+ emptyNewProperty($scope.newInterpreterSetting)
} else {
// Add new property from edit form
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
if (!setting.propertyKey || setting.propertyKey === '') {
- return;
+ return
}
- setting.properties[setting.propertyKey] = {value: setting.propertyValue, widget: setting.propertyWidget};
+ setting.properties[setting.propertyKey] = {value: setting.propertyValue, widget: setting.propertyWidget}
emptyNewProperty(setting);
}
- };
+ }
- $scope.addNewInterpreterDependency = function(settingId) {
+ $scope.addNewInterpreterDependency = function (settingId) {
if (settingId === undefined) {
// Add new dependency from create form
if (!$scope.newInterpreterSetting.depArtifact || $scope.newInterpreterSetting.depArtifact === '') {
- return;
+ return
}
// overwrite if artifact already exists
- var newSetting = $scope.newInterpreterSetting;
- for (var d in newSetting.dependencies) {
+ let newSetting = $scope.newInterpreterSetting
+ for (let d in newSetting.dependencies) {
if (newSetting.dependencies[d].groupArtifactVersion === newSetting.depArtifact) {
newSetting.dependencies[d] = {
'groupArtifactVersion': newSetting.depArtifact,
'exclusions': newSetting.depExclude
- };
- newSetting.dependencies.splice(d, 1);
+ }
+ newSetting.dependencies.splice(d, 1)
}
}
newSetting.dependencies.push({
'groupArtifactVersion': newSetting.depArtifact,
'exclusions': (newSetting.depExclude === '') ? [] : newSetting.depExclude
- });
- emptyNewDependency(newSetting);
+ })
+ emptyNewDependency(newSetting)
} else {
// Add new dependency from edit form
- var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
- var setting = $scope.interpreterSettings[index];
+ let index = _.findIndex($scope.interpreterSettings, {'id': settingId})
+ let setting = $scope.interpreterSettings[index]
if (!setting.depArtifact || setting.depArtifact === '') {
- return;
+ return
}
// overwrite if artifact already exists
- for (var dep in setting.dependencies) {
+ for (let dep in setting.dependencies) {
if (setting.dependencies[dep].groupArtifactVersion === setting.depArtifact) {
setting.dependencies[dep] = {
'groupArtifactVersion': setting.depArtifact,
'exclusions': setting.depExclude
- };
- setting.dependencies.splice(dep, 1);
+ }
+ setting.dependencies.splice(dep, 1)
}
}
setting.dependencies.push({
'groupArtifactVersion': setting.depArtifact,
'exclusions': (setting.depExclude === '') ? [] : setting.depExclude
- });
- emptyNewDependency(setting);
+ })
+ emptyNewDependency(setting)
}
- };
+ }
- $scope.resetNewRepositorySetting = function() {
+ $scope.resetNewRepositorySetting = function () {
$scope.newRepoSetting = {
id: '',
url: '',
@@ -659,92 +660,91 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
proxyPort: null,
proxyLogin: '',
proxyPassword: ''
- };
- };
+ }
+ }
- var getRepositories = function() {
+ let getRepositories = function () {
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/repository')
- .success(function(data, status, headers, config) {
- $scope.repositories = data.body;
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
- };
+ .success(function (data, status, headers, config) {
+ $scope.repositories = data.body
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- $scope.addNewRepository = function() {
- var request = angular.copy($scope.newRepoSetting);
+ $scope.addNewRepository = function () {
+ let request = angular.copy($scope.newRepoSetting)
$http.post(baseUrlSrv.getRestApiBase() + '/interpreter/repository', request)
- .success(function(data, status, headers, config) {
- getRepositories();
- $scope.resetNewRepositorySetting();
- angular.element('#repoModal').modal('hide');
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', headers, config);
- });
- };
+ .success(function (data, status, headers, config) {
+ getRepositories()
+ $scope.resetNewRepositorySetting()
+ angular.element('#repoModal').modal('hide')
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', headers, config)
+ })
+ }
- $scope.removeRepository = function(repoId) {
+ $scope.removeRepository = function (repoId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Do you want to delete this repository?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
$http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/repository/' + repoId)
- .success(function(data, status, headers, config) {
- var index = _.findIndex($scope.repositories, {'id': repoId});
- $scope.repositories.splice(index, 1);
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
+ .success(function (data, status, headers, config) {
+ let index = _.findIndex($scope.repositories, {'id': repoId})
+ $scope.repositories.splice(index, 1)
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
}
}
- });
- };
+ })
+ }
- $scope.isDefaultRepository = function(repoId) {
+ $scope.isDefaultRepository = function (repoId) {
if (repoId === 'central' || repoId === 'local') {
- return true;
+ return true
} else {
- return false;
+ return false
}
- };
+ }
- $scope.showErrorMessage = function(setting) {
+ $scope.showErrorMessage = function (setting) {
BootstrapDialog.show({
title: 'Error downloading dependencies',
message: setting.errorReason
- });
- };
+ })
+ }
- var init = function() {
- getAvailableInterpreterPropertyWidgets();
+ let init = function() {
+ getAvailableInterpreterPropertyWidgets()
- $scope.resetNewInterpreterSetting();
- $scope.resetNewRepositorySetting();
+ $scope.resetNewInterpreterSetting()
+ $scope.resetNewRepositorySetting()
- getInterpreterSettings();
- getAvailableInterpreters();
- getRepositories();
- };
+ getInterpreterSettings()
+ getAvailableInterpreters()
+ getRepositories()
+ }
- $scope.showSparkUI = function(settingId) {
+ $scope.showSparkUI = function (settingId) {
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/getmetainfos/' + settingId + '?propName=url')
- .success(function(data, status, headers, config) {
- var url = data.body.url;
+ .success(function (data, status, headers, config) {
+ let url = data.body.url
if (!url) {
BootstrapDialog.alert({
message: 'No spark application running'
- });
- return;
+ })
+ return
}
- window.open(url, '_blank');
- }).error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
- });
- };
+ window.open(url, '_blank')
+ }).error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
+ })
+ }
- init();
+ init()
}
-
diff --git a/zeppelin-web/src/app/interpreter/interpreter.filter.js b/zeppelin-web/src/app/interpreter/interpreter.filter.js
index c5f1572b08..3f42572015 100644
--- a/zeppelin-web/src/app/interpreter/interpreter.filter.js
+++ b/zeppelin-web/src/app/interpreter/interpreter.filter.js
@@ -12,11 +12,11 @@
* limitations under the License.
*/
-angular.module('zeppelinWebApp').filter('sortByKey', sortByKey);
+angular.module('zeppelinWebApp').filter('sortByKey', sortByKey)
-function sortByKey() {
- return function(properties) {
- var sortedKeys = properties ? Object.keys(properties) : [];
- return sortedKeys.sort();
- };
+function sortByKey () {
+ return function (properties) {
+ let sortedKeys = properties ? Object.keys(properties) : []
+ return sortedKeys.sort()
+ }
}
diff --git a/zeppelin-web/src/app/jobmanager/jobmanager.controller.js b/zeppelin-web/src/app/jobmanager/jobmanager.controller.js
index 5503be4324..ec6f1ab5d9 100644
--- a/zeppelin-web/src/app/jobmanager/jobmanager.controller.js
+++ b/zeppelin-web/src/app/jobmanager/jobmanager.controller.js
@@ -13,172 +13,169 @@
*/
angular.module('zeppelinWebApp')
- .controller('JobmanagerCtrl', JobmanagerCtrl);
+ .controller('JobmanagerCtrl', JobmanagerCtrl)
-function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeout, jobManagerFilter) {
- 'ngInject';
+function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeout, jobManagerFilter) {
+ 'ngInject'
- ngToast.dismiss();
- var asyncNotebookJobFilter = function(jobInfomations, filterConfig) {
- return $q(function(resolve, reject) {
- $scope.JobInfomationsByFilter = $scope.jobTypeFilter(jobInfomations, filterConfig);
- resolve($scope.JobInfomationsByFilter);
- });
- };
+ ngToast.dismiss()
+ let asyncNotebookJobFilter = function (jobInfomations, filterConfig) {
+ return $q(function (resolve, reject) {
+ $scope.JobInfomationsByFilter = $scope.jobTypeFilter(jobInfomations, filterConfig)
+ resolve($scope.JobInfomationsByFilter)
+ })
+ }
- $scope.doFiltering = function(jobInfomations, filterConfig) {
+ $scope.doFiltering = function (jobInfomations, filterConfig) {
asyncNotebookJobFilter(jobInfomations, filterConfig).then(
- function() {
+ function () {
// success
- $scope.isLoadingFilter = false;
+ $scope.isLoadingFilter = false
},
- function() {
+ function () {
// failed
- });
- };
+ })
+ }
- $scope.filterValueToName = function(filterValue, maxStringLength) {
+ $scope.filterValueToName = function (filterValue, maxStringLength) {
if ($scope.activeInterpreters === undefined) {
- return;
+ return
}
- var index = _.findIndex($scope.activeInterpreters, {value: filterValue});
+ let index = _.findIndex($scope.activeInterpreters, {value: filterValue})
if ($scope.activeInterpreters[index].name !== undefined) {
if (maxStringLength !== undefined && maxStringLength > $scope.activeInterpreters[index].name) {
- return $scope.activeInterpreters[index].name.substr(0, maxStringLength - 3) + '...';
+ return $scope.activeInterpreters[index].name.substr(0, maxStringLength - 3) + '...'
}
- return $scope.activeInterpreters[index].name;
+ return $scope.activeInterpreters[index].name
} else {
- return 'Interpreter is not set';
+ return 'Interpreter is not set'
}
- };
+ }
- $scope.setFilterValue = function(filterValue) {
- $scope.filterConfig.filterValueInterpreter = filterValue;
- $scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
- };
+ $scope.setFilterValue = function (filterValue) {
+ $scope.filterConfig.filterValueInterpreter = filterValue
+ $scope.doFiltering($scope.jobInfomations, $scope.filterConfig)
+ }
- $scope.onChangeRunJobToAlwaysTopToggle = function() {
- $scope.filterConfig.isRunningAlwaysTop = !$scope.filterConfig.isRunningAlwaysTop;
- $scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
- };
+ $scope.onChangeRunJobToAlwaysTopToggle = function () {
+ $scope.filterConfig.isRunningAlwaysTop = !$scope.filterConfig.isRunningAlwaysTop
+ $scope.doFiltering($scope.jobInfomations, $scope.filterConfig)
+ }
- $scope.onChangeSortAsc = function() {
- $scope.filterConfig.isSortByAsc = !$scope.filterConfig.isSortByAsc;
- $scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
- };
+ $scope.onChangeSortAsc = function () {
+ $scope.filterConfig.isSortByAsc = !$scope.filterConfig.isSortByAsc
+ $scope.doFiltering($scope.jobInfomations, $scope.filterConfig)
+ }
- $scope.doFilterInputTyping = function(keyEvent, jobInfomations, filterConfig) {
- var RETURN_KEY_CODE = 13;
- $timeout.cancel($scope.dofilterTimeoutObject);
- $scope.isActiveSearchTimer = true;
- $scope.dofilterTimeoutObject = $timeout(function() {
- $scope.doFiltering(jobInfomations, filterConfig);
- $scope.isActiveSearchTimer = false;
- }, 10000);
+ $scope.doFilterInputTyping = function (keyEvent, jobInfomations, filterConfig) {
+ let RETURN_KEY_CODE = 13
+ $timeout.cancel($scope.dofilterTimeoutObject)
+ $scope.isActiveSearchTimer = true
+ $scope.dofilterTimeoutObject = $timeout(function () {
+ $scope.doFiltering(jobInfomations, filterConfig)
+ $scope.isActiveSearchTimer = false
+ }, 10000)
if (keyEvent.which === RETURN_KEY_CODE) {
- $timeout.cancel($scope.dofilterTimeoutObject);
- $scope.doFiltering(jobInfomations, filterConfig);
- $scope.isActiveSearchTimer = false;
+ $timeout.cancel($scope.dofilterTimeoutObject)
+ $scope.doFiltering(jobInfomations, filterConfig)
+ $scope.isActiveSearchTimer = false
}
- };
+ }
- $scope.doForceFilterInputTyping = function(keyEvent, jobInfomations, filterConfig) {
- $timeout.cancel($scope.dofilterTimeoutObject);
- $scope.doFiltering(jobInfomations, filterConfig);
- $scope.isActiveSearchTimer = false;
- };
+ $scope.doForceFilterInputTyping = function (keyEvent, jobInfomations, filterConfig) {
+ $timeout.cancel($scope.dofilterTimeoutObject)
+ $scope.doFiltering(jobInfomations, filterConfig)
+ $scope.isActiveSearchTimer = false
+ }
- $scope.init = function() {
- $scope.isLoadingFilter = true;
- $scope.jobInfomations = [];
- $scope.JobInfomationsByFilter = $scope.jobInfomations;
+ $scope.init = function () {
+ $scope.isLoadingFilter = true
+ $scope.jobInfomations = []
+ $scope.JobInfomationsByFilter = $scope.jobInfomations
$scope.filterConfig = {
isRunningAlwaysTop: true,
filterValueNotebookName: '',
filterValueInterpreter: '*',
isSortByAsc: true
- };
- $scope.sortTooltipMsg = 'Switch to sort by desc';
- $scope.jobTypeFilter = jobManagerFilter;
+ }
+ $scope.sortTooltipMsg = 'Switch to sort by desc'
+ $scope.jobTypeFilter = jobManagerFilter
- websocketMsgSrv.getNoteJobsList();
+ websocketMsgSrv.getNoteJobsList()
$scope.$watch('filterConfig.isSortByAsc', function (value) {
if (value) {
- $scope.sortTooltipMsg = 'Switch to sort by desc';
+ $scope.sortTooltipMsg = 'Switch to sort by desc'
} else {
- $scope.sortTooltipMsg = 'Switch to sort by asc';
+ $scope.sortTooltipMsg = 'Switch to sort by asc'
}
- });
+ })
- $scope.$on('$destroy', function() {
- websocketMsgSrv.unsubscribeJobManager();
- });
- };
+ $scope.$on('$destroy', function () {
+ websocketMsgSrv.unsubscribeJobManager()
+ })
+ }
/*
** $scope.$on functions below
*/
- $scope.$on('setNoteJobs', function(event, responseData) {
- $scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
- $scope.jobInfomations = responseData.jobs;
- $scope.jobInfomationsIndexs = $scope.jobInfomations ? _.indexBy($scope.jobInfomations, 'noteId') : {};
- $scope.jobTypeFilter($scope.jobInfomations, $scope.filterConfig);
+ $scope.$on('setNoteJobs', function (event, responseData) {
+ $scope.lastJobServerUnixTime = responseData.lastResponseUnixTime
+ $scope.jobInfomations = responseData.jobs
+ $scope.jobInfomationsIndexs = $scope.jobInfomations ? _.indexBy($scope.jobInfomations, 'noteId') : {}
+ $scope.jobTypeFilter($scope.jobInfomations, $scope.filterConfig)
$scope.activeInterpreters = [
{
name: 'ALL',
value: '*'
}
- ];
- var interpreterLists = _.uniq(_.pluck($scope.jobInfomations, 'interpreter'), false);
- for (var index = 0, length = interpreterLists.length; index < length; index++) {
+ ]
+ let interpreterLists = _.uniq(_.pluck($scope.jobInfomations, 'interpreter'), false)
+ for (let index = 0, length = interpreterLists.length; index < length; index++) {
$scope.activeInterpreters.push({
name: interpreterLists[index],
value: interpreterLists[index]
- });
+ })
}
- $scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
- });
+ $scope.doFiltering($scope.jobInfomations, $scope.filterConfig)
+ })
- $scope.$on('setUpdateNoteJobs', function(event, responseData) {
- var jobInfomations = $scope.jobInfomations;
- var indexStore = $scope.jobInfomationsIndexs;
- $scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
- var notes = responseData.jobs;
- notes.map(function(changedItem) {
+ $scope.$on('setUpdateNoteJobs', function (event, responseData) {
+ let jobInfomations = $scope.jobInfomations
+ let indexStore = $scope.jobInfomationsIndexs
+ $scope.lastJobServerUnixTime = responseData.lastResponseUnixTime
+ let notes = responseData.jobs
+ notes.map(function (changedItem) {
if (indexStore[changedItem.noteId] === undefined) {
- var newItem = angular.copy(changedItem);
- jobInfomations.push(newItem);
- indexStore[changedItem.noteId] = newItem;
+ let newItem = angular.copy(changedItem)
+ jobInfomations.push(newItem)
+ indexStore[changedItem.noteId] = newItem
} else {
- var changeOriginTarget = indexStore[changedItem.noteId];
+ let changeOriginTarget = indexStore[changedItem.noteId]
if (changedItem.isRemoved !== undefined && changedItem.isRemoved === true) {
-
// remove Item.
- var removeIndex = _.findIndex(indexStore, changedItem.noteId);
+ let removeIndex = _.findIndex(indexStore, changedItem.noteId)
if (removeIndex > -1) {
- indexStore.splice(removeIndex, 1);
+ indexStore.splice(removeIndex, 1)
}
- removeIndex = _.findIndex(jobInfomations, {'noteId': changedItem.noteId});
+ removeIndex = _.findIndex(jobInfomations, {'noteId': changedItem.noteId})
if (removeIndex) {
- jobInfomations.splice(removeIndex, 1);
+ jobInfomations.splice(removeIndex, 1)
}
-
} else {
// change value for item.
- changeOriginTarget.isRunningJob = changedItem.isRunningJob;
- changeOriginTarget.noteName = changedItem.noteName;
- changeOriginTarget.noteType = changedItem.noteType;
- changeOriginTarget.interpreter = changedItem.interpreter;
- changeOriginTarget.unixTimeLastRun = changedItem.unixTimeLastRun;
- changeOriginTarget.paragraphs = changedItem.paragraphs;
+ changeOriginTarget.isRunningJob = changedItem.isRunningJob
+ changeOriginTarget.noteName = changedItem.noteName
+ changeOriginTarget.noteType = changedItem.noteType
+ changeOriginTarget.interpreter = changedItem.interpreter
+ changeOriginTarget.unixTimeLastRun = changedItem.unixTimeLastRun
+ changeOriginTarget.paragraphs = changedItem.paragraphs
}
}
- });
- $scope.doFiltering(jobInfomations, $scope.filterConfig);
- });
+ })
+ $scope.doFiltering(jobInfomations, $scope.filterConfig)
+ })
}
-
diff --git a/zeppelin-web/src/app/jobmanager/jobmanager.filter.js b/zeppelin-web/src/app/jobmanager/jobmanager.filter.js
index 05a1b6ecc1..92114984ee 100644
--- a/zeppelin-web/src/app/jobmanager/jobmanager.filter.js
+++ b/zeppelin-web/src/app/jobmanager/jobmanager.filter.js
@@ -12,37 +12,36 @@
* limitations under the License.
*/
-angular.module('zeppelinWebApp').filter('jobManager', jobManagerFilter);
+angular.module('zeppelinWebApp').filter('jobManager', jobManagerFilter)
-function jobManagerFilter() {
- function filterContext(jobItems, filterConfig) {
- var filterValueInterpreter = filterConfig.filterValueInterpreter;
- var filterValueNotebookName = filterConfig.filterValueNotebookName;
- var isSortByAsc = filterConfig.isSortByAsc;
- var filterItems = jobItems;
+function jobManagerFilter () {
+ function filterContext (jobItems, filterConfig) {
+ let filterValueInterpreter = filterConfig.filterValueInterpreter
+ let filterValueNotebookName = filterConfig.filterValueNotebookName
+ let isSortByAsc = filterConfig.isSortByAsc
+ let filterItems = jobItems
if (filterValueInterpreter === undefined) {
- filterItems = _.filter(filterItems, function(jobItem) {
- return jobItem.interpreter === undefined ? true : false;
- });
+ filterItems = _.filter(filterItems, function (jobItem) {
+ return jobItem.interpreter === undefined ? true : false
+ })
} else if (filterValueInterpreter !== '*') {
- filterItems = _.where(filterItems, {interpreter: filterValueInterpreter});
+ filterItems = _.where(filterItems, {interpreter: filterValueInterpreter})
}
if (filterValueNotebookName !== '') {
- filterItems = _.filter(filterItems, function(jobItem) {
- var lowerFilterValue = filterValueNotebookName.toLocaleLowerCase();
- var lowerNotebookName = jobItem.noteName.toLocaleLowerCase();
- return lowerNotebookName.match(new RegExp('.*' + lowerFilterValue + '.*'));
- });
+ filterItems = _.filter(filterItems, function (jobItem) {
+ let lowerFilterValue = filterValueNotebookName.toLocaleLowerCase()
+ let lowerNotebookName = jobItem.noteName.toLocaleLowerCase()
+ return lowerNotebookName.match(new RegExp('.*' + lowerFilterValue + '.*'))
+ })
}
- filterItems = _.sortBy(filterItems, function(sortItem) {
- return sortItem.noteName.toLowerCase();
- });
+ filterItems = _.sortBy(filterItems, function (sortItem) {
+ return sortItem.noteName.toLowerCase()
+ })
- return isSortByAsc ? filterItems : filterItems.reverse();
+ return isSortByAsc ? filterItems : filterItems.reverse()
}
- return filterContext;
+ return filterContext
}
-
diff --git a/zeppelin-web/src/app/jobmanager/jobs/job.controller.js b/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
index 50f8d7afbe..e1ce02ddc2 100644
--- a/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
+++ b/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
@@ -12,38 +12,38 @@
* limitations under the License.
*/
-import { ParagraphStatus, } from '../../notebook/paragraph/paragraph.status';
+import { ParagraphStatus, } from '../../notebook/paragraph/paragraph.status'
-angular.module('zeppelinWebApp').controller('JobCtrl', JobCtrl);
+angular.module('zeppelinWebApp').controller('JobCtrl', JobCtrl)
-function JobCtrl($scope, $http, baseUrlSrv) {
- 'ngInject';
+function JobCtrl ($scope, $http, baseUrlSrv) {
+ 'ngInject'
- $scope.init = function(jobInformation) {
- $scope.progressValue = 0;
- };
+ $scope.init = function (jobInformation) {
+ $scope.progressValue = 0
+ }
- $scope.getProgress = function() {
- var statusList = _.pluck($scope.notebookJob.paragraphs, 'status');
- var runningJob = _.countBy(statusList, function(status) {
+ $scope.getProgress = function () {
+ let statusList = _.pluck($scope.notebookJob.paragraphs, 'status')
+ let runningJob = _.countBy(statusList, function (status) {
if (status === ParagraphStatus.RUNNING || status === ParagraphStatus.FINISHED) {
- return 'matchCount';
+ return 'matchCount'
} else {
- return 'none';
+ return 'none'
}
- });
- var totalCount = statusList.length;
- var runningJobCount = runningJob.matchCount;
- var result = Math.ceil(runningJobCount / totalCount * 100);
- return isNaN(result) ? 0 : result;
- };
+ })
+ let totalCount = statusList.length
+ let runningJobCount = runningJob.matchCount
+ let result = Math.ceil(runningJobCount / totalCount * 100)
+ return isNaN(result) ? 0 : result
+ }
- $scope.runNotebookJob = function(notebookId) {
+ $scope.runNotebookJob = function (notebookId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Run all paragraphs?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
$http({
method: 'POST',
@@ -51,30 +51,31 @@ function JobCtrl($scope, $http, baseUrlSrv) {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
- }).then(function successCallback(response) {
+ }).then(function successCallback (response) {
// success
- }, function errorCallback(errorResponse) {
- var errorText = 'SERVER ERROR';
+ }, function errorCallback (errorResponse) {
+ let errorText = 'SERVER ERROR'
+ // eslint-disable-next-line no-extra-boolean-cast
if (!!errorResponse.data.message) {
- errorText = errorResponse.data.message;
+ errorText = errorResponse.data.message
}
BootstrapDialog.alert({
closable: true,
title: 'Execution Failure',
message: errorText
- });
- });
+ })
+ })
}
}
- });
- };
+ })
+ }
- $scope.stopNotebookJob = function(notebookId) {
+ $scope.stopNotebookJob = function (notebookId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Stop all paragraphs?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
$http({
method: 'DELETE',
@@ -82,28 +83,26 @@ function JobCtrl($scope, $http, baseUrlSrv) {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
- }).then(function successCallback(response) {
+ }).then(function successCallback (response) {
// success
- }, function errorCallback(errorResponse) {
- var errorText = 'SERVER ERROR';
+ }, function errorCallback (errorResponse) {
+ let errorText = 'SERVER ERROR'
+ // eslint-disable-next-line no-extra-boolean-cast
if (!!errorResponse.data.message) {
-
- errorText = errorResponse.data.message;
+ errorText = errorResponse.data.message
}
BootstrapDialog.alert({
closable: true,
title: 'Stop Failure',
message: errorText
- });
- });
+ })
+ })
}
}
- });
- };
-
- $scope.lastExecuteTime = function(unixtime) {
- return moment.unix(unixtime / 1000).fromNow();
- };
+ })
+ }
+ $scope.lastExecuteTime = function (unixtime) {
+ return moment.unix(unixtime / 1000).fromNow()
+ }
}
-
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js
index 5fde0f49c4..e481e9be4c 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -12,25 +12,25 @@
* limitations under the License.
*/
-import { isParagraphRunning, } from './paragraph/paragraph.status';
+import { isParagraphRunning, } from './paragraph/paragraph.status'
-angular.module('zeppelinWebApp').controller('NotebookCtrl', NotebookCtrl);
+angular.module('zeppelinWebApp').controller('NotebookCtrl', NotebookCtrl)
-function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
+function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
$http, websocketMsgSrv, baseUrlSrv, $timeout, saveAsService,
ngToast, noteActionSrv, noteVarShareService, TRASH_FOLDER_ID,
heliumService) {
- 'ngInject';
+ 'ngInject'
- ngToast.dismiss();
+ ngToast.dismiss()
- $scope.note = null;
- $scope.moment = moment;
- $scope.editorToggled = false;
- $scope.tableToggled = false;
- $scope.viewOnly = false;
- $scope.showSetting = false;
- $scope.looknfeelOption = ['default', 'simple', 'report'];
+ $scope.note = null
+ $scope.moment = moment
+ $scope.editorToggled = false
+ $scope.tableToggled = false
+ $scope.viewOnly = false
+ $scope.showSetting = false
+ $scope.looknfeelOption = ['default', 'simple', 'report']
$scope.cronOption = [
{name: 'None', value: undefined},
{name: '1m', value: '0 0/1 * * * ?'},
@@ -40,50 +40,50 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
{name: '6h', value: '0 0 0/6 * * ?'},
{name: '12h', value: '0 0 0/12 * * ?'},
{name: '1d', value: '0 0 0 * * ?'}
- ];
+ ]
- $scope.interpreterSettings = [];
- $scope.interpreterBindings = [];
- $scope.isNoteDirty = null;
- $scope.saveTimer = null;
+ $scope.interpreterSettings = []
+ $scope.interpreterBindings = []
+ $scope.isNoteDirty = null
+ $scope.saveTimer = null
- var connectedOnce = false;
- var isRevisionPath = function(path) {
- var pattern = new RegExp('^.*\/notebook\/[a-zA-Z0-9_]*\/revision\/[a-zA-Z0-9_]*');
- return pattern.test(path);
- };
+ let connectedOnce = false
+ let isRevisionPath = function (path) {
+ let pattern = new RegExp('^.*\/notebook\/[a-zA-Z0-9_]*\/revision\/[a-zA-Z0-9_]*')
+ return pattern.test(path)
+ }
- $scope.noteRevisions = [];
- $scope.currentRevision = 'Head';
- $scope.revisionView = isRevisionPath($location.path());
+ $scope.noteRevisions = []
+ $scope.currentRevision = 'Head'
+ $scope.revisionView = isRevisionPath($location.path())
- $scope.$on('setConnectedStatus', function(event, param) {
+ $scope.$on('setConnectedStatus', function (event, param) {
if (connectedOnce && param) {
- initNotebook();
+ initNotebook()
}
- connectedOnce = true;
- });
+ connectedOnce = true
+ })
- $scope.getCronOptionNameFromValue = function(value) {
+ $scope.getCronOptionNameFromValue = function (value) {
if (!value) {
- return '';
+ return ''
}
- for (var o in $scope.cronOption) {
+ for (let o in $scope.cronOption) {
if ($scope.cronOption[o].value === value) {
- return $scope.cronOption[o].name;
+ return $scope.cronOption[o].name
}
}
- return value;
- };
+ return value
+ }
- $scope.blockAnonUsers = function() {
- var zeppelinVersion = $rootScope.zeppelinVersion;
- var url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/security/notebook_authorization.html';
- var content = 'Only authenticated user can set the permission.' +
+ $scope.blockAnonUsers = function () {
+ let zeppelinVersion = $rootScope.zeppelinVersion
+ let url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/security/notebook_authorization.html'
+ let content = 'Only authenticated user can set the permission.' +
'
' +
'' +
- '';
+ ''
BootstrapDialog.show({
closable: false,
closeByBackdrop: false,
@@ -92,187 +92,189 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
message: content,
buttons: [{
label: 'Close',
- action: function(dialog) {
- dialog.close();
+ action: function (dialog) {
+ dialog.close()
}
}]
- });
- };
+ })
+ }
/** Init the new controller */
- var initNotebook = function() {
- noteVarShareService.clear();
+ const initNotebook = function () {
+ noteVarShareService.clear()
if ($routeParams.revisionId) {
- websocketMsgSrv.getNoteByRevision($routeParams.noteId, $routeParams.revisionId);
+ websocketMsgSrv.getNoteByRevision($routeParams.noteId, $routeParams.revisionId)
} else {
- websocketMsgSrv.getNote($routeParams.noteId);
+ websocketMsgSrv.getNote($routeParams.noteId)
}
- websocketMsgSrv.listRevisionHistory($routeParams.noteId);
- var currentRoute = $route.current;
+ websocketMsgSrv.listRevisionHistory($routeParams.noteId)
+ let currentRoute = $route.current
if (currentRoute) {
setTimeout(
- function() {
- var routeParams = currentRoute.params;
- var $id = angular.element('#' + routeParams.paragraph + '_container');
+ function () {
+ let routeParams = currentRoute.params
+ let $id = angular.element('#' + routeParams.paragraph + '_container')
if ($id.length > 0) {
// adjust for navbar
- var top = $id.offset().top - 103;
- angular.element('html, body').scrollTo({top: top, left: 0});
+ let top = $id.offset().top - 103
+ angular.element('html, body').scrollTo({top: top, left: 0})
}
},
1000
- );
+ )
}
- };
+ }
- initNotebook();
+ initNotebook()
- $scope.focusParagraphOnClick = function(clickEvent) {
+ $scope.focusParagraphOnClick = function (clickEvent) {
if (!$scope.note) {
- return;
+ return
}
- for (var i = 0; i < $scope.note.paragraphs.length; i++) {
- var paragraphId = $scope.note.paragraphs[i].id;
+ for (let i = 0; i < $scope.note.paragraphs.length; i++) {
+ let paragraphId = $scope.note.paragraphs[i].id
if (jQuery.contains(angular.element('#' + paragraphId + '_container')[0], clickEvent.target)) {
- $scope.$broadcast('focusParagraph', paragraphId, 0, true);
- break;
+ $scope.$broadcast('focusParagraph', paragraphId, 0, true)
+ break
}
}
- };
+ }
// register mouseevent handler for focus paragraph
- document.addEventListener('click', $scope.focusParagraphOnClick);
+ document.addEventListener('click', $scope.focusParagraphOnClick)
- $scope.keyboardShortcut = function(keyEvent) {
+ $scope.keyboardShortcut = function (keyEvent) {
// handle keyevent
if (!$scope.viewOnly && !$scope.revisionView) {
- $scope.$broadcast('keyEvent', keyEvent);
+ $scope.$broadcast('keyEvent', keyEvent)
}
- };
+ }
// register mouseevent handler for focus paragraph
- document.addEventListener('keydown', $scope.keyboardShortcut);
+ document.addEventListener('keydown', $scope.keyboardShortcut)
- $scope.paragraphOnDoubleClick = function(paragraphId) {
- $scope.$broadcast('doubleClickParagraph', paragraphId);
- };
+ $scope.paragraphOnDoubleClick = function (paragraphId) {
+ $scope.$broadcast('doubleClickParagraph', paragraphId)
+ }
// Move the note to trash and go back to the main page
- $scope.moveNoteToTrash = function(noteId) {
- noteActionSrv.moveNoteToTrash(noteId, true);
- };
+ $scope.moveNoteToTrash = function (noteId) {
+ noteActionSrv.moveNoteToTrash(noteId, true)
+ }
// Remove the note permanently if it's in the trash
- $scope.removeNote = function(noteId) {
- noteActionSrv.removeNote(noteId, true);
- };
+ $scope.removeNote = function (noteId) {
+ noteActionSrv.removeNote(noteId, true)
+ }
- $scope.isTrash = function(note) {
- return note ? note.name.split('/')[0] === TRASH_FOLDER_ID : false;
- };
+ $scope.isTrash = function (note) {
+ return note ? note.name.split('/')[0] === TRASH_FOLDER_ID : false
+ }
- //Export notebook
- $scope.exportNote = function() {
- var jsonContent = JSON.stringify($scope.note);
- saveAsService.saveAs(jsonContent, $scope.note.name, 'json');
- };
+ // Export notebook
+ $scope.exportNote = function () {
+ let jsonContent = JSON.stringify($scope.note)
+ saveAsService.saveAs(jsonContent, $scope.note.name, 'json')
+ }
- //Clone note
- $scope.cloneNote = function(noteId) {
+ // Clone note
+ $scope.cloneNote = function (noteId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Do you want to clone this note?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- websocketMsgSrv.cloneNote(noteId);
- $location.path('/');
+ websocketMsgSrv.cloneNote(noteId)
+ $location.path('/')
}
}
- });
- };
+ })
+ }
// checkpoint/commit notebook
- $scope.checkpointNote = function(commitMessage) {
+ $scope.checkpointNote = function (commitMessage) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Commit note to current repository?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- websocketMsgSrv.checkpointNote($routeParams.noteId, commitMessage);
+ websocketMsgSrv.checkpointNote($routeParams.noteId, commitMessage)
}
}
- });
- document.getElementById('note.checkpoint.message').value = '';
- };
+ })
+ document.getElementById('note.checkpoint.message').value = ''
+ }
// set notebook head to given revision
- $scope.setNoteRevision = function() {
+ $scope.setNoteRevision = function () {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Set notebook head to current revision?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- websocketMsgSrv.setNoteRevision($routeParams.noteId, $routeParams.revisionId);
+ websocketMsgSrv.setNoteRevision($routeParams.noteId, $routeParams.revisionId)
}
}
- });
- };
+ })
+ }
- $scope.$on('listRevisionHistory', function(event, data) {
- console.log('received list of revisions %o', data);
- $scope.noteRevisions = data.revisionList;
+ $scope.$on('listRevisionHistory', function (event, data) {
+ console.log('received list of revisions %o', data)
+ $scope.noteRevisions = data.revisionList
$scope.noteRevisions.splice(0, 0, {
id: 'Head',
message: 'Head'
- });
+ })
if ($routeParams.revisionId) {
- var index = _.findIndex($scope.noteRevisions, {'id': $routeParams.revisionId});
+ let index = _.findIndex($scope.noteRevisions, {'id': $routeParams.revisionId})
if (index > -1) {
- $scope.currentRevision = $scope.noteRevisions[index].message;
+ $scope.currentRevision = $scope.noteRevisions[index].message
}
}
- });
+ })
- $scope.$on('noteRevision', function(event, data) {
- console.log('received note revision %o', data);
+ $scope.$on('noteRevision', function (event, data) {
+ console.log('received note revision %o', data)
if (data.note) {
- $scope.note = data.note;
- initializeLookAndFeel();
+ $scope.note = data.note
+ initializeLookAndFeel()
} else {
- $location.path('/');
+ $location.path('/')
}
- });
+ })
- $scope.$on('setNoteRevisionResult', function(event, data) {
- console.log('received set note revision result %o', data);
+ $scope.$on('setNoteRevisionResult', function (event, data) {
+ console.log('received set note revision result %o', data)
if (data.status) {
- $location.path('/notebook/' + $routeParams.noteId);
+ $location.path('/notebook/' + $routeParams.noteId)
}
- });
+ })
- $scope.visitRevision = function(revision) {
+ $scope.visitRevision = function (revision) {
if (revision.id) {
if (revision.id === 'Head') {
- $location.path('/notebook/' + $routeParams.noteId);
+ $location.path('/notebook/' + $routeParams.noteId)
} else {
- $location.path('/notebook/' + $routeParams.noteId + '/revision/' + revision.id);
+ $location.path('/notebook/' + $routeParams.noteId + '/revision/' + revision.id)
}
} else {
ngToast.danger({content: 'There is a problem with this Revision',
- verticalPosition: 'top', dismissOnTimeout: false});
+ verticalPosition: 'top',
+ dismissOnTimeout: false
+ })
}
- };
+ }
- $scope.runAllParagraphs = function(noteId) {
+ $scope.runAllParagraphs = function (noteId) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Run all paragraphs?',
- callback: function(result) {
+ callback: function (result) {
if (result) {
const paragraphs = $scope.note.paragraphs.map(p => {
return {
@@ -281,491 +283,491 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
paragraph: p.text,
config: p.config,
params: p.settings.params
- };
- });
- websocketMsgSrv.runAllParagraphs(noteId, paragraphs);
+ }
+ })
+ websocketMsgSrv.runAllParagraphs(noteId, paragraphs)
}
}
- });
- };
+ })
+ }
- $scope.saveNote = function() {
+ $scope.saveNote = function () {
if ($scope.note && $scope.note.paragraphs) {
- _.forEach($scope.note.paragraphs, function(par) {
+ _.forEach($scope.note.paragraphs, function (par) {
angular
.element('#' + par.id + '_paragraphColumn_main')
.scope()
- .saveParagraph(par);
- });
- $scope.isNoteDirty = null;
+ .saveParagraph(par)
+ })
+ $scope.isNoteDirty = null
}
- };
+ }
- $scope.clearAllParagraphOutput = function(noteId) {
- noteActionSrv.clearAllParagraphOutput(noteId);
- };
+ $scope.clearAllParagraphOutput = function (noteId) {
+ noteActionSrv.clearAllParagraphOutput(noteId)
+ }
- $scope.toggleAllEditor = function() {
+ $scope.toggleAllEditor = function () {
if ($scope.editorToggled) {
- $scope.$broadcast('openEditor');
+ $scope.$broadcast('openEditor')
} else {
- $scope.$broadcast('closeEditor');
+ $scope.$broadcast('closeEditor')
}
- $scope.editorToggled = !$scope.editorToggled;
- };
+ $scope.editorToggled = !$scope.editorToggled
+ }
- $scope.showAllEditor = function() {
- $scope.$broadcast('openEditor');
- };
+ $scope.showAllEditor = function () {
+ $scope.$broadcast('openEditor')
+ }
- $scope.hideAllEditor = function() {
- $scope.$broadcast('closeEditor');
- };
+ $scope.hideAllEditor = function () {
+ $scope.$broadcast('closeEditor')
+ }
- $scope.toggleAllTable = function() {
+ $scope.toggleAllTable = function () {
if ($scope.tableToggled) {
- $scope.$broadcast('openTable');
+ $scope.$broadcast('openTable')
} else {
- $scope.$broadcast('closeTable');
+ $scope.$broadcast('closeTable')
}
- $scope.tableToggled = !$scope.tableToggled;
- };
+ $scope.tableToggled = !$scope.tableToggled
+ }
- $scope.showAllTable = function() {
- $scope.$broadcast('openTable');
- };
+ $scope.showAllTable = function () {
+ $scope.$broadcast('openTable')
+ }
- $scope.hideAllTable = function() {
- $scope.$broadcast('closeTable');
- };
+ $scope.hideAllTable = function () {
+ $scope.$broadcast('closeTable')
+ }
/**
* @returns {boolean} true if one more paragraphs are running. otherwise return false.
*/
- $scope.isNoteRunning = function() {
- if (!$scope.note) { return false; }
+ $scope.isNoteRunning = function () {
+ if (!$scope.note) { return false }
for (let i = 0; i < $scope.note.paragraphs.length; i++) {
if (isParagraphRunning($scope.note.paragraphs[i])) {
- return true;
+ return true
}
}
- return false;
- };
+ return false
+ }
- $scope.killSaveTimer = function() {
+ $scope.killSaveTimer = function () {
if ($scope.saveTimer) {
- $timeout.cancel($scope.saveTimer);
- $scope.saveTimer = null;
+ $timeout.cancel($scope.saveTimer)
+ $scope.saveTimer = null
}
- };
+ }
- $scope.startSaveTimer = function() {
- $scope.killSaveTimer();
- $scope.isNoteDirty = true;
- //console.log('startSaveTimer called ' + $scope.note.id);
- $scope.saveTimer = $timeout(function() {
- $scope.saveNote();
- }, 10000);
- };
+ $scope.startSaveTimer = function () {
+ $scope.killSaveTimer()
+ $scope.isNoteDirty = true
+ // console.log('startSaveTimer called ' + $scope.note.id);
+ $scope.saveTimer = $timeout(function () {
+ $scope.saveNote()
+ }, 10000)
+ }
- angular.element(window).on('beforeunload', function(e) {
- $scope.killSaveTimer();
- $scope.saveNote();
- });
+ angular.element(window).on('beforeunload', function (e) {
+ $scope.killSaveTimer()
+ $scope.saveNote()
+ })
- $scope.setLookAndFeel = function(looknfeel) {
- $scope.note.config.looknfeel = looknfeel;
+ $scope.setLookAndFeel = function (looknfeel) {
+ $scope.note.config.looknfeel = looknfeel
if ($scope.revisionView === true) {
- $rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel);
+ $rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel)
} else {
- $scope.setConfig();
+ $scope.setConfig()
}
- };
+ }
/** Set cron expression for this note **/
- $scope.setCronScheduler = function(cronExpr) {
+ $scope.setCronScheduler = function (cronExpr) {
if (cronExpr) {
if (!$scope.note.config.cronExecutingUser) {
- $scope.note.config.cronExecutingUser = $rootScope.ticket.principal;
+ $scope.note.config.cronExecutingUser = $rootScope.ticket.principal
}
} else {
- $scope.note.config.cronExecutingUser = '';
+ $scope.note.config.cronExecutingUser = ''
}
- $scope.note.config.cron = cronExpr;
- $scope.setConfig();
- };
+ $scope.note.config.cron = cronExpr
+ $scope.setConfig()
+ }
/** Set the username of the user to be used to execute all notes in notebook **/
- $scope.setCronExecutingUser = function(cronExecutingUser) {
- $scope.note.config.cronExecutingUser = cronExecutingUser;
- $scope.setConfig();
- };
+ $scope.setCronExecutingUser = function (cronExecutingUser) {
+ $scope.note.config.cronExecutingUser = cronExecutingUser
+ $scope.setConfig()
+ }
/** Set release resource for this note **/
- $scope.setReleaseResource = function(value) {
- $scope.note.config.releaseresource = value;
- $scope.setConfig();
- };
+ $scope.setReleaseResource = function (value) {
+ $scope.note.config.releaseresource = value
+ $scope.setConfig()
+ }
/** Update note config **/
- $scope.setConfig = function(config) {
+ $scope.setConfig = function (config) {
if (config) {
- $scope.note.config = config;
+ $scope.note.config = config
}
- websocketMsgSrv.updateNote($scope.note.id, $scope.note.name, $scope.note.config);
- };
+ websocketMsgSrv.updateNote($scope.note.id, $scope.note.name, $scope.note.config)
+ }
/** Update the note name */
- $scope.updateNoteName = function(newName) {
- const trimmedNewName = newName.trim();
+ $scope.updateNoteName = function (newName) {
+ const trimmedNewName = newName.trim()
if (trimmedNewName.length > 0 && $scope.note.name !== trimmedNewName) {
- $scope.note.name = trimmedNewName;
- websocketMsgSrv.renameNote($scope.note.id, $scope.note.name);
+ $scope.note.name = trimmedNewName
+ websocketMsgSrv.renameNote($scope.note.id, $scope.note.name)
}
- };
+ }
- var initializeLookAndFeel = function() {
+ const initializeLookAndFeel = function () {
if (!$scope.note.config.looknfeel) {
- $scope.note.config.looknfeel = 'default';
+ $scope.note.config.looknfeel = 'default'
} else {
- $scope.viewOnly = $scope.note.config.looknfeel === 'report' ? true : false;
+ $scope.viewOnly = $scope.note.config.looknfeel === 'report' ? true : false
}
if ($scope.note.paragraphs && $scope.note.paragraphs[0]) {
- $scope.note.paragraphs[0].focus = true;
+ $scope.note.paragraphs[0].focus = true
}
- $rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel);
- };
+ $rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel)
+ }
- var cleanParagraphExcept = function(paragraphId, note) {
- var noteCopy = {};
- noteCopy.id = note.id;
- noteCopy.name = note.name;
- noteCopy.config = note.config;
- noteCopy.info = note.info;
- noteCopy.paragraphs = [];
- for (var i = 0; i < note.paragraphs.length; i++) {
+ let cleanParagraphExcept = function (paragraphId, note) {
+ let noteCopy = {}
+ noteCopy.id = note.id
+ noteCopy.name = note.name
+ noteCopy.config = note.config
+ noteCopy.info = note.info
+ noteCopy.paragraphs = []
+ for (let i = 0; i < note.paragraphs.length; i++) {
if (note.paragraphs[i].id === paragraphId) {
- noteCopy.paragraphs[0] = note.paragraphs[i];
+ noteCopy.paragraphs[0] = note.paragraphs[i]
if (!noteCopy.paragraphs[0].config) {
- noteCopy.paragraphs[0].config = {};
+ noteCopy.paragraphs[0].config = {}
}
- noteCopy.paragraphs[0].config.editorHide = true;
- noteCopy.paragraphs[0].config.tableHide = false;
- break;
+ noteCopy.paragraphs[0].config.editorHide = true
+ noteCopy.paragraphs[0].config.tableHide = false
+ break
}
}
- return noteCopy;
- };
+ return noteCopy
+ }
- var addPara = function(paragraph, index) {
- $scope.note.paragraphs.splice(index, 0, paragraph);
- _.each($scope.note.paragraphs, function(para) {
+ let addPara = function (paragraph, index) {
+ $scope.note.paragraphs.splice(index, 0, paragraph)
+ _.each($scope.note.paragraphs, function (para) {
if (para.id === paragraph.id) {
- para.focus = true;
- $scope.$broadcast('focusParagraph', para.id, 0, false);
+ para.focus = true
+ $scope.$broadcast('focusParagraph', para.id, 0, false)
}
- });
- };
+ })
+ }
- var removePara = function(paragraphId) {
- var removeIdx;
- _.each($scope.note.paragraphs, function(para, idx) {
+ let removePara = function (paragraphId) {
+ let removeIdx
+ _.each($scope.note.paragraphs, function (para, idx) {
if (para.id === paragraphId) {
- removeIdx = idx;
+ removeIdx = idx
}
- });
- return $scope.note.paragraphs.splice(removeIdx, 1);
- };
+ })
+ return $scope.note.paragraphs.splice(removeIdx, 1)
+ }
- $scope.$on('addParagraph', function(event, paragraph, index) {
+ $scope.$on('addParagraph', function (event, paragraph, index) {
if ($scope.paragraphUrl) {
- return;
+ return
}
- addPara(paragraph, index);
- });
+ addPara(paragraph, index)
+ })
- $scope.$on('removeParagraph', function(event, paragraphId) {
+ $scope.$on('removeParagraph', function (event, paragraphId) {
if ($scope.paragraphUrl) {
- return;
+ return
}
- removePara(paragraphId);
- });
+ removePara(paragraphId)
+ })
- $scope.$on('moveParagraph', function(event, paragraphId, newIdx) {
- var removedPara = removePara(paragraphId);
+ $scope.$on('moveParagraph', function (event, paragraphId, newIdx) {
+ let removedPara = removePara(paragraphId)
if (removedPara && removedPara.length === 1) {
- addPara(removedPara[0], newIdx);
+ addPara(removedPara[0], newIdx)
}
- });
+ })
- $scope.$on('updateNote', function(event, name, config, info) {
+ $scope.$on('updateNote', function (event, name, config, info) {
/** update Note name */
if (name !== $scope.note.name) {
- console.log('change note name to : %o', $scope.note.name);
- $scope.note.name = name;
+ console.log('change note name to : %o', $scope.note.name)
+ $scope.note.name = name
}
- $scope.note.config = config;
- $scope.note.info = info;
- initializeLookAndFeel();
- });
+ $scope.note.config = config
+ $scope.note.info = info
+ initializeLookAndFeel()
+ })
- var getInterpreterBindings = function() {
- websocketMsgSrv.getInterpreterBindings($scope.note.id);
- };
+ let getInterpreterBindings = function () {
+ websocketMsgSrv.getInterpreterBindings($scope.note.id)
+ }
- $scope.$on('interpreterBindings', function(event, data) {
- $scope.interpreterBindings = data.interpreterBindings;
- $scope.interpreterBindingsOrig = angular.copy($scope.interpreterBindings); // to check dirty
+ $scope.$on('interpreterBindings', function (event, data) {
+ $scope.interpreterBindings = data.interpreterBindings
+ $scope.interpreterBindingsOrig = angular.copy($scope.interpreterBindings) // to check dirty
- var selected = false;
- var key;
- var setting;
+ let selected = false
+ let key
+ let setting
for (key in $scope.interpreterBindings) {
- setting = $scope.interpreterBindings[key];
+ setting = $scope.interpreterBindings[key]
if (setting.selected) {
- selected = true;
- break;
+ selected = true
+ break
}
}
if (!selected) {
// make default selection
- var selectedIntp = {};
+ let selectedIntp = {}
for (key in $scope.interpreterBindings) {
- setting = $scope.interpreterBindings[key];
+ setting = $scope.interpreterBindings[key]
if (!selectedIntp[setting.name]) {
- setting.selected = true;
- selectedIntp[setting.name] = true;
+ setting.selected = true
+ selectedIntp[setting.name] = true
}
}
- $scope.showSetting = true;
+ $scope.showSetting = true
}
- });
+ })
$scope.interpreterSelectionListeners = {
- accept: function(sourceItemHandleScope, destSortableScope) {return true;},
- itemMoved: function(event) {},
- orderChanged: function(event) {}
- };
+ accept: function (sourceItemHandleScope, destSortableScope) { return true },
+ itemMoved: function (event) {},
+ orderChanged: function (event) {}
+ }
- $scope.openSetting = function() {
- $scope.showSetting = true;
- getInterpreterBindings();
- };
+ $scope.openSetting = function () {
+ $scope.showSetting = true
+ getInterpreterBindings()
+ }
- $scope.closeSetting = function() {
+ $scope.closeSetting = function () {
if (isSettingDirty()) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Interpreter setting changes will be discarded.',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- $scope.$apply(function() {
- $scope.showSetting = false;
- });
+ $scope.$apply(function () {
+ $scope.showSetting = false
+ })
}
}
- });
+ })
} else {
- $scope.showSetting = false;
+ $scope.showSetting = false
}
- };
+ }
- $scope.saveSetting = function() {
- var selectedSettingIds = [];
- for (var no in $scope.interpreterBindings) {
- var setting = $scope.interpreterBindings[no];
+ $scope.saveSetting = function () {
+ let selectedSettingIds = []
+ for (let no in $scope.interpreterBindings) {
+ let setting = $scope.interpreterBindings[no]
if (setting.selected) {
- selectedSettingIds.push(setting.id);
+ selectedSettingIds.push(setting.id)
}
}
- websocketMsgSrv.saveInterpreterBindings($scope.note.id, selectedSettingIds);
- console.log('Interpreter bindings %o saved', selectedSettingIds);
+ websocketMsgSrv.saveInterpreterBindings($scope.note.id, selectedSettingIds)
+ console.log('Interpreter bindings %o saved', selectedSettingIds)
- _.forEach($scope.note.paragraphs, function(n, key) {
- var regExp = /^\s*%/g;
+ _.forEach($scope.note.paragraphs, function (n, key) {
+ let regExp = /^\s*%/g
if (n.text && !regExp.exec(n.text)) {
- $scope.$broadcast('saveInterpreterBindings', n.id);
+ $scope.$broadcast('saveInterpreterBindings', n.id)
}
- });
+ })
- $scope.showSetting = false;
- };
+ $scope.showSetting = false
+ }
- $scope.toggleSetting = function() {
+ $scope.toggleSetting = function () {
if ($scope.showSetting) {
- $scope.closeSetting();
+ $scope.closeSetting()
} else {
- $scope.openSetting();
- $scope.closePermissions();
- angular.element('html, body').animate({ scrollTop: 0 }, 'slow');
+ $scope.openSetting()
+ $scope.closePermissions()
+ angular.element('html, body').animate({ scrollTop: 0 }, 'slow')
}
- };
+ }
- var getPermissions = function(callback) {
- $http.get(baseUrlSrv.getRestApiBase() + '/notebook/' + $scope.note.id + '/permissions').
- success(function(data, status, headers, config) {
- $scope.permissions = data.body;
- $scope.permissionsOrig = angular.copy($scope.permissions); // to check dirty
+ let getPermissions = function (callback) {
+ $http.get(baseUrlSrv.getRestApiBase() + '/notebook/' + $scope.note.id + '/permissions')
+ .success(function (data, status, headers, config) {
+ $scope.permissions = data.body
+ $scope.permissionsOrig = angular.copy($scope.permissions) // to check dirty
- var selectJson = {
+ let selectJson = {
tokenSeparators: [',', ' '],
ajax: {
- url: function(params) {
+ url: function (params) {
if (!params.term) {
- return false;
+ return false
}
- return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term;
+ return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term
},
delay: 250,
- processResults: function(data, params) {
- var results = [];
+ processResults: function (data, params) {
+ let results = []
if (data.body.users.length !== 0) {
- var users = [];
- for (var len = 0; len < data.body.users.length; len++) {
+ let users = []
+ for (let len = 0; len < data.body.users.length; len++) {
users.push({
'id': data.body.users[len],
'text': data.body.users[len]
- });
+ })
}
results.push({
'text': 'Users :',
'children': users
- });
+ })
}
if (data.body.roles.length !== 0) {
- var roles = [];
- for (var len = 0; len < data.body.roles.length; len++) {
+ let roles = []
+ for (let len = 0; len < data.body.roles.length; len++) {
roles.push({
'id': data.body.roles[len],
'text': data.body.roles[len]
- });
+ })
}
results.push({
'text': 'Roles :',
'children': roles
- });
+ })
}
return {
results: results,
pagination: {
more: false
}
- };
+ }
},
cache: false
},
width: ' ',
tags: true,
minimumInputLength: 3
- };
+ }
- $scope.setIamOwner();
- angular.element('#selectOwners').select2(selectJson);
- angular.element('#selectReaders').select2(selectJson);
- angular.element('#selectWriters').select2(selectJson);
+ $scope.setIamOwner()
+ angular.element('#selectOwners').select2(selectJson)
+ angular.element('#selectReaders').select2(selectJson)
+ angular.element('#selectWriters').select2(selectJson)
if (callback) {
- callback();
+ callback()
}
- }).
- error(function(data, status, headers, config) {
+ })
+ .error(function (data, status, headers, config) {
if (status !== 0) {
- console.log('Error %o %o', status, data.message);
+ console.log('Error %o %o', status, data.message)
}
- });
- };
+ })
+ }
- $scope.openPermissions = function() {
- $scope.showPermissions = true;
- getPermissions();
- };
+ $scope.openPermissions = function () {
+ $scope.showPermissions = true
+ getPermissions()
+ }
- $scope.closePermissions = function() {
+ $scope.closePermissions = function () {
if (isPermissionsDirty()) {
BootstrapDialog.confirm({
closable: true,
title: '',
message: 'Changes will be discarded.',
- callback: function(result) {
+ callback: function (result) {
if (result) {
- $scope.$apply(function() {
- $scope.showPermissions = false;
- });
+ $scope.$apply(function () {
+ $scope.showPermissions = false
+ })
}
}
- });
+ })
} else {
- $scope.showPermissions = false;
+ $scope.showPermissions = false
}
- };
-
- function convertPermissionsToArray() {
- $scope.permissions.owners = angular.element('#selectOwners').val();
- $scope.permissions.readers = angular.element('#selectReaders').val();
- $scope.permissions.writers = angular.element('#selectWriters').val();
- angular.element('.permissionsForm select').find('option:not([is-select2="false"])').remove();
}
- $scope.restartInterpreter = function(interpeter) {
- var thisConfirm = BootstrapDialog.confirm({
+ function convertPermissionsToArray () {
+ $scope.permissions.owners = angular.element('#selectOwners').val()
+ $scope.permissions.readers = angular.element('#selectReaders').val()
+ $scope.permissions.writers = angular.element('#selectWriters').val()
+ angular.element('.permissionsForm select').find('option:not([is-select2="false"])').remove()
+ }
+
+ $scope.restartInterpreter = function(interpreter) {
+ const thisConfirm = BootstrapDialog.confirm({
closable: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: '',
- message: 'Do you want to restart ' + interpeter.name + ' interpreter?',
+ message: 'Do you want to restart ' + interpreter.name + ' interpreter?',
callback: function(result) {
if (result) {
- var payload = {
+ let payload = {
'noteId': $scope.note.id
- };
+ }
- thisConfirm.$modalFooter.find('button').addClass('disabled');
+ thisConfirm.$modalFooter.find('button').addClass('disabled')
thisConfirm.$modalFooter.find('button:contains("OK")')
- .html('
Saving Setting');
+ .html('
Saving Setting')
- $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + interpeter.id, payload)
+ $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + interpreter.id, payload)
.success(function(data, status, headers, config) {
- var index = _.findIndex($scope.interpreterSettings, {'id': interpeter.id});
- $scope.interpreterSettings[index] = data.body;
- thisConfirm.close();
- }).error(function(data, status, headers, config) {
- thisConfirm.close();
- console.log('Error %o %o', status, data.message);
- BootstrapDialog.show({
- title: 'Error restart interpreter.',
- message: data.message
- });
- });
- return false;
+ let index = _.findIndex($scope.interpreterSettings, {'id': interpreter.id})
+ $scope.interpreterSettings[index] = data.body
+ thisConfirm.close()
+ }).error(function (data, status, headers, config) {
+ thisConfirm.close()
+ console.log('Error %o %o', status, data.message)
+ BootstrapDialog.show({
+ title: 'Error restart interpreter.',
+ message: data.message
+ })
+ })
+ return false
}
}
- });
- };
+ })
+ }
- $scope.savePermissions = function() {
- convertPermissionsToArray();
+ $scope.savePermissions = function () {
+ convertPermissionsToArray()
$http.put(baseUrlSrv.getRestApiBase() + '/notebook/' + $scope.note.id + '/permissions',
- $scope.permissions, {withCredentials: true}).
- success(function(data, status, headers, config) {
- getPermissions(function() {
- console.log('Note permissions %o saved', $scope.permissions);
+ $scope.permissions, {withCredentials: true})
+ .success(function (data, status, headers, config) {
+ getPermissions(function () {
+ console.log('Note permissions %o saved', $scope.permissions)
BootstrapDialog.alert({
closable: true,
title: 'Permissions Saved Successfully!!!',
message: 'Owners : ' + $scope.permissions.owners + '\n\n' + 'Readers : ' +
$scope.permissions.readers + '\n\n' + 'Writers : ' + $scope.permissions.writers
- });
- $scope.showPermissions = false;
- });
- }).
- error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
+ })
+ $scope.showPermissions = false
+ })
+ })
+ .error(function (data, status, headers, config) {
+ console.log('Error %o %o', status, data.message)
BootstrapDialog.show({
closable: false,
closeByBackdrop: false,
@@ -775,249 +777,249 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
buttons: [
{
label: 'Login',
- action: function(dialog) {
- dialog.close();
+ action: function (dialog) {
+ dialog.close()
angular.element('#loginModal').modal({
show: 'true'
- });
+ })
}
},
{
label: 'Cancel',
- action: function(dialog) {
- dialog.close();
- $location.path('/');
+ action: function (dialog) {
+ dialog.close()
+ $location.path('/')
}
}
]
- });
- });
- };
+ })
+ })
+ }
- $scope.togglePermissions = function() {
- var principal = $rootScope.ticket.principal;
- $scope.isAnonymous = principal === 'anonymous' ? true : false;
+ $scope.togglePermissions = function () {
+ let principal = $rootScope.ticket.principal
+ $scope.isAnonymous = principal === 'anonymous' ? true : false
if (!!principal && $scope.isAnonymous) {
- $scope.blockAnonUsers();
+ $scope.blockAnonUsers()
} else {
if ($scope.showPermissions) {
- $scope.closePermissions();
- angular.element('#selectOwners').select2({});
- angular.element('#selectReaders').select2({});
- angular.element('#selectWriters').select2({});
+ $scope.closePermissions()
+ angular.element('#selectOwners').select2({})
+ angular.element('#selectReaders').select2({})
+ angular.element('#selectWriters').select2({})
} else {
- $scope.openPermissions();
- $scope.closeSetting();
+ $scope.openPermissions()
+ $scope.closeSetting()
}
}
- };
+ }
- $scope.setIamOwner = function() {
+ $scope.setIamOwner = function () {
if ($scope.permissions.owners.length > 0 &&
_.indexOf($scope.permissions.owners, $rootScope.ticket.principal) < 0) {
- $scope.isOwner = false;
- return false;
+ $scope.isOwner = false
+ return false
}
- $scope.isOwner = true;
- return true;
- };
+ $scope.isOwner = true
+ return true
+ }
- $scope.toggleNotePersonalizedMode = function() {
- var personalizedMode = $scope.note.config.personalizedMode;
+ $scope.toggleNotePersonalizedMode = function () {
+ let personalizedMode = $scope.note.config.personalizedMode
if ($scope.isOwner) {
BootstrapDialog.confirm({
closable: true,
title: 'Setting the result display',
- message: function(dialog) {
- var modeText = $scope.note.config.personalizedMode === 'true' ? 'collaborate' : 'personalize';
- return 'Do you want to
' + modeText + ' your analysis?';
+ message: function (dialog) {
+ let modeText = $scope.note.config.personalizedMode === 'true' ? 'collaborate' : 'personalize'
+ return 'Do you want to
' + modeText + ' your analysis?'
},
- callback: function(result) {
+ callback: function (result) {
if (result) {
if ($scope.note.config.personalizedMode === undefined) {
- $scope.note.config.personalizedMode = 'false';
+ $scope.note.config.personalizedMode = 'false'
}
- $scope.note.config.personalizedMode = personalizedMode === 'true' ? 'false' : 'true';
- websocketMsgSrv.updatePersonalizedMode($scope.note.id, $scope.note.config.personalizedMode);
+ $scope.note.config.personalizedMode = personalizedMode === 'true' ? 'false' : 'true'
+ websocketMsgSrv.updatePersonalizedMode($scope.note.id, $scope.note.config.personalizedMode)
}
}
- });
+ })
}
- };
+ }
- var isSettingDirty = function() {
+ const isSettingDirty = function () {
if (angular.equals($scope.interpreterBindings, $scope.interpreterBindingsOrig)) {
- return false;
+ return false
} else {
- return true;
+ return true
}
- };
+ }
- var isPermissionsDirty = function() {
+ const isPermissionsDirty = function () {
if (angular.equals($scope.permissions, $scope.permissionsOrig)) {
- return false;
+ return false
} else {
- return true;
+ return true
}
- };
+ }
- angular.element(document).click(function() {
- angular.element('.ace_autocomplete').hide();
- });
+ angular.element(document).click(function () {
+ angular.element('.ace_autocomplete').hide()
+ })
/*
** $scope.$on functions below
*/
- $scope.$on('setConnectedStatus', function(event, param) {
+ $scope.$on('setConnectedStatus', function (event, param) {
if (connectedOnce && param) {
- initNotebook();
+ initNotebook()
}
- connectedOnce = true;
- });
+ connectedOnce = true
+ })
- $scope.$on('moveParagraphUp', function(event, paragraph) {
- var newIndex = -1;
- for (var i = 0; i < $scope.note.paragraphs.length; i++) {
+ $scope.$on('moveParagraphUp', function (event, paragraph) {
+ let newIndex = -1
+ for (let i = 0; i < $scope.note.paragraphs.length; i++) {
if ($scope.note.paragraphs[i].id === paragraph.id) {
- newIndex = i - 1;
- break;
+ newIndex = i - 1
+ break
}
}
if (newIndex < 0 || newIndex >= $scope.note.paragraphs.length) {
- return;
+ return
}
// save dirtyText of moving paragraphs.
- var prevParagraph = $scope.note.paragraphs[newIndex];
+ let prevParagraph = $scope.note.paragraphs[newIndex]
angular
.element('#' + paragraph.id + '_paragraphColumn_main')
.scope()
- .saveParagraph(paragraph);
+ .saveParagraph(paragraph)
angular
.element('#' + prevParagraph.id + '_paragraphColumn_main')
.scope()
- .saveParagraph(prevParagraph);
- websocketMsgSrv.moveParagraph(paragraph.id, newIndex);
- });
+ .saveParagraph(prevParagraph)
+ websocketMsgSrv.moveParagraph(paragraph.id, newIndex)
+ })
- $scope.$on('moveParagraphDown', function(event, paragraph) {
- var newIndex = -1;
- for (var i = 0; i < $scope.note.paragraphs.length; i++) {
+ $scope.$on('moveParagraphDown', function (event, paragraph) {
+ let newIndex = -1
+ for (let i = 0; i < $scope.note.paragraphs.length; i++) {
if ($scope.note.paragraphs[i].id === paragraph.id) {
- newIndex = i + 1;
- break;
+ newIndex = i + 1
+ break
}
}
if (newIndex < 0 || newIndex >= $scope.note.paragraphs.length) {
- return;
+ return
}
// save dirtyText of moving paragraphs.
- var nextParagraph = $scope.note.paragraphs[newIndex];
+ let nextParagraph = $scope.note.paragraphs[newIndex]
angular
.element('#' + paragraph.id + '_paragraphColumn_main')
.scope()
- .saveParagraph(paragraph);
+ .saveParagraph(paragraph)
angular
.element('#' + nextParagraph.id + '_paragraphColumn_main')
.scope()
- .saveParagraph(nextParagraph);
- websocketMsgSrv.moveParagraph(paragraph.id, newIndex);
- });
+ .saveParagraph(nextParagraph)
+ websocketMsgSrv.moveParagraph(paragraph.id, newIndex)
+ })
- $scope.$on('moveFocusToPreviousParagraph', function(event, currentParagraphId) {
- var focus = false;
- for (var i = $scope.note.paragraphs.length - 1; i >= 0; i--) {
+ $scope.$on('moveFocusToPreviousParagraph', function (event, currentParagraphId) {
+ let focus = false
+ for (let i = $scope.note.paragraphs.length - 1; i >= 0; i--) {
if (focus === false) {
if ($scope.note.paragraphs[i].id === currentParagraphId) {
- focus = true;
- continue;
+ focus = true
+ continue
}
} else {
- $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id, -1);
- break;
+ $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id, -1)
+ break
}
}
- });
+ })
- $scope.$on('moveFocusToNextParagraph', function(event, currentParagraphId) {
- var focus = false;
- for (var i = 0; i < $scope.note.paragraphs.length; i++) {
+ $scope.$on('moveFocusToNextParagraph', function (event, currentParagraphId) {
+ let focus = false
+ for (let i = 0; i < $scope.note.paragraphs.length; i++) {
if (focus === false) {
if ($scope.note.paragraphs[i].id === currentParagraphId) {
- focus = true;
- continue;
+ focus = true
+ continue
}
} else {
- $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id, 0);
- break;
+ $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id, 0)
+ break
}
}
- });
+ })
- $scope.$on('insertParagraph', function(event, paragraphId, position) {
- var newIndex = -1;
- for (var i = 0; i < $scope.note.paragraphs.length; i++) {
+ $scope.$on('insertParagraph', function (event, paragraphId, position) {
+ let newIndex = -1
+ for (let i = 0; i < $scope.note.paragraphs.length; i++) {
if ($scope.note.paragraphs[i].id === paragraphId) {
- //determine position of where to add new paragraph; default is below
+ // determine position of where to add new paragraph; default is below
if (position === 'above') {
- newIndex = i;
+ newIndex = i
} else {
- newIndex = i + 1;
+ newIndex = i + 1
}
- break;
+ break
}
}
if (newIndex < 0 || newIndex > $scope.note.paragraphs.length) {
- return;
+ return
}
- websocketMsgSrv.insertParagraph(newIndex);
- });
+ websocketMsgSrv.insertParagraph(newIndex)
+ })
- $scope.$on('setNoteContent', function(event, note) {
+ $scope.$on('setNoteContent', function (event, note) {
if (note === undefined) {
- $location.path('/');
+ $location.path('/')
}
- $scope.note = note;
+ $scope.note = note
- $scope.paragraphUrl = $routeParams.paragraphId;
- $scope.asIframe = $routeParams.asIframe;
+ $scope.paragraphUrl = $routeParams.paragraphId
+ $scope.asIframe = $routeParams.asIframe
if ($scope.paragraphUrl) {
- $scope.note = cleanParagraphExcept($scope.paragraphUrl, $scope.note);
- $scope.$broadcast('$unBindKeyEvent', $scope.$unBindKeyEvent);
- $rootScope.$broadcast('setIframe', $scope.asIframe);
- initializeLookAndFeel();
- return;
+ $scope.note = cleanParagraphExcept($scope.paragraphUrl, $scope.note)
+ $scope.$broadcast('$unBindKeyEvent', $scope.$unBindKeyEvent)
+ $rootScope.$broadcast('setIframe', $scope.asIframe)
+ initializeLookAndFeel()
+ return
}
- initializeLookAndFeel();
+ initializeLookAndFeel()
- //open interpreter binding setting when there're none selected
- getInterpreterBindings();
- getPermissions();
- var isPersonalized = $scope.note.config.personalizedMode;
- isPersonalized = isPersonalized === undefined ? 'false' : isPersonalized;
- $scope.note.config.personalizedMode = isPersonalized;
- });
+ // open interpreter binding setting when there're none selected
+ getInterpreterBindings()
+ getPermissions()
+ let isPersonalized = $scope.note.config.personalizedMode
+ isPersonalized = isPersonalized === undefined ? 'false' : isPersonalized
+ $scope.note.config.personalizedMode = isPersonalized
+ })
- $scope.$on('$destroy', function() {
- angular.element(window).off('beforeunload');
- $scope.killSaveTimer();
- $scope.saveNote();
+ $scope.$on('$destroy', function () {
+ angular.element(window).off('beforeunload')
+ $scope.killSaveTimer()
+ $scope.saveNote()
- document.removeEventListener('click', $scope.focusParagraphOnClick);
- document.removeEventListener('keydown', $scope.keyboardShortcut);
- });
+ document.removeEventListener('click', $scope.focusParagraphOnClick)
+ document.removeEventListener('keydown', $scope.keyboardShortcut)
+ })
- $scope.$on('$unBindKeyEvent', function() {
- document.removeEventListener('click', $scope.focusParagraphOnClick);
- document.removeEventListener('keydown', $scope.keyboardShortcut);
- });
+ $scope.$on('$unBindKeyEvent', function () {
+ document.removeEventListener('click', $scope.focusParagraphOnClick)
+ document.removeEventListener('keydown', $scope.keyboardShortcut)
+ })
- angular.element(window).bind('resize', function() {
- const actionbarHeight = document.getElementById('actionbar').lastElementChild.clientHeight;
- angular.element(document.getElementById('content')).css('padding-top', actionbarHeight - 20);
- });
+ angular.element(window).bind('resize', function () {
+ const actionbarHeight = document.getElementById('actionbar').lastElementChild.clientHeight
+ angular.element(document.getElementById('content')).css('padding-top', actionbarHeight - 20)
+ })
}
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.test.js b/zeppelin-web/src/app/notebook/notebook.controller.test.js
index 6df6893aa0..f393d2c09c 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.test.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.test.js
@@ -1,139 +1,139 @@
-describe('Controller: NotebookCtrl', function() {
- beforeEach(angular.mock.module('zeppelinWebApp'));
+describe('Controller: NotebookCtrl', function () {
+ beforeEach(angular.mock.module('zeppelinWebApp'))
- var scope;
+ let scope
- var websocketMsgSrvMock = {
- getNote: function() {},
- listRevisionHistory: function() {},
- getInterpreterBindings: function() {},
- updateNote: function() {},
- renameNote: function() {}
- };
+ let websocketMsgSrvMock = {
+ getNote: function () {},
+ listRevisionHistory: function () {},
+ getInterpreterBindings: function () {},
+ updateNote: function () {},
+ renameNote: function () {}
+ }
- var baseUrlSrvMock = {
- getRestApiBase: function() {
- return 'http://localhost:8080';
+ let baseUrlSrvMock = {
+ getRestApiBase: function () {
+ return 'http://localhost:8080'
}
- };
+ }
- var noteMock = {
+ let noteMock = {
id: 1,
name: 'my note',
config: {},
- };
+ }
- beforeEach(inject(function($controller, $rootScope) {
- scope = $rootScope.$new();
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new()
$controller('NotebookCtrl', {
$scope: scope,
websocketMsgSrv: websocketMsgSrvMock,
baseUrlSrv: baseUrlSrvMock
- });
- }));
+ })
+ }))
- beforeEach(function() {
- scope.note = noteMock;
- });
+ beforeEach(function () {
+ scope.note = noteMock
+ })
- var functions = ['getCronOptionNameFromValue', 'removeNote', 'runAllParagraphs', 'saveNote', 'toggleAllEditor',
+ let functions = ['getCronOptionNameFromValue', 'removeNote', 'runAllParagraphs', 'saveNote', 'toggleAllEditor',
'showAllEditor', 'hideAllEditor', 'toggleAllTable', 'hideAllTable', 'showAllTable', 'isNoteRunning',
'killSaveTimer', 'startSaveTimer', 'setLookAndFeel', 'setCronScheduler', 'setConfig', 'updateNoteName',
- 'openSetting', 'closeSetting', 'saveSetting', 'toggleSetting'];
+ 'openSetting', 'closeSetting', 'saveSetting', 'toggleSetting']
- functions.forEach(function(fn) {
- it('check for scope functions to be defined : ' + fn, function() {
- expect(scope[fn]).toBeDefined();
- });
- });
+ functions.forEach(function (fn) {
+ it('check for scope functions to be defined : ' + fn, function () {
+ expect(scope[fn]).toBeDefined()
+ })
+ })
- it('should set default value of "editorToggled" to false', function() {
- expect(scope.editorToggled).toEqual(false);
- });
+ it('should set default value of "editorToggled" to false', function () {
+ expect(scope.editorToggled).toEqual(false)
+ })
- it('should set "showSetting" to true when openSetting() is called', function() {
- scope.openSetting();
- expect(scope.showSetting).toEqual(true);
- });
+ it('should set "showSetting" to true when openSetting() is called', function () {
+ scope.openSetting()
+ expect(scope.showSetting).toEqual(true)
+ })
- it('should set "showSetting" to false when closeSetting() is called', function() {
- scope.closeSetting();
- expect(scope.showSetting).toEqual(false);
- });
+ it('should set "showSetting" to false when closeSetting() is called', function () {
+ scope.closeSetting()
+ expect(scope.showSetting).toEqual(false)
+ })
- it('should return the correct value for getCronOptionNameFromValue()', function() {
- var none = scope.getCronOptionNameFromValue();
- var oneMin = scope.getCronOptionNameFromValue('0 0/1 * * * ?');
- var fiveMin = scope.getCronOptionNameFromValue('0 0/5 * * * ?');
- var oneHour = scope.getCronOptionNameFromValue('0 0 0/1 * * ?');
- var threeHours = scope.getCronOptionNameFromValue('0 0 0/3 * * ?');
- var sixHours = scope.getCronOptionNameFromValue('0 0 0/6 * * ?');
- var twelveHours = scope.getCronOptionNameFromValue('0 0 0/12 * * ?');
- var oneDay = scope.getCronOptionNameFromValue('0 0 0 * * ?');
+ it('should return the correct value for getCronOptionNameFromValue()', function () {
+ let none = scope.getCronOptionNameFromValue()
+ let oneMin = scope.getCronOptionNameFromValue('0 0/1 * * * ?')
+ let fiveMin = scope.getCronOptionNameFromValue('0 0/5 * * * ?')
+ let oneHour = scope.getCronOptionNameFromValue('0 0 0/1 * * ?')
+ let threeHours = scope.getCronOptionNameFromValue('0 0 0/3 * * ?')
+ let sixHours = scope.getCronOptionNameFromValue('0 0 0/6 * * ?')
+ let twelveHours = scope.getCronOptionNameFromValue('0 0 0/12 * * ?')
+ let oneDay = scope.getCronOptionNameFromValue('0 0 0 * * ?')
- expect(none).toEqual('');
- expect(oneMin).toEqual('1m');
- expect(fiveMin).toEqual('5m');
- expect(oneHour).toEqual('1h');
- expect(threeHours).toEqual('3h');
- expect(sixHours).toEqual('6h');
- expect(twelveHours).toEqual('12h');
- expect(oneDay).toEqual('1d');
- });
+ expect(none).toEqual('')
+ expect(oneMin).toEqual('1m')
+ expect(fiveMin).toEqual('5m')
+ expect(oneHour).toEqual('1h')
+ expect(threeHours).toEqual('3h')
+ expect(sixHours).toEqual('6h')
+ expect(twelveHours).toEqual('12h')
+ expect(oneDay).toEqual('1d')
+ })
- it('should have "isNoteDirty" as null by default', function() {
- expect(scope.isNoteDirty).toEqual(null);
- });
+ it('should have "isNoteDirty" as null by default', function () {
+ expect(scope.isNoteDirty).toEqual(null)
+ })
- it('should first call killSaveTimer() when calling startSaveTimer()', function() {
- expect(scope.saveTimer).toEqual(null);
- spyOn(scope, 'killSaveTimer');
- scope.startSaveTimer();
- expect(scope.killSaveTimer).toHaveBeenCalled();
- });
+ it('should first call killSaveTimer() when calling startSaveTimer()', function () {
+ expect(scope.saveTimer).toEqual(null)
+ spyOn(scope, 'killSaveTimer')
+ scope.startSaveTimer()
+ expect(scope.killSaveTimer).toHaveBeenCalled()
+ })
- it('should set "saveTimer" when saveTimer() and killSaveTimer() are called', function() {
- expect(scope.saveTimer).toEqual(null);
- scope.startSaveTimer();
- expect(scope.saveTimer).toBeTruthy();
- scope.killSaveTimer();
- expect(scope.saveTimer).toEqual(null);
- });
+ it('should set "saveTimer" when saveTimer() and killSaveTimer() are called', function () {
+ expect(scope.saveTimer).toEqual(null)
+ scope.startSaveTimer()
+ expect(scope.saveTimer).toBeTruthy()
+ scope.killSaveTimer()
+ expect(scope.saveTimer).toEqual(null)
+ })
- it('should NOT update note name when updateNoteName() is called with an invalid name', function() {
- spyOn(websocketMsgSrvMock, 'renameNote');
- scope.updateNoteName('');
- expect(scope.note.name).toEqual(noteMock.name);
- expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
- scope.updateNoteName(' ');
- expect(scope.note.name).toEqual(noteMock.name);
- expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
- scope.updateNoteName(scope.note.name);
- expect(scope.note.name).toEqual(noteMock.name);
- expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
- });
+ it('should NOT update note name when updateNoteName() is called with an invalid name', function () {
+ spyOn(websocketMsgSrvMock, 'renameNote')
+ scope.updateNoteName('')
+ expect(scope.note.name).toEqual(noteMock.name)
+ expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled()
+ scope.updateNoteName(' ')
+ expect(scope.note.name).toEqual(noteMock.name)
+ expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled()
+ scope.updateNoteName(scope.note.name)
+ expect(scope.note.name).toEqual(noteMock.name)
+ expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled()
+ })
- it('should update note name when updateNoteName() is called with a valid name', function() {
- spyOn(websocketMsgSrvMock, 'renameNote');
- var newName = 'Your Note';
- scope.updateNoteName(newName);
- expect(scope.note.name).toEqual(newName);
- expect(websocketMsgSrvMock.renameNote).toHaveBeenCalled();
- });
+ it('should update note name when updateNoteName() is called with a valid name', function () {
+ spyOn(websocketMsgSrvMock, 'renameNote')
+ let newName = 'Your Note'
+ scope.updateNoteName(newName)
+ expect(scope.note.name).toEqual(newName)
+ expect(websocketMsgSrvMock.renameNote).toHaveBeenCalled()
+ })
- it('should reload note info once per one "setNoteMenu" event', function() {
- spyOn(websocketMsgSrvMock, 'getNote');
- spyOn(websocketMsgSrvMock, 'listRevisionHistory');
+ it('should reload note info once per one "setNoteMenu" event', function () {
+ spyOn(websocketMsgSrvMock, 'getNote')
+ spyOn(websocketMsgSrvMock, 'listRevisionHistory')
- scope.$broadcast('setNoteMenu');
- expect(websocketMsgSrvMock.getNote.calls.count()).toEqual(0);
- expect(websocketMsgSrvMock.listRevisionHistory.calls.count()).toEqual(0);
+ scope.$broadcast('setNoteMenu')
+ expect(websocketMsgSrvMock.getNote.calls.count()).toEqual(0)
+ expect(websocketMsgSrvMock.listRevisionHistory.calls.count()).toEqual(0)
- websocketMsgSrvMock.getNote.calls.reset();
- websocketMsgSrvMock.listRevisionHistory.calls.reset();
+ websocketMsgSrvMock.getNote.calls.reset()
+ websocketMsgSrvMock.listRevisionHistory.calls.reset()
- scope.$broadcast('setNoteMenu');
- expect(websocketMsgSrvMock.getNote.calls.count()).toEqual(0);
- expect(websocketMsgSrvMock.listRevisionHistory.calls.count()).toEqual(0);
- });
-});
+ scope.$broadcast('setNoteMenu')
+ expect(websocketMsgSrvMock.getNote.calls.count()).toEqual(0)
+ expect(websocketMsgSrvMock.listRevisionHistory.calls.count()).toEqual(0)
+ })
+})
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-parameterizedQueryForm.html b/zeppelin-web/src/app/notebook/paragraph/paragraph-parameterizedQueryForm.html
index 64da3cfff7..249e7c105b 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph-parameterizedQueryForm.html
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-parameterizedQueryForm.html
@@ -20,7 +20,7 @@ limitations under the License.