mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix: no-var
``` /Users/1ambda/github/apache/apache-zeppelin/zeppelin-master/zeppelin-web/src/components/resizable/resizable.directive.js 18:3 error Unexpected var, use let or const instead no-var 34:9 error Unexpected var, use let or const instead no-var 35:11 error Unexpected var, use let or const instead no-var 37:11 error Unexpected var, use let or const instead no-var 50:15 error Unexpected var, use let or const instead no-var /Users/1ambda/github/apache/apache-zeppelin/zeppelin-master/zeppelin-web/src/components/saveAs/saveAs.service.js 21:5 error Unexpected var, use let or const instead no-var 24:7 error Unexpected var, use let or const instead no-var 30:7 error Unexpected var, use let or const instead no-var 32:7 error Unexpected var, use let or const instead no-var 43:7 error Unexpected var, use let or const instead no-var /Users/1ambda/github/apache/apache-zeppelin/zeppelin-master/zeppelin-web/src/components/searchService/search.service.js 26:5 error Unexpected var, use let or const instead no-var /Users/1ambda/github/apache/apache-zeppelin/zeppelin-master/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js 20:3 error Unexpected var, use let or const instead no-var 21:3 error Unexpected var, use let or const instead no-var 53:5 error Unexpected var, use let or const instead no-var 58:5 error Unexpected var, use let or const instead no-var 59:5 error Unexpected var, use let or const instead no-var 71:7 error Unexpected var, use let or const instead no-var ✖ 685 problems (677 errors, 8 warnings) ```
This commit is contained in:
parent
3fd91fea98
commit
526dbebb46
57 changed files with 665 additions and 666 deletions
|
|
@ -31,7 +31,6 @@
|
|||
"process": false
|
||||
},
|
||||
"rules": {
|
||||
"no-var": 0,
|
||||
"semi": 0,
|
||||
"no-unneeded-ternary": 0,
|
||||
"comma-dangle": 0,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function MainCtrl ($scope, $rootScope, $window, arrayOrderingSrv) {
|
|||
|
||||
$scope.looknfeel = 'default';
|
||||
|
||||
var init = function () {
|
||||
let init = function () {
|
||||
$scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
describe('Controller: MainCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
var rootScope;
|
||||
let scope;
|
||||
let rootScope;
|
||||
|
||||
beforeEach(inject(function ($controller, $rootScope) {
|
||||
rootScope = $rootScope;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var zeppelinWebApp = angular.module('zeppelinWebApp', [
|
||||
let zeppelinWebApp = angular.module('zeppelinWebApp', [
|
||||
'ngCookies',
|
||||
'ngAnimate',
|
||||
'ngRoute',
|
||||
|
|
@ -47,7 +47,7 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
|
|||
// withCredentials when running locally via grunt
|
||||
$httpProvider.defaults.withCredentials = true;
|
||||
|
||||
var visBundleLoad = {
|
||||
let visBundleLoad = {
|
||||
load: ['heliumService', function (heliumService) {
|
||||
return heliumService.load;
|
||||
}]
|
||||
|
|
@ -124,7 +124,7 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
|
|||
return {
|
||||
'responseError': function (rejection) {
|
||||
if (rejection.status === 405) {
|
||||
var data = {};
|
||||
let data = {};
|
||||
data.info = '';
|
||||
$rootScope.$broadcast('session_logout', data);
|
||||
}
|
||||
|
|
@ -138,8 +138,8 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
|
|||
.constant('TRASH_FOLDER_ID', '~Trash');
|
||||
|
||||
function auth () {
|
||||
var $http = angular.injector(['ng']).get('$http');
|
||||
var baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv');
|
||||
let $http = angular.injector(['ng']).get('$http');
|
||||
let baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv');
|
||||
// withCredentials when running locally via grunt
|
||||
$http.defaults.withCredentials = true;
|
||||
jQuery.ajaxSetup({
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ function ConfigurationCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
$scope._ = _;
|
||||
ngToast.dismiss();
|
||||
|
||||
var getConfigurations = function () {
|
||||
let getConfigurations = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/configurations/all')
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.configurations = data.body;
|
||||
|
|
@ -41,7 +41,7 @@ function ConfigurationCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
var init = function () {
|
||||
let init = function () {
|
||||
getConfigurations();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
$scope.showAddNewCredentialInfo = false;
|
||||
$scope.availableInterpreters = [];
|
||||
|
||||
var getCredentialInfo = function () {
|
||||
let getCredentialInfo = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/credential')
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.credentialInfo = _.map(data.body.userCredentials, function (value, prop) {
|
||||
|
|
@ -58,7 +58,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
return;
|
||||
}
|
||||
|
||||
var newCredential = {
|
||||
let newCredential = {
|
||||
'entity': $scope.entity,
|
||||
'username': $scope.username,
|
||||
'password': $scope.password
|
||||
|
|
@ -86,10 +86,10 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
var getAvailableInterpreters = function () {
|
||||
let getAvailableInterpreters = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
|
||||
.success(function (data, status, headers, config) {
|
||||
for (var setting = 0; setting < data.body.length; setting++) {
|
||||
for (let setting = 0; setting < data.body.length; setting++) {
|
||||
$scope.availableInterpreters.push(
|
||||
data.body[setting].group + '.' + data.body[setting].name);
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
resetCredentialInfo();
|
||||
};
|
||||
|
||||
var resetCredentialInfo = function () {
|
||||
const resetCredentialInfo = function () {
|
||||
$scope.entity = '';
|
||||
$scope.username = '';
|
||||
$scope.password = '';
|
||||
|
|
@ -133,7 +133,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
};
|
||||
|
||||
$scope.updateCredentialInfo = function (form, data, entity) {
|
||||
var request = {
|
||||
let request = {
|
||||
entity: entity,
|
||||
username: data.username,
|
||||
password: data.password
|
||||
|
|
@ -141,7 +141,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/credential/', request)
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.credentialInfo, {'entity': entity});
|
||||
let index = _.findIndex($scope.credentialInfo, {'entity': entity});
|
||||
$scope.credentialInfo[index] = request;
|
||||
return true;
|
||||
})
|
||||
|
|
@ -168,7 +168,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
if (result) {
|
||||
$http.delete(baseUrlSrv.getRestApiBase() + '/credential/' + entity)
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.credentialInfo, {'entity': entity});
|
||||
let index = _.findIndex($scope.credentialInfo, {'entity': entity});
|
||||
$scope.credentialInfo.splice(index, 1);
|
||||
console.log('Success %o %o', status, data.message);
|
||||
})
|
||||
|
|
@ -180,7 +180,7 @@ function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
var init = function () {
|
||||
let init = function () {
|
||||
getAvailableInterpreters();
|
||||
getCredentialInfo();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export default class HandsonHelper {
|
|||
}
|
||||
|
||||
getHandsonTableConfig (columns, columnNames, resultRows) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
return {
|
||||
colHeaders: columnNames,
|
||||
data: resultRows,
|
||||
|
|
@ -42,17 +42,17 @@ export default class HandsonHelper {
|
|||
fragmentSelection: true,
|
||||
disableVisualSelection: true,
|
||||
cells: function (ro, co, pro) {
|
||||
var cellProperties = {};
|
||||
var colType = columns[co].type;
|
||||
let cellProperties = {};
|
||||
let colType = columns[co].type;
|
||||
cellProperties.renderer = function (instance, td, row, col, prop, value, cellProperties) {
|
||||
self._cellRenderer(instance, td, row, col, prop, value, cellProperties, colType);
|
||||
};
|
||||
return cellProperties;
|
||||
},
|
||||
afterGetColHeader: function (col, TH) {
|
||||
var instance = this;
|
||||
var menu = self._buildDropDownMenu(columns[col].type);
|
||||
var button = self._buildTypeSwitchButton();
|
||||
let instance = this;
|
||||
let menu = self._buildDropDownMenu(columns[col].type);
|
||||
let button = self._buildTypeSwitchButton();
|
||||
|
||||
self._addButtonMenuEvent(button, menu);
|
||||
|
||||
|
|
@ -76,9 +76,9 @@ export default class HandsonHelper {
|
|||
|
||||
_addButtonMenuEvent (button, menu) {
|
||||
Handsontable.Dom.addEvent(button, 'click', function (event) {
|
||||
var changeTypeMenu;
|
||||
var position;
|
||||
var removeMenu;
|
||||
let changeTypeMenu;
|
||||
let position;
|
||||
let removeMenu;
|
||||
|
||||
document.body.appendChild(menu);
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ export default class HandsonHelper {
|
|||
|
||||
changeTypeMenu = document.querySelectorAll('.changeTypeMenu');
|
||||
|
||||
for (var i = 0, len = changeTypeMenu.length; i < len; i++) {
|
||||
for (let i = 0, len = changeTypeMenu.length; i < len; i++) {
|
||||
changeTypeMenu[i].style.display = 'none';
|
||||
}
|
||||
menu.style.display = 'block';
|
||||
|
|
@ -107,13 +107,13 @@ export default class HandsonHelper {
|
|||
}
|
||||
|
||||
_buildDropDownMenu (activeCellType) {
|
||||
var menu = document.createElement('UL');
|
||||
var types = ['text', 'numeric', 'date'];
|
||||
var item;
|
||||
let menu = document.createElement('UL');
|
||||
let types = ['text', 'numeric', 'date'];
|
||||
let item;
|
||||
|
||||
menu.className = 'changeTypeMenu';
|
||||
|
||||
for (var i = 0, len = types.length; i < len; i++) {
|
||||
for (let i = 0, len = types.length; i < len; i++) {
|
||||
item = document.createElement('LI');
|
||||
if ('innerText' in item) {
|
||||
item.innerText = types[i];
|
||||
|
|
@ -133,7 +133,7 @@ export default class HandsonHelper {
|
|||
}
|
||||
|
||||
_buildTypeSwitchButton () {
|
||||
var button = document.createElement('BUTTON');
|
||||
let button = document.createElement('BUTTON');
|
||||
|
||||
button.innerHTML = '\u25BC';
|
||||
button.className = 'changeType';
|
||||
|
|
@ -167,7 +167,7 @@ export default class HandsonHelper {
|
|||
}
|
||||
|
||||
_dateValidator (value, callback) {
|
||||
var d = moment(value);
|
||||
let d = moment(value);
|
||||
return callback(d.isValid());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
});
|
||||
}
|
||||
|
||||
var orderPackageByPubDate = function (a, b) {
|
||||
let orderPackageByPubDate = function (a, b) {
|
||||
if (!a.pkg.published) {
|
||||
// Because local registry pkgs don't have 'published' field, put current time instead to show them first
|
||||
a.pkg.published = new Date().getTime()
|
||||
|
|
@ -69,19 +69,19 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
return new Date(a.pkg.published).getTime() - new Date(b.pkg.published).getTime();
|
||||
};
|
||||
|
||||
var classifyPkgType = function (packageInfo) {
|
||||
var allTypesOfPkg = {};
|
||||
var vizTypePkg = [];
|
||||
var spellTypePkg = [];
|
||||
var intpTypePkg = [];
|
||||
var appTypePkg = [];
|
||||
const classifyPkgType = function (packageInfo) {
|
||||
let allTypesOfPkg = {};
|
||||
let vizTypePkg = [];
|
||||
let spellTypePkg = [];
|
||||
let intpTypePkg = [];
|
||||
let appTypePkg = [];
|
||||
|
||||
var packageInfoArr = Object.keys(packageInfo).map(key => packageInfo[key])
|
||||
let packageInfoArr = Object.keys(packageInfo).map(key => packageInfo[key])
|
||||
packageInfoArr = packageInfoArr.sort(orderPackageByPubDate).reverse();
|
||||
|
||||
for (var name in packageInfoArr) {
|
||||
var pkgs = packageInfoArr[name];
|
||||
var pkgType = pkgs.pkg.type;
|
||||
for (let name in packageInfoArr) {
|
||||
let pkgs = packageInfoArr[name];
|
||||
let pkgType = pkgs.pkg.type;
|
||||
|
||||
switch (pkgType) {
|
||||
case HeliumType.VISUALIZATION:
|
||||
|
|
@ -99,13 +99,13 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
}
|
||||
}
|
||||
|
||||
var pkgsArr = [
|
||||
let pkgsArr = [
|
||||
vizTypePkg,
|
||||
spellTypePkg,
|
||||
intpTypePkg,
|
||||
appTypePkg
|
||||
]
|
||||
for (var idx in _.keys(HeliumType)) {
|
||||
for (let idx in _.keys(HeliumType)) {
|
||||
allTypesOfPkg[_.keys(HeliumType)[idx]] = pkgsArr[idx];
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
};
|
||||
|
||||
$scope.saveBundleOrder = function () {
|
||||
var confirm = BootstrapDialog.confirm({
|
||||
const confirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
|
|
@ -151,12 +151,12 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
});
|
||||
};
|
||||
|
||||
var getLicense = function (name, artifact) {
|
||||
var filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function (p) {
|
||||
let getLicense = function (name, artifact) {
|
||||
let filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function (p) {
|
||||
return p.artifact === artifact;
|
||||
});
|
||||
|
||||
var license;
|
||||
let license;
|
||||
if (filteredPkgSearchResults.length === 0) {
|
||||
filteredPkgSearchResults = _.filter($scope.pkgSearchResults[name], function (p) {
|
||||
return p.pkg.artifact === artifact;
|
||||
|
|
@ -186,12 +186,12 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
}
|
||||
|
||||
$scope.enable = function (name, artifact, type, groupId, description) {
|
||||
var license = getLicense(name, artifact);
|
||||
var mavenArtifactInfoToHTML = groupId + ':' + artifact.split('@')[0] + ':' + artifact.split('@')[1];
|
||||
var zeppelinVersion = $rootScope.zeppelinVersion;
|
||||
var url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/manual/interpreterinstallation.html';
|
||||
let license = getLicense(name, artifact);
|
||||
let mavenArtifactInfoToHTML = groupId + ':' + artifact.split('@')[0] + ':' + artifact.split('@')[1];
|
||||
let zeppelinVersion = $rootScope.zeppelinVersion;
|
||||
let url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/manual/interpreterinstallation.html';
|
||||
|
||||
var confirm = ''
|
||||
let confirm = ''
|
||||
if (type === HeliumType.INTERPRETER) {
|
||||
confirm = BootstrapDialog.show({
|
||||
title: '',
|
||||
|
|
@ -248,7 +248,7 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
};
|
||||
|
||||
$scope.disable = function (name, artifact) {
|
||||
var confirm = BootstrapDialog.confirm({
|
||||
const confirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
|
|
@ -304,7 +304,7 @@ export default function HeliumCtrl ($scope, $rootScope, $sce,
|
|||
};
|
||||
|
||||
$scope.getPackageSize = function (pkgSearchResult, targetPkgType) {
|
||||
var result = []
|
||||
let result = []
|
||||
_.map(pkgSearchResult, function (pkg) {
|
||||
result.push(_.find(pkg, {type: targetPkgType}))
|
||||
})
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function HomeCtrl ($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arr
|
|||
'ngInject';
|
||||
|
||||
ngToast.dismiss();
|
||||
var vm = this;
|
||||
let vm = this;
|
||||
vm.notes = noteListDataFactory;
|
||||
vm.websocketMsgSrv = websocketMsgSrv;
|
||||
vm.arrayOrderingSrv = arrayOrderingSrv;
|
||||
|
|
@ -133,7 +133,7 @@ function HomeCtrl ($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arr
|
|||
return true;
|
||||
}
|
||||
|
||||
var noteName = note.name;
|
||||
let noteName = note.name;
|
||||
if (noteName.toLowerCase().indexOf($scope.query.q.toLowerCase()) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl);
|
|||
function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) {
|
||||
'ngInject';
|
||||
|
||||
var interpreterSettingsTmp = [];
|
||||
let interpreterSettingsTmp = [];
|
||||
$scope.interpreterSettings = [];
|
||||
$scope.availableInterpreters = {};
|
||||
$scope.showAddNewSetting = false;
|
||||
|
|
@ -36,8 +36,8 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
$scope.showInterpreterAuth = false;
|
||||
};
|
||||
|
||||
var getSelectJson = function () {
|
||||
var selectJson = {
|
||||
let getSelectJson = function () {
|
||||
let selectJson = {
|
||||
tags: false,
|
||||
multiple: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
|
|
@ -51,9 +51,9 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
},
|
||||
delay: 250,
|
||||
processResults: function (data, params) {
|
||||
var users = [];
|
||||
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]
|
||||
|
|
@ -83,12 +83,12 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.$on('ngRenderFinished', function (event, data) {
|
||||
for (var setting = 0; setting < $scope.interpreterSettings.length; setting++) {
|
||||
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;
|
||||
|
|
@ -108,10 +108,10 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
});
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
}
|
||||
};
|
||||
|
||||
var getAvailableInterpreters = function () {
|
||||
let getAvailableInterpreters = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function (data, status, headers, config) {
|
||||
$scope.availableInterpreters = data.body;
|
||||
}).error(function (data, status, headers, config) {
|
||||
|
|
@ -142,30 +142,30 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
});
|
||||
};
|
||||
|
||||
var emptyNewProperty = function (object) {
|
||||
let emptyNewProperty = function (object) {
|
||||
angular.extend(object, {propertyValue: '', propertyKey: ''});
|
||||
};
|
||||
|
||||
var emptyNewDependency = function (object) {
|
||||
let emptyNewDependency = function (object) {
|
||||
angular.extend(object, {depArtifact: '', depExclude: ''});
|
||||
};
|
||||
|
||||
var removeTMPSettings = function (index) {
|
||||
let removeTMPSettings = function (index) {
|
||||
interpreterSettingsTmp.splice(index, 1);
|
||||
};
|
||||
|
||||
$scope.copyOriginInterpreterSettingProperties = function (settingId) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]);
|
||||
};
|
||||
|
||||
$scope.setPerNoteOption = function (settingId, sessionOption) {
|
||||
var option;
|
||||
let option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let setting = $scope.interpreterSettings[index];
|
||||
option = setting.option;
|
||||
}
|
||||
|
||||
|
|
@ -185,12 +185,12 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.setPerUserOption = function (settingId, sessionOption) {
|
||||
var option;
|
||||
let option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let setting = $scope.interpreterSettings[index];
|
||||
option = setting.option;
|
||||
}
|
||||
|
||||
|
|
@ -210,12 +210,12 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.getPerNoteOption = function (settingId) {
|
||||
var option;
|
||||
let option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let setting = $scope.interpreterSettings[index];
|
||||
option = setting.option;
|
||||
}
|
||||
|
||||
|
|
@ -229,12 +229,12 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.getPerUserOption = function (settingId) {
|
||||
var option;
|
||||
let option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let setting = $scope.interpreterSettings[index];
|
||||
option = setting.option;
|
||||
}
|
||||
|
||||
|
|
@ -248,23 +248,23 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.getInterpreterRunningOption = function (settingId) {
|
||||
var sharedModeName = 'shared';
|
||||
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;
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
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) {
|
||||
|
|
@ -290,12 +290,12 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.setInterpreterRunningOption = function (settingId, isPerNoteMode, isPerUserMode) {
|
||||
var option;
|
||||
let option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let setting = $scope.interpreterSettings[index];
|
||||
option = setting.option;
|
||||
}
|
||||
option.perNote = isPerNoteMode;
|
||||
|
|
@ -303,7 +303,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.updateInterpreterSetting = function (form, settingId) {
|
||||
var thisConfirm = BootstrapDialog.confirm({
|
||||
const thisConfirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
|
|
@ -311,8 +311,8 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
message: 'Do you want to update this interpreter and restart with new settings?',
|
||||
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);
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
}
|
||||
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)
|
||||
|
|
@ -374,7 +374,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.resetInterpreterSetting = function (settingId) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
|
||||
// Set the old settings back
|
||||
$scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index]);
|
||||
|
|
@ -390,7 +390,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
if (result) {
|
||||
$http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId)
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
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);
|
||||
|
|
@ -401,12 +401,12 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.newInterpreterGroupChange = function () {
|
||||
var el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}),
|
||||
let 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) {
|
||||
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
|
||||
|
|
@ -425,11 +425,11 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
if (result) {
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId)
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
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) {
|
||||
var errorMsg = (data !== null) ? data.message : 'Could not connect to server.';
|
||||
let errorMsg = (data !== null) ? data.message : 'Could not connect to server.';
|
||||
console.log('Error %o %o', status, errorMsg);
|
||||
ngToast.danger(errorMsg);
|
||||
});
|
||||
|
|
@ -468,7 +468,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
return;
|
||||
}
|
||||
|
||||
var newSetting = $scope.newInterpreterSetting;
|
||||
let newSetting = $scope.newInterpreterSetting;
|
||||
if (newSetting.propertyKey !== '' || newSetting.propertyKey) {
|
||||
$scope.addNewInterpreterProperty();
|
||||
}
|
||||
|
|
@ -480,11 +480,11 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
}
|
||||
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 = {};
|
||||
for (var p in newSetting.properties) {
|
||||
let newProperties = {};
|
||||
for (let p in newSetting.properties) {
|
||||
newProperties[p] = newSetting.properties[p].value;
|
||||
}
|
||||
request.properties = newProperties;
|
||||
|
|
@ -528,7 +528,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
if (settingId === undefined) {
|
||||
delete $scope.newInterpreterSetting.properties[key];
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
let index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
delete $scope.interpreterSettings[index].properties[key];
|
||||
}
|
||||
};
|
||||
|
|
@ -540,7 +540,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
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;
|
||||
|
|
@ -561,8 +561,8 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
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;
|
||||
|
|
@ -580,8 +580,8 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
}
|
||||
|
||||
// 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,
|
||||
|
|
@ -598,14 +598,14 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
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;
|
||||
}
|
||||
|
||||
// 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,
|
||||
|
|
@ -638,7 +638,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
};
|
||||
|
||||
var getRepositories = function () {
|
||||
let getRepositories = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/repository')
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.repositories = data.body;
|
||||
|
|
@ -648,7 +648,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
};
|
||||
|
||||
$scope.addNewRepository = function () {
|
||||
var request = angular.copy($scope.newRepoSetting);
|
||||
let request = angular.copy($scope.newRepoSetting);
|
||||
|
||||
$http.post(baseUrlSrv.getRestApiBase() + '/interpreter/repository', request)
|
||||
.success(function (data, status, headers, config) {
|
||||
|
|
@ -669,7 +669,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
if (result) {
|
||||
$http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/repository/' + repoId)
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.repositories, {'id': repoId});
|
||||
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);
|
||||
|
|
@ -694,7 +694,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
});
|
||||
};
|
||||
|
||||
var init = function () {
|
||||
let init = function () {
|
||||
$scope.resetNewInterpreterSetting();
|
||||
$scope.resetNewRepositorySetting();
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo
|
|||
$scope.showSparkUI = function (settingId) {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/getmetainfos/' + settingId + '?propName=url')
|
||||
.success(function (data, status, headers, config) {
|
||||
var url = data.body.url;
|
||||
let url = data.body.url;
|
||||
if (!url) {
|
||||
BootstrapDialog.alert({
|
||||
message: 'No spark application running'
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ angular.module('zeppelinWebApp').filter('sortByKey', sortByKey);
|
|||
|
||||
function sortByKey () {
|
||||
return function (properties) {
|
||||
var sortedKeys = properties ? Object.keys(properties) : [];
|
||||
let sortedKeys = properties ? Object.keys(properties) : [];
|
||||
return sortedKeys.sort();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeo
|
|||
'ngInject';
|
||||
|
||||
ngToast.dismiss();
|
||||
var asyncNotebookJobFilter = function (jobInfomations, filterConfig) {
|
||||
let asyncNotebookJobFilter = function (jobInfomations, filterConfig) {
|
||||
return $q(function (resolve, reject) {
|
||||
$scope.JobInfomationsByFilter = $scope.jobTypeFilter(jobInfomations, filterConfig);
|
||||
resolve($scope.JobInfomationsByFilter);
|
||||
|
|
@ -41,7 +41,7 @@ function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeo
|
|||
if ($scope.activeInterpreters === undefined) {
|
||||
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) + '...';
|
||||
|
|
@ -68,7 +68,7 @@ function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeo
|
|||
};
|
||||
|
||||
$scope.doFilterInputTyping = function (keyEvent, jobInfomations, filterConfig) {
|
||||
var RETURN_KEY_CODE = 13;
|
||||
let RETURN_KEY_CODE = 13;
|
||||
$timeout.cancel($scope.dofilterTimeoutObject);
|
||||
$scope.isActiveSearchTimer = true;
|
||||
$scope.dofilterTimeoutObject = $timeout(function () {
|
||||
|
|
@ -131,8 +131,8 @@ function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeo
|
|||
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]
|
||||
|
|
@ -142,21 +142,21 @@ function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeo
|
|||
});
|
||||
|
||||
$scope.$on('setUpdateNoteJobs', function (event, responseData) {
|
||||
var jobInfomations = $scope.jobInfomations;
|
||||
var indexStore = $scope.jobInfomationsIndexs;
|
||||
let jobInfomations = $scope.jobInfomations;
|
||||
let indexStore = $scope.jobInfomationsIndexs;
|
||||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
var notes = responseData.jobs;
|
||||
let notes = responseData.jobs;
|
||||
notes.map(function (changedItem) {
|
||||
if (indexStore[changedItem.noteId] === undefined) {
|
||||
var newItem = angular.copy(changedItem);
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ 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;
|
||||
let filterValueInterpreter = filterConfig.filterValueInterpreter;
|
||||
let filterValueNotebookName = filterConfig.filterValueNotebookName;
|
||||
let isSortByAsc = filterConfig.isSortByAsc;
|
||||
let filterItems = jobItems;
|
||||
|
||||
if (filterValueInterpreter === undefined) {
|
||||
filterItems = _.filter(filterItems, function (jobItem) {
|
||||
|
|
@ -31,8 +31,8 @@ function jobManagerFilter () {
|
|||
|
||||
if (filterValueNotebookName !== '') {
|
||||
filterItems = _.filter(filterItems, function (jobItem) {
|
||||
var lowerFilterValue = filterValueNotebookName.toLocaleLowerCase();
|
||||
var lowerNotebookName = jobItem.noteName.toLocaleLowerCase();
|
||||
let lowerFilterValue = filterValueNotebookName.toLocaleLowerCase();
|
||||
let lowerNotebookName = jobItem.noteName.toLocaleLowerCase();
|
||||
return lowerNotebookName.match(new RegExp('.*' + lowerFilterValue + '.*'));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@ function JobCtrl ($scope, $http, baseUrlSrv) {
|
|||
};
|
||||
|
||||
$scope.getProgress = function () {
|
||||
var statusList = _.pluck($scope.notebookJob.paragraphs, 'status');
|
||||
var runningJob = _.countBy(statusList, function (status) {
|
||||
let statusList = _.pluck($scope.notebookJob.paragraphs, 'status');
|
||||
let runningJob = _.countBy(statusList, function (status) {
|
||||
if (status === ParagraphStatus.RUNNING || status === ParagraphStatus.FINISHED) {
|
||||
return 'matchCount';
|
||||
} else {
|
||||
return 'none';
|
||||
}
|
||||
});
|
||||
var totalCount = statusList.length;
|
||||
var runningJobCount = runningJob.matchCount;
|
||||
var result = Math.ceil(runningJobCount / totalCount * 100);
|
||||
let totalCount = statusList.length;
|
||||
let runningJobCount = runningJob.matchCount;
|
||||
let result = Math.ceil(runningJobCount / totalCount * 100);
|
||||
return isNaN(result) ? 0 : result;
|
||||
};
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ function JobCtrl ($scope, $http, baseUrlSrv) {
|
|||
}).then(function successCallback (response) {
|
||||
// success
|
||||
}, function errorCallback (errorResponse) {
|
||||
var errorText = 'SERVER ERROR';
|
||||
let errorText = 'SERVER ERROR';
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
if (!!errorResponse.data.message) {
|
||||
errorText = errorResponse.data.message;
|
||||
|
|
@ -86,7 +86,7 @@ function JobCtrl ($scope, $http, baseUrlSrv) {
|
|||
}).then(function successCallback (response) {
|
||||
// success
|
||||
}, function errorCallback (errorResponse) {
|
||||
var errorText = 'SERVER ERROR';
|
||||
let errorText = 'SERVER ERROR';
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
if (!!errorResponse.data.message) {
|
||||
errorText = errorResponse.data.message;
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
$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_]*');
|
||||
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);
|
||||
};
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
return '';
|
||||
}
|
||||
|
||||
for (var o in $scope.cronOption) {
|
||||
for (let o in $scope.cronOption) {
|
||||
if ($scope.cronOption[o].value === value) {
|
||||
return $scope.cronOption[o].name;
|
||||
}
|
||||
|
|
@ -78,9 +78,9 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
$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.' +
|
||||
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.' +
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Learn more" target="_blank" href=' + url + '>' +
|
||||
'<i class="icon-question" />' +
|
||||
'</a>';
|
||||
|
|
@ -100,7 +100,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
/** Init the new controller */
|
||||
var initNotebook = function () {
|
||||
const initNotebook = function () {
|
||||
noteVarShareService.clear();
|
||||
if ($routeParams.revisionId) {
|
||||
websocketMsgSrv.getNoteByRevision($routeParams.noteId, $routeParams.revisionId);
|
||||
|
|
@ -108,16 +108,16 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
websocketMsgSrv.getNote($routeParams.noteId);
|
||||
}
|
||||
websocketMsgSrv.listRevisionHistory($routeParams.noteId);
|
||||
var currentRoute = $route.current;
|
||||
let currentRoute = $route.current;
|
||||
if (currentRoute) {
|
||||
setTimeout(
|
||||
function () {
|
||||
var routeParams = currentRoute.params;
|
||||
var $id = angular.element('#' + routeParams.paragraph + '_container');
|
||||
let routeParams = currentRoute.params;
|
||||
let $id = angular.element('#' + routeParams.paragraph + '_container');
|
||||
|
||||
if ($id.length > 0) {
|
||||
// adjust for navbar
|
||||
var top = $id.offset().top - 103;
|
||||
let top = $id.offset().top - 103;
|
||||
angular.element('html, body').scrollTo({top: top, left: 0});
|
||||
}
|
||||
},
|
||||
|
|
@ -132,8 +132,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
if (!$scope.note) {
|
||||
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;
|
||||
|
|
@ -174,7 +174,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
|
||||
// Export notebook
|
||||
$scope.exportNote = function () {
|
||||
var jsonContent = JSON.stringify($scope.note);
|
||||
let jsonContent = JSON.stringify($scope.note);
|
||||
saveAsService.saveAs(jsonContent, $scope.note.name, 'json');
|
||||
};
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
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;
|
||||
}
|
||||
|
|
@ -428,7 +428,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var initializeLookAndFeel = function () {
|
||||
const initializeLookAndFeel = function () {
|
||||
if (!$scope.note.config.looknfeel) {
|
||||
$scope.note.config.looknfeel = 'default';
|
||||
} else {
|
||||
|
|
@ -441,14 +441,14 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
$rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel);
|
||||
};
|
||||
|
||||
var cleanParagraphExcept = function (paragraphId, note) {
|
||||
var noteCopy = {};
|
||||
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 (var i = 0; i < note.paragraphs.length; i++) {
|
||||
for (let i = 0; i < note.paragraphs.length; i++) {
|
||||
if (note.paragraphs[i].id === paragraphId) {
|
||||
noteCopy.paragraphs[0] = note.paragraphs[i];
|
||||
if (!noteCopy.paragraphs[0].config) {
|
||||
|
|
@ -462,7 +462,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
return noteCopy;
|
||||
};
|
||||
|
||||
var addPara = function (paragraph, index) {
|
||||
let addPara = function (paragraph, index) {
|
||||
$scope.note.paragraphs.splice(index, 0, paragraph);
|
||||
_.each($scope.note.paragraphs, function (para) {
|
||||
if (para.id === paragraph.id) {
|
||||
|
|
@ -472,8 +472,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
};
|
||||
|
||||
var removePara = function (paragraphId) {
|
||||
var removeIdx;
|
||||
let removePara = function (paragraphId) {
|
||||
let removeIdx;
|
||||
_.each($scope.note.paragraphs, function (para, idx) {
|
||||
if (para.id === paragraphId) {
|
||||
removeIdx = idx;
|
||||
|
|
@ -497,7 +497,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.$on('moveParagraph', function (event, paragraphId, newIdx) {
|
||||
var removedPara = removePara(paragraphId);
|
||||
let removedPara = removePara(paragraphId);
|
||||
if (removedPara && removedPara.length === 1) {
|
||||
addPara(removedPara[0], newIdx);
|
||||
}
|
||||
|
|
@ -514,7 +514,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
initializeLookAndFeel();
|
||||
});
|
||||
|
||||
var getInterpreterBindings = function () {
|
||||
let getInterpreterBindings = function () {
|
||||
websocketMsgSrv.getInterpreterBindings($scope.note.id);
|
||||
};
|
||||
|
||||
|
|
@ -522,9 +522,9 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
$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];
|
||||
|
|
@ -536,7 +536,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
|
||||
if (!selected) {
|
||||
// make default selection
|
||||
var selectedIntp = {};
|
||||
let selectedIntp = {};
|
||||
for (key in $scope.interpreterBindings) {
|
||||
setting = $scope.interpreterBindings[key];
|
||||
if (!selectedIntp[setting.name]) {
|
||||
|
|
@ -579,9 +579,9 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
$scope.saveSetting = function () {
|
||||
var selectedSettingIds = [];
|
||||
for (var no in $scope.interpreterBindings) {
|
||||
var setting = $scope.interpreterBindings[no];
|
||||
let selectedSettingIds = [];
|
||||
for (let no in $scope.interpreterBindings) {
|
||||
let setting = $scope.interpreterBindings[no];
|
||||
if (setting.selected) {
|
||||
selectedSettingIds.push(setting.id);
|
||||
}
|
||||
|
|
@ -590,7 +590,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
console.log('Interpreter bindings %o saved', selectedSettingIds);
|
||||
|
||||
_.forEach($scope.note.paragraphs, function (n, key) {
|
||||
var regExp = /^\s*%/g;
|
||||
let regExp = /^\s*%/g;
|
||||
if (n.text && !regExp.exec(n.text)) {
|
||||
$scope.$broadcast('saveInterpreterBindings', n.id);
|
||||
}
|
||||
|
|
@ -609,13 +609,13 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var getPermissions = function (callback) {
|
||||
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) {
|
||||
|
|
@ -626,11 +626,11 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
},
|
||||
delay: 250,
|
||||
processResults: function (data, params) {
|
||||
var results = [];
|
||||
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]
|
||||
|
|
@ -642,7 +642,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
}
|
||||
if (data.body.roles.length !== 0) {
|
||||
var roles = [];
|
||||
let roles = [];
|
||||
for (let len = 0; len < data.body.roles.length; len++) {
|
||||
roles.push({
|
||||
'id': data.body.roles[len],
|
||||
|
|
@ -723,7 +723,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
message: 'Do you want to restart ' + interpreter.name + ' interpreter?',
|
||||
callback: function(result) {
|
||||
if (result) {
|
||||
var payload = {
|
||||
let payload = {
|
||||
'noteId': $scope.note.id
|
||||
};
|
||||
|
||||
|
|
@ -797,7 +797,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
$scope.togglePermissions = function () {
|
||||
var principal = $rootScope.ticket.principal;
|
||||
let principal = $rootScope.ticket.principal;
|
||||
$scope.isAnonymous = principal === 'anonymous' ? true : false;
|
||||
if (!!principal && $scope.isAnonymous) {
|
||||
$scope.blockAnonUsers();
|
||||
|
|
@ -825,13 +825,13 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
$scope.toggleNotePersonalizedMode = function () {
|
||||
var personalizedMode = $scope.note.config.personalizedMode;
|
||||
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';
|
||||
let modeText = $scope.note.config.personalizedMode === 'true' ? 'collaborate' : 'personalize';
|
||||
return 'Do you want to <span class="text-info">' + modeText + '</span> your analysis?';
|
||||
},
|
||||
callback: function (result) {
|
||||
|
|
@ -847,7 +847,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var isSettingDirty = function () {
|
||||
const isSettingDirty = function () {
|
||||
if (angular.equals($scope.interpreterBindings, $scope.interpreterBindingsOrig)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -855,7 +855,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var isPermissionsDirty = function () {
|
||||
const isPermissionsDirty = function () {
|
||||
if (angular.equals($scope.permissions, $scope.permissionsOrig)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -879,8 +879,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.$on('moveParagraphUp', function (event, paragraph) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
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;
|
||||
|
|
@ -890,7 +890,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
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()
|
||||
|
|
@ -903,8 +903,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.$on('moveParagraphDown', function (event, paragraph) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
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;
|
||||
|
|
@ -915,7 +915,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
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()
|
||||
|
|
@ -928,8 +928,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.$on('moveFocusToPreviousParagraph', function (event, currentParagraphId) {
|
||||
var focus = false;
|
||||
for (var i = $scope.note.paragraphs.length - 1; i >= 0; i--) {
|
||||
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;
|
||||
|
|
@ -943,8 +943,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.$on('moveFocusToNextParagraph', function (event, currentParagraphId) {
|
||||
var focus = false;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
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;
|
||||
|
|
@ -958,8 +958,8 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.$on('insertParagraph', function (event, paragraphId, position) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
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
|
||||
if (position === 'above') {
|
||||
|
|
@ -999,7 +999,7 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
|||
// open interpreter binding setting when there're none selected
|
||||
getInterpreterBindings();
|
||||
getPermissions();
|
||||
var isPersonalized = $scope.note.config.personalizedMode;
|
||||
let isPersonalized = $scope.note.config.personalizedMode;
|
||||
isPersonalized = isPersonalized === undefined ? 'false' : isPersonalized;
|
||||
$scope.note.config.personalizedMode = isPersonalized;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
describe('Controller: NotebookCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
let scope;
|
||||
|
||||
var websocketMsgSrvMock = {
|
||||
let websocketMsgSrvMock = {
|
||||
getNote: function () {},
|
||||
listRevisionHistory: function () {},
|
||||
getInterpreterBindings: function () {},
|
||||
|
|
@ -11,13 +11,13 @@ describe('Controller: NotebookCtrl', function () {
|
|||
renameNote: function () {}
|
||||
};
|
||||
|
||||
var baseUrlSrvMock = {
|
||||
let baseUrlSrvMock = {
|
||||
getRestApiBase: function () {
|
||||
return 'http://localhost:8080';
|
||||
}
|
||||
};
|
||||
|
||||
var noteMock = {
|
||||
let noteMock = {
|
||||
id: 1,
|
||||
name: 'my note',
|
||||
config: {},
|
||||
|
|
@ -36,7 +36,7 @@ describe('Controller: NotebookCtrl', 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'];
|
||||
|
|
@ -62,14 +62,14 @@ describe('Controller: NotebookCtrl', function () {
|
|||
});
|
||||
|
||||
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 * * ?');
|
||||
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');
|
||||
|
|
@ -115,7 +115,7 @@ describe('Controller: NotebookCtrl', function () {
|
|||
|
||||
it('should update note name when updateNoteName() is called with a valid name', function () {
|
||||
spyOn(websocketMsgSrvMock, 'renameNote');
|
||||
var newName = 'Your Note';
|
||||
let newName = 'Your Note';
|
||||
scope.updateNoteName(newName);
|
||||
expect(scope.note.name).toEqual(newName);
|
||||
expect(websocketMsgSrvMock.renameNote).toHaveBeenCalled();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
heliumService) {
|
||||
'ngInject';
|
||||
|
||||
var ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_';
|
||||
let ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_';
|
||||
$rootScope.keys = Object.keys;
|
||||
$scope.parentNote = null;
|
||||
$scope.paragraph = {};
|
||||
|
|
@ -49,12 +49,12 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
paragraphText: '',
|
||||
};
|
||||
|
||||
var editorSetting = {};
|
||||
let editorSetting = {};
|
||||
// flag that is used to set editor setting on paste percent sign
|
||||
var pastePercentSign = false;
|
||||
let pastePercentSign = false;
|
||||
// flag that is used to set editor setting on save interpreter bindings
|
||||
var setInterpreterBindings = false;
|
||||
var paragraphScope = $rootScope.$new(true, $rootScope);
|
||||
let setInterpreterBindings = false;
|
||||
let paragraphScope = $rootScope.$new(true, $rootScope);
|
||||
|
||||
// to keep backward compatibility
|
||||
$scope.compiledScope = paragraphScope;
|
||||
|
|
@ -63,11 +63,11 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
// z.runParagraph('20150213-231621_168813393')
|
||||
runParagraph: function (paragraphId) {
|
||||
if (paragraphId) {
|
||||
var filtered = $scope.parentNote.paragraphs.filter(function (x) {
|
||||
let filtered = $scope.parentNote.paragraphs.filter(function (x) {
|
||||
return x.id === paragraphId;
|
||||
});
|
||||
if (filtered.length === 1) {
|
||||
var paragraph = filtered[0];
|
||||
let paragraph = filtered[0];
|
||||
websocketMsgSrv.runParagraph(paragraph.id, paragraph.title, paragraph.text,
|
||||
paragraph.config, paragraph.settings.params);
|
||||
} else {
|
||||
|
|
@ -116,7 +116,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
}
|
||||
};
|
||||
|
||||
var angularObjectRegistry = {};
|
||||
let angularObjectRegistry = {};
|
||||
|
||||
// Controller init
|
||||
$scope.init = function (newParagraph, note) {
|
||||
|
|
@ -139,8 +139,8 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
initializeDefault($scope.paragraph.config);
|
||||
};
|
||||
|
||||
var initializeDefault = function (config) {
|
||||
var forms = $scope.paragraph.settings.forms;
|
||||
const initializeDefault = function (config) {
|
||||
let forms = $scope.paragraph.settings.forms;
|
||||
|
||||
if (!config.colWidth) {
|
||||
config.colWidth = 12;
|
||||
|
|
@ -150,7 +150,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
config.enabled = true;
|
||||
}
|
||||
|
||||
for (var idx in forms) {
|
||||
for (let idx in forms) {
|
||||
if (forms[idx]) {
|
||||
if (forms[idx].options) {
|
||||
if (config.runOnSelectionChange === undefined) {
|
||||
|
|
@ -180,7 +180,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
$scope.paragraph.results.msg = [];
|
||||
}
|
||||
|
||||
var update = ($scope.paragraph.results.msg[data.index]) ? true : false;
|
||||
let update = ($scope.paragraph.results.msg[data.index]) ? true : false;
|
||||
|
||||
$scope.paragraph.results.msg[data.index] = {
|
||||
data: data.data,
|
||||
|
|
@ -200,8 +200,8 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
$scope.getIframeDimensions = function () {
|
||||
if ($scope.asIframe) {
|
||||
var paragraphid = '#' + $routeParams.paragraphId + '_container';
|
||||
var height = angular.element(paragraphid).height();
|
||||
let paragraphid = '#' + $routeParams.paragraphId + '_container';
|
||||
let height = angular.element(paragraphid).height();
|
||||
return height;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -209,7 +209,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
$scope.$watch($scope.getIframeDimensions, function (newValue, oldValue) {
|
||||
if ($scope.asIframe && newValue) {
|
||||
var message = {};
|
||||
let message = {};
|
||||
message.height = newValue;
|
||||
message.url = $location.$$absUrl;
|
||||
$window.parent.postMessage(angular.toJson(message), '*');
|
||||
|
|
@ -235,7 +235,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
}
|
||||
});
|
||||
|
||||
var isEmpty = function (object) {
|
||||
let isEmpty = function (object) {
|
||||
return !object;
|
||||
};
|
||||
|
||||
|
|
@ -426,15 +426,15 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.copyPara = function (position) {
|
||||
var editorValue = $scope.getEditorValue();
|
||||
let editorValue = $scope.getEditorValue();
|
||||
if (editorValue) {
|
||||
$scope.copyParagraph(editorValue, position);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.copyParagraph = function (data, position) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
let newIndex = -1;
|
||||
for (let i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
if ($scope.note.paragraphs[i].id === $scope.paragraph.id) {
|
||||
// determine position of where to add new paragraph; default is below
|
||||
if (position === 'above') {
|
||||
|
|
@ -450,7 +450,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
return;
|
||||
}
|
||||
|
||||
var config = angular.copy($scope.paragraph.config);
|
||||
let config = angular.copy($scope.paragraph.config);
|
||||
config.editorHide = false;
|
||||
|
||||
websocketMsgSrv.copyParagraph(newIndex, $scope.paragraph.title, data,
|
||||
|
|
@ -458,7 +458,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.removeParagraph = function (paragraph) {
|
||||
var paragraphs = angular.element('div[id$="_paragraphColumn_main"]');
|
||||
let paragraphs = angular.element('div[id$="_paragraphColumn_main"]');
|
||||
if (paragraphs[paragraphs.length - 1].id.indexOf(paragraph.id) === 0) {
|
||||
BootstrapDialog.alert({
|
||||
closable: true,
|
||||
|
|
@ -521,19 +521,19 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
var openEditorAndCloseTable = function (paragraph) {
|
||||
let openEditorAndCloseTable = function (paragraph) {
|
||||
manageEditorAndTableState(paragraph, false, true);
|
||||
};
|
||||
|
||||
var closeEditorAndOpenTable = function (paragraph) {
|
||||
const closeEditorAndOpenTable = function (paragraph) {
|
||||
manageEditorAndTableState(paragraph, true, false);
|
||||
};
|
||||
|
||||
var openEditorAndOpenTable = function (paragraph) {
|
||||
const openEditorAndOpenTable = function (paragraph) {
|
||||
manageEditorAndTableState(paragraph, false, false);
|
||||
};
|
||||
|
||||
var manageEditorAndTableState = function (paragraph, hideEditor, hideTable) {
|
||||
const manageEditorAndTableState = function (paragraph, hideEditor, hideTable) {
|
||||
paragraph.config.editorHide = hideEditor;
|
||||
paragraph.config.tableHide = hideTable;
|
||||
commitParagraph(paragraph);
|
||||
|
|
@ -589,7 +589,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.loadForm = function (formulaire, params) {
|
||||
var value = formulaire.defaultValue;
|
||||
let value = formulaire.defaultValue;
|
||||
if (params[formulaire.name]) {
|
||||
value = params[formulaire.name];
|
||||
}
|
||||
|
|
@ -598,7 +598,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.toggleCheckbox = function (formulaire, option) {
|
||||
var idx = $scope.paragraph.settings.params[formulaire.name].indexOf(option.value);
|
||||
let idx = $scope.paragraph.settings.params[formulaire.name].indexOf(option.value);
|
||||
if (idx > -1) {
|
||||
$scope.paragraph.settings.params[formulaire.name].splice(idx, 1);
|
||||
} else {
|
||||
|
|
@ -607,16 +607,16 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.aceChanged = function (_, editor) {
|
||||
var session = editor.getSession();
|
||||
var dirtyText = session.getValue();
|
||||
let session = editor.getSession();
|
||||
let dirtyText = session.getValue();
|
||||
$scope.dirtyText = dirtyText;
|
||||
$scope.startSaveTimer();
|
||||
setParagraphMode(session, dirtyText, editor.getCursorPosition());
|
||||
};
|
||||
|
||||
$scope.aceLoaded = function (_editor) {
|
||||
var langTools = ace.require('ace/ext/language_tools');
|
||||
var Range = ace.require('ace/range').Range;
|
||||
let langTools = ace.require('ace/ext/language_tools');
|
||||
let Range = ace.require('ace/range').Range;
|
||||
|
||||
_editor.$blockScrolling = Infinity;
|
||||
$scope.editor = _editor;
|
||||
|
|
@ -669,7 +669,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
}
|
||||
|
||||
pos = session.getTextRange(new Range(0, 0, pos.row, pos.column)).length;
|
||||
var buf = session.getValue();
|
||||
let buf = session.getValue();
|
||||
|
||||
websocketMsgSrv.completion($scope.paragraph.id, buf, pos);
|
||||
|
||||
|
|
@ -771,9 +771,9 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
// autocomplete on 'ctrl+.'
|
||||
$scope.editor.commands.bindKey('ctrl-.', 'startAutocomplete');
|
||||
|
||||
var keyBindingEditorFocusAction = function (scrollValue) {
|
||||
var numRows = $scope.editor.getSession().getLength();
|
||||
var currentRow = $scope.editor.getCursorPosition().row;
|
||||
let keyBindingEditorFocusAction = function (scrollValue) {
|
||||
let numRows = $scope.editor.getSession().getLength();
|
||||
let currentRow = $scope.editor.getCursorPosition().row;
|
||||
if (currentRow === 0 && scrollValue <= 0) {
|
||||
// move focus to previous paragraph
|
||||
$scope.$emit('moveFocusToPreviousParagraph', $scope.paragraph.id);
|
||||
|
|
@ -792,13 +792,13 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
// fix ace editor focus issue in chrome (textarea element goes to top: -1000px after focused by cursor move)
|
||||
if (parseInt(angular.element('#' + $scope.paragraph.id + '_editor > textarea')
|
||||
.css('top').replace('px', '')) < 0) {
|
||||
var position = $scope.editor.getCursorPosition();
|
||||
var cursorPos = $scope.editor.renderer.$cursorLayer.getPixelPosition(position, true);
|
||||
let position = $scope.editor.getCursorPosition();
|
||||
let cursorPos = $scope.editor.renderer.$cursorLayer.getPixelPosition(position, true);
|
||||
angular.element('#' + $scope.paragraph.id + '_editor > textarea').css('top', cursorPos.top);
|
||||
}
|
||||
|
||||
var ROW_UP = -1;
|
||||
var ROW_DOWN = 1;
|
||||
let ROW_UP = -1;
|
||||
let ROW_DOWN = 1;
|
||||
|
||||
switch (keyCode) {
|
||||
case 38:
|
||||
|
|
@ -824,7 +824,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
}
|
||||
};
|
||||
|
||||
var handleFocus = function (value, isDigestPass) {
|
||||
const handleFocus = function (value, isDigestPass) {
|
||||
$scope.paragraphFocused = value;
|
||||
if (isDigestPass === false || isDigestPass === undefined) {
|
||||
// Protect against error in case digest is already running
|
||||
|
|
@ -835,8 +835,8 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
}
|
||||
};
|
||||
|
||||
var getEditorSetting = function (paragraph, interpreterName) {
|
||||
var deferred = $q.defer();
|
||||
let getEditorSetting = function (paragraph, interpreterName) {
|
||||
let deferred = $q.defer();
|
||||
websocketMsgSrv.getEditorSetting(paragraph.id, interpreterName);
|
||||
$timeout(
|
||||
$scope.$on('editorSetting', function (event, data) {
|
||||
|
|
@ -848,14 +848,14 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
var setEditorLanguage = function (session, language) {
|
||||
var mode = 'ace/mode/';
|
||||
let setEditorLanguage = function (session, language) {
|
||||
let mode = 'ace/mode/';
|
||||
mode += language;
|
||||
$scope.paragraph.config.editorMode = mode;
|
||||
session.setMode(mode);
|
||||
};
|
||||
|
||||
var setParagraphMode = function (session, paragraphText, pos) {
|
||||
const setParagraphMode = function (session, paragraphText, pos) {
|
||||
// Evaluate the mode only if the the position is undefined
|
||||
// or the first 30 characters of the paragraph have been modified
|
||||
// or cursor position is at beginning of second line.(in case user hit enter after typing %magic)
|
||||
|
|
@ -866,7 +866,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
!setInterpreterBindings) {
|
||||
session.setMode($scope.paragraph.config.editorMode);
|
||||
} else {
|
||||
var magic = getInterpreterName(paragraphText);
|
||||
let magic = getInterpreterName(paragraphText);
|
||||
if (editorSetting.magic !== magic) {
|
||||
editorSetting.magic = magic;
|
||||
getEditorSetting($scope.paragraph, magic)
|
||||
|
|
@ -894,8 +894,8 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
return '';
|
||||
};
|
||||
|
||||
var autoAdjustEditorHeight = function (editor) {
|
||||
var height =
|
||||
const autoAdjustEditorHeight = function (editor) {
|
||||
let height =
|
||||
editor.getSession().getScreenLength() *
|
||||
editor.renderer.lineHeight +
|
||||
editor.renderer.scrollBar.getWidth();
|
||||
|
|
@ -906,7 +906,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
$rootScope.$on('scrollToCursor', function (event) {
|
||||
// scroll on 'scrollToCursor' event only when cursor is in the last paragraph
|
||||
var paragraphs = angular.element('div[id$="_paragraphColumn_main"]');
|
||||
let paragraphs = angular.element('div[id$="_paragraphColumn_main"]');
|
||||
if (paragraphs[paragraphs.length - 1].id.indexOf($scope.paragraph.id) === 0) {
|
||||
$scope.scrollToCursor($scope.paragraph.id, 0);
|
||||
}
|
||||
|
|
@ -922,21 +922,21 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
// only make sense when editor is focused
|
||||
return;
|
||||
}
|
||||
var lineHeight = $scope.editor.renderer.lineHeight;
|
||||
var headerHeight = 103; // menubar, notebook titlebar
|
||||
var scrollTriggerEdgeMargin = 50;
|
||||
let lineHeight = $scope.editor.renderer.lineHeight;
|
||||
let headerHeight = 103; // menubar, notebook titlebar
|
||||
let scrollTriggerEdgeMargin = 50;
|
||||
|
||||
var documentHeight = angular.element(document).height();
|
||||
var windowHeight = angular.element(window).height(); // actual viewport height
|
||||
let documentHeight = angular.element(document).height();
|
||||
let windowHeight = angular.element(window).height(); // actual viewport height
|
||||
|
||||
var scrollPosition = angular.element(document).scrollTop();
|
||||
var editorPosition = angular.element('#' + paragraphId + '_editor').offset();
|
||||
var position = $scope.editor.getCursorPosition();
|
||||
var lastCursorPosition = $scope.editor.renderer.$cursorLayer.getPixelPosition(position, true);
|
||||
let scrollPosition = angular.element(document).scrollTop();
|
||||
let editorPosition = angular.element('#' + paragraphId + '_editor').offset();
|
||||
let position = $scope.editor.getCursorPosition();
|
||||
let lastCursorPosition = $scope.editor.renderer.$cursorLayer.getPixelPosition(position, true);
|
||||
|
||||
var calculatedCursorPosition = editorPosition.top + lastCursorPosition.top + lineHeight * lastCursorMove;
|
||||
let calculatedCursorPosition = editorPosition.top + lastCursorPosition.top + lineHeight * lastCursorMove;
|
||||
|
||||
var scrollTargetPos;
|
||||
let scrollTargetPos;
|
||||
if (calculatedCursorPosition < scrollPosition + headerHeight + scrollTriggerEdgeMargin) {
|
||||
scrollTargetPos = calculatedCursorPosition - headerHeight - ((windowHeight - headerHeight) / 3);
|
||||
if (scrollTargetPos < 0) {
|
||||
|
|
@ -951,7 +951,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
}
|
||||
|
||||
// cancel previous scroll animation
|
||||
var bodyEl = angular.element('body');
|
||||
let bodyEl = angular.element('body');
|
||||
bodyEl.stop();
|
||||
bodyEl.finish();
|
||||
|
||||
|
|
@ -968,15 +968,15 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.getExecutionTime = function (pdata) {
|
||||
var timeMs = Date.parse(pdata.dateFinished) - Date.parse(pdata.dateStarted);
|
||||
let timeMs = Date.parse(pdata.dateFinished) - Date.parse(pdata.dateStarted);
|
||||
if (isNaN(timeMs) || timeMs < 0) {
|
||||
if ($scope.isResultOutdated(pdata)) {
|
||||
return 'outdated';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
var user = (pdata.user === undefined || pdata.user === null) ? 'anonymous' : pdata.user;
|
||||
var desc = 'Took ' + moment.duration((timeMs / 1000), 'seconds').format('h [hrs] m [min] s [sec]') +
|
||||
let user = (pdata.user === undefined || pdata.user === null) ? 'anonymous' : pdata.user;
|
||||
let desc = 'Took ' + moment.duration((timeMs / 1000), 'seconds').format('h [hrs] m [min] s [sec]') +
|
||||
'. Last updated by ' + user + ' at ' + moment(pdata.dateFinished).format('MMMM DD YYYY, h:mm:ss A') + '.';
|
||||
if ($scope.isResultOutdated(pdata)) {
|
||||
desc += ' (outdated)';
|
||||
|
|
@ -1007,14 +1007,14 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
return Number(cell);
|
||||
}
|
||||
}
|
||||
var d = moment(cell);
|
||||
let d = moment(cell);
|
||||
if (d.isValid()) {
|
||||
return d;
|
||||
}
|
||||
return cell;
|
||||
};
|
||||
|
||||
var commitParagraph = function (paragraph) {
|
||||
const commitParagraph = function (paragraph) {
|
||||
const {
|
||||
id,
|
||||
title,
|
||||
|
|
@ -1028,14 +1028,14 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
/** Utility function */
|
||||
$scope.goToSingleParagraph = function () {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
var redirectToUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId +
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
let redirectToUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId +
|
||||
'/paragraph/' + $scope.paragraph.id + '?asIframe';
|
||||
$window.open(redirectToUrl);
|
||||
};
|
||||
|
||||
$scope.showScrollDownIcon = function (id) {
|
||||
var doc = angular.element('#p' + id + '_text');
|
||||
let doc = angular.element('#p' + id + '_text');
|
||||
if (doc[0]) {
|
||||
return doc[0].scrollHeight > doc.innerHeight();
|
||||
}
|
||||
|
|
@ -1043,7 +1043,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.scrollParagraphDown = function (id) {
|
||||
var doc = angular.element('#p' + id + '_text');
|
||||
let doc = angular.element('#p' + id + '_text');
|
||||
doc.animate({scrollTop: doc[0].scrollHeight}, 500);
|
||||
$scope.keepScrollDown = true;
|
||||
};
|
||||
|
|
@ -1056,16 +1056,16 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
};
|
||||
|
||||
$scope.scrollParagraphUp = function (id) {
|
||||
var doc = angular.element('#p' + id + '_text');
|
||||
let doc = angular.element('#p' + id + '_text');
|
||||
doc.animate({scrollTop: 0}, 500);
|
||||
$scope.keepScrollDown = false;
|
||||
};
|
||||
|
||||
$scope.$on('angularObjectUpdate', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
var registry;
|
||||
let scope;
|
||||
let registry;
|
||||
|
||||
if (!data.paragraphId || data.paragraphId === $scope.paragraph.id) {
|
||||
scope = paragraphScope;
|
||||
|
|
@ -1073,7 +1073,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
} else {
|
||||
return;
|
||||
}
|
||||
var varName = data.angularObject.name;
|
||||
let varName = data.angularObject.name;
|
||||
|
||||
if (angular.equals(data.angularObject.object, scope[varName])) {
|
||||
// return when update has no change
|
||||
|
|
@ -1113,7 +1113,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
// create proxy for AngularFunction
|
||||
if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) {
|
||||
var funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
let funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
scope[funcName] = function () {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
scope[varName] = arguments;
|
||||
|
|
@ -1133,10 +1133,10 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
});
|
||||
|
||||
$scope.$on('angularObjectRemove', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
var registry;
|
||||
let scope;
|
||||
let registry;
|
||||
|
||||
if (!data.paragraphId || data.paragraphId === $scope.paragraph.id) {
|
||||
scope = paragraphScope;
|
||||
|
|
@ -1145,7 +1145,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
return;
|
||||
}
|
||||
|
||||
var varName = data.name;
|
||||
let varName = data.name;
|
||||
|
||||
// clear watcher
|
||||
if (registry[varName]) {
|
||||
|
|
@ -1158,7 +1158,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
// remove proxy for AngularFunction
|
||||
if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) {
|
||||
var funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
let funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
scope[funcName] = undefined;
|
||||
}
|
||||
}
|
||||
|
|
@ -1319,10 +1319,10 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
|
||||
$scope.$on('keyEvent', function (event, keyEvent) {
|
||||
if ($scope.paragraphFocused) {
|
||||
var paragraphId = $scope.paragraph.id;
|
||||
var keyCode = keyEvent.keyCode;
|
||||
var noShortcutDefined = false;
|
||||
var editorHide = $scope.paragraph.config.editorHide;
|
||||
let paragraphId = $scope.paragraph.id;
|
||||
let keyCode = keyEvent.keyCode;
|
||||
let noShortcutDefined = false;
|
||||
let editorHide = $scope.paragraph.config.editorHide;
|
||||
|
||||
if (editorHide && (keyCode === 38 || (keyCode === 80 && keyEvent.ctrlKey && !keyEvent.altKey))) { // up
|
||||
// move focus to previous paragraph
|
||||
|
|
@ -1389,7 +1389,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
if (!mouseEvent) {
|
||||
$scope.editor.focus();
|
||||
// move cursor to the first row (or the last row)
|
||||
var row;
|
||||
let row;
|
||||
if (cursorPos >= 0) {
|
||||
row = cursorPos;
|
||||
$scope.editor.gotoLine(row, 0);
|
||||
|
|
@ -1405,7 +1405,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
if ($scope.editor !== undefined && $scope.editor !== null) {
|
||||
$scope.editor.blur();
|
||||
}
|
||||
var isDigestPass = true;
|
||||
let isDigestPass = true;
|
||||
handleFocus(false, isDigestPass);
|
||||
}
|
||||
});
|
||||
|
|
@ -1420,7 +1420,7 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
|
|||
$scope.$on('doubleClickParagraph', function (event, paragraphId) {
|
||||
if ($scope.paragraph.id === paragraphId && $scope.paragraph.config.editorHide &&
|
||||
$scope.paragraph.config.editorSetting.editOnDblClick && $scope.revisionView !== true) {
|
||||
var deferred = $q.defer();
|
||||
let deferred = $q.defer();
|
||||
openEditorAndCloseTable($scope.paragraph);
|
||||
$timeout(
|
||||
$scope.$on('updateParagraph', function (event, data) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
describe('Controller: ParagraphCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
var websocketMsgSrvMock = {};
|
||||
var paragraphMock = {
|
||||
let scope;
|
||||
let websocketMsgSrvMock = {};
|
||||
let paragraphMock = {
|
||||
config: {},
|
||||
settings: {
|
||||
forms: {}
|
||||
}
|
||||
};
|
||||
var route = {
|
||||
let route = {
|
||||
current: {
|
||||
pathParams: {
|
||||
noteId: 'noteId'
|
||||
|
|
@ -31,7 +31,7 @@ describe('Controller: ParagraphCtrl', function () {
|
|||
scope.init(paragraphMock);
|
||||
}));
|
||||
|
||||
var functions = ['isRunning', 'getIframeDimensions', 'cancelParagraph', 'runParagraph', 'saveParagraph',
|
||||
let functions = ['isRunning', 'getIframeDimensions', 'cancelParagraph', 'runParagraph', 'saveParagraph',
|
||||
'moveUp', 'moveDown', 'insertNew', 'removeParagraph', 'toggleEditor', 'closeEditor', 'openEditor',
|
||||
'closeTable', 'openTable', 'showTitle', 'hideTitle', 'setTitle', 'showLineNumbers', 'hideLineNumbers',
|
||||
'changeColWidth', 'columnWidthClass', 'toggleOutput', 'loadForm',
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
/**
|
||||
* Holds class and actual runtime instance and related infos of built-in visualizations
|
||||
*/
|
||||
var builtInVisualizations = {
|
||||
let builtInVisualizations = {
|
||||
'table': {
|
||||
class: TableVisualization,
|
||||
instance: undefined // created from setGraphMode()
|
||||
|
|
@ -106,7 +106,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
$scope.type = null;
|
||||
|
||||
// Data of the result
|
||||
var data;
|
||||
let data;
|
||||
|
||||
// config
|
||||
$scope.config = null;
|
||||
|
|
@ -115,19 +115,19 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
$scope.id = null;
|
||||
|
||||
// referece to paragraph
|
||||
var paragraph;
|
||||
let paragraph;
|
||||
|
||||
// index of the result
|
||||
var resultIndex;
|
||||
let resultIndex;
|
||||
|
||||
// TableData instance
|
||||
var tableData;
|
||||
let tableData;
|
||||
|
||||
// available columns in tabledata
|
||||
$scope.tableDataColumns = [];
|
||||
|
||||
// enable helium
|
||||
var enableHelium = false;
|
||||
let enableHelium = false;
|
||||
|
||||
// graphMode
|
||||
$scope.graphMode = null;
|
||||
|
|
@ -140,7 +140,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
$scope.init = function (result, config, paragraph, index) {
|
||||
// register helium plugin vis
|
||||
var visBundles = heliumService.getVisualizationBundles();
|
||||
let visBundles = heliumService.getVisualizationBundles();
|
||||
visBundles.forEach(function (vis) {
|
||||
$scope.builtInTableDataVisualizationList.push({
|
||||
id: vis.id,
|
||||
|
|
@ -180,7 +180,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
return;
|
||||
}
|
||||
|
||||
var refresh = !angular.equals(newConfig, $scope.config) ||
|
||||
let refresh = !angular.equals(newConfig, $scope.config) ||
|
||||
!angular.equals(result.type, $scope.type) ||
|
||||
!angular.equals(result.data, data);
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
}
|
||||
});
|
||||
|
||||
var updateData = function (result, config, paragraphRef, index) {
|
||||
const updateData = function (result, config, paragraphRef, index) {
|
||||
data = result.data;
|
||||
paragraph = paragraphRef;
|
||||
resultIndex = parseInt(index);
|
||||
|
|
@ -567,8 +567,8 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
};
|
||||
|
||||
$scope.switchViz = function (newMode) {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
let newConfig = angular.copy($scope.config);
|
||||
let newParams = angular.copy(paragraph.settings.params);
|
||||
|
||||
// graph options
|
||||
newConfig.graph.mode = newMode;
|
||||
|
|
@ -579,12 +579,12 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
var createNewScope = function () {
|
||||
const createNewScope = function () {
|
||||
return $rootScope.$new(true);
|
||||
};
|
||||
|
||||
var commitParagraphResult = function (title, text, config, params) {
|
||||
var newParagraphConfig = angular.copy(paragraph.config);
|
||||
const commitParagraphResult = function (title, text, config, params) {
|
||||
let newParagraphConfig = angular.copy(paragraph.config);
|
||||
newParagraphConfig.results = newParagraphConfig.results || [];
|
||||
newParagraphConfig.results[resultIndex] = config;
|
||||
if ($scope.revisionView === true) {
|
||||
|
|
@ -600,20 +600,20 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
};
|
||||
|
||||
$scope.toggleGraphSetting = function () {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
let newConfig = angular.copy($scope.config);
|
||||
if (newConfig.graph.optionOpen) {
|
||||
newConfig.graph.optionOpen = false;
|
||||
} else {
|
||||
newConfig.graph.optionOpen = true;
|
||||
}
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
let newParams = angular.copy(paragraph.settings.params);
|
||||
|
||||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
var getVizConfig = function (vizId) {
|
||||
var config;
|
||||
var graph = $scope.config.graph;
|
||||
const getVizConfig = function (vizId) {
|
||||
let config;
|
||||
let graph = $scope.config.graph;
|
||||
if (graph) {
|
||||
// copy setting for vizId
|
||||
if (graph.setting) {
|
||||
|
|
@ -640,8 +640,8 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
return config;
|
||||
};
|
||||
|
||||
var commitVizConfigChange = function (config, vizId) {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
const commitVizConfigChange = function (config, vizId) {
|
||||
let newConfig = angular.copy($scope.config);
|
||||
if (!newConfig.graph) {
|
||||
newConfig.graph = {};
|
||||
}
|
||||
|
|
@ -666,14 +666,14 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
delete newConfig.graph.commonSetting.pivot;
|
||||
}
|
||||
console.log('committVizConfig', newConfig);
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
let newParams = angular.copy(paragraph.settings.params);
|
||||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
$scope.$on('paragraphResized', function (event, paragraphId) {
|
||||
// paragraph col width changed
|
||||
if (paragraphId === paragraph.id) {
|
||||
var builtInViz = builtInVisualizations[$scope.graphMode];
|
||||
let builtInViz = builtInVisualizations[$scope.graphMode];
|
||||
if (builtInViz && builtInViz.instance) {
|
||||
builtInViz.instance.resize();
|
||||
}
|
||||
|
|
@ -686,9 +686,9 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
}, 200);
|
||||
};
|
||||
|
||||
var changeHeight = function (width, height) {
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
var newConfig = angular.copy($scope.config);
|
||||
const changeHeight = function (width, height) {
|
||||
let newParams = angular.copy(paragraph.settings.params);
|
||||
let newConfig = angular.copy($scope.config);
|
||||
|
||||
newConfig.graph.height = height;
|
||||
paragraph.config.colWidth = width;
|
||||
|
|
@ -697,19 +697,19 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
};
|
||||
|
||||
$scope.exportToDSV = function (delimiter) {
|
||||
var dsv = '';
|
||||
var dateFinished = moment(paragraph.dateFinished).format('YYYY-MM-DD hh:mm:ss A');
|
||||
var exportedFileName = paragraph.title ? paragraph.title + '_' + dateFinished : 'data_' + dateFinished;
|
||||
let dsv = '';
|
||||
let dateFinished = moment(paragraph.dateFinished).format('YYYY-MM-DD hh:mm:ss A');
|
||||
let exportedFileName = paragraph.title ? paragraph.title + '_' + dateFinished : 'data_' + dateFinished;
|
||||
|
||||
for (var titleIndex in tableData.columns) {
|
||||
for (let titleIndex in tableData.columns) {
|
||||
dsv += tableData.columns[titleIndex].name + delimiter;
|
||||
}
|
||||
dsv = dsv.substring(0, dsv.length - 1) + '\n';
|
||||
for (var r in tableData.rows) {
|
||||
var row = tableData.rows[r];
|
||||
var dsvRow = '';
|
||||
for (var index in row) {
|
||||
var stringValue = (row[index]).toString();
|
||||
for (let r in tableData.rows) {
|
||||
let row = tableData.rows[r];
|
||||
let dsvRow = '';
|
||||
for (let index in row) {
|
||||
let stringValue = (row[index]).toString();
|
||||
if (stringValue.indexOf(delimiter) > -1) {
|
||||
dsvRow += '"' + stringValue + '"' + delimiter;
|
||||
} else {
|
||||
|
|
@ -718,7 +718,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
}
|
||||
dsv += dsvRow.substring(0, dsvRow.length - 1) + '\n';
|
||||
}
|
||||
var extension = '';
|
||||
let extension = '';
|
||||
if (delimiter === '\t') {
|
||||
extension = 'tsv';
|
||||
} else if (delimiter === ',') {
|
||||
|
|
@ -732,7 +732,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
};
|
||||
|
||||
// Helium ----------------
|
||||
var ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_';
|
||||
let ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_';
|
||||
|
||||
// app states
|
||||
$scope.apps = [];
|
||||
|
|
@ -741,8 +741,8 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
$scope.suggestion = {};
|
||||
|
||||
$scope.switchApp = function (appId) {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
let newConfig = angular.copy($scope.config);
|
||||
let newParams = angular.copy(paragraph.settings.params);
|
||||
|
||||
// 'helium.activeApp' can be cleared by switchViz()
|
||||
_.set(newConfig, 'helium.activeApp', appId);
|
||||
|
|
@ -751,7 +751,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
};
|
||||
|
||||
$scope.loadApp = function (heliumPackage) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
$http.post(baseUrlSrv.getRestApiBase() + '/helium/load/' + noteId + '/' + paragraph.id, heliumPackage)
|
||||
.success(function (data, status, headers, config) {
|
||||
console.log('Load app %o', data);
|
||||
|
|
@ -761,12 +761,12 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
});
|
||||
};
|
||||
|
||||
var commitConfig = function (config, params) {
|
||||
const commitConfig = function (config, params) {
|
||||
commitParagraphResult(paragraph.title, paragraph.text, config, params);
|
||||
};
|
||||
|
||||
var getApplicationStates = function () {
|
||||
var appStates = [];
|
||||
const getApplicationStates = function () {
|
||||
let appStates = [];
|
||||
|
||||
// Display ApplicationState
|
||||
if (paragraph.apps) {
|
||||
|
|
@ -782,7 +782,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
// update or remove app states no longer exists
|
||||
_.forEach($scope.apps, function (currentAppState, idx) {
|
||||
var newAppState = _.find(appStates, {id: currentAppState.id});
|
||||
let newAppState = _.find(appStates, {id: currentAppState.id});
|
||||
if (newAppState) {
|
||||
angular.extend($scope.apps[idx], newAppState);
|
||||
} else {
|
||||
|
|
@ -798,9 +798,9 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
});
|
||||
};
|
||||
|
||||
var getSuggestions = function () {
|
||||
const getSuggestions = function () {
|
||||
// Get suggested apps
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
if (!noteId) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -831,14 +831,14 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
*/
|
||||
$scope.$on('appendAppOutput', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
let app = _.find($scope.apps, {id: data.appId});
|
||||
if (app) {
|
||||
app.output += data.data;
|
||||
|
||||
var paragraphAppState = _.find(paragraph.apps, {id: data.appId});
|
||||
let paragraphAppState = _.find(paragraph.apps, {id: data.appId});
|
||||
paragraphAppState.output = app.output;
|
||||
|
||||
var targetEl = angular.element(document.getElementById('p' + app.id));
|
||||
let targetEl = angular.element(document.getElementById('p' + app.id));
|
||||
targetEl.html(app.output);
|
||||
$compile(targetEl.contents())(getAppScope(app));
|
||||
console.log('append app output %o', $scope.apps);
|
||||
|
|
@ -848,14 +848,14 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
$scope.$on('updateAppOutput', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
let app = _.find($scope.apps, {id: data.appId});
|
||||
if (app) {
|
||||
app.output = data.data;
|
||||
|
||||
var paragraphAppState = _.find(paragraph.apps, {id: data.appId});
|
||||
let paragraphAppState = _.find(paragraph.apps, {id: data.appId});
|
||||
paragraphAppState.output = app.output;
|
||||
|
||||
var targetEl = angular.element(document.getElementById('p' + app.id));
|
||||
let targetEl = angular.element(document.getElementById('p' + app.id));
|
||||
targetEl.html(app.output);
|
||||
$compile(targetEl.contents())(getAppScope(app));
|
||||
console.log('append app output');
|
||||
|
|
@ -865,7 +865,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
$scope.$on('appLoad', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
let app = _.find($scope.apps, {id: data.appId});
|
||||
if (!app) {
|
||||
app = {
|
||||
id: data.appId,
|
||||
|
|
@ -883,16 +883,16 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
$scope.$on('appStatusChange', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
let app = _.find($scope.apps, {id: data.appId});
|
||||
if (app) {
|
||||
app.status = data.status;
|
||||
var paragraphAppState = _.find(paragraph.apps, {id: data.appId});
|
||||
let paragraphAppState = _.find(paragraph.apps, {id: data.appId});
|
||||
paragraphAppState.status = app.status;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var getAppRegistry = function (appState) {
|
||||
let getAppRegistry = function (appState) {
|
||||
if (!appState.registry) {
|
||||
appState.registry = {};
|
||||
}
|
||||
|
|
@ -900,7 +900,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
return appState.registry;
|
||||
};
|
||||
|
||||
var getAppScope = function (appState) {
|
||||
const getAppScope = function (appState) {
|
||||
if (!appState.scope) {
|
||||
appState.scope = $rootScope.$new(true, $rootScope);
|
||||
}
|
||||
|
|
@ -908,12 +908,12 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
};
|
||||
|
||||
$scope.$on('angularObjectUpdate', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
var registry;
|
||||
let scope;
|
||||
let registry;
|
||||
|
||||
var app = _.find($scope.apps, {id: data.paragraphId});
|
||||
let app = _.find($scope.apps, {id: data.paragraphId});
|
||||
if (app) {
|
||||
scope = getAppScope(app);
|
||||
registry = getAppRegistry(app);
|
||||
|
|
@ -922,7 +922,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
return;
|
||||
}
|
||||
|
||||
var varName = data.angularObject.name;
|
||||
let varName = data.angularObject.name;
|
||||
|
||||
if (angular.equals(data.angularObject.object, scope[varName])) {
|
||||
// return when update has no change
|
||||
|
|
@ -962,7 +962,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
// create proxy for AngularFunction
|
||||
if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) {
|
||||
var funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
let funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
scope[funcName] = function () {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
scope[varName] = arguments;
|
||||
|
|
@ -976,12 +976,12 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
});
|
||||
|
||||
$scope.$on('angularObjectRemove', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
let noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
var registry;
|
||||
let scope;
|
||||
let registry;
|
||||
|
||||
var app = _.find($scope.apps, {id: data.paragraphId});
|
||||
let app = _.find($scope.apps, {id: data.paragraphId});
|
||||
if (app) {
|
||||
scope = getAppScope(app);
|
||||
registry = getAppRegistry(app);
|
||||
|
|
@ -990,7 +990,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
return;
|
||||
}
|
||||
|
||||
var varName = data.name;
|
||||
let varName = data.name;
|
||||
|
||||
// clear watcher
|
||||
if (registry[varName]) {
|
||||
|
|
@ -1003,7 +1003,7 @@ function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $locatio
|
|||
|
||||
// remove proxy for AngularFunction
|
||||
if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) {
|
||||
var funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
let funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
scope[funcName] = undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').controller('NotebookReposCtrl', NotebookReposCt
|
|||
function NotebookReposCtrl ($http, baseUrlSrv, ngToast) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
let vm = this;
|
||||
vm.notebookRepos = [];
|
||||
vm.showDropdownSelected = showDropdownSelected;
|
||||
vm.saveNotebookRepo = saveNotebookRepo;
|
||||
|
|
@ -32,7 +32,7 @@ function NotebookReposCtrl ($http, baseUrlSrv, ngToast) {
|
|||
'name': repo.className,
|
||||
'settings': data
|
||||
}).success(function (data) {
|
||||
var index = _.findIndex(vm.notebookRepos, {'className': repo.className});
|
||||
let index = _.findIndex(vm.notebookRepos, {'className': repo.className});
|
||||
if (index >= 0) {
|
||||
vm.notebookRepos[index] = data.body;
|
||||
console.log('repos %o, data %o', vm.notebookRepos, data.body);
|
||||
|
|
@ -51,7 +51,7 @@ function NotebookReposCtrl ($http, baseUrlSrv, ngToast) {
|
|||
}
|
||||
|
||||
function showDropdownSelected (setting) {
|
||||
var index = _.findIndex(setting.value, {'value': setting.selected});
|
||||
let index = _.findIndex(setting.value, {'value': setting.selected});
|
||||
if (index < 0) {
|
||||
return 'No value';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function SearchResultCtrl ($scope, $routeParams, searchService) {
|
|||
|
||||
$scope.isResult = true;
|
||||
$scope.searchTerm = $routeParams.searchTerm;
|
||||
var results = searchService.search({'q': $routeParams.searchTerm}).query();
|
||||
let results = searchService.search({'q': $routeParams.searchTerm}).query();
|
||||
|
||||
results.$promise.then(function (result) {
|
||||
$scope.notes = result.body.map(function (note) {
|
||||
|
|
@ -53,7 +53,7 @@ function SearchResultCtrl ($scope, $routeParams, searchService) {
|
|||
$scope.highlightSearchResults = function (note) {
|
||||
return function (_editor) {
|
||||
function getEditorMode (text) {
|
||||
var editorModes = {
|
||||
let editorModes = {
|
||||
'ace/mode/scala': /^%(\w*\.)?spark/,
|
||||
'ace/mode/python': /^%(\w*\.)?(pyspark|python)/,
|
||||
'ace/mode/r': /^%(\w*\.)?(r|sparkr|knitr)/,
|
||||
|
|
@ -67,7 +67,7 @@ function SearchResultCtrl ($scope, $routeParams, searchService) {
|
|||
}, 'ace/mode/scala');
|
||||
}
|
||||
|
||||
var Range = ace.require('ace/range').Range;
|
||||
let Range = ace.require('ace/range').Range;
|
||||
|
||||
_editor.setOption('highlightActiveLine', false);
|
||||
_editor.$blockScrolling = Infinity;
|
||||
|
|
@ -78,8 +78,8 @@ function SearchResultCtrl ($scope, $routeParams, searchService) {
|
|||
|
||||
function getIndeces (term) {
|
||||
return function (str) {
|
||||
var indeces = [];
|
||||
var i = -1;
|
||||
let indeces = [];
|
||||
let i = -1;
|
||||
while ((i = str.indexOf(term, i + 1)) >= 0) {
|
||||
indeces.push(i);
|
||||
}
|
||||
|
|
@ -87,32 +87,32 @@ function SearchResultCtrl ($scope, $routeParams, searchService) {
|
|||
};
|
||||
}
|
||||
|
||||
var result = '';
|
||||
let result = '';
|
||||
if (note.header !== '') {
|
||||
result = note.header + '\n\n' + note.snippet;
|
||||
} else {
|
||||
result = note.snippet;
|
||||
}
|
||||
|
||||
var lines = result
|
||||
let lines = result
|
||||
.split('\n')
|
||||
.map(function (line, row) {
|
||||
var match = line.match(/<B>(.+?)<\/B>/);
|
||||
let match = line.match(/<B>(.+?)<\/B>/);
|
||||
|
||||
// return early if nothing to highlight
|
||||
if (!match) {
|
||||
return line;
|
||||
}
|
||||
|
||||
var term = match[1];
|
||||
var __line = line
|
||||
let term = match[1];
|
||||
let __line = line
|
||||
.replace(/<B>/g, '')
|
||||
.replace(/<\/B>/g, '');
|
||||
|
||||
var indeces = getIndeces(term)(__line);
|
||||
let indeces = getIndeces(term)(__line);
|
||||
|
||||
indeces.forEach(function (start) {
|
||||
var end = start + term.length;
|
||||
let end = start + term.length;
|
||||
if (note.header !== '' && row === 0) {
|
||||
_editor
|
||||
.getSession()
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ export default class ColumnselectorTransformation extends Transformation {
|
|||
}
|
||||
|
||||
getSetting () {
|
||||
var self = this;
|
||||
var configObj = self.config;
|
||||
let self = this;
|
||||
let configObj = self.config;
|
||||
return {
|
||||
template: 'app/tabledata/columnselector_settings.html',
|
||||
scope: {
|
||||
|
|
@ -61,13 +61,13 @@ export default class ColumnselectorTransformation extends Transformation {
|
|||
}
|
||||
|
||||
removeUnknown () {
|
||||
var fields = this.config;
|
||||
for (var f in fields) {
|
||||
let fields = this.config;
|
||||
for (let f in fields) {
|
||||
if (fields[f]) {
|
||||
var found = false;
|
||||
for (var i = 0; i < this.tableDataColumns.length; i++) {
|
||||
var a = fields[f];
|
||||
var b = this.tableDataColumns[i];
|
||||
let found = false;
|
||||
for (let i = 0; i < this.tableDataColumns.length; i++) {
|
||||
let a = fields[f];
|
||||
let b = this.tableDataColumns[i];
|
||||
if (a.index === b.index && a.name === b.name) {
|
||||
found = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
|
||||
getSetting () {
|
||||
var self = this;
|
||||
let self = this;
|
||||
|
||||
var configObj = self.config;
|
||||
let configObj = self.config;
|
||||
console.log('getSetting', configObj);
|
||||
return {
|
||||
template: 'app/tabledata/pivot_settings.html',
|
||||
|
|
@ -63,8 +63,8 @@ export default class PivotTransformation extends Transformation {
|
|||
this.tableDataColumns = tableData.columns;
|
||||
this.config.common = this.config.common || {};
|
||||
this.config.common.pivot = this.config.common.pivot || {};
|
||||
var config = this.config.common.pivot;
|
||||
var firstTime = (!config.keys && !config.groups && !config.values);
|
||||
let config = this.config.common.pivot;
|
||||
let firstTime = (!config.keys && !config.groups && !config.values);
|
||||
|
||||
config.keys = config.keys || [];
|
||||
config.groups = config.groups || [];
|
||||
|
|
@ -82,11 +82,11 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
|
||||
removeUnknown () {
|
||||
var config = this.config.common.pivot;
|
||||
var tableDataColumns = this.tableDataColumns;
|
||||
var unique = function (list) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
for (var j = i + 1; j < list.length; j++) {
|
||||
let config = this.config.common.pivot;
|
||||
let tableDataColumns = this.tableDataColumns;
|
||||
let unique = function (list) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let j = i + 1; j < list.length; j++) {
|
||||
if (angular.equals(list[i], list[j])) {
|
||||
list.splice(j, 1);
|
||||
}
|
||||
|
|
@ -94,13 +94,13 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
};
|
||||
|
||||
var removeUnknown = function (list) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
let removeUnknown = function (list) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
// remove non existing column
|
||||
var found = false;
|
||||
for (var j = 0; j < tableDataColumns.length; j++) {
|
||||
var a = list[i];
|
||||
var b = tableDataColumns[j];
|
||||
let found = false;
|
||||
for (let j = 0; j < tableDataColumns.length; j++) {
|
||||
let a = list[i];
|
||||
let b = tableDataColumns[j];
|
||||
if (a.index === b.index && a.name === b.name) {
|
||||
found = true;
|
||||
break;
|
||||
|
|
@ -120,7 +120,7 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
|
||||
selectDefault () {
|
||||
var config = this.config.common.pivot;
|
||||
let config = this.config.common.pivot;
|
||||
if (config.keys.length === 0 &&
|
||||
config.groups.length === 0 &&
|
||||
config.values.length === 0) {
|
||||
|
|
@ -135,35 +135,35 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
|
||||
pivot (data, keys, groups, values) {
|
||||
var aggrFunc = {
|
||||
let aggrFunc = {
|
||||
sum: function (a, b) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
let varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
let varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return varA + varB;
|
||||
},
|
||||
count: function (a, b) {
|
||||
var varA = (a !== undefined) ? parseInt(a) : 0;
|
||||
var varB = (b !== undefined) ? 1 : 0;
|
||||
let varA = (a !== undefined) ? parseInt(a) : 0;
|
||||
let varB = (b !== undefined) ? 1 : 0;
|
||||
return varA + varB;
|
||||
},
|
||||
min: function (a, b) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
let varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
let varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return Math.min(varA, varB);
|
||||
},
|
||||
max: function (a, b) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
let varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
let varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return Math.max(varA, varB);
|
||||
},
|
||||
avg: function (a, b, c) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
let varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
let varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return varA + varB;
|
||||
}
|
||||
};
|
||||
|
||||
var aggrFuncDiv = {
|
||||
let aggrFuncDiv = {
|
||||
sum: false,
|
||||
count: false,
|
||||
min: false,
|
||||
|
|
@ -171,16 +171,16 @@ export default class PivotTransformation extends Transformation {
|
|||
avg: true
|
||||
};
|
||||
|
||||
var schema = {};
|
||||
var rows = {};
|
||||
let schema = {};
|
||||
let rows = {};
|
||||
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
var row = data.rows[i];
|
||||
var s = schema;
|
||||
var p = rows;
|
||||
for (let i = 0; i < data.rows.length; i++) {
|
||||
let row = data.rows[i];
|
||||
let s = schema;
|
||||
let p = rows;
|
||||
|
||||
for (var k = 0; k < keys.length; k++) {
|
||||
var key = keys[k];
|
||||
for (let k = 0; k < keys.length; k++) {
|
||||
let key = keys[k];
|
||||
|
||||
// add key to schema
|
||||
if (!s[key.name]) {
|
||||
|
|
@ -194,16 +194,16 @@ export default class PivotTransformation extends Transformation {
|
|||
s = s[key.name].children;
|
||||
|
||||
// add key to row
|
||||
var keyKey = row[key.index];
|
||||
let keyKey = row[key.index];
|
||||
if (!p[keyKey]) {
|
||||
p[keyKey] = {};
|
||||
}
|
||||
p = p[keyKey];
|
||||
}
|
||||
|
||||
for (var g = 0; g < groups.length; g++) {
|
||||
var group = groups[g];
|
||||
var groupKey = row[group.index];
|
||||
for (let g = 0; g < groups.length; g++) {
|
||||
let group = groups[g];
|
||||
let groupKey = row[group.index];
|
||||
|
||||
// add group to schema
|
||||
if (!s[groupKey]) {
|
||||
|
|
@ -223,9 +223,9 @@ export default class PivotTransformation extends Transformation {
|
|||
p = p[groupKey];
|
||||
}
|
||||
|
||||
for (var v = 0; v < values.length; v++) {
|
||||
var value = values[v];
|
||||
var valueKey = value.name + '(' + value.aggr + ')';
|
||||
for (let v = 0; v < values.length; v++) {
|
||||
let value = values[v];
|
||||
let valueKey = value.name + '(' + value.aggr + ')';
|
||||
|
||||
// add value to schema
|
||||
if (!s[valueKey]) {
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ export default class TableData {
|
|||
return;
|
||||
}
|
||||
|
||||
var columnNames = [];
|
||||
var rows = [];
|
||||
var array = [];
|
||||
var textRows = paragraphResult.msg.split('\n');
|
||||
var comment = '';
|
||||
var commentRow = false;
|
||||
let columnNames = [];
|
||||
let rows = [];
|
||||
let array = [];
|
||||
let textRows = paragraphResult.msg.split('\n');
|
||||
let comment = '';
|
||||
let commentRow = false;
|
||||
|
||||
for (var i = 0; i < textRows.length; i++) {
|
||||
var textRow = textRows[i];
|
||||
for (let i = 0; i < textRows.length; i++) {
|
||||
let textRow = textRows[i];
|
||||
|
||||
if (commentRow) {
|
||||
comment += textRow;
|
||||
|
|
@ -49,11 +49,11 @@ export default class TableData {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
var textCols = textRow.split('\t');
|
||||
var cols = [];
|
||||
var cols2 = [];
|
||||
for (var j = 0; j < textCols.length; j++) {
|
||||
var col = textCols[j];
|
||||
let textCols = textRow.split('\t');
|
||||
let cols = [];
|
||||
let cols2 = [];
|
||||
for (let j = 0; j < textCols.length; j++) {
|
||||
let col = textCols[j];
|
||||
if (i === 0) {
|
||||
columnNames.push({name: col, index: j, aggr: 'sum'});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
import TableData from './tabledata.js';
|
||||
|
||||
describe('TableData build', function () {
|
||||
var td;
|
||||
let td;
|
||||
|
||||
beforeEach(function () {
|
||||
console.log(TableData);
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ export default class Transformation {
|
|||
* render setting
|
||||
*/
|
||||
renderSetting (targetEl) {
|
||||
var setting = this.getSetting();
|
||||
let setting = this.getSetting();
|
||||
if (!setting) {
|
||||
return;
|
||||
}
|
||||
|
||||
// already readered
|
||||
if (this._scope) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
this._scope.$apply(function () {
|
||||
for (let k in setting.scope) {
|
||||
self._scope[k] = setting.scope[k];
|
||||
|
|
@ -66,11 +66,11 @@ export default class Transformation {
|
|||
this._prevSettingScope = setting.scope;
|
||||
}
|
||||
|
||||
var scope = this._createNewScope();
|
||||
for (var k in setting.scope) {
|
||||
let scope = this._createNewScope();
|
||||
for (let k in setting.scope) {
|
||||
scope[k] = setting.scope[k];
|
||||
}
|
||||
var template = setting.template;
|
||||
let template = setting.template;
|
||||
|
||||
if (template.split('\n').length === 1 &&
|
||||
template.endsWith('.html')) { // template is url
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export default class AreachartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
render (pivot) {
|
||||
var d3Data = this.d3DataFromPivot(
|
||||
let d3Data = this.d3DataFromPivot(
|
||||
pivot.schema,
|
||||
pivot.rows,
|
||||
pivot.keys,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export default class BarchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
render (pivot) {
|
||||
var d3Data = this.d3DataFromPivot(
|
||||
let d3Data = this.d3DataFromPivot(
|
||||
pivot.schema,
|
||||
pivot.rows,
|
||||
pivot.keys,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
render (pivot) {
|
||||
var d3Data = this.d3DataFromPivot(
|
||||
let d3Data = this.d3DataFromPivot(
|
||||
pivot.schema,
|
||||
pivot.rows,
|
||||
pivot.keys,
|
||||
|
|
@ -67,7 +67,7 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
configureChart (chart) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
chart.xAxis.tickFormat(function (d) { return self.xAxisTickFormat(d, self.xLabels); });
|
||||
chart.yAxis.tickFormat(function (d) {
|
||||
if (d === undefined) {
|
||||
|
|
@ -87,8 +87,8 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
getSetting (chart) {
|
||||
var self = this;
|
||||
var configObj = self.config;
|
||||
let self = this;
|
||||
let configObj = self.config;
|
||||
|
||||
return {
|
||||
template: `<div>
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
|
||||
render (data) {
|
||||
var type = this.type();
|
||||
var d3g = data.d3g;
|
||||
let type = this.type();
|
||||
let d3g = data.d3g;
|
||||
|
||||
if (!this.chart) {
|
||||
this.chart = nv.models[type]();
|
||||
|
|
@ -39,9 +39,9 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
|
||||
this.configureChart(this.chart);
|
||||
|
||||
var animationDuration = 300;
|
||||
var numberOfDataThreshold = 150;
|
||||
var height = this.targetEl.height();
|
||||
let animationDuration = 300;
|
||||
let numberOfDataThreshold = 150;
|
||||
let height = this.targetEl.height();
|
||||
|
||||
// turn off animation when dataset is too large. (for performance issue)
|
||||
// still, since dataset is large, the chart content sequentially appears like animated
|
||||
|
|
@ -73,7 +73,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
|
||||
customAbbrevFormatter (x) {
|
||||
var s = d3.format('.3s')(x);
|
||||
let s = d3.format('.3s')(x);
|
||||
switch (s[s.length - 1]) {
|
||||
case 'G': return s.slice(0, -1) + 'B';
|
||||
}
|
||||
|
|
@ -101,11 +101,11 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
|
||||
d3DataFromPivot (
|
||||
schema, rows, keys, groups, values, allowTextXAxis, fillMissingValues, multiBarChart) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
// construct table data
|
||||
var d3g = [];
|
||||
let d3g = [];
|
||||
|
||||
var concat = function (o, n) {
|
||||
let concat = function (o, n) {
|
||||
if (!o) {
|
||||
return n;
|
||||
} else {
|
||||
|
|
@ -113,14 +113,14 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
};
|
||||
|
||||
var getSchemaUnderKey = function (key, s) {
|
||||
for (var c in key.children) {
|
||||
const getSchemaUnderKey = function (key, s) {
|
||||
for (let c in key.children) {
|
||||
s[c] = {};
|
||||
getSchemaUnderKey(key.children[c], s[c]);
|
||||
}
|
||||
};
|
||||
|
||||
var traverse = function (sKey, s, rKey, r, func, rowName, rowValue, colName) {
|
||||
const traverse = function (sKey, s, rKey, r, func, rowName, rowValue, colName) {
|
||||
// console.log("TRAVERSE sKey=%o, s=%o, rKey=%o, r=%o, rowName=%o, rowValue=%o, colName=%o", sKey, s, rKey, r, rowName, rowValue, colName);
|
||||
|
||||
if (s.type === 'key') {
|
||||
|
|
@ -133,15 +133,15 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
func(rowName, rowValue, colName, r);
|
||||
}
|
||||
|
||||
for (var c in s.children) {
|
||||
for (let c in s.children) {
|
||||
if (fillMissingValues && s.children[c].type === 'group' && r[c] === undefined) {
|
||||
var cs = {};
|
||||
let cs = {};
|
||||
getSchemaUnderKey(s.children[c], cs);
|
||||
traverse(c, s.children[c], c, cs, func, rowName, rowValue, colName);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j in r) {
|
||||
for (let j in r) {
|
||||
if (s.children[c].type === 'key' || c === j) {
|
||||
traverse(c, s.children[c], j, r[j], func, rowName, rowValue, colName);
|
||||
}
|
||||
|
|
@ -149,19 +149,19 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
};
|
||||
|
||||
var valueOnly = (keys.length === 0 && groups.length === 0 && values.length > 0);
|
||||
var noKey = (keys.length === 0);
|
||||
var isMultiBarChart = multiBarChart;
|
||||
const valueOnly = (keys.length === 0 && groups.length === 0 && values.length > 0);
|
||||
let noKey = (keys.length === 0);
|
||||
let isMultiBarChart = multiBarChart;
|
||||
|
||||
var sKey = Object.keys(schema)[0];
|
||||
let sKey = Object.keys(schema)[0];
|
||||
|
||||
var rowNameIndex = {};
|
||||
var rowIdx = 0;
|
||||
var colNameIndex = {};
|
||||
var colIdx = 0;
|
||||
var rowIndexValue = {};
|
||||
let rowNameIndex = {};
|
||||
let rowIdx = 0;
|
||||
let colNameIndex = {};
|
||||
let colIdx = 0;
|
||||
let rowIndexValue = {};
|
||||
|
||||
for (var k in rows) {
|
||||
for (let k in rows) {
|
||||
traverse(sKey, schema[sKey], k, rows[k], function (rowName, rowValue, colName, value) {
|
||||
// console.log("RowName=%o, row=%o, col=%o, value=%o", rowName, rowValue, colName, value);
|
||||
if (rowNameIndex[rowValue] === undefined) {
|
||||
|
|
@ -172,7 +172,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
if (colNameIndex[colName] === undefined) {
|
||||
colNameIndex[colName] = colIdx++;
|
||||
}
|
||||
var i = colNameIndex[colName];
|
||||
let i = colNameIndex[colName];
|
||||
if (noKey && isMultiBarChart) {
|
||||
i = 0;
|
||||
}
|
||||
|
|
@ -184,8 +184,8 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
};
|
||||
}
|
||||
|
||||
var xVar = isNaN(rowValue) ? ((allowTextXAxis) ? rowValue : rowNameIndex[rowValue]) : parseFloat(rowValue);
|
||||
var yVar = self.defaultY();
|
||||
let xVar = isNaN(rowValue) ? ((allowTextXAxis) ? rowValue : rowNameIndex[rowValue]) : parseFloat(rowValue);
|
||||
let yVar = self.defaultY();
|
||||
if (xVar === undefined) { xVar = colName; }
|
||||
if (value !== undefined) {
|
||||
yVar = isNaN(value.value) ? self.defaultY() : parseFloat(value.value) / parseFloat(value.count);
|
||||
|
|
@ -198,9 +198,9 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
|
||||
// clear aggregation name, if possible
|
||||
var namesWithoutAggr = {};
|
||||
var colName;
|
||||
var withoutAggr;
|
||||
let namesWithoutAggr = {};
|
||||
let colName;
|
||||
let withoutAggr;
|
||||
// TODO - This part could use som refactoring - Weird if/else with similar actions and variable names
|
||||
for (colName in colNameIndex) {
|
||||
withoutAggr = colName.substring(0, colName.lastIndexOf('('));
|
||||
|
|
@ -212,7 +212,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
|
||||
if (valueOnly) {
|
||||
for (var valueIndex = 0; valueIndex < d3g[0].values.length; valueIndex++) {
|
||||
for (let valueIndex = 0; valueIndex < d3g[0].values.length; valueIndex++) {
|
||||
colName = d3g[0].values[valueIndex].x;
|
||||
if (!colName) {
|
||||
continue;
|
||||
|
|
@ -224,7 +224,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (var d3gIndex = 0; d3gIndex < d3g.length; d3gIndex++) {
|
||||
for (let d3gIndex = 0; d3gIndex < d3g.length; d3gIndex++) {
|
||||
colName = d3g[d3gIndex].key;
|
||||
withoutAggr = colName.substring(0, colName.lastIndexOf('('));
|
||||
if (namesWithoutAggr[withoutAggr] <= 1) {
|
||||
|
|
@ -234,7 +234,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
|
||||
// use group name instead of group.value as a column name, if there're only one group and one value selected.
|
||||
if (groups.length === 1 && values.length === 1) {
|
||||
for (d3gIndex = 0; d3gIndex < d3g.length; d3gIndex++) {
|
||||
for (let d3gIndex = 0; d3gIndex < d3g.length; d3gIndex++) {
|
||||
colName = d3g[d3gIndex].key;
|
||||
colName = colName.split('.').slice(0, -1).join('.');
|
||||
d3g[d3gIndex].key = colName;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
render (tableData) {
|
||||
this.tableData = tableData;
|
||||
this.selectDefault();
|
||||
var d3Data = this.setScatterChart(tableData, true);
|
||||
let d3Data = this.setScatterChart(tableData, true);
|
||||
this.xLabels = d3Data.xLabels;
|
||||
this.yLabels = d3Data.yLabels;
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
configureChart (chart) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
|
||||
chart.xAxis.tickFormat(function (d) { // TODO remove round after bump to nvd3 > 1.8.5
|
||||
return self.xAxisTickFormat(Math.round(d * 1e3) / 1e3, self.xLabels);
|
||||
|
|
@ -98,30 +98,30 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
setScatterChart (data, refresh) {
|
||||
var xAxis = this.config.xAxis;
|
||||
var yAxis = this.config.yAxis;
|
||||
var group = this.config.group;
|
||||
var size = this.config.size;
|
||||
let xAxis = this.config.xAxis;
|
||||
let yAxis = this.config.yAxis;
|
||||
let group = this.config.group;
|
||||
let size = this.config.size;
|
||||
|
||||
var xValues = [];
|
||||
var yValues = [];
|
||||
var rows = {};
|
||||
var d3g = [];
|
||||
let xValues = [];
|
||||
let yValues = [];
|
||||
let rows = {};
|
||||
let d3g = [];
|
||||
|
||||
var rowNameIndex = {};
|
||||
var colNameIndex = {};
|
||||
var grpNameIndex = {};
|
||||
var rowIndexValue = {};
|
||||
var colIndexValue = {};
|
||||
var grpIndexValue = {};
|
||||
var rowIdx = 0;
|
||||
var colIdx = 0;
|
||||
var grpIdx = 0;
|
||||
var grpName = '';
|
||||
let rowNameIndex = {};
|
||||
let colNameIndex = {};
|
||||
let grpNameIndex = {};
|
||||
let rowIndexValue = {};
|
||||
let colIndexValue = {};
|
||||
let grpIndexValue = {};
|
||||
let rowIdx = 0;
|
||||
let colIdx = 0;
|
||||
let grpIdx = 0;
|
||||
let grpName = '';
|
||||
|
||||
var xValue;
|
||||
var yValue;
|
||||
var row;
|
||||
let xValue;
|
||||
let yValue;
|
||||
let row;
|
||||
|
||||
if (!xAxis && !yAxis) {
|
||||
return {
|
||||
|
|
@ -129,7 +129,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
};
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
for (let i = 0; i < data.rows.length; i++) {
|
||||
row = data.rows[i];
|
||||
if (xAxis) {
|
||||
xValue = row[xAxis.index];
|
||||
|
|
@ -141,7 +141,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
}
|
||||
|
||||
var isAllDiscrete = ((xAxis && yAxis && this.isDiscrete(xValues) && this.isDiscrete(yValues)) ||
|
||||
let isAllDiscrete = ((xAxis && yAxis && this.isDiscrete(xValues) && this.isDiscrete(yValues)) ||
|
||||
(!xAxis && this.isDiscrete(yValues)) ||
|
||||
(!yAxis && this.isDiscrete(xValues)));
|
||||
|
||||
|
|
@ -165,9 +165,9 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
grpName = size.name;
|
||||
}
|
||||
|
||||
var epsilon = 1e-4; // TODO remove after bump to nvd3 > 1.8.5
|
||||
let epsilon = 1e-4; // TODO remove after bump to nvd3 > 1.8.5
|
||||
|
||||
for (i = 0; i < rows.length; i++) {
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
row = rows[i];
|
||||
if (xAxis) {
|
||||
xValue = row[xAxis.index];
|
||||
|
|
@ -178,7 +178,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
if (group) {
|
||||
grpName = row[group.index];
|
||||
}
|
||||
var sz = (isAllDiscrete) ? row[row.length - 1] : ((size) ? row[size.index] : 1);
|
||||
let sz = (isAllDiscrete) ? row[row.length - 1] : ((size) ? row[size.index] : 1);
|
||||
|
||||
if (grpNameIndex[grpName] === undefined) {
|
||||
grpIndexValue[grpIdx] = grpName;
|
||||
|
|
@ -203,8 +203,8 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
// TODO remove epsilon jitter after bump to nvd3 > 1.8.5
|
||||
var xval = 0
|
||||
var yval = 0;
|
||||
let xval = 0
|
||||
let yval = 0;
|
||||
if (xAxis) {
|
||||
xval = (isNaN(xValue) ? rowNameIndex[xValue] : parseFloat(xValue)) + Math.random() * epsilon;
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
// TODO remove sort and dedup after bump to nvd3 > 1.8.5
|
||||
var d3gvalues = d3g[grpNameIndex[grpName]].values;
|
||||
let d3gvalues = d3g[grpNameIndex[grpName]].values;
|
||||
d3gvalues.sort(function (a, b) {
|
||||
return ((a['x'] - b['x']) || (a['y'] - b['y']))
|
||||
});
|
||||
|
|
@ -242,18 +242,18 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
setDiscreteScatterData (data) {
|
||||
var xAxis = this.config.xAxis;
|
||||
var yAxis = this.config.yAxis;
|
||||
var group = this.config.group;
|
||||
let xAxis = this.config.xAxis;
|
||||
let yAxis = this.config.yAxis;
|
||||
let group = this.config.group;
|
||||
|
||||
var xValue;
|
||||
var yValue;
|
||||
var grp;
|
||||
let xValue;
|
||||
let yValue;
|
||||
let grp;
|
||||
|
||||
var rows = {};
|
||||
let rows = {};
|
||||
|
||||
for (var i = 0; i < data.rows.length; i++) {
|
||||
var row = data.rows[i];
|
||||
for (let i = 0; i < data.rows.length; i++) {
|
||||
let row = data.rows[i];
|
||||
if (xAxis) {
|
||||
xValue = row[xAxis.index];
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
grp = row[group.index];
|
||||
}
|
||||
|
||||
var key = xValue + ',' + yValue + ',' + grp;
|
||||
let key = xValue + ',' + yValue + ',' + grp;
|
||||
|
||||
if (!rows[key]) {
|
||||
rows[key] = {
|
||||
|
|
@ -279,9 +279,9 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
// change object into array
|
||||
var newRows = [];
|
||||
for (var r in rows) {
|
||||
var newRow = [];
|
||||
let newRows = [];
|
||||
for (let r in rows) {
|
||||
let newRow = [];
|
||||
if (xAxis) { newRow[xAxis.index] = rows[r].x; }
|
||||
if (yAxis) { newRow[yAxis.index] = rows[r].y; }
|
||||
if (group) { newRow[group.index] = rows[r].group; }
|
||||
|
|
@ -292,12 +292,12 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
isDiscrete (field) {
|
||||
var getUnique = function (f) {
|
||||
var uniqObj = {};
|
||||
var uniqArr = [];
|
||||
var j = 0;
|
||||
for (var i = 0; i < f.length; i++) {
|
||||
var item = f[i];
|
||||
let getUnique = function (f) {
|
||||
let uniqObj = {};
|
||||
let uniqArr = [];
|
||||
let j = 0;
|
||||
for (let i = 0; i < f.length; i++) {
|
||||
let item = f[i];
|
||||
if (uniqObj[item] !== 1) {
|
||||
uniqObj[item] = 1;
|
||||
uniqArr[j++] = item;
|
||||
|
|
@ -306,15 +306,15 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
return uniqArr;
|
||||
};
|
||||
|
||||
for (var i = 0; i < field.length; i++) {
|
||||
for (let i = 0; i < field.length; i++) {
|
||||
if (isNaN(parseFloat(field[i])) &&
|
||||
(typeof field[i] === 'string' || field[i] instanceof String)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var threshold = 0.05;
|
||||
var unique = getUnique(field);
|
||||
let threshold = 0.05;
|
||||
let unique = getUnique(field);
|
||||
if (unique.length / field.length < threshold) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -323,13 +323,13 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
isValidSizeOption (options) {
|
||||
var xValues = [];
|
||||
var yValues = [];
|
||||
var rows = this.tableData.rows;
|
||||
let xValues = [];
|
||||
let yValues = [];
|
||||
let rows = this.tableData.rows;
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var size = row[options.size.index];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
let row = rows[i];
|
||||
let size = row[options.size.index];
|
||||
|
||||
// check if the field is numeric
|
||||
if (isNaN(parseFloat(size)) || !isFinite(size)) {
|
||||
|
|
@ -337,17 +337,17 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
|
||||
if (options.xAxis) {
|
||||
var x = row[options.xAxis.index];
|
||||
let x = row[options.xAxis.index];
|
||||
xValues[i] = x;
|
||||
}
|
||||
if (options.yAxis) {
|
||||
var y = row[options.yAxis.index];
|
||||
let y = row[options.yAxis.index];
|
||||
yValues[i] = y;
|
||||
}
|
||||
}
|
||||
|
||||
// check if all existing fields are discrete
|
||||
var isAllDiscrete = ((options.xAxis && options.yAxis && this.isDiscrete(xValues) && this.isDiscrete(yValues)) ||
|
||||
let isAllDiscrete = ((options.xAxis && options.yAxis && this.isDiscrete(xValues) && this.isDiscrete(yValues)) ||
|
||||
(!options.xAxis && this.isDiscrete(yValues)) ||
|
||||
(!options.yAxis && this.isDiscrete(xValues)));
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ export default class TableVisualization extends Visualization {
|
|||
}
|
||||
|
||||
render (tableData) {
|
||||
var height = this.targetEl.height();
|
||||
var container = this.targetEl.css('height', height).get(0);
|
||||
var resultRows = tableData.rows;
|
||||
var columnNames = _.pluck(tableData.columns, 'name');
|
||||
let height = this.targetEl.height();
|
||||
let container = this.targetEl.css('height', height).get(0);
|
||||
let resultRows = tableData.rows;
|
||||
let columnNames = _.pluck(tableData.columns, 'name');
|
||||
// eslint-disable-next-line prefer-spread
|
||||
var columns = Array.apply(null, Array(tableData.columns.length)).map(function () {
|
||||
let columns = Array.apply(null, Array(tableData.columns.length)).map(function () {
|
||||
return {type: 'text'};
|
||||
});
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ export default class TableVisualization extends Visualization {
|
|||
this.hot.destroy();
|
||||
}
|
||||
|
||||
var handsonHelper = new HandsonHelper();
|
||||
let handsonHelper = new HandsonHelper();
|
||||
this.hot = new Handsontable(container, handsonHelper.getHandsonTableConfig(
|
||||
columns, columnNames, resultRows));
|
||||
this.hot.validateCells(null);
|
||||
|
|
|
|||
|
|
@ -122,14 +122,14 @@ export default class Visualization {
|
|||
* render setting
|
||||
*/
|
||||
renderSetting (targetEl) {
|
||||
var setting = this.getSetting();
|
||||
let setting = this.getSetting();
|
||||
if (!setting) {
|
||||
return;
|
||||
}
|
||||
|
||||
// already readered
|
||||
if (this._scope) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
this._scope.$apply(function () {
|
||||
for (let k in setting.scope) {
|
||||
self._scope[k] = setting.scope[k];
|
||||
|
|
@ -146,11 +146,11 @@ export default class Visualization {
|
|||
this._prevSettingScope = setting.scope;
|
||||
}
|
||||
|
||||
var scope = this._createNewScope();
|
||||
for (var k in setting.scope) {
|
||||
let scope = this._createNewScope();
|
||||
for (let k in setting.scope) {
|
||||
scope[k] = setting.scope[k];
|
||||
}
|
||||
var template = setting.template;
|
||||
let template = setting.template;
|
||||
|
||||
if (template.split('\n').length === 1 &&
|
||||
template.endsWith('.html')) { // template is url
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').service('arrayOrderingSrv', arrayOrderingSrv);
|
|||
function arrayOrderingSrv (TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
||||
var arrayOrderingSrv = this;
|
||||
let arrayOrderingSrv = this;
|
||||
|
||||
this.noteListOrdering = function (note) {
|
||||
if (note.id === TRASH_FOLDER_ID) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ angular.module('zeppelinWebApp').service('baseUrlSrv', baseUrlSrv);
|
|||
|
||||
function baseUrlSrv () {
|
||||
this.getPort = function () {
|
||||
var port = Number(location.port);
|
||||
let port = Number(location.port);
|
||||
if (!port) {
|
||||
port = 80;
|
||||
if (location.protocol === 'https:') {
|
||||
|
|
@ -31,7 +31,7 @@ function baseUrlSrv () {
|
|||
};
|
||||
|
||||
this.getWebsocketUrl = function () {
|
||||
var wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
let wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
return wsProtocol + '//' + location.hostname + ':' + this.getPort() +
|
||||
skipTrailingSlash(location.pathname) + '/ws';
|
||||
};
|
||||
|
|
@ -42,7 +42,7 @@ function baseUrlSrv () {
|
|||
'/api';
|
||||
};
|
||||
|
||||
var skipTrailingSlash = function (path) {
|
||||
const skipTrailingSlash = function (path) {
|
||||
return path.replace(/\/$/, '');
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,19 +16,19 @@ angular.module('zeppelinWebApp').service('browserDetectService', browserDetectSe
|
|||
|
||||
function browserDetectService () {
|
||||
this.detectIE = function () {
|
||||
var ua = window.navigator.userAgent;
|
||||
var msie = ua.indexOf('MSIE ');
|
||||
let ua = window.navigator.userAgent;
|
||||
let msie = ua.indexOf('MSIE ');
|
||||
if (msie > 0) {
|
||||
// IE 10 or older => return version number
|
||||
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
|
||||
}
|
||||
var trident = ua.indexOf('Trident/');
|
||||
let trident = ua.indexOf('Trident/');
|
||||
if (trident > 0) {
|
||||
// IE 11 => return version number
|
||||
var rv = ua.indexOf('rv:');
|
||||
let rv = ua.indexOf('rv:');
|
||||
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
|
||||
}
|
||||
var edge = ua.indexOf('Edge/');
|
||||
let edge = ua.indexOf('Edge/');
|
||||
if (edge > 0) {
|
||||
// IE 12 (aka Edge) => return version number
|
||||
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function codeEditor ($templateRequest, $compile) {
|
|||
},
|
||||
link: function (scope, element, attrs, controller) {
|
||||
$templateRequest('components/editor/ace.editor.directive.html').then(function (editorHtml) {
|
||||
var editor = angular.element(editorHtml);
|
||||
let editor = angular.element(editorHtml);
|
||||
editor.attr('id', scope.paragraphId + '_editor');
|
||||
element.append(editor);
|
||||
$compile(editor)(scope);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
angular.module('zeppelinWebApp').controller('ElasticInputCtrl', ElasticInputCtrl);
|
||||
|
||||
function ElasticInputCtrl () {
|
||||
var vm = this;
|
||||
let vm = this;
|
||||
vm.showEditor = false;
|
||||
vm.value = '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function interpreterDirective ($timeout) {
|
|||
link: function (scope, element, attr) {
|
||||
if (scope.$last === true) {
|
||||
$timeout(function () {
|
||||
var id = 'ngRenderFinished';
|
||||
let id = 'ngRenderFinished';
|
||||
scope.$emit(id);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ function LoginCtrl ($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv,
|
|||
// redirect to the page from where the user originally was
|
||||
if ($location.search() && $location.search()['ref']) {
|
||||
$timeout(function () {
|
||||
var redirectLocation = $location.search()['ref'];
|
||||
let redirectLocation = $location.search()['ref'];
|
||||
$location.$$search = {};
|
||||
$location.path(redirectLocation);
|
||||
}, 100);
|
||||
|
|
@ -52,7 +52,7 @@ function LoginCtrl ($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv,
|
|||
});
|
||||
};
|
||||
|
||||
var initValues = function () {
|
||||
let initValues = function () {
|
||||
$scope.loginParams = {
|
||||
userName: '',
|
||||
password: ''
|
||||
|
|
@ -70,7 +70,7 @@ function LoginCtrl ($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv,
|
|||
$scope.loginParams.errorText = data.info;
|
||||
angular.element('.nav-login-btn').click();
|
||||
}, 1000);
|
||||
var locationPath = $location.path();
|
||||
let locationPath = $location.path();
|
||||
$location.path('/').search('ref', locationPath);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function NavCtrl ($scope, $rootScope, $http, $routeParams, $location,
|
|||
arrayOrderingSrv, searchService, TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
let vm = this;
|
||||
vm.arrayOrderingSrv = arrayOrderingSrv;
|
||||
vm.connected = websocketMsgSrv.isConnected();
|
||||
vm.isActive = isActive;
|
||||
|
|
@ -62,7 +62,7 @@ function NavCtrl ($scope, $rootScope, $http, $routeParams, $location,
|
|||
return true;
|
||||
}
|
||||
|
||||
var noteName = note.name;
|
||||
let noteName = note.name;
|
||||
if (noteName.toLowerCase().indexOf($scope.query.q.toLowerCase()) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ function NavCtrl ($scope, $rootScope, $http, $routeParams, $location,
|
|||
}
|
||||
|
||||
function logout () {
|
||||
var logoutURL = baseUrlSrv.getRestApiBase() + '/login/logout';
|
||||
let logoutURL = baseUrlSrv.getRestApiBase() + '/login/logout';
|
||||
|
||||
// for firefox and safari
|
||||
logoutURL = logoutURL.replace('//', '//false:false@');
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
describe('Controller: NavCtrl', function () {
|
||||
// load the controller's module
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
var NavCtrl;
|
||||
var scope;
|
||||
let NavCtrl;
|
||||
let scope;
|
||||
// Initialize the controller and a mock scope
|
||||
beforeEach(inject(function ($controller, $rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ describe('Directive: ngEnter', function () {
|
|||
// load the directive's module
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var element;
|
||||
var scope;
|
||||
let element;
|
||||
let scope;
|
||||
|
||||
beforeEach(inject(function ($rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ function noteActionSrv (websocketMsgSrv, $location, renameSrv, noteListDataFacto
|
|||
title: 'Rename folder',
|
||||
oldName: folderId,
|
||||
callback: function (newName) {
|
||||
var newFolderId = normalizeFolderId(newName);
|
||||
let newFolderId = normalizeFolderId(newName);
|
||||
if (_.has(noteListDataFactory.flatFolderMap, newFolderId)) {
|
||||
BootstrapDialog.confirm({
|
||||
type: BootstrapDialog.TYPE_WARNING,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').factory('noteListDataFactory', noteListDataFact
|
|||
function noteListDataFactory (TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
||||
var notes = {
|
||||
const notes = {
|
||||
root: {children: []},
|
||||
flatList: [],
|
||||
flatFolderMap: {},
|
||||
|
|
@ -34,8 +34,8 @@ function noteListDataFactory (TRASH_FOLDER_ID) {
|
|||
notes.root = {children: []};
|
||||
notes.flatFolderMap = {};
|
||||
_.reduce(notesList, function (root, note) {
|
||||
var noteName = note.name || note.id;
|
||||
var nodes = noteName.match(/([^\/][^\/]*)/g);
|
||||
let noteName = note.name || note.id;
|
||||
let nodes = noteName.match(/([^\/][^\/]*)/g);
|
||||
|
||||
// recursively add nodes
|
||||
addNode(root, nodes, note.id);
|
||||
|
|
@ -45,7 +45,7 @@ function noteListDataFactory (TRASH_FOLDER_ID) {
|
|||
}
|
||||
};
|
||||
|
||||
var addNode = function (curDir, nodes, noteId) {
|
||||
const addNode = function (curDir, nodes, noteId) {
|
||||
if (nodes.length === 1) { // the leaf
|
||||
curDir.children.push({
|
||||
name: nodes[0],
|
||||
|
|
@ -54,13 +54,13 @@ function noteListDataFactory (TRASH_FOLDER_ID) {
|
|||
isTrash: curDir.id ? curDir.id.split('/')[0] === TRASH_FOLDER_ID : false
|
||||
});
|
||||
} else { // a folder node
|
||||
var node = nodes.shift();
|
||||
var dir = _.find(curDir.children,
|
||||
let node = nodes.shift();
|
||||
let dir = _.find(curDir.children,
|
||||
function (c) { return c.name === node && c.children !== undefined; });
|
||||
if (dir !== undefined) { // found an existing dir
|
||||
addNode(dir, nodes, noteId);
|
||||
} else {
|
||||
var newDir = {
|
||||
let newDir = {
|
||||
id: curDir.id ? curDir.id + '/' + node : node,
|
||||
name: node,
|
||||
hidden: true,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
describe('Factory: NoteList', function () {
|
||||
var noteList;
|
||||
let noteList;
|
||||
|
||||
beforeEach(function () {
|
||||
angular.mock.module('zeppelinWebApp');
|
||||
|
|
@ -10,7 +10,7 @@ describe('Factory: NoteList', function () {
|
|||
});
|
||||
|
||||
it('should generate both flat list and folder-based list properly', function () {
|
||||
var notesList = [
|
||||
let notesList = [
|
||||
{name: 'A', id: '000001'},
|
||||
{name: 'B', id: '000002'},
|
||||
{id: '000003'}, // note without name
|
||||
|
|
@ -23,7 +23,7 @@ describe('Factory: NoteList', function () {
|
|||
];
|
||||
noteList.setNotes(notesList);
|
||||
|
||||
var flatList = noteList.flatList;
|
||||
let flatList = noteList.flatList;
|
||||
expect(flatList.length).toBe(9);
|
||||
expect(flatList[0].name).toBe('A');
|
||||
expect(flatList[0].id).toBe('000001');
|
||||
|
|
@ -36,7 +36,7 @@ describe('Factory: NoteList', function () {
|
|||
expect(flatList[7].name).toBe('C///CB//CBB');
|
||||
expect(flatList[8].name).toBe('D/D[A/DA]B');
|
||||
|
||||
var folderList = noteList.root.children;
|
||||
let folderList = noteList.root.children;
|
||||
expect(folderList.length).toBe(5);
|
||||
expect(folderList[0].name).toBe('A');
|
||||
expect(folderList[0].id).toBe('000001');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').controller('NotenameCtrl', NotenameCtrl);
|
|||
function NotenameCtrl ($scope, noteListDataFactory, $routeParams, websocketMsgSrv) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
let vm = this;
|
||||
vm.clone = false;
|
||||
vm.notes = noteListDataFactory;
|
||||
vm.websocketMsgSrv = websocketMsgSrv;
|
||||
|
|
@ -27,14 +27,14 @@ function NotenameCtrl ($scope, noteListDataFactory, $routeParams, websocketMsgSr
|
|||
|
||||
vm.createNote = function () {
|
||||
if (!vm.clone) {
|
||||
var defaultInterpreterId = '';
|
||||
let defaultInterpreterId = '';
|
||||
if ($scope.note.defaultInterpreter !== null) {
|
||||
defaultInterpreterId = $scope.note.defaultInterpreter.id;
|
||||
}
|
||||
vm.websocketMsgSrv.createNotebook($scope.note.notename, defaultInterpreterId);
|
||||
$scope.note.defaultInterpreter = $scope.interpreterSettings[0];
|
||||
} else {
|
||||
var noteId = $routeParams.noteId;
|
||||
let noteId = $routeParams.noteId;
|
||||
vm.websocketMsgSrv.cloneNote(noteId, $scope.note.notename);
|
||||
}
|
||||
};
|
||||
|
|
@ -56,7 +56,7 @@ function NotenameCtrl ($scope, noteListDataFactory, $routeParams, websocketMsgSr
|
|||
angular.forEach(vm.notes.flatList, function (noteName) {
|
||||
noteName = noteName.name;
|
||||
if (noteName.match(/^Untitled Note [0-9]*$/)) {
|
||||
var lastCount = noteName.substr(14) * 1;
|
||||
let lastCount = noteName.substr(14) * 1;
|
||||
if (newCount <= lastCount) {
|
||||
newCount = lastCount + 1;
|
||||
}
|
||||
|
|
@ -66,17 +66,17 @@ function NotenameCtrl ($scope, noteListDataFactory, $routeParams, websocketMsgSr
|
|||
};
|
||||
|
||||
vm.cloneNoteName = function () {
|
||||
var copyCount = 1;
|
||||
var newCloneName = '';
|
||||
var lastIndex = vm.sourceNoteName.lastIndexOf(' ');
|
||||
var endsWithNumber = !!vm.sourceNoteName.match('^.+?\\s\\d$');
|
||||
var noteNamePrefix = endsWithNumber ? vm.sourceNoteName.substr(0, lastIndex) : vm.sourceNoteName;
|
||||
var regexp = new RegExp('^' + noteNamePrefix + ' .+');
|
||||
let copyCount = 1;
|
||||
let newCloneName = '';
|
||||
let lastIndex = vm.sourceNoteName.lastIndexOf(' ');
|
||||
let endsWithNumber = !!vm.sourceNoteName.match('^.+?\\s\\d$');
|
||||
let noteNamePrefix = endsWithNumber ? vm.sourceNoteName.substr(0, lastIndex) : vm.sourceNoteName;
|
||||
let regexp = new RegExp('^' + noteNamePrefix + ' .+');
|
||||
|
||||
angular.forEach(vm.notes.flatList, function (noteName) {
|
||||
noteName = noteName.name;
|
||||
if (noteName.match(regexp)) {
|
||||
var lastCopyCount = noteName.substr(lastIndex).trim();
|
||||
let lastCopyCount = noteName.substr(lastIndex).trim();
|
||||
newCloneName = noteNamePrefix;
|
||||
lastCopyCount = parseInt(lastCopyCount);
|
||||
if (copyCount <= lastCopyCount) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
describe('Controller: NotenameCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
var ctrl;
|
||||
var noteList;
|
||||
let scope;
|
||||
let ctrl;
|
||||
let noteList;
|
||||
|
||||
beforeEach(inject(function ($injector, $rootScope, $controller) {
|
||||
noteList = $injector.get('noteListDataFactory');
|
||||
|
|
@ -15,7 +15,7 @@ describe('Controller: NotenameCtrl', function () {
|
|||
}));
|
||||
|
||||
it('should create a new name from current name when cloneNoteName is called', function () {
|
||||
var notesList = [
|
||||
let notesList = [
|
||||
{name: 'dsds 1', id: '1'},
|
||||
{name: 'dsds 2', id: '2'},
|
||||
{name: 'test name', id: '3'},
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ function modalvisible () {
|
|||
},
|
||||
link: function (scope, element, attrs) {
|
||||
// Add some listeners
|
||||
var previsibleMethod = scope.preVisibleCallback;
|
||||
var postVisibleMethod = scope.postVisibleCallback;
|
||||
let previsibleMethod = scope.preVisibleCallback;
|
||||
let postVisibleMethod = scope.postVisibleCallback;
|
||||
element.on('show.bs.modal', function (e) {
|
||||
var relatedTarget = angular.element(e.relatedTarget);
|
||||
var clone = relatedTarget.data('clone');
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ angular.module('zeppelinWebApp').controller('NoteImportCtrl', NoteImportCtrl);
|
|||
function NoteImportCtrl ($scope, $timeout, websocketMsgSrv) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
let vm = this;
|
||||
$scope.note = {};
|
||||
$scope.note.step1 = true;
|
||||
$scope.note.step2 = false;
|
||||
$scope.maxLimit = '';
|
||||
var limit = 0;
|
||||
let limit = 0;
|
||||
|
||||
websocketMsgSrv.listConfigurations();
|
||||
$scope.$on('configurationsInfo', function (scope, event) {
|
||||
|
|
@ -44,8 +44,8 @@ function NoteImportCtrl ($scope, $timeout, websocketMsgSrv) {
|
|||
$scope.importFile = function (element) {
|
||||
$scope.note.errorText = '';
|
||||
$scope.note.importFile = element.files[0];
|
||||
var file = $scope.note.importFile;
|
||||
var reader = new FileReader();
|
||||
let file = $scope.note.importFile;
|
||||
let reader = new FileReader();
|
||||
|
||||
if (file.size > limit) {
|
||||
$scope.note.errorText = 'File size limit Exceeded!';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').service('noteVarShareService', noteVarShareServ
|
|||
function noteVarShareService () {
|
||||
'ngInject';
|
||||
|
||||
var store = {};
|
||||
let store = {};
|
||||
|
||||
this.clear = function () {
|
||||
store = {};
|
||||
|
|
@ -32,7 +32,7 @@ function noteVarShareService () {
|
|||
};
|
||||
|
||||
this.del = function (key) {
|
||||
var v = store[key];
|
||||
let v = store[key];
|
||||
delete store[key];
|
||||
return v;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').controller('RenameCtrl', RenameCtrl);
|
|||
function RenameCtrl ($scope) {
|
||||
'ngInject';
|
||||
|
||||
var self = this;
|
||||
let self = this;
|
||||
|
||||
$scope.params = {newName: ''};
|
||||
$scope.isValid = true;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ angular.module('zeppelinWebApp').service('renameSrv', renameSrv);
|
|||
function renameSrv ($rootScope) {
|
||||
'ngInject';
|
||||
|
||||
var self = this;
|
||||
let self = this;
|
||||
|
||||
/**
|
||||
* <options schema>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
angular.module('zeppelinWebApp').directive('resizable', resizable);
|
||||
|
||||
function resizable () {
|
||||
var resizableConfig = {
|
||||
let resizableConfig = {
|
||||
autoHide: true,
|
||||
handles: 'se',
|
||||
helper: 'resizable-helper',
|
||||
|
|
@ -31,10 +31,10 @@ function resizable () {
|
|||
},
|
||||
link: function postLink (scope, elem, attrs) {
|
||||
attrs.$observe('resize', function (resize) {
|
||||
var resetResize = function (elem, resize) {
|
||||
var colStep = window.innerWidth / 12;
|
||||
let resetResize = function (elem, resize) {
|
||||
let colStep = window.innerWidth / 12;
|
||||
elem.off('resizestop');
|
||||
var conf = angular.copy(resizableConfig);
|
||||
let conf = angular.copy(resizableConfig);
|
||||
if (resize.graphType === 'TABLE' || resize.graphType === 'TEXT') {
|
||||
conf.grid = [colStep, 10];
|
||||
conf.minHeight = 100;
|
||||
|
|
@ -47,7 +47,7 @@ function resizable () {
|
|||
elem.resizable(conf);
|
||||
elem.on('resizestop', function () {
|
||||
if (scope.callback) {
|
||||
var height = elem.height();
|
||||
let height = elem.height();
|
||||
if (height < 50) {
|
||||
height = 300;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@ function saveAsService (browserDetectService) {
|
|||
'ngInject';
|
||||
|
||||
this.saveAs = function (content, filename, extension) {
|
||||
var BOM = '\uFEFF';
|
||||
let BOM = '\uFEFF';
|
||||
if (browserDetectService.detectIE()) {
|
||||
angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>');
|
||||
var frameSaveAs = angular.element('body > iframe#SaveAsId')[0].contentWindow;
|
||||
let frameSaveAs = angular.element('body > iframe#SaveAsId')[0].contentWindow;
|
||||
content = BOM + content;
|
||||
frameSaveAs.document.open('text/json', 'replace');
|
||||
frameSaveAs.document.write(content);
|
||||
frameSaveAs.document.close();
|
||||
frameSaveAs.focus();
|
||||
var t1 = Date.now();
|
||||
let t1 = Date.now();
|
||||
frameSaveAs.document.execCommand('SaveAs', false, filename + '.' + extension);
|
||||
var t2 = Date.now();
|
||||
let t2 = Date.now();
|
||||
|
||||
// This means, this version of IE dosen't support auto download of a file with extension provided in param
|
||||
// falling back to ".txt"
|
||||
|
|
@ -40,7 +40,7 @@ function saveAsService (browserDetectService) {
|
|||
} else {
|
||||
content = 'data:image/svg;charset=utf-8,' + BOM + encodeURIComponent(content);
|
||||
angular.element('body').append('<a id="SaveAsId"></a>');
|
||||
var saveAsElement = angular.element('body > a#SaveAsId');
|
||||
let saveAsElement = angular.element('body > a#SaveAsId');
|
||||
saveAsElement.attr('href', content);
|
||||
saveAsElement.attr('download', filename + '.' + extension);
|
||||
saveAsElement.attr('target', '_blank');
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function searchService ($resource, baseUrlSrv) {
|
|||
if (!term.q) { // TODO(bzz): empty string check
|
||||
return;
|
||||
}
|
||||
var encQuery = window.encodeURIComponent(term.q);
|
||||
let encQuery = window.encodeURIComponent(term.q);
|
||||
return $resource(baseUrlSrv.getRestApiBase() + '/notebook/search?q=' + encQuery, {}, {
|
||||
query: {method: 'GET'}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ angular.module('zeppelinWebApp').factory('websocketEvents', websocketEvents);
|
|||
function websocketEvents ($rootScope, $websocket, $location, baseUrlSrv) {
|
||||
'ngInject';
|
||||
|
||||
var websocketCalls = {};
|
||||
var pingIntervalId;
|
||||
let websocketCalls = {};
|
||||
let pingIntervalId;
|
||||
|
||||
websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl());
|
||||
websocketCalls.ws.reconnectIfNotNormalClose = true;
|
||||
|
|
@ -50,14 +50,14 @@ function websocketEvents ($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
};
|
||||
|
||||
websocketCalls.ws.onMessage(function (event) {
|
||||
var payload;
|
||||
let payload;
|
||||
if (event.data) {
|
||||
payload = angular.fromJson(event.data);
|
||||
}
|
||||
console.log('Receive Json << %o', event.data)
|
||||
console.log('Receive << %o, %o', payload.op, payload);
|
||||
var op = payload.op;
|
||||
var data = payload.data;
|
||||
let op = payload.op;
|
||||
let data = payload.data;
|
||||
if (op === 'NOTE') {
|
||||
$rootScope.$broadcast('setNoteContent', data.note);
|
||||
} else if (op === 'NEW_NOTE') {
|
||||
|
|
@ -69,7 +69,7 @@ function websocketEvents ($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
} else if (op === 'LIST_UPDATE_NOTE_JOBS') {
|
||||
$rootScope.$broadcast('setUpdateNoteJobs', data.noteRunningJobs);
|
||||
} else if (op === 'AUTH_INFO') {
|
||||
var btn = [];
|
||||
let btn = [];
|
||||
if ($rootScope.ticket.roles === '[]') {
|
||||
btn = [{
|
||||
label: 'Close',
|
||||
|
|
|
|||
Loading…
Reference in a new issue