mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix: space-before-function-paren
``` /Users/1ambda/github/apache/apache-zeppelin/zeppelin-master/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js (48/0) ✖ 17:25 Missing space before function parentheses space-before-function-paren ✖ 22:26 Missing space before function parentheses space-before-function-paren ✖ 26:29 Missing space before function parentheses space-before-function-paren ✖ 36:30 Missing space before function parentheses space-before-function-paren ✖ 40:32 Missing space before function parentheses space-before-function-paren ✖ 44:26 Missing space before function parentheses space-before-function-paren ✖ 48:28 Missing space before function parentheses space-before-function-paren ✖ 52:25 Missing space before function parentheses space-before-function-paren ✖ 56:25 Missing space before function parentheses space-before-function-paren ✖ 60:27 Missing space before function parentheses space-before-function-paren ✖ 64:25 Missing space before function parentheses space-before-function-paren ✖ 68:24 Missing space before function parentheses space-before-function-paren ```
This commit is contained in:
parent
59c3996f82
commit
6e44e96de8
74 changed files with 975 additions and 976 deletions
|
|
@ -44,7 +44,6 @@
|
|||
"no-unneeded-ternary": 0,
|
||||
"padded-blocks": 0,
|
||||
"no-var": 0,
|
||||
"space-before-function-paren": 0,
|
||||
"object-curly-spacing": 0,
|
||||
"comma-dangle": 0,
|
||||
"semi": 0,
|
||||
|
|
|
|||
|
|
@ -14,25 +14,25 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('MainCtrl', MainCtrl);
|
||||
|
||||
function MainCtrl($scope, $rootScope, $window, arrayOrderingSrv) {
|
||||
function MainCtrl ($scope, $rootScope, $window, arrayOrderingSrv) {
|
||||
'ngInject';
|
||||
|
||||
$scope.looknfeel = 'default';
|
||||
|
||||
var init = function() {
|
||||
var init = function () {
|
||||
$scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false);
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
$rootScope.$on('setIframe', function(event, data) {
|
||||
$rootScope.$on('setIframe', function (event, data) {
|
||||
if (!event.defaultPrevented) {
|
||||
$scope.asIframe = data;
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('setLookAndFeel', function(event, data) {
|
||||
$rootScope.$on('setLookAndFeel', function (event, data) {
|
||||
if (!event.defaultPrevented && data && data !== '' && data !== $scope.looknfeel) {
|
||||
$scope.looknfeel = data;
|
||||
event.preventDefault();
|
||||
|
|
@ -40,17 +40,17 @@ function MainCtrl($scope, $rootScope, $window, arrayOrderingSrv) {
|
|||
});
|
||||
|
||||
// Set The lookAndFeel to default on every page
|
||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||
$rootScope.$on('$routeChangeStart', function (event, next, current) {
|
||||
$rootScope.$broadcast('setLookAndFeel', 'default');
|
||||
});
|
||||
|
||||
$rootScope.noteName = function(note) {
|
||||
$rootScope.noteName = function (note) {
|
||||
if (!_.isEmpty(note)) {
|
||||
return arrayOrderingSrv.getNoteName(note);
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapDialog.defaultOptions.onshown = function() {
|
||||
BootstrapDialog.defaultOptions.onshown = function () {
|
||||
angular.element('#' + this.id).find('.btn:last').focus();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
describe('Controller: MainCtrl', function() {
|
||||
describe('Controller: MainCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
var rootScope;
|
||||
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
beforeEach(inject(function ($controller, $rootScope) {
|
||||
rootScope = $rootScope;
|
||||
scope = $rootScope.$new();
|
||||
$controller('MainCtrl', {
|
||||
|
|
@ -12,16 +12,16 @@ describe('Controller: MainCtrl', function() {
|
|||
});
|
||||
}));
|
||||
|
||||
it('should attach "asIframe" to the scope and the default value should be false', function() {
|
||||
it('should attach "asIframe" to the scope and the default value should be false', function () {
|
||||
expect(scope.asIframe).toBeDefined();
|
||||
expect(scope.asIframe).toEqual(false);
|
||||
});
|
||||
|
||||
it('should set the default value of "looknfeel to "default"', function() {
|
||||
it('should set the default value of "looknfeel to "default"', function () {
|
||||
expect(scope.looknfeel).toEqual('default');
|
||||
});
|
||||
|
||||
it('should set "asIframe" flag to true when a controller broadcasts setIframe event', function() {
|
||||
it('should set "asIframe" flag to true when a controller broadcasts setIframe event', function () {
|
||||
rootScope.$broadcast('setIframe', true);
|
||||
expect(scope.asIframe).toEqual(true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -35,20 +35,20 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
|
|||
'ngResource',
|
||||
'ngclipboard'
|
||||
])
|
||||
.filter('breakFilter', function() {
|
||||
return function(text) {
|
||||
.filter('breakFilter', function () {
|
||||
return function (text) {
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
if (!!text) {
|
||||
return text.replace(/\n/g, '<br />');
|
||||
}
|
||||
};
|
||||
})
|
||||
.config(function($httpProvider, $routeProvider, ngToastProvider) {
|
||||
.config(function ($httpProvider, $routeProvider, ngToastProvider) {
|
||||
// withCredentials when running locally via grunt
|
||||
$httpProvider.defaults.withCredentials = true;
|
||||
|
||||
var visBundleLoad = {
|
||||
load: ['heliumService', function(heliumService) {
|
||||
load: ['heliumService', function (heliumService) {
|
||||
return heliumService.load;
|
||||
}]
|
||||
};
|
||||
|
|
@ -137,7 +137,7 @@ var zeppelinWebApp = angular.module('zeppelinWebApp', [
|
|||
})
|
||||
.constant('TRASH_FOLDER_ID', '~Trash');
|
||||
|
||||
function auth() {
|
||||
function auth () {
|
||||
var $http = angular.injector(['ng']).get('$http');
|
||||
var baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv');
|
||||
// withCredentials when running locally via grunt
|
||||
|
|
@ -149,18 +149,18 @@ function auth() {
|
|||
},
|
||||
crossDomain: true
|
||||
});
|
||||
return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function(response) {
|
||||
zeppelinWebApp.run(function($rootScope) {
|
||||
return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function (response) {
|
||||
zeppelinWebApp.run(function ($rootScope) {
|
||||
$rootScope.ticket = angular.fromJson(response.data).body;
|
||||
});
|
||||
}, function(errorResponse) {
|
||||
}, function (errorResponse) {
|
||||
// Handle error case
|
||||
});
|
||||
}
|
||||
|
||||
function bootstrapApplication() {
|
||||
zeppelinWebApp.run(function($rootScope, $location) {
|
||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||
function bootstrapApplication () {
|
||||
zeppelinWebApp.run(function ($rootScope, $location) {
|
||||
$rootScope.$on('$routeChangeStart', function (event, next, current) {
|
||||
if (!$rootScope.ticket && next.$$route && !next.$$route.publicAccess) {
|
||||
$location.path('/');
|
||||
}
|
||||
|
|
@ -169,6 +169,6 @@ function bootstrapApplication() {
|
|||
angular.bootstrap(document, ['zeppelinWebApp']);
|
||||
}
|
||||
|
||||
angular.element(document).ready(function() {
|
||||
angular.element(document).ready(function () {
|
||||
auth().then(bootstrapApplication);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,26 +14,26 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('ConfigurationCtrl', ConfigurationCtrl);
|
||||
|
||||
function ConfigurationCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
||||
function ConfigurationCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
||||
'ngInject';
|
||||
|
||||
$scope.configrations = [];
|
||||
$scope._ = _;
|
||||
ngToast.dismiss();
|
||||
|
||||
var getConfigurations = function() {
|
||||
var getConfigurations = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/configurations/all')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.configurations = data.body;
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
if (status === 401) {
|
||||
ngToast.danger({
|
||||
content: 'You don\'t have permission on this page',
|
||||
verticalPosition: 'bottom',
|
||||
timeout: '3000'
|
||||
});
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
window.location.replace('/');
|
||||
}, 3000);
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ function ConfigurationCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
var init = function () {
|
||||
getConfigurations();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('CredentialCtrl', CredentialCtrl);
|
||||
|
||||
function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
||||
function CredentialCtrl ($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
||||
'ngInject';
|
||||
|
||||
$scope._ = _;
|
||||
|
|
@ -24,22 +24,22 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
$scope.showAddNewCredentialInfo = false;
|
||||
$scope.availableInterpreters = [];
|
||||
|
||||
var getCredentialInfo = function() {
|
||||
var getCredentialInfo = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/credential')
|
||||
.success(function(data, status, headers, config) {
|
||||
$scope.credentialInfo = _.map(data.body.userCredentials, function(value, prop) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.credentialInfo = _.map(data.body.userCredentials, function (value, prop) {
|
||||
return {entity: prop, password: value.password, username: value.username};
|
||||
});
|
||||
console.log('Success %o %o', status, $scope.credentialInfo);
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
if (status === 401) {
|
||||
ngToast.danger({
|
||||
content: 'You don\'t have permission on this page',
|
||||
verticalPosition: 'bottom',
|
||||
timeout: '3000'
|
||||
});
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
window.location.replace('/');
|
||||
}, 3000);
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.addNewCredentialInfo = function() {
|
||||
$scope.addNewCredentialInfo = function () {
|
||||
if ($scope.entity && _.isEmpty($scope.entity.trim()) &&
|
||||
$scope.username && _.isEmpty($scope.username.trim())) {
|
||||
ngToast.danger({
|
||||
|
|
@ -65,7 +65,7 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
};
|
||||
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/credential', newCredential)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
ngToast.success({
|
||||
content: 'Successfully saved credentials.',
|
||||
verticalPosition: 'bottom',
|
||||
|
|
@ -76,7 +76,7 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
$scope.showAddNewCredentialInfo = false;
|
||||
console.log('Success %o %o', status, data.message);
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
ngToast.danger({
|
||||
content: 'Error saving credentials',
|
||||
verticalPosition: 'bottom',
|
||||
|
|
@ -86,26 +86,26 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
var getAvailableInterpreters = function() {
|
||||
var getAvailableInterpreters = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
for (var setting = 0; setting < data.body.length; setting++) {
|
||||
$scope.availableInterpreters.push(
|
||||
data.body[setting].group + '.' + data.body[setting].name);
|
||||
}
|
||||
angular.element('#entityname').autocomplete({
|
||||
source: $scope.availableInterpreters,
|
||||
select: function(event, selected) {
|
||||
select: function (event, selected) {
|
||||
$scope.entity = selected.item.value;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleAddNewCredentialInfo = function() {
|
||||
$scope.toggleAddNewCredentialInfo = function () {
|
||||
if ($scope.showAddNewCredentialInfo) {
|
||||
$scope.showAddNewCredentialInfo = false;
|
||||
} else {
|
||||
|
|
@ -113,18 +113,18 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
}
|
||||
};
|
||||
|
||||
$scope.cancelCredentialInfo = function() {
|
||||
$scope.cancelCredentialInfo = function () {
|
||||
$scope.showAddNewCredentialInfo = false;
|
||||
resetCredentialInfo();
|
||||
};
|
||||
|
||||
var resetCredentialInfo = function() {
|
||||
var resetCredentialInfo = function () {
|
||||
$scope.entity = '';
|
||||
$scope.username = '';
|
||||
$scope.password = '';
|
||||
};
|
||||
|
||||
$scope.copyOriginCredentialsInfo = function() {
|
||||
$scope.copyOriginCredentialsInfo = function () {
|
||||
ngToast.info({
|
||||
content: 'Since entity is a unique key, you can edit only username & password',
|
||||
verticalPosition: 'bottom',
|
||||
|
|
@ -132,7 +132,7 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.updateCredentialInfo = function(form, data, entity) {
|
||||
$scope.updateCredentialInfo = function (form, data, entity) {
|
||||
var request = {
|
||||
entity: entity,
|
||||
username: data.username,
|
||||
|
|
@ -140,12 +140,12 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
};
|
||||
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/credential/', request)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.credentialInfo, {'entity': entity});
|
||||
$scope.credentialInfo[index] = request;
|
||||
return true;
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
ngToast.danger({
|
||||
content: 'We couldn\'t save the credential',
|
||||
|
|
@ -157,22 +157,22 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
return false;
|
||||
};
|
||||
|
||||
$scope.removeCredentialInfo = function(entity) {
|
||||
$scope.removeCredentialInfo = function (entity) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
title: '',
|
||||
message: 'Do you want to delete this credential information?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$http.delete(baseUrlSrv.getRestApiBase() + '/credential/' + entity)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.credentialInfo, {'entity': entity});
|
||||
$scope.credentialInfo.splice(index, 1);
|
||||
console.log('Success %o %o', status, data.message);
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ function CredentialCtrl($scope, $rootScope, $http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
var init = function () {
|
||||
getAvailableInterpreters();
|
||||
getCredentialInfo();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@
|
|||
* HandsonHelper class
|
||||
*/
|
||||
export default class HandsonHelper {
|
||||
constructor(columns, rows, comment) {
|
||||
constructor (columns, rows, comment) {
|
||||
this.columns = columns || [];
|
||||
this.rows = rows || [];
|
||||
this.comment = comment || '';
|
||||
this._numericValidator = this._numericValidator.bind(this);
|
||||
};
|
||||
|
||||
getHandsonTableConfig(columns, columnNames, resultRows) {
|
||||
getHandsonTableConfig (columns, columnNames, resultRows) {
|
||||
var self = this;
|
||||
return {
|
||||
colHeaders: columnNames,
|
||||
|
|
@ -41,22 +41,22 @@ export default class HandsonHelper {
|
|||
fillHandle: false,
|
||||
fragmentSelection: true,
|
||||
disableVisualSelection: true,
|
||||
cells: function(ro, co, pro) {
|
||||
cells: function (ro, co, pro) {
|
||||
var cellProperties = {};
|
||||
var colType = columns[co].type;
|
||||
cellProperties.renderer = function(instance, td, row, col, prop, value, cellProperties) {
|
||||
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) {
|
||||
afterGetColHeader: function (col, TH) {
|
||||
var instance = this;
|
||||
var menu = self._buildDropDownMenu(columns[col].type);
|
||||
var button = self._buildTypeSwitchButton();
|
||||
|
||||
self._addButtonMenuEvent(button, menu);
|
||||
|
||||
Handsontable.Dom.addEvent(menu, 'click', function(event) {
|
||||
Handsontable.Dom.addEvent(menu, 'click', function (event) {
|
||||
if (event.target.nodeName === 'LI') {
|
||||
self._setColumnType(columns, event.target.data.colType, instance, col);
|
||||
}
|
||||
|
|
@ -74,8 +74,8 @@ export default class HandsonHelper {
|
|||
** Private Service Functions
|
||||
*/
|
||||
|
||||
_addButtonMenuEvent(button, menu) {
|
||||
Handsontable.Dom.addEvent(button, 'click', function(event) {
|
||||
_addButtonMenuEvent (button, menu) {
|
||||
Handsontable.Dom.addEvent(button, 'click', function (event) {
|
||||
var changeTypeMenu;
|
||||
var position;
|
||||
var removeMenu;
|
||||
|
|
@ -96,7 +96,7 @@ export default class HandsonHelper {
|
|||
menu.style.top = (position.top + (window.scrollY || window.pageYOffset)) + 2 + 'px';
|
||||
menu.style.left = (position.left) + 'px';
|
||||
|
||||
removeMenu = function(event) {
|
||||
removeMenu = function (event) {
|
||||
if (menu.parentNode) {
|
||||
menu.parentNode.removeChild(menu);
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ export default class HandsonHelper {
|
|||
});
|
||||
}
|
||||
|
||||
_buildDropDownMenu(activeCellType) {
|
||||
_buildDropDownMenu (activeCellType) {
|
||||
var menu = document.createElement('UL');
|
||||
var types = ['text', 'numeric', 'date'];
|
||||
var item;
|
||||
|
|
@ -132,7 +132,7 @@ export default class HandsonHelper {
|
|||
return menu;
|
||||
}
|
||||
|
||||
_buildTypeSwitchButton() {
|
||||
_buildTypeSwitchButton () {
|
||||
var button = document.createElement('BUTTON');
|
||||
|
||||
button.innerHTML = '\u25BC';
|
||||
|
|
@ -141,7 +141,7 @@ export default class HandsonHelper {
|
|||
return button;
|
||||
}
|
||||
|
||||
_isNumeric(value) {
|
||||
_isNumeric (value) {
|
||||
if (!isNaN(value)) {
|
||||
if (value.length !== 0) {
|
||||
if (Number(value) <= Number.MAX_SAFE_INTEGER && Number(value) >= Number.MIN_SAFE_INTEGER) {
|
||||
|
|
@ -152,7 +152,7 @@ export default class HandsonHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
_cellRenderer(instance, td, row, col, prop, value, cellProperties, colType) {
|
||||
_cellRenderer (instance, td, row, col, prop, value, cellProperties, colType) {
|
||||
if (colType === 'numeric' && this._isNumeric(value)) {
|
||||
cellProperties.format = '0,0.[00000]';
|
||||
td.style.textAlign = 'left';
|
||||
|
|
@ -164,16 +164,16 @@ export default class HandsonHelper {
|
|||
}
|
||||
}
|
||||
|
||||
_dateValidator(value, callback) {
|
||||
_dateValidator (value, callback) {
|
||||
var d = moment(value);
|
||||
return callback(d.isValid());
|
||||
}
|
||||
|
||||
_numericValidator(value, callback) {
|
||||
_numericValidator (value, callback) {
|
||||
return callback(this._isNumeric(value));
|
||||
}
|
||||
|
||||
_setColumnType(columns, type, instance, col) {
|
||||
_setColumnType (columns, type, instance, col) {
|
||||
columns[col].type = type;
|
||||
this._setColumnValidator(columns, col);
|
||||
instance.updateSettings({columns: columns});
|
||||
|
|
@ -183,11 +183,11 @@ export default class HandsonHelper {
|
|||
}
|
||||
}
|
||||
|
||||
_isColumnSorted(instance, col) {
|
||||
_isColumnSorted (instance, col) {
|
||||
return instance.sortingEnabled && instance.sortColumn === col;
|
||||
}
|
||||
|
||||
_setColumnValidator(columns, col) {
|
||||
_setColumnValidator (columns, col) {
|
||||
if (columns[col].type === 'numeric') {
|
||||
columns[col].validator = this._numericValidator;
|
||||
} else if (columns[col].type === 'date') {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export const HeliumConfFieldType = {
|
|||
* @param persisted <Object> including `type`, `description`, `defaultValue` for each conf key
|
||||
* @param spec <Object> including `value` for each conf key
|
||||
*/
|
||||
export function mergePersistedConfWithSpec(persisted, spec) {
|
||||
export function mergePersistedConfWithSpec (persisted, spec) {
|
||||
const confs = [];
|
||||
|
||||
for (let name in spec) {
|
||||
|
|
@ -44,7 +44,7 @@ export function mergePersistedConfWithSpec(persisted, spec) {
|
|||
return confs;
|
||||
}
|
||||
|
||||
export function createPackageConf(defaultPackages, persistedPackacgeConfs) {
|
||||
export function createPackageConf (defaultPackages, persistedPackacgeConfs) {
|
||||
let packageConfs = {};
|
||||
|
||||
for (let name in defaultPackages) {
|
||||
|
|
@ -68,7 +68,7 @@ export function createPackageConf(defaultPackages, persistedPackacgeConfs) {
|
|||
return packageConfs;
|
||||
}
|
||||
|
||||
export function parseConfigValue(type, stringified) {
|
||||
export function parseConfigValue (type, stringified) {
|
||||
let value = stringified;
|
||||
|
||||
try {
|
||||
|
|
@ -88,7 +88,7 @@ export function parseConfigValue(type, stringified) {
|
|||
/**
|
||||
* create persistable config object
|
||||
*/
|
||||
export function createPersistableConfig(currentConf) {
|
||||
export function createPersistableConfig (currentConf) {
|
||||
// persist key-value only
|
||||
// since other info (e.g type, desc) can be provided by default config
|
||||
const filtered = currentConf.reduce((acc, c) => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { HeliumType, } from '../../components/helium/helium-type';
|
||||
|
||||
export default function HeliumCtrl($scope, $rootScope, $sce,
|
||||
export default function HeliumCtrl ($scope, $rootScope, $sce,
|
||||
baseUrlSrv, ngToast, heliumService) {
|
||||
'ngInject';
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
$scope.defaultPackageConfigs = {}; // { pkgName, [{name, type, desc, value, defaultValue}] }
|
||||
$scope.intpDefaultIcon = $sce.trustAsHtml('<img src="../assets/images/maven_default_icon.png" style="width: 12px"/>');
|
||||
|
||||
function init() {
|
||||
function init () {
|
||||
// get all package info and set config
|
||||
heliumService.getAllPackageInfoAndDefaultPackages()
|
||||
.then(({ pkgSearchResults, defaultPackages }) => {
|
||||
|
|
@ -60,7 +60,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
});
|
||||
};
|
||||
|
||||
var orderPackageByPubDate = function(a, b) {
|
||||
var 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,7 +69,7 @@ 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 classifyPkgType = function (packageInfo) {
|
||||
var allTypesOfPkg = {};
|
||||
var vizTypePkg = [];
|
||||
var spellTypePkg = [];
|
||||
|
|
@ -113,31 +113,31 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
};
|
||||
|
||||
$scope.bundleOrderListeners = {
|
||||
accept: function(sourceItemHandleScope, destSortableScope) { return true; },
|
||||
itemMoved: function(event) {},
|
||||
orderChanged: function(event) {
|
||||
accept: function (sourceItemHandleScope, destSortableScope) { return true; },
|
||||
itemMoved: function (event) {},
|
||||
orderChanged: function (event) {
|
||||
$scope.bundleOrderChanged = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.saveBundleOrder = function() {
|
||||
$scope.saveBundleOrder = function () {
|
||||
var confirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
title: '',
|
||||
message: 'Save changes?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
confirm.$modalFooter.find('button').addClass('disabled');
|
||||
confirm.$modalFooter.find('button:contains("OK")')
|
||||
.html('<i class="fa fa-circle-o-notch fa-spin"></i> Enabling');
|
||||
heliumService.setVisualizationPackageOrder($scope.bundleOrder)
|
||||
.success(function(data, status) {
|
||||
.success(function (data, status) {
|
||||
init();
|
||||
confirm.close();
|
||||
})
|
||||
.error(function(data, status) {
|
||||
.error(function (data, status) {
|
||||
confirm.close();
|
||||
console.log('Failed to save order');
|
||||
BootstrapDialog.show({
|
||||
|
|
@ -151,14 +151,14 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
});
|
||||
};
|
||||
|
||||
var getLicense = function(name, artifact) {
|
||||
var filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function(p) {
|
||||
var getLicense = function (name, artifact) {
|
||||
var filteredPkgSearchResults = _.filter($scope.defaultPackages[name], function (p) {
|
||||
return p.artifact === artifact;
|
||||
});
|
||||
|
||||
var license;
|
||||
if (filteredPkgSearchResults.length === 0) {
|
||||
filteredPkgSearchResults = _.filter($scope.pkgSearchResults[name], function(p) {
|
||||
filteredPkgSearchResults = _.filter($scope.pkgSearchResults[name], function (p) {
|
||||
return p.pkg.artifact === artifact;
|
||||
});
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
return license;
|
||||
}
|
||||
|
||||
const getHeliumTypeText = function(type) {
|
||||
const getHeliumTypeText = function (type) {
|
||||
if (type === HeliumType.VISUALIZATION) {
|
||||
return `<a target="_blank" href="https://zeppelin.apache.org/docs/${$rootScope.zeppelinVersion}/development/writingzeppelinvisualization.html">${type}</a>`; // eslint-disable-line max-len
|
||||
} else if (type === HeliumType.SPELL) {
|
||||
|
|
@ -185,7 +185,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
}
|
||||
}
|
||||
|
||||
$scope.enable = function(name, artifact, type, groupId, description) {
|
||||
$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;
|
||||
|
|
@ -247,24 +247,24 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
}
|
||||
};
|
||||
|
||||
$scope.disable = function(name, artifact) {
|
||||
$scope.disable = function (name, artifact) {
|
||||
var confirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
title: '<div style="font-weight: 300;">Do you want to disable Helium Package?</div>',
|
||||
message: artifact,
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
confirm.$modalFooter.find('button').addClass('disabled');
|
||||
confirm.$modalFooter.find('button:contains("OK")')
|
||||
.html('<i class="fa fa-circle-o-notch fa-spin"></i> Disabling');
|
||||
heliumService.disable(name)
|
||||
.success(function(data, status) {
|
||||
.success(function (data, status) {
|
||||
init();
|
||||
confirm.close();
|
||||
})
|
||||
.error(function(data, status) {
|
||||
.error(function (data, status) {
|
||||
confirm.close();
|
||||
console.log('Failed to disable package %o. %o', name, data);
|
||||
BootstrapDialog.show({
|
||||
|
|
@ -278,7 +278,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.toggleVersions = function(pkgName) {
|
||||
$scope.toggleVersions = function (pkgName) {
|
||||
if ($scope.showVersions[pkgName]) {
|
||||
$scope.showVersions[pkgName] = false;
|
||||
} else {
|
||||
|
|
@ -286,24 +286,24 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
}
|
||||
};
|
||||
|
||||
$scope.isLocalPackage = function(pkgSearchResult) {
|
||||
$scope.isLocalPackage = function (pkgSearchResult) {
|
||||
const pkg = pkgSearchResult.pkg;
|
||||
return pkg.artifact && !pkg.artifact.includes('@');
|
||||
};
|
||||
|
||||
$scope.hasNpmLink = function(pkgSearchResult) {
|
||||
$scope.hasNpmLink = function (pkgSearchResult) {
|
||||
const pkg = pkgSearchResult.pkg;
|
||||
return (pkg.type === HeliumType.SPELL || pkg.type === HeliumType.VISUALIZATION) &&
|
||||
!$scope.isLocalPackage(pkgSearchResult);
|
||||
};
|
||||
|
||||
$scope.hasMavenLink = function(pkgSearchResult) {
|
||||
$scope.hasMavenLink = function (pkgSearchResult) {
|
||||
const pkg = pkgSearchResult.pkg;
|
||||
return (pkg.type === HeliumType.APPLICATION || pkg.type === HeliumType.INTERPRETER) &&
|
||||
!$scope.isLocalPackage(pkgSearchResult);
|
||||
};
|
||||
|
||||
$scope.getPackageSize = function(pkgSearchResult, targetPkgType) {
|
||||
$scope.getPackageSize = function (pkgSearchResult, targetPkgType) {
|
||||
var result = []
|
||||
_.map(pkgSearchResult, function (pkg) {
|
||||
result.push(_.find(pkg, {type: targetPkgType}))
|
||||
|
|
@ -311,21 +311,21 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
return _.compact(result).length
|
||||
}
|
||||
|
||||
$scope.configExists = function(pkgSearchResult) {
|
||||
$scope.configExists = function (pkgSearchResult) {
|
||||
// helium package config is persisted per version
|
||||
return pkgSearchResult.pkg.config && pkgSearchResult.pkg.artifact;
|
||||
};
|
||||
|
||||
$scope.configOpened = function(pkgSearchResult) {
|
||||
$scope.configOpened = function (pkgSearchResult) {
|
||||
return pkgSearchResult.configOpened && !pkgSearchResult.configFetching;
|
||||
};
|
||||
|
||||
$scope.getConfigButtonClass = function(pkgSearchResult) {
|
||||
$scope.getConfigButtonClass = function (pkgSearchResult) {
|
||||
return (pkgSearchResult.configOpened && pkgSearchResult.configFetching)
|
||||
? 'disabled' : '';
|
||||
}
|
||||
|
||||
$scope.toggleConfigButton = function(pkgSearchResult) {
|
||||
$scope.toggleConfigButton = function (pkgSearchResult) {
|
||||
if (pkgSearchResult.configOpened) {
|
||||
pkgSearchResult.configOpened = false;
|
||||
return;
|
||||
|
|
@ -343,7 +343,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.saveConfig = function(pkgSearchResult) {
|
||||
$scope.saveConfig = function (pkgSearchResult) {
|
||||
const pkgName = pkgSearchResult.pkg.name;
|
||||
const currentConf = $scope.defaultPackageConfigs[pkgName];
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ export default function HeliumCtrl($scope, $rootScope, $sce,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.getDescriptionText = function(pkgSearchResult) {
|
||||
$scope.getDescriptionText = function (pkgSearchResult) {
|
||||
return $sce.trustAsHtml(pkgSearchResult.pkg.description);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('HomeCtrl', HomeCtrl);
|
||||
|
||||
function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arrayOrderingSrv,
|
||||
function HomeCtrl ($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arrayOrderingSrv,
|
||||
ngToast, noteActionSrv, TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
||||
|
|
@ -36,21 +36,21 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra
|
|||
$scope.TRASH_FOLDER_ID = TRASH_FOLDER_ID;
|
||||
$scope.query = {q: ''};
|
||||
|
||||
$scope.initHome = function() {
|
||||
$scope.initHome = function () {
|
||||
websocketMsgSrv.getHomeNote();
|
||||
vm.noteCustomHome = false;
|
||||
};
|
||||
|
||||
$scope.reloadNoteList = function() {
|
||||
$scope.reloadNoteList = function () {
|
||||
websocketMsgSrv.reloadAllNotesFromRepo();
|
||||
$scope.isReloadingNotes = true;
|
||||
};
|
||||
|
||||
$scope.toggleFolderNode = function(node) {
|
||||
$scope.toggleFolderNode = function (node) {
|
||||
node.hidden = !node.hidden;
|
||||
};
|
||||
|
||||
angular.element('#loginModal').on('hidden.bs.modal', function(e) {
|
||||
angular.element('#loginModal').on('hidden.bs.modal', function (e) {
|
||||
$rootScope.$broadcast('initLoginValues');
|
||||
});
|
||||
|
||||
|
|
@ -58,11 +58,11 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra
|
|||
** $scope.$on functions below
|
||||
*/
|
||||
|
||||
$scope.$on('setNoteMenu', function(event, notes) {
|
||||
$scope.$on('setNoteMenu', function (event, notes) {
|
||||
$scope.isReloadingNotes = false;
|
||||
});
|
||||
|
||||
$scope.$on('setNoteContent', function(event, note) {
|
||||
$scope.$on('setNoteContent', function (event, note) {
|
||||
if (vm.noteCustomHome) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -84,51 +84,51 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra
|
|||
}
|
||||
});
|
||||
|
||||
$scope.renameNote = function(nodeId, nodePath) {
|
||||
$scope.renameNote = function (nodeId, nodePath) {
|
||||
noteActionSrv.renameNote(nodeId, nodePath);
|
||||
};
|
||||
|
||||
$scope.moveNoteToTrash = function(noteId) {
|
||||
$scope.moveNoteToTrash = function (noteId) {
|
||||
noteActionSrv.moveNoteToTrash(noteId, false);
|
||||
};
|
||||
|
||||
$scope.moveFolderToTrash = function(folderId) {
|
||||
$scope.moveFolderToTrash = function (folderId) {
|
||||
noteActionSrv.moveFolderToTrash(folderId);
|
||||
};
|
||||
|
||||
$scope.restoreNote = function(noteId) {
|
||||
$scope.restoreNote = function (noteId) {
|
||||
websocketMsgSrv.restoreNote(noteId);
|
||||
};
|
||||
|
||||
$scope.restoreFolder = function(folderId) {
|
||||
$scope.restoreFolder = function (folderId) {
|
||||
websocketMsgSrv.restoreFolder(folderId);
|
||||
};
|
||||
|
||||
$scope.restoreAll = function() {
|
||||
$scope.restoreAll = function () {
|
||||
noteActionSrv.restoreAll();
|
||||
};
|
||||
|
||||
$scope.renameFolder = function(node) {
|
||||
$scope.renameFolder = function (node) {
|
||||
noteActionSrv.renameFolder(node.id);
|
||||
};
|
||||
|
||||
$scope.removeNote = function(noteId) {
|
||||
$scope.removeNote = function (noteId) {
|
||||
noteActionSrv.removeNote(noteId, false);
|
||||
};
|
||||
|
||||
$scope.removeFolder = function(folderId) {
|
||||
$scope.removeFolder = function (folderId) {
|
||||
noteActionSrv.removeFolder(folderId);
|
||||
};
|
||||
|
||||
$scope.emptyTrash = function() {
|
||||
$scope.emptyTrash = function () {
|
||||
noteActionSrv.emptyTrash();
|
||||
};
|
||||
|
||||
$scope.clearAllParagraphOutput = function(noteId) {
|
||||
$scope.clearAllParagraphOutput = function (noteId) {
|
||||
noteActionSrv.clearAllParagraphOutput(noteId);
|
||||
};
|
||||
|
||||
$scope.isFilterNote = function(note) {
|
||||
$scope.isFilterNote = function (note) {
|
||||
if (!$scope.query.q) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra
|
|||
return false;
|
||||
};
|
||||
|
||||
$scope.getNoteName = function(note) {
|
||||
$scope.getNoteName = function (note) {
|
||||
return arrayOrderingSrv.getNoteName(note);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status';
|
|||
|
||||
angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl);
|
||||
|
||||
function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) {
|
||||
function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) {
|
||||
'ngInject';
|
||||
|
||||
var interpreterSettingsTmp = [];
|
||||
|
|
@ -28,29 +28,29 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
$scope._ = _;
|
||||
ngToast.dismiss();
|
||||
|
||||
$scope.openPermissions = function() {
|
||||
$scope.openPermissions = function () {
|
||||
$scope.showInterpreterAuth = true;
|
||||
};
|
||||
|
||||
$scope.closePermissions = function() {
|
||||
$scope.closePermissions = function () {
|
||||
$scope.showInterpreterAuth = false;
|
||||
};
|
||||
|
||||
var getSelectJson = function() {
|
||||
var getSelectJson = function () {
|
||||
var selectJson = {
|
||||
tags: false,
|
||||
multiple: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
minimumInputLength: 2,
|
||||
ajax: {
|
||||
url: function(params) {
|
||||
url: function (params) {
|
||||
if (!params.term) {
|
||||
return false;
|
||||
}
|
||||
return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term;
|
||||
},
|
||||
delay: 250,
|
||||
processResults: function(data, params) {
|
||||
processResults: function (data, params) {
|
||||
var users = [];
|
||||
if (data.body.users.length !== 0) {
|
||||
for (var i = 0; i < data.body.users.length; i++) {
|
||||
|
|
@ -73,7 +73,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
return selectJson;
|
||||
};
|
||||
|
||||
$scope.togglePermissions = function(intpName) {
|
||||
$scope.togglePermissions = function (intpName) {
|
||||
angular.element('#' + intpName + 'Users').select2(getSelectJson());
|
||||
if ($scope.showInterpreterAuth) {
|
||||
$scope.closePermissions();
|
||||
|
|
@ -82,25 +82,25 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.$on('ngRenderFinished', function(event, data) {
|
||||
$scope.$on('ngRenderFinished', function (event, data) {
|
||||
for (var setting = 0; setting < $scope.interpreterSettings.length; setting++) {
|
||||
angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson());
|
||||
}
|
||||
});
|
||||
|
||||
var getInterpreterSettings = function() {
|
||||
var getInterpreterSettings = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.interpreterSettings = data.body;
|
||||
checkDownloadingDependencies();
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
if (status === 401) {
|
||||
ngToast.danger({
|
||||
content: 'You don\'t have permission on this page',
|
||||
verticalPosition: 'bottom',
|
||||
timeout: '3000'
|
||||
});
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
window.location.replace('/');
|
||||
}, 3000);
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
});
|
||||
};
|
||||
|
||||
var checkDownloadingDependencies = function() {
|
||||
var checkDownloadingDependencies = function () {
|
||||
var isDownloading = false;
|
||||
for (var index = 0; index < $scope.interpreterSettings.length; index++) {
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
|
|
@ -126,7 +126,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
|
||||
if (isDownloading) {
|
||||
$timeout(function() {
|
||||
$timeout(function () {
|
||||
if ($route.current.$$route.originalPath === '/interpreter') {
|
||||
getInterpreterSettings();
|
||||
}
|
||||
|
|
@ -134,32 +134,32 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
var getAvailableInterpreters = function() {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function(data, status, headers, config) {
|
||||
var getAvailableInterpreters = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function (data, status, headers, config) {
|
||||
$scope.availableInterpreters = data.body;
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
};
|
||||
|
||||
var emptyNewProperty = function(object) {
|
||||
var emptyNewProperty = function (object) {
|
||||
angular.extend(object, {propertyValue: '', propertyKey: ''});
|
||||
};
|
||||
|
||||
var emptyNewDependency = function(object) {
|
||||
var emptyNewDependency = function (object) {
|
||||
angular.extend(object, {depArtifact: '', depExclude: ''});
|
||||
};
|
||||
|
||||
var removeTMPSettings = function(index) {
|
||||
var removeTMPSettings = function (index) {
|
||||
interpreterSettingsTmp.splice(index, 1);
|
||||
};
|
||||
|
||||
$scope.copyOriginInterpreterSettingProperties = function(settingId) {
|
||||
$scope.copyOriginInterpreterSettingProperties = function (settingId) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]);
|
||||
};
|
||||
|
||||
$scope.setPerNoteOption = function(settingId, sessionOption) {
|
||||
$scope.setPerNoteOption = function (settingId, sessionOption) {
|
||||
var option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
|
|
@ -184,7 +184,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.setPerUserOption = function(settingId, sessionOption) {
|
||||
$scope.setPerUserOption = function (settingId, sessionOption) {
|
||||
var option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
|
|
@ -209,7 +209,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.getPerNoteOption = function(settingId) {
|
||||
$scope.getPerNoteOption = function (settingId) {
|
||||
var option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
|
|
@ -228,7 +228,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.getPerUserOption = function(settingId) {
|
||||
$scope.getPerUserOption = function (settingId) {
|
||||
var option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
|
|
@ -247,7 +247,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.getInterpreterRunningOption = function(settingId) {
|
||||
$scope.getInterpreterRunningOption = function (settingId) {
|
||||
var sharedModeName = 'shared';
|
||||
|
||||
var globallyModeName = 'Globally';
|
||||
|
|
@ -289,7 +289,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
return globallyModeName;
|
||||
};
|
||||
|
||||
$scope.setInterpreterRunningOption = function(settingId, isPerNoteMode, isPerUserMode) {
|
||||
$scope.setInterpreterRunningOption = function (settingId, isPerNoteMode, isPerUserMode) {
|
||||
var option;
|
||||
if (settingId === undefined) {
|
||||
option = $scope.newInterpreterSetting.option;
|
||||
|
|
@ -302,14 +302,14 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
option.perUser = isPerUserMode;
|
||||
};
|
||||
|
||||
$scope.updateInterpreterSetting = function(form, settingId) {
|
||||
$scope.updateInterpreterSetting = function (form, settingId) {
|
||||
var thisConfirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
title: '',
|
||||
message: 'Do you want to update this interpreter and restart with new settings?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
var setting = $scope.interpreterSettings[index];
|
||||
|
|
@ -353,13 +353,13 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
.html('<i class="fa fa-circle-o-notch fa-spin"></i> Saving Setting');
|
||||
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId, request)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.interpreterSettings[index] = data.body;
|
||||
removeTMPSettings(index);
|
||||
checkDownloadingDependencies();
|
||||
thisConfirm.close();
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
ngToast.danger({content: data.message, verticalPosition: 'bottom'});
|
||||
form.$show();
|
||||
|
|
@ -373,7 +373,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
});
|
||||
};
|
||||
|
||||
$scope.resetInterpreterSetting = function(settingId) {
|
||||
$scope.resetInterpreterSetting = function (settingId) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
|
||||
// Set the old settings back
|
||||
|
|
@ -381,19 +381,19 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
removeTMPSettings(index);
|
||||
};
|
||||
|
||||
$scope.removeInterpreterSetting = function(settingId) {
|
||||
$scope.removeInterpreterSetting = function (settingId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Do you want to delete this interpreter setting?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
$scope.interpreterSettings.splice(index, 1);
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
}
|
||||
|
|
@ -401,7 +401,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
});
|
||||
};
|
||||
|
||||
$scope.newInterpreterGroupChange = function() {
|
||||
$scope.newInterpreterGroupChange = function () {
|
||||
var el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}),
|
||||
'properties');
|
||||
var properties = {};
|
||||
|
|
@ -417,19 +417,19 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
$scope.newInterpreterSetting.properties = properties;
|
||||
};
|
||||
|
||||
$scope.restartInterpreterSetting = function(settingId) {
|
||||
$scope.restartInterpreterSetting = function (settingId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Do you want to restart this interpreter?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
$scope.interpreterSettings[index] = data.body;
|
||||
ngToast.info('Interpreter stopped. Will be lazily started on next run.');
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
var errorMsg = (data !== null) ? data.message : 'Could not connect to server.';
|
||||
console.log('Error %o %o', status, errorMsg);
|
||||
ngToast.danger(errorMsg);
|
||||
|
|
@ -439,7 +439,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
});
|
||||
};
|
||||
|
||||
$scope.addNewInterpreterSetting = function() {
|
||||
$scope.addNewInterpreterSetting = function () {
|
||||
// user input validation on interpreter creation
|
||||
if (!$scope.newInterpreterSetting.name ||
|
||||
!$scope.newInterpreterSetting.name.trim() || !$scope.newInterpreterSetting.group) {
|
||||
|
|
@ -491,23 +491,23 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
request.properties = newProperties;
|
||||
|
||||
$http.post(baseUrlSrv.getRestApiBase() + '/interpreter/setting', request)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.resetNewInterpreterSetting();
|
||||
getInterpreterSettings();
|
||||
$scope.showAddNewSetting = false;
|
||||
checkDownloadingDependencies();
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
ngToast.danger({content: data.message, verticalPosition: 'bottom'});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.cancelInterpreterSetting = function() {
|
||||
$scope.cancelInterpreterSetting = function () {
|
||||
$scope.showAddNewSetting = false;
|
||||
$scope.resetNewInterpreterSetting();
|
||||
};
|
||||
|
||||
$scope.resetNewInterpreterSetting = function() {
|
||||
$scope.resetNewInterpreterSetting = function () {
|
||||
$scope.newInterpreterSetting = {
|
||||
name: undefined,
|
||||
group: undefined,
|
||||
|
|
@ -525,7 +525,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
emptyNewProperty($scope.newInterpreterSetting);
|
||||
};
|
||||
|
||||
$scope.removeInterpreterProperty = function(key, settingId) {
|
||||
$scope.removeInterpreterProperty = function (key, settingId) {
|
||||
if (settingId === undefined) {
|
||||
delete $scope.newInterpreterSetting.properties[key];
|
||||
} else {
|
||||
|
|
@ -534,22 +534,22 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.removeInterpreterDependency = function(artifact, settingId) {
|
||||
$scope.removeInterpreterDependency = function (artifact, settingId) {
|
||||
if (settingId === undefined) {
|
||||
$scope.newInterpreterSetting.dependencies = _.reject($scope.newInterpreterSetting.dependencies,
|
||||
function(el) {
|
||||
function (el) {
|
||||
return el.groupArtifactVersion === artifact;
|
||||
});
|
||||
} else {
|
||||
var index = _.findIndex($scope.interpreterSettings, {'id': settingId});
|
||||
$scope.interpreterSettings[index].dependencies = _.reject($scope.interpreterSettings[index].dependencies,
|
||||
function(el) {
|
||||
function (el) {
|
||||
return el.groupArtifactVersion === artifact;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.addNewInterpreterProperty = function(settingId) {
|
||||
$scope.addNewInterpreterProperty = function (settingId) {
|
||||
if (settingId === undefined) {
|
||||
// Add new property from create form
|
||||
if (!$scope.newInterpreterSetting.propertyKey || $scope.newInterpreterSetting.propertyKey === '') {
|
||||
|
|
@ -573,7 +573,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.addNewInterpreterDependency = function(settingId) {
|
||||
$scope.addNewInterpreterDependency = function (settingId) {
|
||||
if (settingId === undefined) {
|
||||
// Add new dependency from create form
|
||||
if (!$scope.newInterpreterSetting.depArtifact || $scope.newInterpreterSetting.depArtifact === '') {
|
||||
|
|
@ -624,7 +624,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.resetNewRepositorySetting = function() {
|
||||
$scope.resetNewRepositorySetting = function () {
|
||||
$scope.newRepoSetting = {
|
||||
id: '',
|
||||
url: '',
|
||||
|
|
@ -639,40 +639,40 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
};
|
||||
};
|
||||
|
||||
var getRepositories = function() {
|
||||
var getRepositories = function () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/repository')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.repositories = data.body;
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addNewRepository = function() {
|
||||
$scope.addNewRepository = function () {
|
||||
var request = angular.copy($scope.newRepoSetting);
|
||||
|
||||
$http.post(baseUrlSrv.getRestApiBase() + '/interpreter/repository', request)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
getRepositories();
|
||||
$scope.resetNewRepositorySetting();
|
||||
angular.element('#repoModal').modal('hide');
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', headers, config);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeRepository = function(repoId) {
|
||||
$scope.removeRepository = function (repoId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Do you want to delete this repository?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/repository/' + repoId)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
var index = _.findIndex($scope.repositories, {'id': repoId});
|
||||
$scope.repositories.splice(index, 1);
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
}
|
||||
|
|
@ -680,7 +680,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
});
|
||||
};
|
||||
|
||||
$scope.isDefaultRepository = function(repoId) {
|
||||
$scope.isDefaultRepository = function (repoId) {
|
||||
if (repoId === 'central' || repoId === 'local') {
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -688,14 +688,14 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.showErrorMessage = function(setting) {
|
||||
$scope.showErrorMessage = function (setting) {
|
||||
BootstrapDialog.show({
|
||||
title: 'Error downloading dependencies',
|
||||
message: setting.errorReason
|
||||
});
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
var init = function () {
|
||||
$scope.resetNewInterpreterSetting();
|
||||
$scope.resetNewRepositorySetting();
|
||||
|
||||
|
|
@ -704,9 +704,9 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
getRepositories();
|
||||
};
|
||||
|
||||
$scope.showSparkUI = function(settingId) {
|
||||
$scope.showSparkUI = function (settingId) {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/interpreter/getmetainfos/' + settingId + '?propName=url')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
var url = data.body.url;
|
||||
if (!url) {
|
||||
BootstrapDialog.alert({
|
||||
|
|
@ -715,7 +715,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou
|
|||
return;
|
||||
}
|
||||
window.open(url, '_blank');
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
angular.module('zeppelinWebApp').filter('sortByKey', sortByKey);
|
||||
|
||||
function sortByKey() {
|
||||
return function(properties) {
|
||||
function sortByKey () {
|
||||
return function (properties) {
|
||||
var sortedKeys = properties ? Object.keys(properties) : [];
|
||||
return sortedKeys.sort();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,29 +15,29 @@
|
|||
angular.module('zeppelinWebApp')
|
||||
.controller('JobmanagerCtrl', JobmanagerCtrl);
|
||||
|
||||
function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeout, jobManagerFilter) {
|
||||
function JobmanagerCtrl ($scope, websocketMsgSrv, $interval, ngToast, $q, $timeout, jobManagerFilter) {
|
||||
'ngInject';
|
||||
|
||||
ngToast.dismiss();
|
||||
var asyncNotebookJobFilter = function(jobInfomations, filterConfig) {
|
||||
return $q(function(resolve, reject) {
|
||||
var asyncNotebookJobFilter = function (jobInfomations, filterConfig) {
|
||||
return $q(function (resolve, reject) {
|
||||
$scope.JobInfomationsByFilter = $scope.jobTypeFilter(jobInfomations, filterConfig);
|
||||
resolve($scope.JobInfomationsByFilter);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.doFiltering = function(jobInfomations, filterConfig) {
|
||||
$scope.doFiltering = function (jobInfomations, filterConfig) {
|
||||
asyncNotebookJobFilter(jobInfomations, filterConfig).then(
|
||||
function() {
|
||||
function () {
|
||||
// success
|
||||
$scope.isLoadingFilter = false;
|
||||
},
|
||||
function() {
|
||||
function () {
|
||||
// failed
|
||||
});
|
||||
};
|
||||
|
||||
$scope.filterValueToName = function(filterValue, maxStringLength) {
|
||||
$scope.filterValueToName = function (filterValue, maxStringLength) {
|
||||
if ($scope.activeInterpreters === undefined) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -52,26 +52,26 @@ function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.setFilterValue = function(filterValue) {
|
||||
$scope.setFilterValue = function (filterValue) {
|
||||
$scope.filterConfig.filterValueInterpreter = filterValue;
|
||||
$scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
|
||||
};
|
||||
|
||||
$scope.onChangeRunJobToAlwaysTopToggle = function() {
|
||||
$scope.onChangeRunJobToAlwaysTopToggle = function () {
|
||||
$scope.filterConfig.isRunningAlwaysTop = !$scope.filterConfig.isRunningAlwaysTop;
|
||||
$scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
|
||||
};
|
||||
|
||||
$scope.onChangeSortAsc = function() {
|
||||
$scope.onChangeSortAsc = function () {
|
||||
$scope.filterConfig.isSortByAsc = !$scope.filterConfig.isSortByAsc;
|
||||
$scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
|
||||
};
|
||||
|
||||
$scope.doFilterInputTyping = function(keyEvent, jobInfomations, filterConfig) {
|
||||
$scope.doFilterInputTyping = function (keyEvent, jobInfomations, filterConfig) {
|
||||
var RETURN_KEY_CODE = 13;
|
||||
$timeout.cancel($scope.dofilterTimeoutObject);
|
||||
$scope.isActiveSearchTimer = true;
|
||||
$scope.dofilterTimeoutObject = $timeout(function() {
|
||||
$scope.dofilterTimeoutObject = $timeout(function () {
|
||||
$scope.doFiltering(jobInfomations, filterConfig);
|
||||
$scope.isActiveSearchTimer = false;
|
||||
}, 10000);
|
||||
|
|
@ -82,13 +82,13 @@ function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeou
|
|||
}
|
||||
};
|
||||
|
||||
$scope.doForceFilterInputTyping = function(keyEvent, jobInfomations, filterConfig) {
|
||||
$scope.doForceFilterInputTyping = function (keyEvent, jobInfomations, filterConfig) {
|
||||
$timeout.cancel($scope.dofilterTimeoutObject);
|
||||
$scope.doFiltering(jobInfomations, filterConfig);
|
||||
$scope.isActiveSearchTimer = false;
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.init = function () {
|
||||
$scope.isLoadingFilter = true;
|
||||
$scope.jobInfomations = [];
|
||||
$scope.JobInfomationsByFilter = $scope.jobInfomations;
|
||||
|
|
@ -111,7 +111,7 @@ function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeou
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
$scope.$on('$destroy', function () {
|
||||
websocketMsgSrv.unsubscribeJobManager();
|
||||
});
|
||||
};
|
||||
|
|
@ -120,7 +120,7 @@ function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeou
|
|||
** $scope.$on functions below
|
||||
*/
|
||||
|
||||
$scope.$on('setNoteJobs', function(event, responseData) {
|
||||
$scope.$on('setNoteJobs', function (event, responseData) {
|
||||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
$scope.jobInfomations = responseData.jobs;
|
||||
$scope.jobInfomationsIndexs = $scope.jobInfomations ? _.indexBy($scope.jobInfomations, 'noteId') : {};
|
||||
|
|
@ -141,12 +141,12 @@ function JobmanagerCtrl($scope, websocketMsgSrv, $interval, ngToast, $q, $timeou
|
|||
$scope.doFiltering($scope.jobInfomations, $scope.filterConfig);
|
||||
});
|
||||
|
||||
$scope.$on('setUpdateNoteJobs', function(event, responseData) {
|
||||
$scope.$on('setUpdateNoteJobs', function (event, responseData) {
|
||||
var jobInfomations = $scope.jobInfomations;
|
||||
var indexStore = $scope.jobInfomationsIndexs;
|
||||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
var notes = responseData.jobs;
|
||||
notes.map(function(changedItem) {
|
||||
notes.map(function (changedItem) {
|
||||
if (indexStore[changedItem.noteId] === undefined) {
|
||||
var newItem = angular.copy(changedItem);
|
||||
jobInfomations.push(newItem);
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
|
||||
angular.module('zeppelinWebApp').filter('jobManager', jobManagerFilter);
|
||||
|
||||
function jobManagerFilter() {
|
||||
function filterContext(jobItems, filterConfig) {
|
||||
function jobManagerFilter () {
|
||||
function filterContext (jobItems, filterConfig) {
|
||||
var filterValueInterpreter = filterConfig.filterValueInterpreter;
|
||||
var filterValueNotebookName = filterConfig.filterValueNotebookName;
|
||||
var isSortByAsc = filterConfig.isSortByAsc;
|
||||
var filterItems = jobItems;
|
||||
|
||||
if (filterValueInterpreter === undefined) {
|
||||
filterItems = _.filter(filterItems, function(jobItem) {
|
||||
filterItems = _.filter(filterItems, function (jobItem) {
|
||||
return jobItem.interpreter === undefined ? true : false;
|
||||
});
|
||||
} else if (filterValueInterpreter !== '*') {
|
||||
|
|
@ -30,14 +30,14 @@ function jobManagerFilter() {
|
|||
}
|
||||
|
||||
if (filterValueNotebookName !== '') {
|
||||
filterItems = _.filter(filterItems, function(jobItem) {
|
||||
filterItems = _.filter(filterItems, function (jobItem) {
|
||||
var lowerFilterValue = filterValueNotebookName.toLocaleLowerCase();
|
||||
var lowerNotebookName = jobItem.noteName.toLocaleLowerCase();
|
||||
return lowerNotebookName.match(new RegExp('.*' + lowerFilterValue + '.*'));
|
||||
});
|
||||
}
|
||||
|
||||
filterItems = _.sortBy(filterItems, function(sortItem) {
|
||||
filterItems = _.sortBy(filterItems, function (sortItem) {
|
||||
return sortItem.noteName.toLowerCase();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ import { ParagraphStatus, } from '../../notebook/paragraph/paragraph.status';
|
|||
|
||||
angular.module('zeppelinWebApp').controller('JobCtrl', JobCtrl);
|
||||
|
||||
function JobCtrl($scope, $http, baseUrlSrv) {
|
||||
function JobCtrl ($scope, $http, baseUrlSrv) {
|
||||
'ngInject';
|
||||
|
||||
$scope.init = function(jobInformation) {
|
||||
$scope.init = function (jobInformation) {
|
||||
$scope.progressValue = 0;
|
||||
};
|
||||
|
||||
$scope.getProgress = function() {
|
||||
$scope.getProgress = function () {
|
||||
var statusList = _.pluck($scope.notebookJob.paragraphs, 'status');
|
||||
var runningJob = _.countBy(statusList, function(status) {
|
||||
var runningJob = _.countBy(statusList, function (status) {
|
||||
if (status === ParagraphStatus.RUNNING || status === ParagraphStatus.FINISHED) {
|
||||
return 'matchCount';
|
||||
} else {
|
||||
|
|
@ -38,12 +38,12 @@ function JobCtrl($scope, $http, baseUrlSrv) {
|
|||
return isNaN(result) ? 0 : result;
|
||||
};
|
||||
|
||||
$scope.runNotebookJob = function(notebookId) {
|
||||
$scope.runNotebookJob = function (notebookId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Run all paragraphs?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$http({
|
||||
method: 'POST',
|
||||
|
|
@ -51,9 +51,9 @@ function JobCtrl($scope, $http, baseUrlSrv) {
|
|||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}).then(function successCallback(response) {
|
||||
}).then(function successCallback (response) {
|
||||
// success
|
||||
}, function errorCallback(errorResponse) {
|
||||
}, function errorCallback (errorResponse) {
|
||||
var errorText = 'SERVER ERROR';
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
if (!!errorResponse.data.message) {
|
||||
|
|
@ -70,12 +70,12 @@ function JobCtrl($scope, $http, baseUrlSrv) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.stopNotebookJob = function(notebookId) {
|
||||
$scope.stopNotebookJob = function (notebookId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Stop all paragraphs?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$http({
|
||||
method: 'DELETE',
|
||||
|
|
@ -83,9 +83,9 @@ function JobCtrl($scope, $http, baseUrlSrv) {
|
|||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}).then(function successCallback(response) {
|
||||
}).then(function successCallback (response) {
|
||||
// success
|
||||
}, function errorCallback(errorResponse) {
|
||||
}, function errorCallback (errorResponse) {
|
||||
var errorText = 'SERVER ERROR';
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
if (!!errorResponse.data.message) {
|
||||
|
|
@ -102,7 +102,7 @@ function JobCtrl($scope, $http, baseUrlSrv) {
|
|||
});
|
||||
};
|
||||
|
||||
$scope.lastExecuteTime = function(unixtime) {
|
||||
$scope.lastExecuteTime = function (unixtime) {
|
||||
return moment.unix(unixtime / 1000).fromNow();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { isParagraphRunning, } from './paragraph/paragraph.status';
|
|||
|
||||
angular.module('zeppelinWebApp').controller('NotebookCtrl', NotebookCtrl);
|
||||
|
||||
function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
||||
function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
|
||||
$http, websocketMsgSrv, baseUrlSrv, $timeout, saveAsService,
|
||||
ngToast, noteActionSrv, noteVarShareService, TRASH_FOLDER_ID,
|
||||
heliumService) {
|
||||
|
|
@ -48,7 +48,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.saveTimer = null;
|
||||
|
||||
var connectedOnce = false;
|
||||
var isRevisionPath = function(path) {
|
||||
var isRevisionPath = function (path) {
|
||||
var pattern = new RegExp('^.*\/notebook\/[a-zA-Z0-9_]*\/revision\/[a-zA-Z0-9_]*');
|
||||
return pattern.test(path);
|
||||
};
|
||||
|
|
@ -57,14 +57,14 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.currentRevision = 'Head';
|
||||
$scope.revisionView = isRevisionPath($location.path());
|
||||
|
||||
$scope.$on('setConnectedStatus', function(event, param) {
|
||||
$scope.$on('setConnectedStatus', function (event, param) {
|
||||
if (connectedOnce && param) {
|
||||
initNotebook();
|
||||
}
|
||||
connectedOnce = true;
|
||||
});
|
||||
|
||||
$scope.getCronOptionNameFromValue = function(value) {
|
||||
$scope.getCronOptionNameFromValue = function (value) {
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
return value;
|
||||
};
|
||||
|
||||
$scope.blockAnonUsers = function() {
|
||||
$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.' +
|
||||
|
|
@ -92,7 +92,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
message: content,
|
||||
buttons: [{
|
||||
label: 'Close',
|
||||
action: function(dialog) {
|
||||
action: function (dialog) {
|
||||
dialog.close();
|
||||
}
|
||||
}]
|
||||
|
|
@ -100,7 +100,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
/** Init the new controller */
|
||||
var initNotebook = function() {
|
||||
var initNotebook = function () {
|
||||
noteVarShareService.clear();
|
||||
if ($routeParams.revisionId) {
|
||||
websocketMsgSrv.getNoteByRevision($routeParams.noteId, $routeParams.revisionId);
|
||||
|
|
@ -111,7 +111,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
var currentRoute = $route.current;
|
||||
if (currentRoute) {
|
||||
setTimeout(
|
||||
function() {
|
||||
function () {
|
||||
var routeParams = currentRoute.params;
|
||||
var $id = angular.element('#' + routeParams.paragraph + '_container');
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
|
||||
initNotebook();
|
||||
|
||||
$scope.focusParagraphOnClick = function(clickEvent) {
|
||||
$scope.focusParagraphOnClick = function (clickEvent) {
|
||||
if (!$scope.note) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
// register mouseevent handler for focus paragraph
|
||||
document.addEventListener('click', $scope.focusParagraphOnClick);
|
||||
|
||||
$scope.keyboardShortcut = function(keyEvent) {
|
||||
$scope.keyboardShortcut = function (keyEvent) {
|
||||
// handle keyevent
|
||||
if (!$scope.viewOnly && !$scope.revisionView) {
|
||||
$scope.$broadcast('keyEvent', keyEvent);
|
||||
|
|
@ -154,37 +154,37 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
// register mouseevent handler for focus paragraph
|
||||
document.addEventListener('keydown', $scope.keyboardShortcut);
|
||||
|
||||
$scope.paragraphOnDoubleClick = function(paragraphId) {
|
||||
$scope.paragraphOnDoubleClick = function (paragraphId) {
|
||||
$scope.$broadcast('doubleClickParagraph', paragraphId);
|
||||
};
|
||||
|
||||
// Move the note to trash and go back to the main page
|
||||
$scope.moveNoteToTrash = function(noteId) {
|
||||
$scope.moveNoteToTrash = function (noteId) {
|
||||
noteActionSrv.moveNoteToTrash(noteId, true);
|
||||
};
|
||||
|
||||
// Remove the note permanently if it's in the trash
|
||||
$scope.removeNote = function(noteId) {
|
||||
$scope.removeNote = function (noteId) {
|
||||
noteActionSrv.removeNote(noteId, true);
|
||||
};
|
||||
|
||||
$scope.isTrash = function(note) {
|
||||
$scope.isTrash = function (note) {
|
||||
return note ? note.name.split('/')[0] === TRASH_FOLDER_ID : false;
|
||||
};
|
||||
|
||||
// Export notebook
|
||||
$scope.exportNote = function() {
|
||||
$scope.exportNote = function () {
|
||||
var jsonContent = JSON.stringify($scope.note);
|
||||
saveAsService.saveAs(jsonContent, $scope.note.name, 'json');
|
||||
};
|
||||
|
||||
// Clone note
|
||||
$scope.cloneNote = function(noteId) {
|
||||
$scope.cloneNote = function (noteId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Do you want to clone this note?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.cloneNote(noteId);
|
||||
$location.path('/');
|
||||
|
|
@ -194,12 +194,12 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
// checkpoint/commit notebook
|
||||
$scope.checkpointNote = function(commitMessage) {
|
||||
$scope.checkpointNote = function (commitMessage) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Commit note to current repository?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.checkpointNote($routeParams.noteId, commitMessage);
|
||||
}
|
||||
|
|
@ -209,12 +209,12 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
// set notebook head to given revision
|
||||
$scope.setNoteRevision = function() {
|
||||
$scope.setNoteRevision = function () {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Set notebook head to current revision?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.setNoteRevision($routeParams.noteId, $routeParams.revisionId);
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on('listRevisionHistory', function(event, data) {
|
||||
$scope.$on('listRevisionHistory', function (event, data) {
|
||||
console.log('received list of revisions %o', data);
|
||||
$scope.noteRevisions = data.revisionList;
|
||||
$scope.noteRevisions.splice(0, 0, {
|
||||
|
|
@ -237,7 +237,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('noteRevision', function(event, data) {
|
||||
$scope.$on('noteRevision', function (event, data) {
|
||||
console.log('received note revision %o', data);
|
||||
if (data.note) {
|
||||
$scope.note = data.note;
|
||||
|
|
@ -247,14 +247,14 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('setNoteRevisionResult', function(event, data) {
|
||||
$scope.$on('setNoteRevisionResult', function (event, data) {
|
||||
console.log('received set note revision result %o', data);
|
||||
if (data.status) {
|
||||
$location.path('/notebook/' + $routeParams.noteId);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.visitRevision = function(revision) {
|
||||
$scope.visitRevision = function (revision) {
|
||||
if (revision.id) {
|
||||
if (revision.id === 'Head') {
|
||||
$location.path('/notebook/' + $routeParams.noteId);
|
||||
|
|
@ -269,12 +269,12 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
$scope.runAllParagraphs = function(noteId) {
|
||||
$scope.runAllParagraphs = function (noteId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Run all paragraphs?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
const paragraphs = $scope.note.paragraphs.map(p => {
|
||||
return {
|
||||
|
|
@ -291,9 +291,9 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.saveNote = function() {
|
||||
$scope.saveNote = function () {
|
||||
if ($scope.note && $scope.note.paragraphs) {
|
||||
_.forEach($scope.note.paragraphs, function(par) {
|
||||
_.forEach($scope.note.paragraphs, function (par) {
|
||||
angular
|
||||
.element('#' + par.id + '_paragraphColumn_main')
|
||||
.scope()
|
||||
|
|
@ -303,11 +303,11 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
$scope.clearAllParagraphOutput = function(noteId) {
|
||||
$scope.clearAllParagraphOutput = function (noteId) {
|
||||
noteActionSrv.clearAllParagraphOutput(noteId);
|
||||
};
|
||||
|
||||
$scope.toggleAllEditor = function() {
|
||||
$scope.toggleAllEditor = function () {
|
||||
if ($scope.editorToggled) {
|
||||
$scope.$broadcast('openEditor');
|
||||
} else {
|
||||
|
|
@ -316,15 +316,15 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.editorToggled = !$scope.editorToggled;
|
||||
};
|
||||
|
||||
$scope.showAllEditor = function() {
|
||||
$scope.showAllEditor = function () {
|
||||
$scope.$broadcast('openEditor');
|
||||
};
|
||||
|
||||
$scope.hideAllEditor = function() {
|
||||
$scope.hideAllEditor = function () {
|
||||
$scope.$broadcast('closeEditor');
|
||||
};
|
||||
|
||||
$scope.toggleAllTable = function() {
|
||||
$scope.toggleAllTable = function () {
|
||||
if ($scope.tableToggled) {
|
||||
$scope.$broadcast('openTable');
|
||||
} else {
|
||||
|
|
@ -333,18 +333,18 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.tableToggled = !$scope.tableToggled;
|
||||
};
|
||||
|
||||
$scope.showAllTable = function() {
|
||||
$scope.showAllTable = function () {
|
||||
$scope.$broadcast('openTable');
|
||||
};
|
||||
|
||||
$scope.hideAllTable = function() {
|
||||
$scope.hideAllTable = function () {
|
||||
$scope.$broadcast('closeTable');
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {boolean} true if one more paragraphs are running. otherwise return false.
|
||||
*/
|
||||
$scope.isNoteRunning = function() {
|
||||
$scope.isNoteRunning = function () {
|
||||
if (!$scope.note) { return false; }
|
||||
|
||||
for (let i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
|
|
@ -356,28 +356,28 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
return false;
|
||||
};
|
||||
|
||||
$scope.killSaveTimer = function() {
|
||||
$scope.killSaveTimer = function () {
|
||||
if ($scope.saveTimer) {
|
||||
$timeout.cancel($scope.saveTimer);
|
||||
$scope.saveTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.startSaveTimer = function() {
|
||||
$scope.startSaveTimer = function () {
|
||||
$scope.killSaveTimer();
|
||||
$scope.isNoteDirty = true;
|
||||
// console.log('startSaveTimer called ' + $scope.note.id);
|
||||
$scope.saveTimer = $timeout(function() {
|
||||
$scope.saveTimer = $timeout(function () {
|
||||
$scope.saveNote();
|
||||
}, 10000);
|
||||
};
|
||||
|
||||
angular.element(window).on('beforeunload', function(e) {
|
||||
angular.element(window).on('beforeunload', function (e) {
|
||||
$scope.killSaveTimer();
|
||||
$scope.saveNote();
|
||||
});
|
||||
|
||||
$scope.setLookAndFeel = function(looknfeel) {
|
||||
$scope.setLookAndFeel = function (looknfeel) {
|
||||
$scope.note.config.looknfeel = looknfeel;
|
||||
if ($scope.revisionView === true) {
|
||||
$rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel);
|
||||
|
|
@ -387,7 +387,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
/** Set cron expression for this note **/
|
||||
$scope.setCronScheduler = function(cronExpr) {
|
||||
$scope.setCronScheduler = function (cronExpr) {
|
||||
if (cronExpr) {
|
||||
if (!$scope.note.config.cronExecutingUser) {
|
||||
$scope.note.config.cronExecutingUser = $rootScope.ticket.principal;
|
||||
|
|
@ -400,19 +400,19 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
/** Set the username of the user to be used to execute all notes in notebook **/
|
||||
$scope.setCronExecutingUser = function(cronExecutingUser) {
|
||||
$scope.setCronExecutingUser = function (cronExecutingUser) {
|
||||
$scope.note.config.cronExecutingUser = cronExecutingUser;
|
||||
$scope.setConfig();
|
||||
};
|
||||
|
||||
/** Set release resource for this note **/
|
||||
$scope.setReleaseResource = function(value) {
|
||||
$scope.setReleaseResource = function (value) {
|
||||
$scope.note.config.releaseresource = value;
|
||||
$scope.setConfig();
|
||||
};
|
||||
|
||||
/** Update note config **/
|
||||
$scope.setConfig = function(config) {
|
||||
$scope.setConfig = function (config) {
|
||||
if (config) {
|
||||
$scope.note.config = config;
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
};
|
||||
|
||||
/** Update the note name */
|
||||
$scope.updateNoteName = function(newName) {
|
||||
$scope.updateNoteName = function (newName) {
|
||||
const trimmedNewName = newName.trim();
|
||||
if (trimmedNewName.length > 0 && $scope.note.name !== trimmedNewName) {
|
||||
$scope.note.name = trimmedNewName;
|
||||
|
|
@ -428,7 +428,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var initializeLookAndFeel = function() {
|
||||
var initializeLookAndFeel = function () {
|
||||
if (!$scope.note.config.looknfeel) {
|
||||
$scope.note.config.looknfeel = 'default';
|
||||
} else {
|
||||
|
|
@ -441,7 +441,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$rootScope.$broadcast('setLookAndFeel', $scope.note.config.looknfeel);
|
||||
};
|
||||
|
||||
var cleanParagraphExcept = function(paragraphId, note) {
|
||||
var cleanParagraphExcept = function (paragraphId, note) {
|
||||
var noteCopy = {};
|
||||
noteCopy.id = note.id;
|
||||
noteCopy.name = note.name;
|
||||
|
|
@ -462,9 +462,9 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
return noteCopy;
|
||||
};
|
||||
|
||||
var addPara = function(paragraph, index) {
|
||||
var addPara = function (paragraph, index) {
|
||||
$scope.note.paragraphs.splice(index, 0, paragraph);
|
||||
_.each($scope.note.paragraphs, function(para) {
|
||||
_.each($scope.note.paragraphs, function (para) {
|
||||
if (para.id === paragraph.id) {
|
||||
para.focus = true;
|
||||
$scope.$broadcast('focusParagraph', para.id, 0, false);
|
||||
|
|
@ -472,9 +472,9 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
};
|
||||
|
||||
var removePara = function(paragraphId) {
|
||||
var removePara = function (paragraphId) {
|
||||
var removeIdx;
|
||||
_.each($scope.note.paragraphs, function(para, idx) {
|
||||
_.each($scope.note.paragraphs, function (para, idx) {
|
||||
if (para.id === paragraphId) {
|
||||
removeIdx = idx;
|
||||
}
|
||||
|
|
@ -482,28 +482,28 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
return $scope.note.paragraphs.splice(removeIdx, 1);
|
||||
};
|
||||
|
||||
$scope.$on('addParagraph', function(event, paragraph, index) {
|
||||
$scope.$on('addParagraph', function (event, paragraph, index) {
|
||||
if ($scope.paragraphUrl) {
|
||||
return;
|
||||
}
|
||||
addPara(paragraph, index);
|
||||
});
|
||||
|
||||
$scope.$on('removeParagraph', function(event, paragraphId) {
|
||||
$scope.$on('removeParagraph', function (event, paragraphId) {
|
||||
if ($scope.paragraphUrl) {
|
||||
return;
|
||||
}
|
||||
removePara(paragraphId);
|
||||
});
|
||||
|
||||
$scope.$on('moveParagraph', function(event, paragraphId, newIdx) {
|
||||
$scope.$on('moveParagraph', function (event, paragraphId, newIdx) {
|
||||
var removedPara = removePara(paragraphId);
|
||||
if (removedPara && removedPara.length === 1) {
|
||||
addPara(removedPara[0], newIdx);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('updateNote', function(event, name, config, info) {
|
||||
$scope.$on('updateNote', function (event, name, config, info) {
|
||||
/** update Note name */
|
||||
if (name !== $scope.note.name) {
|
||||
console.log('change note name to : %o', $scope.note.name);
|
||||
|
|
@ -514,11 +514,11 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
initializeLookAndFeel();
|
||||
});
|
||||
|
||||
var getInterpreterBindings = function() {
|
||||
var getInterpreterBindings = function () {
|
||||
websocketMsgSrv.getInterpreterBindings($scope.note.id);
|
||||
};
|
||||
|
||||
$scope.$on('interpreterBindings', function(event, data) {
|
||||
$scope.$on('interpreterBindings', function (event, data) {
|
||||
$scope.interpreterBindings = data.interpreterBindings;
|
||||
$scope.interpreterBindingsOrig = angular.copy($scope.interpreterBindings); // to check dirty
|
||||
|
||||
|
|
@ -549,25 +549,25 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
|
||||
$scope.interpreterSelectionListeners = {
|
||||
accept: function(sourceItemHandleScope, destSortableScope) { return true; },
|
||||
itemMoved: function(event) {},
|
||||
orderChanged: function(event) {}
|
||||
accept: function (sourceItemHandleScope, destSortableScope) { return true; },
|
||||
itemMoved: function (event) {},
|
||||
orderChanged: function (event) {}
|
||||
};
|
||||
|
||||
$scope.openSetting = function() {
|
||||
$scope.openSetting = function () {
|
||||
$scope.showSetting = true;
|
||||
getInterpreterBindings();
|
||||
};
|
||||
|
||||
$scope.closeSetting = function() {
|
||||
$scope.closeSetting = function () {
|
||||
if (isSettingDirty()) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Interpreter setting changes will be discarded.',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$scope.$apply(function() {
|
||||
$scope.$apply(function () {
|
||||
$scope.showSetting = false;
|
||||
});
|
||||
}
|
||||
|
|
@ -578,7 +578,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
$scope.saveSetting = function() {
|
||||
$scope.saveSetting = function () {
|
||||
var selectedSettingIds = [];
|
||||
for (var no in $scope.interpreterBindings) {
|
||||
var setting = $scope.interpreterBindings[no];
|
||||
|
|
@ -589,7 +589,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
websocketMsgSrv.saveInterpreterBindings($scope.note.id, selectedSettingIds);
|
||||
console.log('Interpreter bindings %o saved', selectedSettingIds);
|
||||
|
||||
_.forEach($scope.note.paragraphs, function(n, key) {
|
||||
_.forEach($scope.note.paragraphs, function (n, key) {
|
||||
var regExp = /^\s*%/g;
|
||||
if (n.text && !regExp.exec(n.text)) {
|
||||
$scope.$broadcast('saveInterpreterBindings', n.id);
|
||||
|
|
@ -599,7 +599,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.showSetting = false;
|
||||
};
|
||||
|
||||
$scope.toggleSetting = function() {
|
||||
$scope.toggleSetting = function () {
|
||||
if ($scope.showSetting) {
|
||||
$scope.closeSetting();
|
||||
} else {
|
||||
|
|
@ -609,23 +609,23 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var getPermissions = function(callback) {
|
||||
var getPermissions = function (callback) {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/notebook/' + $scope.note.id + '/permissions')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.permissions = data.body;
|
||||
$scope.permissionsOrig = angular.copy($scope.permissions); // to check dirty
|
||||
|
||||
var selectJson = {
|
||||
tokenSeparators: [',', ' '],
|
||||
ajax: {
|
||||
url: function(params) {
|
||||
url: function (params) {
|
||||
if (!params.term) {
|
||||
return false;
|
||||
}
|
||||
return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term;
|
||||
},
|
||||
delay: 250,
|
||||
processResults: function(data, params) {
|
||||
processResults: function (data, params) {
|
||||
var results = [];
|
||||
|
||||
if (data.body.users.length !== 0) {
|
||||
|
|
@ -676,27 +676,27 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
callback();
|
||||
}
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
if (status !== 0) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openPermissions = function() {
|
||||
$scope.openPermissions = function () {
|
||||
$scope.showPermissions = true;
|
||||
getPermissions();
|
||||
};
|
||||
|
||||
$scope.closePermissions = function() {
|
||||
$scope.closePermissions = function () {
|
||||
if (isPermissionsDirty()) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Changes will be discarded.',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$scope.$apply(function() {
|
||||
$scope.$apply(function () {
|
||||
$scope.showPermissions = false;
|
||||
});
|
||||
}
|
||||
|
|
@ -707,7 +707,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
function convertPermissionsToArray() {
|
||||
function convertPermissionsToArray () {
|
||||
$scope.permissions.owners = angular.element('#selectOwners').val();
|
||||
$scope.permissions.readers = angular.element('#selectReaders').val();
|
||||
$scope.permissions.writers = angular.element('#selectWriters').val();
|
||||
|
|
@ -736,7 +736,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
var index = _.findIndex($scope.interpreterSettings, {'id': interpreter.id});
|
||||
$scope.interpreterSettings[index] = data.body;
|
||||
thisConfirm.close();
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
thisConfirm.close();
|
||||
console.log('Error %o %o', status, data.message);
|
||||
BootstrapDialog.show({
|
||||
|
|
@ -750,12 +750,12 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.savePermissions = function() {
|
||||
$scope.savePermissions = function () {
|
||||
convertPermissionsToArray();
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/notebook/' + $scope.note.id + '/permissions',
|
||||
$scope.permissions, {withCredentials: true})
|
||||
.success(function(data, status, headers, config) {
|
||||
getPermissions(function() {
|
||||
.success(function (data, status, headers, config) {
|
||||
getPermissions(function () {
|
||||
console.log('Note permissions %o saved', $scope.permissions);
|
||||
BootstrapDialog.alert({
|
||||
closable: true,
|
||||
|
|
@ -766,7 +766,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.showPermissions = false;
|
||||
});
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
.error(function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
BootstrapDialog.show({
|
||||
closable: false,
|
||||
|
|
@ -777,7 +777,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
buttons: [
|
||||
{
|
||||
label: 'Login',
|
||||
action: function(dialog) {
|
||||
action: function (dialog) {
|
||||
dialog.close();
|
||||
angular.element('#loginModal').modal({
|
||||
show: 'true'
|
||||
|
|
@ -786,7 +786,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
},
|
||||
{
|
||||
label: 'Cancel',
|
||||
action: function(dialog) {
|
||||
action: function (dialog) {
|
||||
dialog.close();
|
||||
$location.path('/');
|
||||
}
|
||||
|
|
@ -796,7 +796,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
});
|
||||
};
|
||||
|
||||
$scope.togglePermissions = function() {
|
||||
$scope.togglePermissions = function () {
|
||||
var principal = $rootScope.ticket.principal;
|
||||
$scope.isAnonymous = principal === 'anonymous' ? true : false;
|
||||
if (!!principal && $scope.isAnonymous) {
|
||||
|
|
@ -814,7 +814,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
$scope.setIamOwner = function() {
|
||||
$scope.setIamOwner = function () {
|
||||
if ($scope.permissions.owners.length > 0 &&
|
||||
_.indexOf($scope.permissions.owners, $rootScope.ticket.principal) < 0) {
|
||||
$scope.isOwner = false;
|
||||
|
|
@ -824,17 +824,17 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
return true;
|
||||
};
|
||||
|
||||
$scope.toggleNotePersonalizedMode = function() {
|
||||
$scope.toggleNotePersonalizedMode = function () {
|
||||
var personalizedMode = $scope.note.config.personalizedMode;
|
||||
if ($scope.isOwner) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: 'Setting the result display',
|
||||
message: function(dialog) {
|
||||
message: function (dialog) {
|
||||
var modeText = $scope.note.config.personalizedMode === 'true' ? 'collaborate' : 'personalize';
|
||||
return 'Do you want to <span class="text-info">' + modeText + '</span> your analysis?';
|
||||
},
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
if ($scope.note.config.personalizedMode === undefined) {
|
||||
$scope.note.config.personalizedMode = 'false';
|
||||
|
|
@ -847,7 +847,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
var isSettingDirty = function() {
|
||||
var 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() {
|
||||
var isPermissionsDirty = function () {
|
||||
if (angular.equals($scope.permissions, $scope.permissionsOrig)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -863,7 +863,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
};
|
||||
|
||||
angular.element(document).click(function() {
|
||||
angular.element(document).click(function () {
|
||||
angular.element('.ace_autocomplete').hide();
|
||||
});
|
||||
|
||||
|
|
@ -871,14 +871,14 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
** $scope.$on functions below
|
||||
*/
|
||||
|
||||
$scope.$on('setConnectedStatus', function(event, param) {
|
||||
$scope.$on('setConnectedStatus', function (event, param) {
|
||||
if (connectedOnce && param) {
|
||||
initNotebook();
|
||||
}
|
||||
connectedOnce = true;
|
||||
});
|
||||
|
||||
$scope.$on('moveParagraphUp', function(event, paragraph) {
|
||||
$scope.$on('moveParagraphUp', function (event, paragraph) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
if ($scope.note.paragraphs[i].id === paragraph.id) {
|
||||
|
|
@ -902,7 +902,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
websocketMsgSrv.moveParagraph(paragraph.id, newIndex);
|
||||
});
|
||||
|
||||
$scope.$on('moveParagraphDown', function(event, paragraph) {
|
||||
$scope.$on('moveParagraphDown', function (event, paragraph) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
if ($scope.note.paragraphs[i].id === paragraph.id) {
|
||||
|
|
@ -927,7 +927,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
websocketMsgSrv.moveParagraph(paragraph.id, newIndex);
|
||||
});
|
||||
|
||||
$scope.$on('moveFocusToPreviousParagraph', function(event, currentParagraphId) {
|
||||
$scope.$on('moveFocusToPreviousParagraph', function (event, currentParagraphId) {
|
||||
var focus = false;
|
||||
for (var i = $scope.note.paragraphs.length - 1; i >= 0; i--) {
|
||||
if (focus === false) {
|
||||
|
|
@ -942,7 +942,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('moveFocusToNextParagraph', function(event, currentParagraphId) {
|
||||
$scope.$on('moveFocusToNextParagraph', function (event, currentParagraphId) {
|
||||
var focus = false;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
if (focus === false) {
|
||||
|
|
@ -957,7 +957,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('insertParagraph', function(event, paragraphId, position) {
|
||||
$scope.$on('insertParagraph', function (event, paragraphId, position) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
if ($scope.note.paragraphs[i].id === paragraphId) {
|
||||
|
|
@ -977,7 +977,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
websocketMsgSrv.insertParagraph(newIndex);
|
||||
});
|
||||
|
||||
$scope.$on('setNoteContent', function(event, note) {
|
||||
$scope.$on('setNoteContent', function (event, note) {
|
||||
if (note === undefined) {
|
||||
$location.path('/');
|
||||
}
|
||||
|
|
@ -1004,7 +1004,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
$scope.note.config.personalizedMode = isPersonalized;
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
$scope.$on('$destroy', function () {
|
||||
angular.element(window).off('beforeunload');
|
||||
$scope.killSaveTimer();
|
||||
$scope.saveNote();
|
||||
|
|
@ -1013,12 +1013,12 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
document.removeEventListener('keydown', $scope.keyboardShortcut);
|
||||
});
|
||||
|
||||
$scope.$on('$unBindKeyEvent', function() {
|
||||
$scope.$on('$unBindKeyEvent', function () {
|
||||
document.removeEventListener('click', $scope.focusParagraphOnClick);
|
||||
document.removeEventListener('keydown', $scope.keyboardShortcut);
|
||||
});
|
||||
|
||||
angular.element(window).bind('resize', function() {
|
||||
angular.element(window).bind('resize', function () {
|
||||
const actionbarHeight = document.getElementById('actionbar').lastElementChild.clientHeight;
|
||||
angular.element(document.getElementById('content')).css('padding-top', actionbarHeight - 20);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
describe('Controller: NotebookCtrl', function() {
|
||||
describe('Controller: NotebookCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
|
||||
var websocketMsgSrvMock = {
|
||||
getNote: function() {},
|
||||
listRevisionHistory: function() {},
|
||||
getInterpreterBindings: function() {},
|
||||
updateNote: function() {},
|
||||
renameNote: function() {}
|
||||
getNote: function () {},
|
||||
listRevisionHistory: function () {},
|
||||
getInterpreterBindings: function () {},
|
||||
updateNote: function () {},
|
||||
renameNote: function () {}
|
||||
};
|
||||
|
||||
var baseUrlSrvMock = {
|
||||
getRestApiBase: function() {
|
||||
getRestApiBase: function () {
|
||||
return 'http://localhost:8080';
|
||||
}
|
||||
};
|
||||
|
|
@ -23,7 +23,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
config: {},
|
||||
};
|
||||
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
beforeEach(inject(function ($controller, $rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
$controller('NotebookCtrl', {
|
||||
$scope: scope,
|
||||
|
|
@ -32,7 +32,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
});
|
||||
}));
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
scope.note = noteMock;
|
||||
});
|
||||
|
||||
|
|
@ -41,27 +41,27 @@ describe('Controller: NotebookCtrl', function() {
|
|||
'killSaveTimer', 'startSaveTimer', 'setLookAndFeel', 'setCronScheduler', 'setConfig', 'updateNoteName',
|
||||
'openSetting', 'closeSetting', 'saveSetting', 'toggleSetting'];
|
||||
|
||||
functions.forEach(function(fn) {
|
||||
it('check for scope functions to be defined : ' + fn, function() {
|
||||
functions.forEach(function (fn) {
|
||||
it('check for scope functions to be defined : ' + fn, function () {
|
||||
expect(scope[fn]).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it('should set default value of "editorToggled" to false', function() {
|
||||
it('should set default value of "editorToggled" to false', function () {
|
||||
expect(scope.editorToggled).toEqual(false);
|
||||
});
|
||||
|
||||
it('should set "showSetting" to true when openSetting() is called', function() {
|
||||
it('should set "showSetting" to true when openSetting() is called', function () {
|
||||
scope.openSetting();
|
||||
expect(scope.showSetting).toEqual(true);
|
||||
});
|
||||
|
||||
it('should set "showSetting" to false when closeSetting() is called', function() {
|
||||
it('should set "showSetting" to false when closeSetting() is called', function () {
|
||||
scope.closeSetting();
|
||||
expect(scope.showSetting).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return the correct value for getCronOptionNameFromValue()', function() {
|
||||
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 * * * ?');
|
||||
|
|
@ -81,18 +81,18 @@ describe('Controller: NotebookCtrl', function() {
|
|||
expect(oneDay).toEqual('1d');
|
||||
});
|
||||
|
||||
it('should have "isNoteDirty" as null by default', function() {
|
||||
it('should have "isNoteDirty" as null by default', function () {
|
||||
expect(scope.isNoteDirty).toEqual(null);
|
||||
});
|
||||
|
||||
it('should first call killSaveTimer() when calling startSaveTimer()', function() {
|
||||
it('should first call killSaveTimer() when calling startSaveTimer()', function () {
|
||||
expect(scope.saveTimer).toEqual(null);
|
||||
spyOn(scope, 'killSaveTimer');
|
||||
scope.startSaveTimer();
|
||||
expect(scope.killSaveTimer).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should set "saveTimer" when saveTimer() and killSaveTimer() are called', function() {
|
||||
it('should set "saveTimer" when saveTimer() and killSaveTimer() are called', function () {
|
||||
expect(scope.saveTimer).toEqual(null);
|
||||
scope.startSaveTimer();
|
||||
expect(scope.saveTimer).toBeTruthy();
|
||||
|
|
@ -100,7 +100,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
expect(scope.saveTimer).toEqual(null);
|
||||
});
|
||||
|
||||
it('should NOT update note name when updateNoteName() is called with an invalid name', function() {
|
||||
it('should NOT update note name when updateNoteName() is called with an invalid name', function () {
|
||||
spyOn(websocketMsgSrvMock, 'renameNote');
|
||||
scope.updateNoteName('');
|
||||
expect(scope.note.name).toEqual(noteMock.name);
|
||||
|
|
@ -113,7 +113,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should update note name when updateNoteName() is called with a valid name', function() {
|
||||
it('should update note name when updateNoteName() is called with a valid name', function () {
|
||||
spyOn(websocketMsgSrvMock, 'renameNote');
|
||||
var newName = 'Your Note';
|
||||
scope.updateNoteName(newName);
|
||||
|
|
@ -121,7 +121,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
expect(websocketMsgSrvMock.renameNote).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reload note info once per one "setNoteMenu" event', function() {
|
||||
it('should reload note info once per one "setNoteMenu" event', function () {
|
||||
spyOn(websocketMsgSrvMock, 'getNote');
|
||||
spyOn(websocketMsgSrvMock, 'listRevisionHistory');
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const ParagraphExecutor = {
|
|||
|
||||
angular.module('zeppelinWebApp').controller('ParagraphCtrl', ParagraphCtrl);
|
||||
|
||||
function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $location,
|
||||
function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $location,
|
||||
$timeout, $compile, $http, $q, websocketMsgSrv,
|
||||
baseUrlSrv, ngToast, saveAsService, noteVarShareService,
|
||||
heliumService) {
|
||||
|
|
@ -61,9 +61,9 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
|
||||
paragraphScope.z = {
|
||||
// z.runParagraph('20150213-231621_168813393')
|
||||
runParagraph: function(paragraphId) {
|
||||
runParagraph: function (paragraphId) {
|
||||
if (paragraphId) {
|
||||
var filtered = $scope.parentNote.paragraphs.filter(function(x) {
|
||||
var filtered = $scope.parentNote.paragraphs.filter(function (x) {
|
||||
return x.id === paragraphId;
|
||||
});
|
||||
if (filtered.length === 1) {
|
||||
|
|
@ -87,7 +87,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
},
|
||||
|
||||
// Example: z.angularBind('my_var', 'Test Value', '20150213-231621_168813393')
|
||||
angularBind: function(varName, value, paragraphId) {
|
||||
angularBind: function (varName, value, paragraphId) {
|
||||
// Only push to server if there paragraphId is defined
|
||||
if (paragraphId) {
|
||||
websocketMsgSrv.clientBindAngularObject($routeParams.noteId, varName, value, paragraphId);
|
||||
|
|
@ -102,7 +102,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
},
|
||||
|
||||
// Example: z.angularUnBind('my_var', '20150213-231621_168813393')
|
||||
angularUnbind: function(varName, paragraphId) {
|
||||
angularUnbind: function (varName, paragraphId) {
|
||||
// Only push to server if paragraphId is defined
|
||||
if (paragraphId) {
|
||||
websocketMsgSrv.clientUnbindAngularObject($routeParams.noteId, varName, paragraphId);
|
||||
|
|
@ -119,7 +119,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
var angularObjectRegistry = {};
|
||||
|
||||
// Controller init
|
||||
$scope.init = function(newParagraph, note) {
|
||||
$scope.init = function (newParagraph, note) {
|
||||
$scope.paragraph = newParagraph;
|
||||
$scope.parentNote = note;
|
||||
$scope.originalText = angular.copy(newParagraph.text);
|
||||
|
|
@ -139,7 +139,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
initializeDefault($scope.paragraph.config);
|
||||
};
|
||||
|
||||
var initializeDefault = function(config) {
|
||||
var initializeDefault = function (config) {
|
||||
var forms = $scope.paragraph.settings.forms;
|
||||
|
||||
if (!config.colWidth) {
|
||||
|
|
@ -171,7 +171,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.$on('updateParagraphOutput', function(event, data) {
|
||||
$scope.$on('updateParagraphOutput', function (event, data) {
|
||||
if ($scope.paragraph.id === data.paragraphId) {
|
||||
if (!$scope.paragraph.results) {
|
||||
$scope.paragraph.results = {};
|
||||
|
|
@ -198,7 +198,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
$scope.getIframeDimensions = function() {
|
||||
$scope.getIframeDimensions = function () {
|
||||
if ($scope.asIframe) {
|
||||
var paragraphid = '#' + $routeParams.paragraphId + '_container';
|
||||
var height = angular.element(paragraphid).height();
|
||||
|
|
@ -207,7 +207,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return 0;
|
||||
};
|
||||
|
||||
$scope.$watch($scope.getIframeDimensions, function(newValue, oldValue) {
|
||||
$scope.$watch($scope.getIframeDimensions, function (newValue, oldValue) {
|
||||
if ($scope.asIframe && newValue) {
|
||||
var message = {};
|
||||
message.height = newValue;
|
||||
|
|
@ -216,11 +216,11 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
$scope.getEditor = function() {
|
||||
$scope.getEditor = function () {
|
||||
return $scope.editor;
|
||||
};
|
||||
|
||||
$scope.$watch($scope.getEditor, function(newValue, oldValue) {
|
||||
$scope.$watch($scope.getEditor, function (newValue, oldValue) {
|
||||
if (!$scope.editor) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -235,20 +235,20 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
var isEmpty = function(object) {
|
||||
var isEmpty = function (object) {
|
||||
return !object;
|
||||
};
|
||||
|
||||
$scope.isRunning = function(paragraph) {
|
||||
$scope.isRunning = function (paragraph) {
|
||||
return isParagraphRunning(paragraph);
|
||||
};
|
||||
|
||||
$scope.cancelParagraph = function(paragraph) {
|
||||
$scope.cancelParagraph = function (paragraph) {
|
||||
console.log('Cancel %o', paragraph.id);
|
||||
websocketMsgSrv.cancelParagraphRun(paragraph.id);
|
||||
};
|
||||
|
||||
$scope.propagateSpellResult = function(paragraphId, paragraphTitle,
|
||||
$scope.propagateSpellResult = function (paragraphId, paragraphTitle,
|
||||
paragraphText, paragraphResults,
|
||||
paragraphStatus, paragraphErrorMessage,
|
||||
paragraphConfig, paragraphSettingsParam) {
|
||||
|
|
@ -259,7 +259,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
paragraphConfig, paragraphSettingsParam);
|
||||
};
|
||||
|
||||
$scope.handleSpellError = function(paragraphText, error,
|
||||
$scope.handleSpellError = function (paragraphText, error,
|
||||
digestRequired, propagated) {
|
||||
const errorMessage = error.stack;
|
||||
$scope.paragraph.status = ParagraphStatus.ERROR;
|
||||
|
|
@ -274,7 +274,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.prepareSpellTransaction = function(resultsMsg, propagated, paragraphText) {
|
||||
$scope.prepareSpellTransaction = function (resultsMsg, propagated, paragraphText) {
|
||||
$scope.spellTransaction.totalResultCount = resultsMsg.length;
|
||||
$scope.spellTransaction.renderedResultCount = 0;
|
||||
$scope.spellTransaction.propagated = propagated;
|
||||
|
|
@ -287,7 +287,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
* - check transaction is finished based on the result count
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$scope.increaseSpellTransactionResultCount = function() {
|
||||
$scope.increaseSpellTransactionResultCount = function () {
|
||||
$scope.spellTransaction.renderedResultCount += 1;
|
||||
|
||||
const total = $scope.spellTransaction.totalResultCount;
|
||||
|
|
@ -295,7 +295,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return total === current;
|
||||
};
|
||||
|
||||
$scope.cleanupSpellTransaction = function() {
|
||||
$scope.cleanupSpellTransaction = function () {
|
||||
const status = ParagraphStatus.FINISHED;
|
||||
$scope.paragraph.executor = ParagraphExecutor.NONE;
|
||||
$scope.paragraph.status = status;
|
||||
|
|
@ -314,7 +314,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.runParagraphUsingSpell = function(paragraphText,
|
||||
$scope.runParagraphUsingSpell = function (paragraphText,
|
||||
magic, digestRequired, propagated) {
|
||||
$scope.paragraph.status = 'RUNNING';
|
||||
$scope.paragraph.executor = ParagraphExecutor.SPELL;
|
||||
|
|
@ -347,12 +347,12 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.runParagraphUsingBackendInterpreter = function(paragraphText) {
|
||||
$scope.runParagraphUsingBackendInterpreter = function (paragraphText) {
|
||||
websocketMsgSrv.runParagraph($scope.paragraph.id, $scope.paragraph.title,
|
||||
paragraphText, $scope.paragraph.config, $scope.paragraph.settings.params);
|
||||
};
|
||||
|
||||
$scope.saveParagraph = function(paragraph) {
|
||||
$scope.saveParagraph = function (paragraph) {
|
||||
const dirtyText = paragraph.text;
|
||||
if (dirtyText === undefined || dirtyText === $scope.originalText) {
|
||||
return;
|
||||
|
|
@ -362,7 +362,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
$scope.dirtyText = undefined;
|
||||
};
|
||||
|
||||
$scope.toggleEnableDisable = function(paragraph) {
|
||||
$scope.toggleEnableDisable = function (paragraph) {
|
||||
paragraph.config.enabled = !paragraph.config.enabled;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
|
@ -372,7 +372,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
* @param digestRequired true if calling `$digest` is required
|
||||
* @param propagated true if update request is sent from other client
|
||||
*/
|
||||
$scope.runParagraph = function(paragraphText, digestRequired, propagated) {
|
||||
$scope.runParagraph = function (paragraphText, digestRequired, propagated) {
|
||||
if (!paragraphText || $scope.isRunning($scope.paragraph)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -398,13 +398,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
editorSetting.isOutputHidden = $scope.paragraph.config.editorSetting.editOnDblClick;
|
||||
};
|
||||
|
||||
$scope.runParagraphFromShortcut = function(paragraphText) {
|
||||
$scope.runParagraphFromShortcut = function (paragraphText) {
|
||||
// passing `digestRequired` as true to update view immediately
|
||||
// without this, results cannot be rendered in view more than once
|
||||
$scope.runParagraph(paragraphText, true, false);
|
||||
};
|
||||
|
||||
$scope.runParagraphFromButton = function(paragraphText) {
|
||||
$scope.runParagraphFromButton = function (paragraphText) {
|
||||
// we come here from the view, so we don't need to call `$digest()`
|
||||
$scope.runParagraph(paragraphText, false, false)
|
||||
};
|
||||
|
|
@ -414,26 +414,26 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.moveUp = function(paragraph) {
|
||||
$scope.moveUp = function (paragraph) {
|
||||
$scope.$emit('moveParagraphUp', paragraph);
|
||||
};
|
||||
|
||||
$scope.moveDown = function(paragraph) {
|
||||
$scope.moveDown = function (paragraph) {
|
||||
$scope.$emit('moveParagraphDown', paragraph);
|
||||
};
|
||||
|
||||
$scope.insertNew = function(position) {
|
||||
$scope.insertNew = function (position) {
|
||||
$scope.$emit('insertParagraph', $scope.paragraph.id, position);
|
||||
};
|
||||
|
||||
$scope.copyPara = function(position) {
|
||||
$scope.copyPara = function (position) {
|
||||
var editorValue = $scope.getEditorValue();
|
||||
if (editorValue) {
|
||||
$scope.copyParagraph(editorValue, position);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.copyParagraph = function(data, position) {
|
||||
$scope.copyParagraph = function (data, position) {
|
||||
var newIndex = -1;
|
||||
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
|
||||
if ($scope.note.paragraphs[i].id === $scope.paragraph.id) {
|
||||
|
|
@ -458,13 +458,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
config, $scope.paragraph.settings.params);
|
||||
};
|
||||
|
||||
$scope.removeParagraph = function(paragraph) {
|
||||
$scope.removeParagraph = function (paragraph) {
|
||||
var paragraphs = angular.element('div[id$="_paragraphColumn_main"]');
|
||||
if (paragraphs[paragraphs.length - 1].id.indexOf(paragraph.id) === 0) {
|
||||
BootstrapDialog.alert({
|
||||
closable: true,
|
||||
message: 'The last paragraph can\'t be deleted.',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$scope.editor.focus();
|
||||
}
|
||||
|
|
@ -475,7 +475,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
closable: true,
|
||||
title: '',
|
||||
message: 'Do you want to delete this paragraph?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
console.log('Remove paragraph');
|
||||
websocketMsgSrv.removeParagraph(paragraph.id);
|
||||
|
|
@ -486,11 +486,11 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.clearParagraphOutput = function(paragraph) {
|
||||
$scope.clearParagraphOutput = function (paragraph) {
|
||||
websocketMsgSrv.clearParagraphOutput(paragraph.id);
|
||||
};
|
||||
|
||||
$scope.toggleEditor = function(paragraph) {
|
||||
$scope.toggleEditor = function (paragraph) {
|
||||
if (paragraph.config.editorHide) {
|
||||
$scope.openEditor(paragraph);
|
||||
} else {
|
||||
|
|
@ -498,63 +498,63 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.closeEditor = function(paragraph) {
|
||||
$scope.closeEditor = function (paragraph) {
|
||||
console.log('close the note');
|
||||
paragraph.config.editorHide = true;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.openEditor = function(paragraph) {
|
||||
$scope.openEditor = function (paragraph) {
|
||||
console.log('open the note');
|
||||
paragraph.config.editorHide = false;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.closeTable = function(paragraph) {
|
||||
$scope.closeTable = function (paragraph) {
|
||||
console.log('close the output');
|
||||
paragraph.config.tableHide = true;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.openTable = function(paragraph) {
|
||||
$scope.openTable = function (paragraph) {
|
||||
console.log('open the output');
|
||||
paragraph.config.tableHide = false;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
var openEditorAndCloseTable = function(paragraph) {
|
||||
var openEditorAndCloseTable = function (paragraph) {
|
||||
manageEditorAndTableState(paragraph, false, true);
|
||||
};
|
||||
|
||||
var closeEditorAndOpenTable = function(paragraph) {
|
||||
var closeEditorAndOpenTable = function (paragraph) {
|
||||
manageEditorAndTableState(paragraph, true, false);
|
||||
};
|
||||
|
||||
var openEditorAndOpenTable = function(paragraph) {
|
||||
var openEditorAndOpenTable = function (paragraph) {
|
||||
manageEditorAndTableState(paragraph, false, false);
|
||||
};
|
||||
|
||||
var manageEditorAndTableState = function(paragraph, hideEditor, hideTable) {
|
||||
var manageEditorAndTableState = function (paragraph, hideEditor, hideTable) {
|
||||
paragraph.config.editorHide = hideEditor;
|
||||
paragraph.config.tableHide = hideTable;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.showTitle = function(paragraph) {
|
||||
$scope.showTitle = function (paragraph) {
|
||||
paragraph.config.title = true;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.hideTitle = function(paragraph) {
|
||||
$scope.hideTitle = function (paragraph) {
|
||||
paragraph.config.title = false;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.setTitle = function(paragraph) {
|
||||
$scope.setTitle = function (paragraph) {
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.showLineNumbers = function(paragraph) {
|
||||
$scope.showLineNumbers = function (paragraph) {
|
||||
if ($scope.editor) {
|
||||
paragraph.config.lineNumbers = true;
|
||||
$scope.editor.renderer.setShowGutter(true);
|
||||
|
|
@ -562,7 +562,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.hideLineNumbers = function(paragraph) {
|
||||
$scope.hideLineNumbers = function (paragraph) {
|
||||
if ($scope.editor) {
|
||||
paragraph.config.lineNumbers = false;
|
||||
$scope.editor.renderer.setShowGutter(false);
|
||||
|
|
@ -570,7 +570,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.columnWidthClass = function(n) {
|
||||
$scope.columnWidthClass = function (n) {
|
||||
if ($scope.asIframe) {
|
||||
return 'col-md-12';
|
||||
} else {
|
||||
|
|
@ -578,18 +578,18 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.changeColWidth = function(paragraph, width) {
|
||||
$scope.changeColWidth = function (paragraph, width) {
|
||||
angular.element('.navbar-right.open').removeClass('open');
|
||||
paragraph.config.colWidth = width;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.toggleOutput = function(paragraph) {
|
||||
$scope.toggleOutput = function (paragraph) {
|
||||
paragraph.config.tableHide = !paragraph.config.tableHide;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.loadForm = function(formulaire, params) {
|
||||
$scope.loadForm = function (formulaire, params) {
|
||||
var value = formulaire.defaultValue;
|
||||
if (params[formulaire.name]) {
|
||||
value = params[formulaire.name];
|
||||
|
|
@ -598,7 +598,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
$scope.paragraph.settings.params[formulaire.name] = value;
|
||||
};
|
||||
|
||||
$scope.toggleCheckbox = function(formulaire, option) {
|
||||
$scope.toggleCheckbox = function (formulaire, option) {
|
||||
var idx = $scope.paragraph.settings.params[formulaire.name].indexOf(option.value);
|
||||
if (idx > -1) {
|
||||
$scope.paragraph.settings.params[formulaire.name].splice(idx, 1);
|
||||
|
|
@ -607,7 +607,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.aceChanged = function(_, editor) {
|
||||
$scope.aceChanged = function (_, editor) {
|
||||
var session = editor.getSession();
|
||||
var dirtyText = session.getValue();
|
||||
$scope.dirtyText = dirtyText;
|
||||
|
|
@ -615,7 +615,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
setParagraphMode(session, dirtyText, editor.getCursorPosition());
|
||||
};
|
||||
|
||||
$scope.aceLoaded = function(_editor) {
|
||||
$scope.aceLoaded = function (_editor) {
|
||||
var langTools = ace.require('ace/ext/language_tools');
|
||||
var Range = ace.require('ace/range').Range;
|
||||
|
||||
|
|
@ -636,7 +636,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
|
||||
autoAdjustEditorHeight(_editor);
|
||||
angular.element(window).resize(function() {
|
||||
angular.element(window).resize(function () {
|
||||
autoAdjustEditorHeight(_editor);
|
||||
});
|
||||
|
||||
|
|
@ -716,22 +716,22 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
enableLiveAutocompletion: false
|
||||
});
|
||||
|
||||
$scope.editor.on('focus', function() {
|
||||
$scope.editor.on('focus', function () {
|
||||
handleFocus(true);
|
||||
});
|
||||
|
||||
$scope.editor.on('blur', function() {
|
||||
$scope.editor.on('blur', function () {
|
||||
handleFocus(false);
|
||||
$scope.saveParagraph($scope.paragraph);
|
||||
});
|
||||
|
||||
$scope.editor.on('paste', function(e) {
|
||||
$scope.editor.on('paste', function (e) {
|
||||
if (e.text.indexOf('%') === 0) {
|
||||
pastePercentSign = true;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.editor.getSession().on('change', function(e, editSession) {
|
||||
$scope.editor.getSession().on('change', function (e, editSession) {
|
||||
autoAdjustEditorHeight(_editor);
|
||||
});
|
||||
|
||||
|
|
@ -772,7 +772,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
// autocomplete on 'ctrl+.'
|
||||
$scope.editor.commands.bindKey('ctrl-.', 'startAutocomplete');
|
||||
|
||||
var keyBindingEditorFocusAction = function(scrollValue) {
|
||||
var keyBindingEditorFocusAction = function (scrollValue) {
|
||||
var numRows = $scope.editor.getSession().getLength();
|
||||
var currentRow = $scope.editor.getCursorPosition().row;
|
||||
if (currentRow === 0 && scrollValue <= 0) {
|
||||
|
|
@ -787,7 +787,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
|
||||
// handle cursor moves
|
||||
$scope.editor.keyBinding.origOnCommandKey = $scope.editor.keyBinding.onCommandKey;
|
||||
$scope.editor.keyBinding.onCommandKey = function(e, hashId, keyCode) {
|
||||
$scope.editor.keyBinding.onCommandKey = function (e, hashId, keyCode) {
|
||||
if ($scope.editor.completer && $scope.editor.completer.activated) { // if autocompleter is active
|
||||
} else {
|
||||
// fix ace editor focus issue in chrome (textarea element goes to top: -1000px after focused by cursor move)
|
||||
|
|
@ -825,22 +825,22 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
var handleFocus = function(value, isDigestPass) {
|
||||
var handleFocus = function (value, isDigestPass) {
|
||||
$scope.paragraphFocused = value;
|
||||
if (isDigestPass === false || isDigestPass === undefined) {
|
||||
// Protect against error in case digest is already running
|
||||
$timeout(function() {
|
||||
$timeout(function () {
|
||||
// Apply changes since they come from 3rd party library
|
||||
$scope.$digest();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getEditorSetting = function(paragraph, interpreterName) {
|
||||
var getEditorSetting = function (paragraph, interpreterName) {
|
||||
var deferred = $q.defer();
|
||||
websocketMsgSrv.getEditorSetting(paragraph.id, interpreterName);
|
||||
$timeout(
|
||||
$scope.$on('editorSetting', function(event, data) {
|
||||
$scope.$on('editorSetting', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
deferred.resolve(data);
|
||||
}
|
||||
|
|
@ -849,14 +849,14 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
var setEditorLanguage = function(session, language) {
|
||||
var setEditorLanguage = function (session, language) {
|
||||
var mode = 'ace/mode/';
|
||||
mode += language;
|
||||
$scope.paragraph.config.editorMode = mode;
|
||||
session.setMode(mode);
|
||||
};
|
||||
|
||||
var setParagraphMode = function(session, paragraphText, pos) {
|
||||
var 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)
|
||||
|
|
@ -871,7 +871,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
if (editorSetting.magic !== magic) {
|
||||
editorSetting.magic = magic;
|
||||
getEditorSetting($scope.paragraph, magic)
|
||||
.then(function(setting) {
|
||||
.then(function (setting) {
|
||||
setEditorLanguage(session, setting.editor.language);
|
||||
_.merge($scope.paragraph.config.editorSetting, setting.editor);
|
||||
});
|
||||
|
|
@ -895,7 +895,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return '';
|
||||
};
|
||||
|
||||
var autoAdjustEditorHeight = function(editor) {
|
||||
var autoAdjustEditorHeight = function (editor) {
|
||||
var height =
|
||||
editor.getSession().getScreenLength() *
|
||||
editor.renderer.lineHeight +
|
||||
|
|
@ -905,7 +905,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
editor.resize();
|
||||
};
|
||||
|
||||
$rootScope.$on('scrollToCursor', function(event) {
|
||||
$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"]');
|
||||
if (paragraphs[paragraphs.length - 1].id.indexOf($scope.paragraph.id) === 0) {
|
||||
|
|
@ -918,7 +918,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
* paragraphId : paragraph that has active cursor
|
||||
* lastCursorMove : 1(down), 0, -1(up) last cursor move event
|
||||
**/
|
||||
$scope.scrollToCursor = function(paragraphId, lastCursorMove) {
|
||||
$scope.scrollToCursor = function (paragraphId, lastCursorMove) {
|
||||
if (!$scope.editor || !$scope.editor.isFocused()) {
|
||||
// only make sense when editor is focused
|
||||
return;
|
||||
|
|
@ -960,15 +960,15 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
bodyEl.scrollTo(scrollTargetPos, {axis: 'y', interrupt: true, duration: 100});
|
||||
};
|
||||
|
||||
$scope.getEditorValue = function() {
|
||||
$scope.getEditorValue = function () {
|
||||
return !$scope.editor ? $scope.paragraph.text : $scope.editor.getValue();
|
||||
};
|
||||
|
||||
$scope.getProgress = function() {
|
||||
$scope.getProgress = function () {
|
||||
return $scope.currentProgress || 0;
|
||||
};
|
||||
|
||||
$scope.getExecutionTime = function(pdata) {
|
||||
$scope.getExecutionTime = function (pdata) {
|
||||
var timeMs = Date.parse(pdata.dateFinished) - Date.parse(pdata.dateStarted);
|
||||
if (isNaN(timeMs) || timeMs < 0) {
|
||||
if ($scope.isResultOutdated(pdata)) {
|
||||
|
|
@ -985,22 +985,22 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return desc;
|
||||
};
|
||||
|
||||
$scope.getElapsedTime = function(paragraph) {
|
||||
$scope.getElapsedTime = function (paragraph) {
|
||||
return 'Started ' + moment(paragraph.dateStarted).fromNow() + '.';
|
||||
};
|
||||
|
||||
$scope.isResultOutdated = function(pdata) {
|
||||
$scope.isResultOutdated = function (pdata) {
|
||||
if (pdata.dateUpdated !== undefined && Date.parse(pdata.dateUpdated) > Date.parse(pdata.dateStarted)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$scope.goToEnd = function(editor) {
|
||||
$scope.goToEnd = function (editor) {
|
||||
editor.navigateFileEnd();
|
||||
};
|
||||
|
||||
$scope.parseTableCell = function(cell) {
|
||||
$scope.parseTableCell = function (cell) {
|
||||
if (!isNaN(cell)) {
|
||||
if (cell.length === 0 || Number(cell) > Number.MAX_SAFE_INTEGER || Number(cell) < Number.MIN_SAFE_INTEGER) {
|
||||
return cell;
|
||||
|
|
@ -1015,7 +1015,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return cell;
|
||||
};
|
||||
|
||||
var commitParagraph = function(paragraph) {
|
||||
var commitParagraph = function (paragraph) {
|
||||
const {
|
||||
id,
|
||||
title,
|
||||
|
|
@ -1028,14 +1028,14 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
};
|
||||
|
||||
/** Utility function */
|
||||
$scope.goToSingleParagraph = function() {
|
||||
$scope.goToSingleParagraph = function () {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
var redirectToUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId +
|
||||
'/paragraph/' + $scope.paragraph.id + '?asIframe';
|
||||
$window.open(redirectToUrl);
|
||||
};
|
||||
|
||||
$scope.showScrollDownIcon = function(id) {
|
||||
$scope.showScrollDownIcon = function (id) {
|
||||
var doc = angular.element('#p' + id + '_text');
|
||||
if (doc[0]) {
|
||||
return doc[0].scrollHeight > doc.innerHeight();
|
||||
|
|
@ -1043,13 +1043,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
return false;
|
||||
};
|
||||
|
||||
$scope.scrollParagraphDown = function(id) {
|
||||
$scope.scrollParagraphDown = function (id) {
|
||||
var doc = angular.element('#p' + id + '_text');
|
||||
doc.animate({scrollTop: doc[0].scrollHeight}, 500);
|
||||
$scope.keepScrollDown = true;
|
||||
};
|
||||
|
||||
$scope.showScrollUpIcon = function(id) {
|
||||
$scope.showScrollUpIcon = function (id) {
|
||||
if (angular.element('#p' + id + '_text')[0]) {
|
||||
return angular.element('#p' + id + '_text')[0].scrollTop !== 0;
|
||||
}
|
||||
|
|
@ -1057,13 +1057,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
|
||||
};
|
||||
|
||||
$scope.scrollParagraphUp = function(id) {
|
||||
$scope.scrollParagraphUp = function (id) {
|
||||
var doc = angular.element('#p' + id + '_text');
|
||||
doc.animate({scrollTop: 0}, 500);
|
||||
$scope.keepScrollDown = false;
|
||||
};
|
||||
|
||||
$scope.$on('angularObjectUpdate', function(event, data) {
|
||||
$scope.$on('angularObjectUpdate', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
|
|
@ -1096,7 +1096,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
registry[varName].skipEmit = true;
|
||||
|
||||
if (!registry[varName].clearWatcher) {
|
||||
registry[varName].clearWatcher = scope.$watch(varName, function(newValue, oldValue) {
|
||||
registry[varName].clearWatcher = scope.$watch(varName, function (newValue, oldValue) {
|
||||
console.log('angular object (paragraph) updated %o %o', varName, registry[varName]);
|
||||
if (registry[varName].skipEmit) {
|
||||
registry[varName].skipEmit = false;
|
||||
|
|
@ -1116,7 +1116,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
// create proxy for AngularFunction
|
||||
if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) {
|
||||
var funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
scope[funcName] = function() {
|
||||
scope[funcName] = function () {
|
||||
scope[varName] = arguments;
|
||||
console.log('angular function (paragraph) invoked %o', arguments);
|
||||
};
|
||||
|
|
@ -1126,13 +1126,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('updateParaInfos', function(event, data) {
|
||||
$scope.$on('updateParaInfos', function (event, data) {
|
||||
if (data.id === $scope.paragraph.id) {
|
||||
$scope.paragraph.runtimeInfos = data.infos;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('angularObjectRemove', function(event, data) {
|
||||
$scope.$on('angularObjectRemove', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
|
|
@ -1167,7 +1167,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
/**
|
||||
* @returns {boolean} true if updated is needed
|
||||
*/
|
||||
function isUpdateRequired(oldPara, newPara) {
|
||||
function isUpdateRequired (oldPara, newPara) {
|
||||
return (newPara.id === oldPara.id &&
|
||||
(newPara.dateCreated !== oldPara.dateCreated ||
|
||||
newPara.text !== oldPara.text ||
|
||||
|
|
@ -1184,7 +1184,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
!angular.equals(newPara.runtimeInfos, oldPara.runtimeInfos)))
|
||||
}
|
||||
|
||||
$scope.updateAllScopeTexts = function(oldPara, newPara) {
|
||||
$scope.updateAllScopeTexts = function (oldPara, newPara) {
|
||||
if (oldPara.text !== newPara.text) {
|
||||
if ($scope.dirtyText) { // check if editor has local update
|
||||
if ($scope.dirtyText === newPara.text) { // when local update is the same from remote, clear local update
|
||||
|
|
@ -1202,7 +1202,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.updateParagraphObjectWhenUpdated = function(newPara) {
|
||||
$scope.updateParagraphObjectWhenUpdated = function (newPara) {
|
||||
// resize col width
|
||||
if ($scope.paragraph.config.colWidth !== newPara.colWidth) {
|
||||
$rootScope.$broadcast('paragraphResized', $scope.paragraph.id);
|
||||
|
|
@ -1239,7 +1239,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
};
|
||||
|
||||
$scope.updateParagraph = function(oldPara, newPara, updateCallback) {
|
||||
$scope.updateParagraph = function (oldPara, newPara, updateCallback) {
|
||||
// 1. get status, refreshed
|
||||
const statusChanged = (newPara.status !== oldPara.status);
|
||||
const resultRefreshed = (newPara.dateFinished !== oldPara.dateFinished) ||
|
||||
|
|
@ -1270,7 +1270,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
|
||||
/** $scope.$on */
|
||||
|
||||
$scope.$on('runParagraphUsingSpell', function(event, data) {
|
||||
$scope.$on('runParagraphUsingSpell', function (event, data) {
|
||||
const oldPara = $scope.paragraph;
|
||||
let newPara = data.paragraph;
|
||||
const updateCallback = () => {
|
||||
|
|
@ -1284,7 +1284,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
$scope.updateParagraph(oldPara, newPara, updateCallback)
|
||||
});
|
||||
|
||||
$scope.$on('updateParagraph', function(event, data) {
|
||||
$scope.$on('updateParagraph', function (event, data) {
|
||||
const oldPara = $scope.paragraph;
|
||||
const newPara = data.paragraph;
|
||||
|
||||
|
|
@ -1312,13 +1312,13 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
$scope.updateParagraph(oldPara, newPara, updateCallback)
|
||||
});
|
||||
|
||||
$scope.$on('updateProgress', function(event, data) {
|
||||
$scope.$on('updateProgress', function (event, data) {
|
||||
if (data.id === $scope.paragraph.id) {
|
||||
$scope.currentProgress = data.progress;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('keyEvent', function(event, keyEvent) {
|
||||
$scope.$on('keyEvent', function (event, keyEvent) {
|
||||
if ($scope.paragraphFocused) {
|
||||
|
||||
var paragraphId = $scope.paragraph.id;
|
||||
|
|
@ -1384,7 +1384,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('focusParagraph', function(event, paragraphId, cursorPos, mouseEvent) {
|
||||
$scope.$on('focusParagraph', function (event, paragraphId, cursorPos, mouseEvent) {
|
||||
if ($scope.paragraph.id === paragraphId) {
|
||||
// focus editor
|
||||
if (!$scope.paragraph.config.editorHide) {
|
||||
|
|
@ -1412,25 +1412,25 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('saveInterpreterBindings', function(event, paragraphId) {
|
||||
$scope.$on('saveInterpreterBindings', function (event, paragraphId) {
|
||||
if ($scope.paragraph.id === paragraphId && $scope.editor) {
|
||||
setInterpreterBindings = true;
|
||||
setParagraphMode($scope.editor.getSession(), $scope.editor.getSession().getValue());
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('doubleClickParagraph', function(event, paragraphId) {
|
||||
$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();
|
||||
openEditorAndCloseTable($scope.paragraph);
|
||||
$timeout(
|
||||
$scope.$on('updateParagraph', function(event, data) {
|
||||
$scope.$on('updateParagraph', function (event, data) {
|
||||
deferred.resolve(data);
|
||||
}
|
||||
), 1000);
|
||||
|
||||
deferred.promise.then(function(data) {
|
||||
deferred.promise.then(function (data) {
|
||||
if ($scope.editor) {
|
||||
$scope.editor.focus();
|
||||
$scope.goToEnd($scope.editor);
|
||||
|
|
@ -1439,23 +1439,23 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('openEditor', function(event) {
|
||||
$scope.$on('openEditor', function (event) {
|
||||
$scope.openEditor($scope.paragraph);
|
||||
});
|
||||
|
||||
$scope.$on('closeEditor', function(event) {
|
||||
$scope.$on('closeEditor', function (event) {
|
||||
$scope.closeEditor($scope.paragraph);
|
||||
});
|
||||
|
||||
$scope.$on('openTable', function(event) {
|
||||
$scope.$on('openTable', function (event) {
|
||||
$scope.openTable($scope.paragraph);
|
||||
});
|
||||
|
||||
$scope.$on('closeTable', function(event) {
|
||||
$scope.$on('closeTable', function (event) {
|
||||
$scope.closeTable($scope.paragraph);
|
||||
});
|
||||
|
||||
$scope.$on('resultRendered', function(event, paragraphId) {
|
||||
$scope.$on('resultRendered', function (event, paragraphId) {
|
||||
if ($scope.paragraph.id !== paragraphId) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
describe('Controller: ParagraphCtrl', function() {
|
||||
describe('Controller: ParagraphCtrl', function () {
|
||||
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ describe('Controller: ParagraphCtrl', function() {
|
|||
}
|
||||
};
|
||||
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
beforeEach(inject(function ($controller, $rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
$rootScope.notebookScope = $rootScope.$new(true, $rootScope);
|
||||
|
||||
|
|
@ -38,17 +38,17 @@ describe('Controller: ParagraphCtrl', function() {
|
|||
'changeColWidth', 'columnWidthClass', 'toggleOutput', 'loadForm',
|
||||
'aceChanged', 'aceLoaded', 'getEditorValue', 'getProgress', 'getExecutionTime', 'isResultOutdated'];
|
||||
|
||||
functions.forEach(function(fn) {
|
||||
it('check for scope functions to be defined : ' + fn, function() {
|
||||
functions.forEach(function (fn) {
|
||||
it('check for scope functions to be defined : ' + fn, function () {
|
||||
expect(scope[fn]).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it('should have this array of values for "colWidthOption"', function() {
|
||||
it('should have this array of values for "colWidthOption"', function () {
|
||||
expect(scope.colWidthOption).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
});
|
||||
|
||||
it('should set default value of "paragraphFocused" as false', function() {
|
||||
it('should set default value of "paragraphFocused" as false', function () {
|
||||
expect(scope.paragraphFocused).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export const ParagraphStatus = {
|
|||
ERROR: 'ERROR',
|
||||
};
|
||||
|
||||
export function isParagraphRunning(paragraph) {
|
||||
export function isParagraphRunning (paragraph) {
|
||||
if (!paragraph) { return false; }
|
||||
const status = paragraph.status;
|
||||
if (!status) { return false; }
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import { ParagraphStatus, } from '../paragraph.status';
|
|||
|
||||
angular.module('zeppelinWebApp').controller('ResultCtrl', ResultCtrl);
|
||||
|
||||
function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location,
|
||||
function ResultCtrl ($scope, $rootScope, $route, $window, $routeParams, $location,
|
||||
$timeout, $compile, $http, $q, $templateRequest, $sce, websocketMsgSrv,
|
||||
baseUrlSrv, ngToast, saveAsService, noteVarShareService, heliumService) {
|
||||
'ngInject';
|
||||
|
|
@ -138,10 +138,10 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
// queue for append output
|
||||
const textResultQueueForAppend = [];
|
||||
|
||||
$scope.init = function(result, config, paragraph, index) {
|
||||
$scope.init = function (result, config, paragraph, index) {
|
||||
// register helium plugin vis
|
||||
var visBundles = heliumService.getVisualizationBundles();
|
||||
visBundles.forEach(function(vis) {
|
||||
visBundles.forEach(function (vis) {
|
||||
$scope.builtInTableDataVisualizationList.push({
|
||||
id: vis.id,
|
||||
name: vis.name,
|
||||
|
|
@ -156,13 +156,13 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
renderResult($scope.type);
|
||||
};
|
||||
|
||||
function isDOMLoaded(targetElemId) {
|
||||
function isDOMLoaded (targetElemId) {
|
||||
const elem = angular.element(`#${targetElemId}`);
|
||||
return elem.length;
|
||||
}
|
||||
|
||||
function retryUntilElemIsLoaded(targetElemId, callback) {
|
||||
function retry() {
|
||||
function retryUntilElemIsLoaded (targetElemId, callback) {
|
||||
function retry () {
|
||||
if (!isDOMLoaded(targetElemId)) {
|
||||
$timeout(retry, 10);
|
||||
return;
|
||||
|
|
@ -175,7 +175,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
$timeout(retry);
|
||||
}
|
||||
|
||||
$scope.$on('updateResult', function(event, result, newConfig, paragraphRef, index) {
|
||||
$scope.$on('updateResult', function (event, result, newConfig, paragraphRef, index) {
|
||||
if (paragraph.id !== paragraphRef.id || index !== resultIndex) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
renderResult($scope.type, refresh);
|
||||
});
|
||||
|
||||
$scope.$on('appendParagraphOutput', function(event, data) {
|
||||
$scope.$on('appendParagraphOutput', function (event, data) {
|
||||
/* It has been observed that append events
|
||||
* can be errorneously called even if paragraph
|
||||
* execution has ended, and in that case, no append
|
||||
|
|
@ -208,7 +208,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
var updateData = function(result, config, paragraphRef, index) {
|
||||
var updateData = function (result, config, paragraphRef, index) {
|
||||
data = result.data;
|
||||
paragraph = paragraphRef;
|
||||
resultIndex = parseInt(index);
|
||||
|
|
@ -250,7 +250,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
};
|
||||
|
||||
$scope.createDisplayDOMId = function(baseDOMId, type) {
|
||||
$scope.createDisplayDOMId = function (baseDOMId, type) {
|
||||
if (type === DefaultDisplayType.TABLE) {
|
||||
return `${baseDOMId}_graph`;
|
||||
} else if (type === DefaultDisplayType.HTML) {
|
||||
|
|
@ -266,7 +266,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
};
|
||||
|
||||
$scope.renderDefaultDisplay = function(targetElemId, type, data, refresh) {
|
||||
$scope.renderDefaultDisplay = function (targetElemId, type, data, refresh) {
|
||||
const afterLoaded = () => {
|
||||
if (type === DefaultDisplayType.TABLE) {
|
||||
renderGraph(targetElemId, $scope.graphMode, refresh);
|
||||
|
|
@ -290,7 +290,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
$scope.$emit('resultRendered', paragraphId);
|
||||
};
|
||||
|
||||
const renderResult = function(type, refresh) {
|
||||
const renderResult = function (type, refresh) {
|
||||
let activeApp;
|
||||
if (enableHelium) {
|
||||
getSuggestions();
|
||||
|
|
@ -311,14 +311,14 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
};
|
||||
|
||||
$scope.isDefaultDisplay = function() {
|
||||
$scope.isDefaultDisplay = function () {
|
||||
return DefaultDisplayType[$scope.type];
|
||||
};
|
||||
|
||||
/**
|
||||
* Render multiple sub results for custom display
|
||||
*/
|
||||
$scope.renderCustomDisplay = function(type, data) {
|
||||
$scope.renderCustomDisplay = function (type, data) {
|
||||
// get result from intp
|
||||
if (!heliumService.getSpellByMagic(type)) {
|
||||
console.error(`Can't execute spell due to unknown display type: ${type}`);
|
||||
|
|
@ -364,7 +364,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
* @param successCallback
|
||||
* @param failureCallback
|
||||
*/
|
||||
const handleData = function(data, type, successCallback, failureCallback) {
|
||||
const handleData = function (data, type, successCallback, failureCallback) {
|
||||
if (SpellResult.isFunction(data)) {
|
||||
try {
|
||||
successCallback(data());
|
||||
|
|
@ -381,7 +381,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
};
|
||||
|
||||
const renderElem = function(targetElemId, data) {
|
||||
const renderElem = function (targetElemId, data) {
|
||||
const elem = angular.element(`#${targetElemId}`);
|
||||
handleData(() => { data(targetElemId) }, DefaultDisplayType.ELEMENT,
|
||||
() => {}, /** HTML element will be filled with data. thus pass empty success callback */
|
||||
|
|
@ -389,12 +389,12 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
);
|
||||
};
|
||||
|
||||
const renderHtml = function(targetElemId, data) {
|
||||
const renderHtml = function (targetElemId, data) {
|
||||
const elem = angular.element(`#${targetElemId}`);
|
||||
handleData(data, DefaultDisplayType.HTML,
|
||||
(generated) => {
|
||||
elem.html(generated);
|
||||
elem.find('pre code').each(function(i, e) {
|
||||
elem.find('pre code').each(function (i, e) {
|
||||
hljs.highlightBlock(e);
|
||||
});
|
||||
/* eslint new-cap: [2, {"capIsNewExceptions": ["MathJax.Hub.Queue"]}] */
|
||||
|
|
@ -404,7 +404,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
);
|
||||
};
|
||||
|
||||
const renderAngular = function(targetElemId, data) {
|
||||
const renderAngular = function (targetElemId, data) {
|
||||
const elem = angular.element(`#${targetElemId}`);
|
||||
const paragraphScope = noteVarShareService.get(`${paragraph.id}_paragraphScope`);
|
||||
handleData(data, DefaultDisplayType.ANGULAR,
|
||||
|
|
@ -420,7 +420,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
return `p${resultId}_text`;
|
||||
};
|
||||
|
||||
const renderText = function(targetElemId, data) {
|
||||
const renderText = function (targetElemId, data) {
|
||||
const elem = angular.element(`#${targetElemId}`);
|
||||
handleData(data, DefaultDisplayType.TEXT,
|
||||
(generated) => {
|
||||
|
|
@ -438,14 +438,14 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
);
|
||||
};
|
||||
|
||||
const removeChildrenDOM = function(targetElemId) {
|
||||
const removeChildrenDOM = function (targetElemId) {
|
||||
const elem = angular.element(`#${targetElemId}`);
|
||||
if (elem.length) {
|
||||
elem.children().remove();
|
||||
}
|
||||
};
|
||||
|
||||
function appendTextOutput(data) {
|
||||
function appendTextOutput (data) {
|
||||
const elemId = getTextResultElemId($scope.id);
|
||||
textResultQueueForAppend.push(data);
|
||||
|
||||
|
|
@ -468,15 +468,15 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
}
|
||||
|
||||
const getTrSettingElem = function(scopeId, graphMode) {
|
||||
const getTrSettingElem = function (scopeId, graphMode) {
|
||||
return angular.element('#trsetting' + scopeId + '_' + graphMode)
|
||||
}
|
||||
|
||||
const getVizSettingElem = function(scopeId, graphMode) {
|
||||
const getVizSettingElem = function (scopeId, graphMode) {
|
||||
return angular.element('#vizsetting' + scopeId + '_' + graphMode)
|
||||
}
|
||||
|
||||
const renderGraph = function(graphElemId, graphMode, refresh) {
|
||||
const renderGraph = function (graphElemId, graphMode, refresh) {
|
||||
// set graph height
|
||||
const height = $scope.config.graph.height;
|
||||
const graphElem = angular.element(`#${graphElemId}`);
|
||||
|
|
@ -497,11 +497,11 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
}
|
||||
|
||||
let afterLoaded = function() { /** will be overwritten */ };
|
||||
let afterLoaded = function () { /** will be overwritten */ };
|
||||
|
||||
if (!builtInViz.instance) { // not instantiated yet
|
||||
// render when targetEl is available
|
||||
afterLoaded = function(loadedElem) {
|
||||
afterLoaded = function (loadedElem) {
|
||||
try {
|
||||
const transformationSettingTargetEl = getTrSettingElem($scope.id, graphMode)
|
||||
const visualizationSettingTargetEl = getVizSettingElem($scope.id, graphMode)
|
||||
|
|
@ -514,7 +514,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
builtInViz.instance = new Visualization(loadedElem, config);
|
||||
|
||||
// inject emitter, $templateRequest
|
||||
const emitter = function(graphSetting) {
|
||||
const emitter = function (graphSetting) {
|
||||
commitVizConfigChange(graphSetting, graphMode);
|
||||
};
|
||||
builtInViz.instance._emitter = emitter;
|
||||
|
|
@ -544,7 +544,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
// when graph options or data are changed
|
||||
console.log('Refresh data %o', tableData);
|
||||
|
||||
afterLoaded = function(loadedElem) {
|
||||
afterLoaded = function (loadedElem) {
|
||||
const transformationSettingTargetEl = getTrSettingElem($scope.id, graphMode)
|
||||
const visualizationSettingTargetEl = getVizSettingElem($scope.id, graphMode)
|
||||
const config = getVizConfig(graphMode);
|
||||
|
|
@ -559,7 +559,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
};
|
||||
|
||||
} else {
|
||||
afterLoaded = function(loadedElem) {
|
||||
afterLoaded = function (loadedElem) {
|
||||
loadedElem.height(height);
|
||||
builtInViz.instance.activate();
|
||||
};
|
||||
|
|
@ -569,7 +569,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
retryUntilElemIsLoaded(tableElemId, afterLoaded);
|
||||
};
|
||||
|
||||
$scope.switchViz = function(newMode) {
|
||||
$scope.switchViz = function (newMode) {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
|
||||
|
|
@ -582,11 +582,11 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
var createNewScope = function() {
|
||||
var createNewScope = function () {
|
||||
return $rootScope.$new(true);
|
||||
};
|
||||
|
||||
var commitParagraphResult = function(title, text, config, params) {
|
||||
var commitParagraphResult = function (title, text, config, params) {
|
||||
var newParagraphConfig = angular.copy(paragraph.config);
|
||||
newParagraphConfig.results = newParagraphConfig.results || [];
|
||||
newParagraphConfig.results[resultIndex] = config;
|
||||
|
|
@ -602,7 +602,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
};
|
||||
|
||||
$scope.toggleGraphSetting = function() {
|
||||
$scope.toggleGraphSetting = function () {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
if (newConfig.graph.optionOpen) {
|
||||
newConfig.graph.optionOpen = false;
|
||||
|
|
@ -614,7 +614,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
var getVizConfig = function(vizId) {
|
||||
var getVizConfig = function (vizId) {
|
||||
var config;
|
||||
var graph = $scope.config.graph;
|
||||
if (graph) {
|
||||
|
|
@ -643,7 +643,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
return config;
|
||||
};
|
||||
|
||||
var commitVizConfigChange = function(config, vizId) {
|
||||
var commitVizConfigChange = function (config, vizId) {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
if (!newConfig.graph) {
|
||||
newConfig.graph = {};
|
||||
|
|
@ -673,7 +673,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
$scope.$on('paragraphResized', function(event, paragraphId) {
|
||||
$scope.$on('paragraphResized', function (event, paragraphId) {
|
||||
// paragraph col width changed
|
||||
if (paragraphId === paragraph.id) {
|
||||
var builtInViz = builtInVisualizations[$scope.graphMode];
|
||||
|
|
@ -683,13 +683,13 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
$scope.resize = function(width, height) {
|
||||
$timeout(function() {
|
||||
$scope.resize = function (width, height) {
|
||||
$timeout(function () {
|
||||
changeHeight(width, height);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
var changeHeight = function(width, height) {
|
||||
var changeHeight = function (width, height) {
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
var newConfig = angular.copy($scope.config);
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
commitParagraphResult(paragraph.title, paragraph.text, newConfig, newParams);
|
||||
};
|
||||
|
||||
$scope.exportToDSV = function(delimiter) {
|
||||
$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;
|
||||
|
|
@ -730,7 +730,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
saveAsService.saveAs(dsv, exportedFileName, extension);
|
||||
};
|
||||
|
||||
$scope.getBase64ImageSrc = function(base64Data) {
|
||||
$scope.getBase64ImageSrc = function (base64Data) {
|
||||
return 'data:image/png;base64,' + base64Data;
|
||||
};
|
||||
|
||||
|
|
@ -743,7 +743,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
// suggested apps
|
||||
$scope.suggestion = {};
|
||||
|
||||
$scope.switchApp = function(appId) {
|
||||
$scope.switchApp = function (appId) {
|
||||
var newConfig = angular.copy($scope.config);
|
||||
var newParams = angular.copy(paragraph.settings.params);
|
||||
|
||||
|
|
@ -753,27 +753,27 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
commitConfig(newConfig, newParams);
|
||||
};
|
||||
|
||||
$scope.loadApp = function(heliumPackage) {
|
||||
$scope.loadApp = function (heliumPackage) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
$http.post(baseUrlSrv.getRestApiBase() + '/helium/load/' + noteId + '/' + paragraph.id, heliumPackage)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
console.log('Load app %o', data);
|
||||
})
|
||||
.error(function(err, status, headers, config) {
|
||||
.error(function (err, status, headers, config) {
|
||||
console.log('Error %o', err);
|
||||
});
|
||||
};
|
||||
|
||||
var commitConfig = function(config, params) {
|
||||
var commitConfig = function (config, params) {
|
||||
commitParagraphResult(paragraph.title, paragraph.text, config, params);
|
||||
};
|
||||
|
||||
var getApplicationStates = function() {
|
||||
var getApplicationStates = function () {
|
||||
var appStates = [];
|
||||
|
||||
// Display ApplicationState
|
||||
if (paragraph.apps) {
|
||||
_.forEach(paragraph.apps, function(app) {
|
||||
_.forEach(paragraph.apps, function (app) {
|
||||
appStates.push({
|
||||
id: app.id,
|
||||
pkg: app.pkg,
|
||||
|
|
@ -784,7 +784,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
|
||||
// update or remove app states no longer exists
|
||||
_.forEach($scope.apps, function(currentAppState, idx) {
|
||||
_.forEach($scope.apps, function (currentAppState, idx) {
|
||||
var newAppState = _.find(appStates, {id: currentAppState.id});
|
||||
if (newAppState) {
|
||||
angular.extend($scope.apps[idx], newAppState);
|
||||
|
|
@ -794,29 +794,29 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
});
|
||||
|
||||
// add new app states
|
||||
_.forEach(appStates, function(app, idx) {
|
||||
_.forEach(appStates, function (app, idx) {
|
||||
if ($scope.apps.length <= idx || $scope.apps[idx].id !== app.id) {
|
||||
$scope.apps.splice(idx, 0, app);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var getSuggestions = function() {
|
||||
var getSuggestions = function () {
|
||||
// Get suggested apps
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
if (!noteId) {
|
||||
return;
|
||||
}
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/helium/suggest/' + noteId + '/' + paragraph.id)
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
$scope.suggestion = data.body;
|
||||
})
|
||||
.error(function(err, status, headers, config) {
|
||||
.error(function (err, status, headers, config) {
|
||||
console.log('Error %o', err);
|
||||
});
|
||||
};
|
||||
|
||||
const renderApp = function(targetElemId, appState) {
|
||||
const renderApp = function (targetElemId, appState) {
|
||||
const afterLoaded = (loadedElem) => {
|
||||
try {
|
||||
console.log('renderApp %o', appState);
|
||||
|
|
@ -832,7 +832,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
/*
|
||||
** $scope.$on functions below
|
||||
*/
|
||||
$scope.$on('appendAppOutput', function(event, data) {
|
||||
$scope.$on('appendAppOutput', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
if (app) {
|
||||
|
|
@ -849,7 +849,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('updateAppOutput', function(event, data) {
|
||||
$scope.$on('updateAppOutput', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
if (app) {
|
||||
|
|
@ -866,7 +866,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('appLoad', function(event, data) {
|
||||
$scope.$on('appLoad', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
if (!app) {
|
||||
|
|
@ -884,7 +884,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('appStatusChange', function(event, data) {
|
||||
$scope.$on('appStatusChange', function (event, data) {
|
||||
if (paragraph.id === data.paragraphId) {
|
||||
var app = _.find($scope.apps, {id: data.appId});
|
||||
if (app) {
|
||||
|
|
@ -895,7 +895,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
var getAppRegistry = function(appState) {
|
||||
var getAppRegistry = function (appState) {
|
||||
if (!appState.registry) {
|
||||
appState.registry = {};
|
||||
}
|
||||
|
|
@ -903,14 +903,14 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
return appState.registry;
|
||||
};
|
||||
|
||||
var getAppScope = function(appState) {
|
||||
var getAppScope = function (appState) {
|
||||
if (!appState.scope) {
|
||||
appState.scope = $rootScope.$new(true, $rootScope);
|
||||
}
|
||||
return appState.scope;
|
||||
};
|
||||
|
||||
$scope.$on('angularObjectUpdate', function(event, data) {
|
||||
$scope.$on('angularObjectUpdate', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
|
|
@ -946,7 +946,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
registry[varName].skipEmit = true;
|
||||
|
||||
if (!registry[varName].clearWatcher) {
|
||||
registry[varName].clearWatcher = scope.$watch(varName, function(newValue, oldValue) {
|
||||
registry[varName].clearWatcher = scope.$watch(varName, function (newValue, oldValue) {
|
||||
console.log('angular object (paragraph) updated %o %o', varName, registry[varName]);
|
||||
if (registry[varName].skipEmit) {
|
||||
registry[varName].skipEmit = false;
|
||||
|
|
@ -966,7 +966,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
// create proxy for AngularFunction
|
||||
if (varName.indexOf(ANGULAR_FUNCTION_OBJECT_NAME_PREFIX) === 0) {
|
||||
var funcName = varName.substring((ANGULAR_FUNCTION_OBJECT_NAME_PREFIX).length);
|
||||
scope[funcName] = function() {
|
||||
scope[funcName] = function () {
|
||||
scope[varName] = arguments;
|
||||
console.log('angular function (paragraph) invoked %o', arguments);
|
||||
};
|
||||
|
|
@ -976,7 +976,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
|
|||
}
|
||||
});
|
||||
|
||||
$scope.$on('angularObjectRemove', function(event, data) {
|
||||
$scope.$on('angularObjectRemove', function (event, data) {
|
||||
var noteId = $route.current.pathParams.noteId;
|
||||
if (!data.noteId || data.noteId === noteId) {
|
||||
var scope;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('NotebookReposCtrl', NotebookReposCtrl);
|
||||
|
||||
function NotebookReposCtrl($http, baseUrlSrv, ngToast) {
|
||||
function NotebookReposCtrl ($http, baseUrlSrv, ngToast) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
|
|
@ -26,19 +26,19 @@ function NotebookReposCtrl($http, baseUrlSrv, ngToast) {
|
|||
|
||||
// Public functions
|
||||
|
||||
function saveNotebookRepo(valueform, repo, data) {
|
||||
function saveNotebookRepo (valueform, repo, data) {
|
||||
console.log('data %o', data);
|
||||
$http.put(baseUrlSrv.getRestApiBase() + '/notebook-repositories', {
|
||||
'name': repo.className,
|
||||
'settings': data
|
||||
}).success(function(data) {
|
||||
}).success(function (data) {
|
||||
var 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);
|
||||
}
|
||||
valueform.$show();
|
||||
}).error(function() {
|
||||
}).error(function () {
|
||||
ngToast.danger({
|
||||
content: 'We couldn\'t save that NotebookRepo\'s settings',
|
||||
verticalPosition: 'bottom',
|
||||
|
|
@ -50,7 +50,7 @@ function NotebookReposCtrl($http, baseUrlSrv, ngToast) {
|
|||
return 'manual';
|
||||
}
|
||||
|
||||
function showDropdownSelected(setting) {
|
||||
function showDropdownSelected (setting) {
|
||||
var index = _.findIndex(setting.value, {'value': setting.selected});
|
||||
if (index < 0) {
|
||||
return 'No value';
|
||||
|
|
@ -61,19 +61,19 @@ function NotebookReposCtrl($http, baseUrlSrv, ngToast) {
|
|||
|
||||
// Private functions
|
||||
|
||||
function _getInterpreterSettings() {
|
||||
function _getInterpreterSettings () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/notebook-repositories')
|
||||
.success(function(data, status, headers, config) {
|
||||
.success(function (data, status, headers, config) {
|
||||
vm.notebookRepos = data.body;
|
||||
console.log('ya notebookRepos %o', vm.notebookRepos);
|
||||
}).error(function(data, status, headers, config) {
|
||||
}).error(function (data, status, headers, config) {
|
||||
if (status === 401) {
|
||||
ngToast.danger({
|
||||
content: 'You don\'t have permission on this page',
|
||||
verticalPosition: 'bottom',
|
||||
timeout: '3000'
|
||||
});
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
window.location.replace('/');
|
||||
}, 3000);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ function NotebookReposCtrl($http, baseUrlSrv, ngToast) {
|
|||
});
|
||||
}
|
||||
|
||||
function _init() {
|
||||
function _init () {
|
||||
_getInterpreterSettings();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('SearchResultCtrl', SearchResultCtrl);
|
||||
|
||||
function SearchResultCtrl($scope, $routeParams, searchService) {
|
||||
function SearchResultCtrl ($scope, $routeParams, searchService) {
|
||||
'ngInject';
|
||||
|
||||
$scope.isResult = true;
|
||||
$scope.searchTerm = $routeParams.searchTerm;
|
||||
var results = searchService.search({'q': $routeParams.searchTerm}).query();
|
||||
|
||||
results.$promise.then(function(result) {
|
||||
$scope.notes = result.body.map(function(note) {
|
||||
results.$promise.then(function (result) {
|
||||
$scope.notes = result.body.map(function (note) {
|
||||
// redirect to notebook when search result is a notebook itself,
|
||||
// not a paragraph
|
||||
if (!/\/paragraph\//.test(note.id)) {
|
||||
|
|
@ -40,7 +40,7 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
$scope.isResult = true;
|
||||
}
|
||||
|
||||
$scope.$on('$routeChangeStart', function(event, next, current) {
|
||||
$scope.$on('$routeChangeStart', function (event, next, current) {
|
||||
if (next.originalPath !== '/search/:searchTerm') {
|
||||
searchService.searchTerm = '';
|
||||
}
|
||||
|
|
@ -50,9 +50,9 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
$scope.page = 0;
|
||||
$scope.allResults = false;
|
||||
|
||||
$scope.highlightSearchResults = function(note) {
|
||||
return function(_editor) {
|
||||
function getEditorMode(text) {
|
||||
$scope.highlightSearchResults = function (note) {
|
||||
return function (_editor) {
|
||||
function getEditorMode (text) {
|
||||
var editorModes = {
|
||||
'ace/mode/scala': /^%(\w*\.)?spark/,
|
||||
'ace/mode/python': /^%(\w*\.)?(pyspark|python)/,
|
||||
|
|
@ -62,7 +62,7 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
'ace/mode/sh': /^%sh/
|
||||
};
|
||||
|
||||
return Object.keys(editorModes).reduce(function(res, mode) {
|
||||
return Object.keys(editorModes).reduce(function (res, mode) {
|
||||
return editorModes[mode].test(text) ? mode : res;
|
||||
}, 'ace/mode/scala');
|
||||
}
|
||||
|
|
@ -76,8 +76,8 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
_editor.setTheme('ace/theme/chrome');
|
||||
_editor.getSession().setMode(getEditorMode(note.text));
|
||||
|
||||
function getIndeces(term) {
|
||||
return function(str) {
|
||||
function getIndeces (term) {
|
||||
return function (str) {
|
||||
var indeces = [];
|
||||
var i = -1;
|
||||
while ((i = str.indexOf(term, i + 1)) >= 0) {
|
||||
|
|
@ -96,7 +96,7 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
|
||||
var lines = result
|
||||
.split('\n')
|
||||
.map(function(line, row) {
|
||||
.map(function (line, row) {
|
||||
|
||||
var match = line.match(/<B>(.+?)<\/B>/);
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
|
||||
var indeces = getIndeces(term)(__line);
|
||||
|
||||
indeces.forEach(function(start) {
|
||||
indeces.forEach(function (start) {
|
||||
var end = start + term.length;
|
||||
if (note.header !== '' && row === 0) {
|
||||
_editor
|
||||
|
|
@ -145,7 +145,7 @@ function SearchResultCtrl($scope, $routeParams, searchService) {
|
|||
// resize editor based on content length
|
||||
_editor.setOption(
|
||||
'maxLines',
|
||||
lines.reduce(function(len, line) { return len + line.length; }, 0)
|
||||
lines.reduce(function (len, line) { return len + line.length; }, 0)
|
||||
);
|
||||
|
||||
_editor.getSession().setValue(lines.join('\n'));
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import {
|
|||
/* eslint-enable no-unused-vars */
|
||||
|
||||
export class SpellBase {
|
||||
constructor(magic) {
|
||||
constructor (magic) {
|
||||
this.magic = magic;
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ export class SpellBase {
|
|||
* @param config {Object}
|
||||
* @return {SpellResult}
|
||||
*/
|
||||
interpret(paragraphText, config) {
|
||||
interpret (paragraphText, config) {
|
||||
throw new Error('SpellBase.interpret() should be overrided');
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ export class SpellBase {
|
|||
* (e.g `%flowchart`)
|
||||
* @return {string}
|
||||
*/
|
||||
getMagic() {
|
||||
getMagic () {
|
||||
return this.magic;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export const DefaultDisplayMagic = {
|
|||
};
|
||||
|
||||
export class DataWithType {
|
||||
constructor(data, type, magic, text) {
|
||||
constructor (data, type, magic, text) {
|
||||
this.data = data;
|
||||
this.type = type;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ export class DataWithType {
|
|||
this.text = text;
|
||||
}
|
||||
|
||||
static handleDefaultMagic(m) {
|
||||
static handleDefaultMagic (m) {
|
||||
// let's use default display type instead of magic in case of default
|
||||
// to keep consistency with backend interpreter
|
||||
if (DefaultDisplayMagic[m]) {
|
||||
|
|
@ -58,7 +58,7 @@ export class DataWithType {
|
|||
}
|
||||
}
|
||||
|
||||
static createPropagable(dataWithType) {
|
||||
static createPropagable (dataWithType) {
|
||||
if (!SpellResult.isFunction(dataWithType.data)) {
|
||||
return dataWithType;
|
||||
}
|
||||
|
|
@ -75,8 +75,8 @@ export class DataWithType {
|
|||
* @param customDisplayType
|
||||
* @return {Array<DataWithType>}
|
||||
*/
|
||||
static parseStringData(data, customDisplayMagic) {
|
||||
function availableMagic(magic) {
|
||||
static parseStringData (data, customDisplayMagic) {
|
||||
function availableMagic (magic) {
|
||||
return magic && (DefaultDisplayMagic[magic] || customDisplayMagic[magic]);
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ export class DataWithType {
|
|||
* @param textWithoutMagic
|
||||
* @return {Promise<Array<DataWithType>>}
|
||||
*/
|
||||
static produceMultipleData(dataWithType, customDisplayType,
|
||||
static produceMultipleData (dataWithType, customDisplayType,
|
||||
magic, textWithoutMagic) {
|
||||
const data = dataWithType.getData();
|
||||
const type = dataWithType.getType();
|
||||
|
|
@ -176,7 +176,7 @@ export class DataWithType {
|
|||
* will be called in `then()` of this promise.
|
||||
* @returns {*} `data` which can be object, function or promise.
|
||||
*/
|
||||
getData() {
|
||||
getData () {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
|
|
@ -186,40 +186,40 @@ export class DataWithType {
|
|||
* by `SpellResult.parseStringData()`
|
||||
* @returns {string}
|
||||
*/
|
||||
getType() {
|
||||
getType () {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
getMagic() {
|
||||
getMagic () {
|
||||
return this.magic;
|
||||
}
|
||||
|
||||
getText() {
|
||||
getText () {
|
||||
return this.text;
|
||||
}
|
||||
}
|
||||
|
||||
export class SpellResult {
|
||||
constructor(resultData, resultType) {
|
||||
constructor (resultData, resultType) {
|
||||
this.dataWithTypes = [];
|
||||
this.add(resultData, resultType);
|
||||
}
|
||||
|
||||
static isFunction(data) {
|
||||
static isFunction (data) {
|
||||
return (data && typeof data === 'function');
|
||||
}
|
||||
|
||||
static isPromise(data) {
|
||||
static isPromise (data) {
|
||||
return (data && typeof data.then === 'function');
|
||||
}
|
||||
|
||||
static isObject(data) {
|
||||
static isObject (data) {
|
||||
return (data &&
|
||||
!SpellResult.isFunction(data) &&
|
||||
!SpellResult.isPromise(data));
|
||||
}
|
||||
|
||||
static extractMagic(allParagraphText) {
|
||||
static extractMagic (allParagraphText) {
|
||||
const pattern = /^\s*%(\S+)\s*/g;
|
||||
try {
|
||||
let match = pattern.exec(allParagraphText);
|
||||
|
|
@ -233,13 +233,13 @@ export class SpellResult {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
static createPropagable(resultMsg) {
|
||||
static createPropagable (resultMsg) {
|
||||
return resultMsg.map(dt => {
|
||||
return DataWithType.createPropagable(dt);
|
||||
})
|
||||
}
|
||||
|
||||
add(resultData, resultType) {
|
||||
add (resultData, resultType) {
|
||||
if (resultData) {
|
||||
this.dataWithTypes.push(
|
||||
new DataWithType(resultData, resultType));
|
||||
|
|
@ -253,7 +253,7 @@ export class SpellResult {
|
|||
* @param textWithoutMagic
|
||||
* @return {Promise<Array<DataWithType>>}
|
||||
*/
|
||||
getAllParsedDataWithTypes(customDisplayType, magic, textWithoutMagic) {
|
||||
getAllParsedDataWithTypes (customDisplayType, magic, textWithoutMagic) {
|
||||
const promises = this.dataWithTypes.map(dt => {
|
||||
return DataWithType.produceMultipleData(
|
||||
dt, customDisplayType, magic, textWithoutMagic);
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ import Transformation from './transformation';
|
|||
* ]
|
||||
*/
|
||||
export default class ColumnselectorTransformation extends Transformation {
|
||||
constructor(config, columnSelectorProp) {
|
||||
constructor (config, columnSelectorProp) {
|
||||
super(config);
|
||||
this.props = columnSelectorProp;
|
||||
};
|
||||
|
||||
getSetting() {
|
||||
getSetting () {
|
||||
var self = this;
|
||||
var configObj = self.config;
|
||||
return {
|
||||
|
|
@ -40,10 +40,10 @@ export default class ColumnselectorTransformation extends Transformation {
|
|||
config: self.config,
|
||||
props: self.props,
|
||||
tableDataColumns: self.tableDataColumns,
|
||||
save: function() {
|
||||
save: function () {
|
||||
self.emitConfig(configObj);
|
||||
},
|
||||
remove: function(selectorName) {
|
||||
remove: function (selectorName) {
|
||||
configObj[selectorName] = null;
|
||||
self.emitConfig(configObj);
|
||||
}
|
||||
|
|
@ -54,13 +54,13 @@ export default class ColumnselectorTransformation extends Transformation {
|
|||
/**
|
||||
* Method will be invoked when tableData or config changes
|
||||
*/
|
||||
transform(tableData) {
|
||||
transform (tableData) {
|
||||
this.tableDataColumns = tableData.columns;
|
||||
this.removeUnknown();
|
||||
return tableData;
|
||||
};
|
||||
|
||||
removeUnknown() {
|
||||
removeUnknown () {
|
||||
var fields = this.config;
|
||||
for (var f in fields) {
|
||||
if (fields[f]) {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ import Transformation from './transformation';
|
|||
* passthough the data
|
||||
*/
|
||||
export default class PassthroughTransformation extends Transformation {
|
||||
constructor(config) {
|
||||
constructor (config) {
|
||||
super(config);
|
||||
};
|
||||
|
||||
/**
|
||||
* Method will be invoked when tableData or config changes
|
||||
*/
|
||||
transform(tableData) {
|
||||
transform (tableData) {
|
||||
return tableData;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ import Transformation from './transformation';
|
|||
* pivot table data and return d3 chart data
|
||||
*/
|
||||
export default class PivotTransformation extends Transformation {
|
||||
constructor(config) {
|
||||
constructor (config) {
|
||||
super(config);
|
||||
};
|
||||
|
||||
getSetting() {
|
||||
getSetting () {
|
||||
var self = this;
|
||||
|
||||
var configObj = self.config;
|
||||
|
|
@ -32,22 +32,22 @@ export default class PivotTransformation extends Transformation {
|
|||
scope: {
|
||||
config: configObj.common.pivot,
|
||||
tableDataColumns: self.tableDataColumns,
|
||||
save: function() {
|
||||
save: function () {
|
||||
self.emitConfig(configObj);
|
||||
},
|
||||
removeKey: function(idx) {
|
||||
removeKey: function (idx) {
|
||||
configObj.common.pivot.keys.splice(idx, 1);
|
||||
self.emitConfig(configObj);
|
||||
},
|
||||
removeGroup: function(idx) {
|
||||
removeGroup: function (idx) {
|
||||
configObj.common.pivot.groups.splice(idx, 1);
|
||||
self.emitConfig(configObj);
|
||||
},
|
||||
removeValue: function(idx) {
|
||||
removeValue: function (idx) {
|
||||
configObj.common.pivot.values.splice(idx, 1);
|
||||
self.emitConfig(configObj);
|
||||
},
|
||||
setValueAggr: function(idx, aggr) {
|
||||
setValueAggr: function (idx, aggr) {
|
||||
configObj.common.pivot.values[idx].aggr = aggr;
|
||||
self.emitConfig(configObj);
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ export default class PivotTransformation extends Transformation {
|
|||
/**
|
||||
* Method will be invoked when tableData or config changes
|
||||
*/
|
||||
transform(tableData) {
|
||||
transform (tableData) {
|
||||
this.tableDataColumns = tableData.columns;
|
||||
this.config.common = this.config.common || {};
|
||||
this.config.common.pivot = this.config.common.pivot || {};
|
||||
|
|
@ -80,10 +80,10 @@ export default class PivotTransformation extends Transformation {
|
|||
config.values);
|
||||
};
|
||||
|
||||
removeUnknown() {
|
||||
removeUnknown () {
|
||||
var config = this.config.common.pivot;
|
||||
var tableDataColumns = this.tableDataColumns;
|
||||
var unique = function(list) {
|
||||
var unique = function (list) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
for (var j = i + 1; j < list.length; j++) {
|
||||
if (angular.equals(list[i], list[j])) {
|
||||
|
|
@ -93,7 +93,7 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
};
|
||||
|
||||
var removeUnknown = function(list) {
|
||||
var removeUnknown = function (list) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
// remove non existing column
|
||||
var found = false;
|
||||
|
|
@ -118,7 +118,7 @@ export default class PivotTransformation extends Transformation {
|
|||
removeUnknown(config.values);
|
||||
};
|
||||
|
||||
selectDefault() {
|
||||
selectDefault () {
|
||||
var config = this.config.common.pivot;
|
||||
if (config.keys.length === 0 &&
|
||||
config.groups.length === 0 &&
|
||||
|
|
@ -133,29 +133,29 @@ export default class PivotTransformation extends Transformation {
|
|||
}
|
||||
};
|
||||
|
||||
pivot(data, keys, groups, values) {
|
||||
pivot (data, keys, groups, values) {
|
||||
var aggrFunc = {
|
||||
sum: function(a, b) {
|
||||
sum: function (a, b) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return varA + varB;
|
||||
},
|
||||
count: function(a, b) {
|
||||
count: function (a, b) {
|
||||
var varA = (a !== undefined) ? parseInt(a) : 0;
|
||||
var varB = (b !== undefined) ? 1 : 0;
|
||||
return varA + varB;
|
||||
},
|
||||
min: function(a, b) {
|
||||
min: function (a, b) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return Math.min(varA, varB);
|
||||
},
|
||||
max: function(a, b) {
|
||||
max: function (a, b) {
|
||||
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
|
||||
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
|
||||
return Math.max(varA, varB);
|
||||
},
|
||||
avg: function(a, b, c) {
|
||||
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;
|
||||
return varA + varB;
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@
|
|||
* Create table data object from paragraph table type result
|
||||
*/
|
||||
export default class TableData {
|
||||
constructor(columns, rows, comment) {
|
||||
constructor (columns, rows, comment) {
|
||||
this.columns = columns || [];
|
||||
this.rows = rows || [];
|
||||
this.comment = comment || '';
|
||||
};
|
||||
|
||||
loadParagraphResult(paragraphResult) {
|
||||
loadParagraphResult (paragraphResult) {
|
||||
if (!paragraphResult || paragraphResult.type !== 'TABLE') {
|
||||
console.log('Can not load paragraph result');
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -14,21 +14,21 @@
|
|||
|
||||
import TableData from './tabledata.js';
|
||||
|
||||
describe('TableData build', function() {
|
||||
describe('TableData build', function () {
|
||||
var td;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
console.log(TableData);
|
||||
td = new TableData();
|
||||
});
|
||||
|
||||
it('should initialize the default value', function() {
|
||||
it('should initialize the default value', function () {
|
||||
expect(td.columns.length).toBe(0);
|
||||
expect(td.rows.length).toBe(0);
|
||||
expect(td.comment).toBe('');
|
||||
});
|
||||
|
||||
it('should able to create Tabledata from paragraph result', function() {
|
||||
it('should able to create Tabledata from paragraph result', function () {
|
||||
td.loadParagraphResult({
|
||||
type: 'TABLE',
|
||||
msg: 'key\tvalue\na\t10\nb\t20\n\nhello'
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* Base class for visualization
|
||||
*/
|
||||
export default class Transformation {
|
||||
constructor(config) {
|
||||
constructor (config) {
|
||||
this.config = config;
|
||||
this._emitter;
|
||||
};
|
||||
|
|
@ -27,21 +27,21 @@ export default class Transformation {
|
|||
* scope : an object to bind to template scope
|
||||
* }
|
||||
*/
|
||||
getSetting() {
|
||||
getSetting () {
|
||||
// override this
|
||||
};
|
||||
|
||||
/**
|
||||
* Method will be invoked when tableData or config changes
|
||||
*/
|
||||
transform(tableData) {
|
||||
transform (tableData) {
|
||||
// override this
|
||||
};
|
||||
|
||||
/**
|
||||
* render setting
|
||||
*/
|
||||
renderSetting(targetEl) {
|
||||
renderSetting (targetEl) {
|
||||
var setting = this.getSetting();
|
||||
if (!setting) {
|
||||
return;
|
||||
|
|
@ -50,7 +50,7 @@ export default class Transformation {
|
|||
// already readered
|
||||
if (this._scope) {
|
||||
var self = this;
|
||||
this._scope.$apply(function() {
|
||||
this._scope.$apply(function () {
|
||||
for (var k in setting.scope) {
|
||||
self._scope[k] = setting.scope[k];
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ export default class Transformation {
|
|||
if (template.split('\n').length === 1 &&
|
||||
template.endsWith('.html')) { // template is url
|
||||
var self = this;
|
||||
this._templateRequest(template).then(function(t) {
|
||||
this._templateRequest(template).then(function (t) {
|
||||
self._render(targetEl, t, scope);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -83,21 +83,21 @@ export default class Transformation {
|
|||
}
|
||||
};
|
||||
|
||||
_render(targetEl, template, scope) {
|
||||
_render (targetEl, template, scope) {
|
||||
this._targetEl = targetEl;
|
||||
targetEl.html(template);
|
||||
this._compile(targetEl.contents())(scope);
|
||||
this._scope = scope;
|
||||
};
|
||||
|
||||
setConfig(config) {
|
||||
setConfig (config) {
|
||||
this.config = config;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit config. config will sent to server and saved.
|
||||
*/
|
||||
emitConfig(config) {
|
||||
emitConfig (config) {
|
||||
this._emitter(config);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,21 +19,21 @@ import PivotTransformation from '../../tabledata/pivot';
|
|||
* Visualize data in area chart
|
||||
*/
|
||||
export default class AreachartVisualization extends Nvd3ChartVisualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
|
||||
this.pivot = new PivotTransformation(config);
|
||||
};
|
||||
|
||||
type() {
|
||||
type () {
|
||||
return 'stackedAreaChart';
|
||||
};
|
||||
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
return this.pivot;
|
||||
};
|
||||
|
||||
render(pivot) {
|
||||
render (pivot) {
|
||||
var d3Data = this.d3DataFromPivot(
|
||||
pivot.schema,
|
||||
pivot.rows,
|
||||
|
|
@ -51,26 +51,26 @@ export default class AreachartVisualization extends Nvd3ChartVisualization {
|
|||
/**
|
||||
* Set new config
|
||||
*/
|
||||
setConfig(config) {
|
||||
setConfig (config) {
|
||||
super.setConfig(config);
|
||||
this.pivot.setConfig(config);
|
||||
};
|
||||
|
||||
configureChart(chart) {
|
||||
configureChart (chart) {
|
||||
var self = this;
|
||||
chart.xAxis.tickFormat(function(d) { return self.xAxisTickFormat(d, self.xLabels); });
|
||||
chart.yAxis.tickFormat(function(d) { return self.yAxisTickFormat(d); });
|
||||
chart.xAxis.tickFormat(function (d) { return self.xAxisTickFormat(d, self.xLabels); });
|
||||
chart.yAxis.tickFormat(function (d) { return self.yAxisTickFormat(d); });
|
||||
chart.yAxis.axisLabelDistance(50);
|
||||
chart.useInteractiveGuideline(true); // for better UX and performance issue. (https://github.com/novus/nvd3/issues/691)
|
||||
|
||||
this.chart.style(this.config.style || 'stack');
|
||||
|
||||
var self = this;
|
||||
this.chart.dispatch.on('stateChange', function(s) {
|
||||
this.chart.dispatch.on('stateChange', function (s) {
|
||||
self.config.style = s.style;
|
||||
|
||||
// give some time to animation finish
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
self.emitConfig(self.config);
|
||||
}, 500);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,21 +19,21 @@ import PivotTransformation from '../../tabledata/pivot';
|
|||
* Visualize data in bar char
|
||||
*/
|
||||
export default class BarchartVisualization extends Nvd3ChartVisualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
|
||||
this.pivot = new PivotTransformation(config);
|
||||
};
|
||||
|
||||
type() {
|
||||
type () {
|
||||
return 'multiBarChart';
|
||||
};
|
||||
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
return this.pivot;
|
||||
};
|
||||
|
||||
render(pivot) {
|
||||
render (pivot) {
|
||||
var d3Data = this.d3DataFromPivot(
|
||||
pivot.schema,
|
||||
pivot.rows,
|
||||
|
|
@ -51,17 +51,17 @@ export default class BarchartVisualization extends Nvd3ChartVisualization {
|
|||
/**
|
||||
* Set new config
|
||||
*/
|
||||
setConfig(config) {
|
||||
setConfig (config) {
|
||||
super.setConfig(config);
|
||||
this.pivot.setConfig(config);
|
||||
};
|
||||
|
||||
configureChart(chart) {
|
||||
configureChart (chart) {
|
||||
var self = this;
|
||||
var configObj = self.config;
|
||||
|
||||
chart.yAxis.axisLabelDistance(50);
|
||||
chart.yAxis.tickFormat(function(d) { return self.yAxisTickFormat(d); });
|
||||
chart.yAxis.tickFormat(function (d) { return self.yAxisTickFormat(d); });
|
||||
|
||||
self.chart.stacked(this.config.stacked);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ import PivotTransformation from '../../tabledata/pivot';
|
|||
* Visualize data in line chart
|
||||
*/
|
||||
export default class LinechartVisualization extends Nvd3ChartVisualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
|
||||
this.pivot = new PivotTransformation(config);
|
||||
};
|
||||
|
||||
type() {
|
||||
type () {
|
||||
if (this.config.lineWithFocus) {
|
||||
return 'lineWithFocusChart';
|
||||
} else {
|
||||
|
|
@ -33,11 +33,11 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
};
|
||||
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
return this.pivot;
|
||||
};
|
||||
|
||||
render(pivot) {
|
||||
render (pivot) {
|
||||
var d3Data = this.d3DataFromPivot(
|
||||
pivot.schema,
|
||||
pivot.rows,
|
||||
|
|
@ -55,7 +55,7 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
/**
|
||||
* Set new config
|
||||
*/
|
||||
setConfig(config) {
|
||||
setConfig (config) {
|
||||
super.setConfig(config);
|
||||
this.pivot.setConfig(config);
|
||||
|
||||
|
|
@ -66,10 +66,10 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
};
|
||||
|
||||
configureChart(chart) {
|
||||
configureChart (chart) {
|
||||
var self = this;
|
||||
chart.xAxis.tickFormat(function(d) { return self.xAxisTickFormat(d, self.xLabels); });
|
||||
chart.yAxis.tickFormat(function(d) {
|
||||
chart.xAxis.tickFormat(function (d) { return self.xAxisTickFormat(d, self.xLabels); });
|
||||
chart.yAxis.tickFormat(function (d) {
|
||||
if (d === undefined) {
|
||||
return 'N/A';
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
};
|
||||
|
||||
getSetting(chart) {
|
||||
getSetting (chart) {
|
||||
var self = this;
|
||||
var configObj = self.config;
|
||||
|
||||
|
|
@ -109,14 +109,14 @@ export default class LinechartVisualization extends Nvd3ChartVisualization {
|
|||
</div>`,
|
||||
scope: {
|
||||
config: configObj,
|
||||
save: function() {
|
||||
save: function () {
|
||||
self.emitConfig(configObj);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
defaultY() {
|
||||
defaultY () {
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@ import Visualization from '../visualization';
|
|||
* Visualize data in table format
|
||||
*/
|
||||
export default class Nvd3ChartVisualization extends Visualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
this.targetEl.append('<svg></svg>');
|
||||
};
|
||||
|
||||
refresh() {
|
||||
refresh () {
|
||||
if (this.chart) {
|
||||
this.chart.update();
|
||||
}
|
||||
};
|
||||
|
||||
render(data) {
|
||||
render (data) {
|
||||
var type = this.type();
|
||||
var d3g = data.d3g;
|
||||
|
||||
|
|
@ -60,19 +60,19 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
d3.select('#' + this.targetEl[0].id + ' svg').style.height = height + 'px';
|
||||
};
|
||||
|
||||
type() {
|
||||
type () {
|
||||
// override this and return chart type
|
||||
};
|
||||
|
||||
configureChart(chart) {
|
||||
configureChart (chart) {
|
||||
// override this to configure chart
|
||||
};
|
||||
|
||||
groupedThousandsWith3DigitsFormatter(x) {
|
||||
groupedThousandsWith3DigitsFormatter (x) {
|
||||
return d3.format(',')(d3.round(x, 3));
|
||||
};
|
||||
|
||||
customAbbrevFormatter(x) {
|
||||
customAbbrevFormatter (x) {
|
||||
var s = d3.format('.3s')(x);
|
||||
switch (s[s.length - 1]) {
|
||||
case 'G': return s.slice(0, -1) + 'B';
|
||||
|
|
@ -80,11 +80,11 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
return s;
|
||||
};
|
||||
|
||||
defaultY() {
|
||||
defaultY () {
|
||||
return 0;
|
||||
};
|
||||
|
||||
xAxisTickFormat(d, xLabels) {
|
||||
xAxisTickFormat (d, xLabels) {
|
||||
if (xLabels[d] && (isNaN(parseFloat(xLabels[d])) || !isFinite(xLabels[d]))) { // to handle string type xlabel
|
||||
return xLabels[d];
|
||||
} else {
|
||||
|
|
@ -92,20 +92,20 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
};
|
||||
|
||||
yAxisTickFormat(d) {
|
||||
yAxisTickFormat (d) {
|
||||
if (Math.abs(d) >= Math.pow(10, 6)) {
|
||||
return this.customAbbrevFormatter(d);
|
||||
}
|
||||
return this.groupedThousandsWith3DigitsFormatter(d);
|
||||
};
|
||||
|
||||
d3DataFromPivot(
|
||||
d3DataFromPivot (
|
||||
schema, rows, keys, groups, values, allowTextXAxis, fillMissingValues, multiBarChart) {
|
||||
var self = this;
|
||||
// construct table data
|
||||
var d3g = [];
|
||||
|
||||
var concat = function(o, n) {
|
||||
var concat = function (o, n) {
|
||||
if (!o) {
|
||||
return n;
|
||||
} else {
|
||||
|
|
@ -113,14 +113,14 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
}
|
||||
};
|
||||
|
||||
var getSchemaUnderKey = function(key, s) {
|
||||
var getSchemaUnderKey = function (key, s) {
|
||||
for (var c in key.children) {
|
||||
s[c] = {};
|
||||
getSchemaUnderKey(key.children[c], s[c]);
|
||||
}
|
||||
};
|
||||
|
||||
var traverse = function(sKey, s, rKey, r, func, rowName, rowValue, colName) {
|
||||
var 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') {
|
||||
|
|
@ -162,7 +162,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
var rowIndexValue = {};
|
||||
|
||||
for (var k in rows) {
|
||||
traverse(sKey, schema[sKey], k, rows[k], function(rowName, rowValue, colName, value) {
|
||||
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) {
|
||||
rowIndexValue[rowIdx] = rowValue;
|
||||
|
|
@ -252,7 +252,7 @@ export default class Nvd3ChartVisualization extends Visualization {
|
|||
* method will be invoked when visualization need to be destroyed.
|
||||
* Don't need to destroy this.targetEl.
|
||||
*/
|
||||
destroy() {
|
||||
destroy () {
|
||||
if (this.chart) {
|
||||
d3.selectAll('#' + this.targetEl[0].id + ' svg > *').remove();
|
||||
this.chart = undefined;
|
||||
|
|
|
|||
|
|
@ -19,20 +19,20 @@ import PivotTransformation from '../../tabledata/pivot';
|
|||
* Visualize data in pie chart
|
||||
*/
|
||||
export default class PiechartVisualization extends Nvd3ChartVisualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
this.pivot = new PivotTransformation(config);
|
||||
};
|
||||
|
||||
type() {
|
||||
type () {
|
||||
return 'pieChart';
|
||||
};
|
||||
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
return this.pivot;
|
||||
};
|
||||
|
||||
render(pivot) {
|
||||
render (pivot) {
|
||||
// [ZEPPELIN-2253] New chart function will be created each time inside super.render()
|
||||
this.chart = null;
|
||||
const d3Data = this.d3DataFromPivot(
|
||||
|
|
@ -69,14 +69,14 @@ export default class PiechartVisualization extends Nvd3ChartVisualization {
|
|||
/**
|
||||
* Set new config
|
||||
*/
|
||||
setConfig(config) {
|
||||
setConfig (config) {
|
||||
super.setConfig(config);
|
||||
this.pivot.setConfig(config);
|
||||
};
|
||||
|
||||
configureChart(chart) {
|
||||
chart.x(function(d) { return d.label; })
|
||||
.y(function(d) { return d.value; })
|
||||
configureChart (chart) {
|
||||
chart.x(function (d) { return d.label; })
|
||||
.y(function (d) { return d.value; })
|
||||
.showLabels(false)
|
||||
.showTooltipPercent(true);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import ColumnselectorTransformation from '../../tabledata/columnselector';
|
|||
* Visualize data in scatter char
|
||||
*/
|
||||
export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
|
||||
this.columnselectorProps = [
|
||||
|
|
@ -45,15 +45,15 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
this.columnselector = new ColumnselectorTransformation(config, this.columnselectorProps);
|
||||
};
|
||||
|
||||
type() {
|
||||
type () {
|
||||
return 'scatterChart';
|
||||
};
|
||||
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
return this.columnselector;
|
||||
};
|
||||
|
||||
render(tableData) {
|
||||
render (tableData) {
|
||||
this.tableData = tableData;
|
||||
this.selectDefault();
|
||||
var d3Data = this.setScatterChart(tableData, true);
|
||||
|
|
@ -63,14 +63,14 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
super.render(d3Data);
|
||||
};
|
||||
|
||||
configureChart(chart) {
|
||||
configureChart (chart) {
|
||||
var self = this;
|
||||
|
||||
chart.xAxis.tickFormat(function(d) { // TODO remove round after bump to nvd3 > 1.8.5
|
||||
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);
|
||||
});
|
||||
|
||||
chart.yAxis.tickFormat(function(d) { // TODO remove round after bump to nvd3 > 1.8.5
|
||||
chart.yAxis.tickFormat(function (d) { // TODO remove round after bump to nvd3 > 1.8.5
|
||||
return self.yAxisTickFormat(Math.round(d * 1e3)/1e3, self.yLabels);
|
||||
});
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
// handle the problem of tooltip not showing when muliple points have same value.
|
||||
};
|
||||
|
||||
yAxisTickFormat(d, yLabels) {
|
||||
yAxisTickFormat (d, yLabels) {
|
||||
if (yLabels[d] && (isNaN(parseFloat(yLabels[d])) || !isFinite(yLabels[d]))) { // to handle string type xlabel
|
||||
return yLabels[d];
|
||||
} else {
|
||||
|
|
@ -86,7 +86,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
}
|
||||
|
||||
selectDefault() {
|
||||
selectDefault () {
|
||||
if (!this.config.xAxis && !this.config.yAxis) {
|
||||
if (this.tableData.columns.length > 1) {
|
||||
this.config.xAxis = this.tableData.columns[0];
|
||||
|
|
@ -97,7 +97,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
};
|
||||
|
||||
setScatterChart(data, refresh) {
|
||||
setScatterChart (data, refresh) {
|
||||
var xAxis = this.config.xAxis;
|
||||
var yAxis = this.config.yAxis;
|
||||
var group = this.config.group;
|
||||
|
|
@ -221,7 +221,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;
|
||||
d3gvalues.sort(function(a, b) {
|
||||
d3gvalues.sort(function (a, b) {
|
||||
return ((a['x'] - b['x']) || (a['y'] - b['y']))
|
||||
});
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
};
|
||||
};
|
||||
|
||||
setDiscreteScatterData(data) {
|
||||
setDiscreteScatterData (data) {
|
||||
var xAxis = this.config.xAxis;
|
||||
var yAxis = this.config.yAxis;
|
||||
var group = this.config.group;
|
||||
|
|
@ -291,8 +291,8 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
return newRows;
|
||||
};
|
||||
|
||||
isDiscrete(field) {
|
||||
var getUnique = function(f) {
|
||||
isDiscrete (field) {
|
||||
var getUnique = function (f) {
|
||||
var uniqObj = {};
|
||||
var uniqArr = [];
|
||||
var j = 0;
|
||||
|
|
@ -322,7 +322,7 @@ export default class ScatterchartVisualization extends Nvd3ChartVisualization {
|
|||
}
|
||||
};
|
||||
|
||||
isValidSizeOption(options) {
|
||||
isValidSizeOption (options) {
|
||||
var xValues = [];
|
||||
var yValues = [];
|
||||
var rows = this.tableData.rows;
|
||||
|
|
|
|||
|
|
@ -20,23 +20,23 @@ import HandsonHelper from '../../handsontable/handsonHelper';
|
|||
* Visualize data in table format
|
||||
*/
|
||||
export default class TableVisualization extends Visualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
super(targetEl, config);
|
||||
console.log('Init table viz');
|
||||
targetEl.addClass('table');
|
||||
this.passthrough = new PassthroughTransformation(config);
|
||||
};
|
||||
|
||||
refresh() {
|
||||
refresh () {
|
||||
this.hot.render();
|
||||
};
|
||||
|
||||
render(tableData) {
|
||||
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');
|
||||
var columns = Array.apply(null, Array(tableData.columns.length)).map(function() {
|
||||
var columns = Array.apply(null, Array(tableData.columns.length)).map(function () {
|
||||
return {type: 'text'};
|
||||
});
|
||||
|
||||
|
|
@ -50,13 +50,13 @@ export default class TableVisualization extends Visualization {
|
|||
this.hot.validateCells(null);
|
||||
};
|
||||
|
||||
destroy() {
|
||||
destroy () {
|
||||
if (this.hot) {
|
||||
this.hot.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
return this.passthrough;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* Base class for visualization
|
||||
*/
|
||||
export default class Visualization {
|
||||
constructor(targetEl, config) {
|
||||
constructor (targetEl, config) {
|
||||
this.targetEl = targetEl;
|
||||
this.config = config;
|
||||
this._dirty = false;
|
||||
|
|
@ -27,21 +27,21 @@ export default class Visualization {
|
|||
/**
|
||||
* get transformation
|
||||
*/
|
||||
getTransformation() {
|
||||
getTransformation () {
|
||||
// override this
|
||||
};
|
||||
|
||||
/**
|
||||
* Method will be invoked when data or configuration changed
|
||||
*/
|
||||
render(tableData) {
|
||||
render (tableData) {
|
||||
// override this
|
||||
};
|
||||
|
||||
/**
|
||||
* Refresh visualization.
|
||||
*/
|
||||
refresh() {
|
||||
refresh () {
|
||||
// override this
|
||||
};
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ export default class Visualization {
|
|||
* method will be invoked when visualization need to be destroyed.
|
||||
* Don't need to destroy this.targetEl.
|
||||
*/
|
||||
destroy() {
|
||||
destroy () {
|
||||
// override this
|
||||
};
|
||||
|
||||
|
|
@ -59,14 +59,14 @@ export default class Visualization {
|
|||
* scope : an object to bind to template scope
|
||||
* }
|
||||
*/
|
||||
getSetting() {
|
||||
getSetting () {
|
||||
// override this
|
||||
};
|
||||
|
||||
/**
|
||||
* Activate. invoked when visualization is selected
|
||||
*/
|
||||
activate() {
|
||||
activate () {
|
||||
if (!this._active || this._dirty) {
|
||||
this.refresh();
|
||||
this._dirty = false;
|
||||
|
|
@ -77,21 +77,21 @@ export default class Visualization {
|
|||
/**
|
||||
* Activate. invoked when visualization is de selected
|
||||
*/
|
||||
deactivate() {
|
||||
deactivate () {
|
||||
this._active = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Is active
|
||||
*/
|
||||
isActive() {
|
||||
isActive () {
|
||||
return this._active;
|
||||
};
|
||||
|
||||
/**
|
||||
* When window or paragraph is resized
|
||||
*/
|
||||
resize() {
|
||||
resize () {
|
||||
if (this.isActive()) {
|
||||
this.refresh();
|
||||
} else {
|
||||
|
|
@ -102,7 +102,7 @@ export default class Visualization {
|
|||
/**
|
||||
* Set new config
|
||||
*/
|
||||
setConfig(config) {
|
||||
setConfig (config) {
|
||||
this.config = config;
|
||||
if (this.isActive()) {
|
||||
this.refresh();
|
||||
|
|
@ -114,14 +114,14 @@ export default class Visualization {
|
|||
/**
|
||||
* Emit config. config will sent to server and saved.
|
||||
*/
|
||||
emitConfig(config) {
|
||||
emitConfig (config) {
|
||||
this._emitter(config);
|
||||
};
|
||||
|
||||
/**
|
||||
* render setting
|
||||
*/
|
||||
renderSetting(targetEl) {
|
||||
renderSetting (targetEl) {
|
||||
var setting = this.getSetting();
|
||||
if (!setting) {
|
||||
return;
|
||||
|
|
@ -130,7 +130,7 @@ export default class Visualization {
|
|||
// already readered
|
||||
if (this._scope) {
|
||||
var self = this;
|
||||
this._scope.$apply(function() {
|
||||
this._scope.$apply(function () {
|
||||
for (var k in setting.scope) {
|
||||
self._scope[k] = setting.scope[k];
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ export default class Visualization {
|
|||
};
|
||||
}
|
||||
|
||||
function _renderSetting(instance, targetEl, template, scope) {
|
||||
function _renderSetting (instance, targetEl, template, scope) {
|
||||
instance._targetEl = targetEl;
|
||||
targetEl.html(template);
|
||||
instance._compile(targetEl.contents())(scope);
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('arrayOrderingSrv', arrayOrderingSrv);
|
||||
|
||||
function arrayOrderingSrv(TRASH_FOLDER_ID) {
|
||||
function arrayOrderingSrv (TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
||||
var arrayOrderingSrv = this;
|
||||
|
||||
this.noteListOrdering = function(note) {
|
||||
this.noteListOrdering = function (note) {
|
||||
if (note.id === TRASH_FOLDER_ID) {
|
||||
return '\uFFFF';
|
||||
}
|
||||
return arrayOrderingSrv.getNoteName(note);
|
||||
};
|
||||
|
||||
this.getNoteName = function(note) {
|
||||
this.getNoteName = function (note) {
|
||||
if (note.name === undefined || note.name.trim() === '') {
|
||||
return 'Note ' + note.id;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('baseUrlSrv', baseUrlSrv);
|
||||
|
||||
function baseUrlSrv() {
|
||||
this.getPort = function() {
|
||||
function baseUrlSrv () {
|
||||
this.getPort = function () {
|
||||
var port = Number(location.port);
|
||||
if (!port) {
|
||||
port = 80;
|
||||
|
|
@ -30,19 +30,19 @@ function baseUrlSrv() {
|
|||
return port;
|
||||
};
|
||||
|
||||
this.getWebsocketUrl = function() {
|
||||
this.getWebsocketUrl = function () {
|
||||
var wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
return wsProtocol + '//' + location.hostname + ':' + this.getPort() +
|
||||
skipTrailingSlash(location.pathname) + '/ws';
|
||||
};
|
||||
|
||||
this.getRestApiBase = function() {
|
||||
this.getRestApiBase = function () {
|
||||
return location.protocol + '//' + location.hostname + ':' +
|
||||
this.getPort() + skipTrailingSlash(location.pathname) +
|
||||
'/api';
|
||||
};
|
||||
|
||||
var skipTrailingSlash = function(path) {
|
||||
var skipTrailingSlash = function (path) {
|
||||
return path.replace(/\/$/, '');
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('browserDetectService', browserDetectService);
|
||||
|
||||
function browserDetectService() {
|
||||
this.detectIE = function() {
|
||||
function browserDetectService () {
|
||||
this.detectIE = function () {
|
||||
var ua = window.navigator.userAgent;
|
||||
var msie = ua.indexOf('MSIE ');
|
||||
if (msie > 0) {
|
||||
|
|
|
|||
|
|
@ -13,21 +13,21 @@
|
|||
*/
|
||||
angular.module('zeppelinWebApp').controller('clipboardCtrl', clipboardCtrl);
|
||||
|
||||
function clipboardCtrl($scope) {
|
||||
function clipboardCtrl ($scope) {
|
||||
'ngInject';
|
||||
|
||||
$scope.complete = function(e) {
|
||||
$scope.complete = function (e) {
|
||||
$scope.copied = true;
|
||||
$scope.tooltip = 'Copied!';
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$scope.tooltip = 'Copy to clipboard';
|
||||
}, 400);
|
||||
};
|
||||
$scope.$watch('input', function() {
|
||||
$scope.$watch('input', function () {
|
||||
$scope.copied = false;
|
||||
$scope.tooltip = 'Copy to clipboard';
|
||||
});
|
||||
$scope.clipError = function(e) {
|
||||
$scope.clipError = function (e) {
|
||||
console.log('Error: ' + e.name + ' - ' + e.message);
|
||||
$scope.tooltip = 'Not supported browser';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('dropdownInput', dropdownInput);
|
||||
|
||||
function dropdownInput() {
|
||||
function dropdownInput () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element) {
|
||||
element.bind('click', function(event) {
|
||||
link: function (scope, element) {
|
||||
element.bind('click', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('codeEditor', codeEditor);
|
||||
|
||||
function codeEditor($templateRequest, $compile) {
|
||||
function codeEditor ($templateRequest, $compile) {
|
||||
return {
|
||||
restrict: 'AE',
|
||||
scope: {
|
||||
|
|
@ -25,8 +25,8 @@ function codeEditor($templateRequest, $compile) {
|
|||
onLoad: '=onLoad',
|
||||
revisionView: '=revisionView'
|
||||
},
|
||||
link: function(scope, element, attrs, controller) {
|
||||
$templateRequest('components/editor/ace.editor.directive.html').then(function(editorHtml) {
|
||||
link: function (scope, element, attrs, controller) {
|
||||
$templateRequest('components/editor/ace.editor.directive.html').then(function (editorHtml) {
|
||||
var editor = angular.element(editorHtml);
|
||||
editor.attr('id', scope.paragraphId + '_editor');
|
||||
element.append(editor);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('ElasticInputCtrl', ElasticInputCtrl);
|
||||
|
||||
function ElasticInputCtrl() {
|
||||
function ElasticInputCtrl () {
|
||||
var vm = this;
|
||||
vm.showEditor = false;
|
||||
vm.value = '';
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('expandCollapse', expandCollapse);
|
||||
|
||||
function expandCollapse() {
|
||||
function expandCollapse () {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
link: function(scope, element, attrs) {
|
||||
angular.element(element).click(function(event) {
|
||||
link: function (scope, element, attrs) {
|
||||
angular.element(element).click(function (event) {
|
||||
if (angular.element(element).find('.expandable:visible').length > 1) {
|
||||
angular.element(element).find('.expandable:visible').slideUp('slow');
|
||||
angular.element(element).find('i.icon-folder-alt').toggleClass('icon-folder icon-folder-alt');
|
||||
} else {
|
||||
angular.element(element).find('.expandable').first().slideToggle('200', function() {
|
||||
angular.element(element).find('.expandable').first().slideToggle('200', function () {
|
||||
// do not toggle trash folder
|
||||
if (angular.element(element).find('.fa-trash-o').length === 0) {
|
||||
angular.element(element).find('i').first().toggleClass('icon-folder icon-folder-alt');
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export const HeliumConfFieldType = {
|
|||
* @param persisted <Object> including `type`, `description`, `defaultValue` for each conf key
|
||||
* @param spec <Object> including `value` for each conf key
|
||||
*/
|
||||
export function mergePersistedConfWithSpec(persisted, spec) {
|
||||
export function mergePersistedConfWithSpec (persisted, spec) {
|
||||
const confs = [];
|
||||
|
||||
for (let name in spec) {
|
||||
|
|
@ -44,7 +44,7 @@ export function mergePersistedConfWithSpec(persisted, spec) {
|
|||
return confs;
|
||||
}
|
||||
|
||||
export function createAllPackageConfigs(defaultPackages, persistedConfs) {
|
||||
export function createAllPackageConfigs (defaultPackages, persistedConfs) {
|
||||
let packageConfs = {};
|
||||
|
||||
for (let name in defaultPackages) {
|
||||
|
|
@ -68,7 +68,7 @@ export function createAllPackageConfigs(defaultPackages, persistedConfs) {
|
|||
return packageConfs;
|
||||
}
|
||||
|
||||
export function parseConfigValue(type, stringified) {
|
||||
export function parseConfigValue (type, stringified) {
|
||||
let value = stringified;
|
||||
|
||||
try {
|
||||
|
|
@ -89,7 +89,7 @@ export function parseConfigValue(type, stringified) {
|
|||
* persist key-value only
|
||||
* since other info (e.g type, desc) can be provided by default config
|
||||
*/
|
||||
export function createPersistableConfig(currentConfs) {
|
||||
export function createPersistableConfig (currentConfs) {
|
||||
const filtered = currentConfs.reduce((acc, c) => {
|
||||
acc[c.name] = parseConfigValue(c.type, c.value);
|
||||
return acc;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function createDefaultPackage(pkgSearchResult, sce) {
|
||||
export function createDefaultPackage (pkgSearchResult, sce) {
|
||||
for (let pkgIdx in pkgSearchResult) {
|
||||
const pkg = pkgSearchResult[pkgIdx];
|
||||
pkg.pkg.icon = sce.trustAsHtml(pkg.pkg.icon);
|
||||
|
|
@ -35,7 +35,7 @@ export function createDefaultPackage(pkgSearchResult, sce) {
|
|||
* @param sce angular `$sce` object
|
||||
* @returns {Object} including {name, pkgInfo}
|
||||
*/
|
||||
export function createDefaultPackages(pkgSearchResults, sce) {
|
||||
export function createDefaultPackages (pkgSearchResults, sce) {
|
||||
const defaultPackages = {};
|
||||
// show enabled version if any version of package is enabled
|
||||
for (let name in pkgSearchResults) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {
|
|||
|
||||
angular.module('zeppelinWebApp').service('heliumService', heliumService);
|
||||
|
||||
export default function heliumService($http, $sce, baseUrlSrv) {
|
||||
export default function heliumService ($http, $sce, baseUrlSrv) {
|
||||
'ngInject';
|
||||
|
||||
let visualizationBundles = [];
|
||||
|
|
@ -39,11 +39,11 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
* @param magic {string} e.g `%flowchart`
|
||||
* @returns {SpellBase} undefined if magic is not registered
|
||||
*/
|
||||
this.getSpellByMagic = function(magic) {
|
||||
this.getSpellByMagic = function (magic) {
|
||||
return spellPerMagic[magic];
|
||||
};
|
||||
|
||||
this.executeSpell = function(magic, textWithoutMagic) {
|
||||
this.executeSpell = function (magic, textWithoutMagic) {
|
||||
const promisedConf = this.getSinglePackageConfigUsingMagic(magic)
|
||||
.then(confs => createPersistableConfig(confs));
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
});
|
||||
};
|
||||
|
||||
this.executeSpellAsDisplaySystem = function(magic, textWithoutMagic) {
|
||||
this.executeSpellAsDisplaySystem = function (magic, textWithoutMagic) {
|
||||
const promisedConf = this.getSinglePackageConfigUsingMagic(magic)
|
||||
.then(confs => createPersistableConfig(confs));
|
||||
|
||||
|
|
@ -70,36 +70,36 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
});
|
||||
};
|
||||
|
||||
this.getVisualizationBundles = function() {
|
||||
this.getVisualizationBundles = function () {
|
||||
return visualizationBundles;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Promise} which returns bundleOrder
|
||||
*/
|
||||
this.getVisualizationPackageOrder = function() {
|
||||
this.getVisualizationPackageOrder = function () {
|
||||
return $http.get(baseUrlSrv.getRestApiBase() + '/helium/order/visualization')
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
return response.data.body;
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function (error) {
|
||||
console.error('Can not get bundle order', error);
|
||||
});
|
||||
};
|
||||
|
||||
this.setVisualizationPackageOrder = function(list) {
|
||||
this.setVisualizationPackageOrder = function (list) {
|
||||
return $http.post(baseUrlSrv.getRestApiBase() + '/helium/order/visualization', list);
|
||||
};
|
||||
|
||||
this.enable = function(name, artifact) {
|
||||
this.enable = function (name, artifact) {
|
||||
return $http.post(baseUrlSrv.getRestApiBase() + '/helium/enable/' + name, artifact);
|
||||
};
|
||||
|
||||
this.disable = function(name) {
|
||||
this.disable = function (name) {
|
||||
return $http.post(baseUrlSrv.getRestApiBase() + '/helium/disable/' + name);
|
||||
};
|
||||
|
||||
this.saveConfig = function(pkg, defaultPackageConfig, closeConfigPanelCallback) {
|
||||
this.saveConfig = function (pkg, defaultPackageConfig, closeConfigPanelCallback) {
|
||||
// in case of local package, it will include `/`
|
||||
const pkgArtifact = encodeURIComponent(pkg.artifact);
|
||||
const pkgName = pkg.name;
|
||||
|
|
@ -123,34 +123,34 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
/**
|
||||
* @returns {Promise<Object>} which including {name, Array<package info for artifact>}
|
||||
*/
|
||||
this.getAllPackageInfo = function() {
|
||||
this.getAllPackageInfo = function () {
|
||||
return $http.get(`${baseUrlSrv.getRestApiBase()}/helium/package`)
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
return response.data.body;
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function (error) {
|
||||
console.error('Failed to get all package infos', error);
|
||||
});
|
||||
};
|
||||
|
||||
this.getAllEnabledPackages = function() {
|
||||
this.getAllEnabledPackages = function () {
|
||||
return $http.get(`${baseUrlSrv.getRestApiBase()}/helium/enabledPackage`)
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
return response.data.body;
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function (error) {
|
||||
console.error('Failed to get all enabled package infos', error);
|
||||
});
|
||||
};
|
||||
|
||||
this.getSingleBundle = function(pkgName) {
|
||||
this.getSingleBundle = function (pkgName) {
|
||||
let url = `${baseUrlSrv.getRestApiBase()}/helium/bundle/load/${pkgName}`
|
||||
if (process.env.HELIUM_BUNDLE_DEV) {
|
||||
url = url + '?refresh=true';
|
||||
}
|
||||
|
||||
return $http.get(url)
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
const bundle = response.data
|
||||
if (bundle.substring(0, 'ERROR:'.length) === 'ERROR:') {
|
||||
console.error(`Failed to get bundle: ${pkgName}`, bundle);
|
||||
|
|
@ -159,19 +159,19 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
|
||||
return bundle
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function (error) {
|
||||
console.error(`Failed to get single bundle: ${pkgName}`, error);
|
||||
});
|
||||
}
|
||||
|
||||
this.getDefaultPackages = function() {
|
||||
this.getDefaultPackages = function () {
|
||||
return this.getAllPackageInfo()
|
||||
.then(pkgSearchResults => {
|
||||
return createDefaultPackages(pkgSearchResults, $sce);
|
||||
});
|
||||
};
|
||||
|
||||
this.getAllPackageInfoAndDefaultPackages = function() {
|
||||
this.getAllPackageInfoAndDefaultPackages = function () {
|
||||
return this.getAllPackageInfo()
|
||||
.then(pkgSearchResults => {
|
||||
return {
|
||||
|
|
@ -185,11 +185,11 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
* get all package configs.
|
||||
* @return { Promise<{name, Array<Object>}> }
|
||||
*/
|
||||
this.getAllPackageConfigs = function() {
|
||||
this.getAllPackageConfigs = function () {
|
||||
const promisedDefaultPackages = this.getDefaultPackages();
|
||||
const promisedPersistedConfs =
|
||||
$http.get(`${baseUrlSrv.getRestApiBase()}/helium/config`)
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
return response.data.body;
|
||||
});
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
|
||||
return createAllPackageConfigs(defaultPackages, persistedConfs);
|
||||
})
|
||||
.catch(function(error) {
|
||||
.catch(function (error) {
|
||||
console.error('Failed to get all package configs', error);
|
||||
});
|
||||
};
|
||||
|
|
@ -209,7 +209,7 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
* get the package config which is persisted in server.
|
||||
* @return { Promise<Array<Object>> }
|
||||
*/
|
||||
this.getSinglePackageConfigs = function(pkg) {
|
||||
this.getSinglePackageConfigs = function (pkg) {
|
||||
const pkgName = pkg.name;
|
||||
// in case of local package, it will include `/`
|
||||
const pkgArtifact = encodeURIComponent(pkg.artifact);
|
||||
|
|
@ -221,7 +221,7 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
|
||||
const confUrl = `${baseUrlSrv.getRestApiBase()}/helium/config/${pkgName}/${pkgArtifact}`;
|
||||
const promisedConf = $http.get(confUrl)
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
return response.data.body;
|
||||
});
|
||||
|
||||
|
|
@ -231,12 +231,12 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
});
|
||||
};
|
||||
|
||||
this.getSinglePackageConfigUsingMagic = function(magic) {
|
||||
this.getSinglePackageConfigUsingMagic = function (magic) {
|
||||
const pkgName = pkgNamePerMagic[magic];
|
||||
|
||||
const confUrl = `${baseUrlSrv.getRestApiBase()}/helium/spell/config/${pkgName}`;
|
||||
const promisedConf = $http.get(confUrl)
|
||||
.then(function(response, status) {
|
||||
.then(function (response, status) {
|
||||
return response.data.body;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('interpreterDirective', interpreterDirective);
|
||||
|
||||
function interpreterDirective($timeout) {
|
||||
function interpreterDirective ($timeout) {
|
||||
'ngInject';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attr) {
|
||||
link: function (scope, element, attr) {
|
||||
if (scope.$last === true) {
|
||||
$timeout(function() {
|
||||
$timeout(function () {
|
||||
var id = 'ngRenderFinished';
|
||||
scope.$emit(id);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('LoginCtrl', LoginCtrl);
|
||||
|
||||
function LoginCtrl($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv, $location, $timeout) {
|
||||
function LoginCtrl ($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv, $location, $timeout) {
|
||||
'ngInject';
|
||||
|
||||
$scope.SigningIn = false;
|
||||
$scope.loginParams = {};
|
||||
$scope.login = function() {
|
||||
$scope.login = function () {
|
||||
|
||||
$scope.SigningIn = true;
|
||||
$http({
|
||||
|
|
@ -32,7 +32,7 @@ function LoginCtrl($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv,
|
|||
'userName': $scope.loginParams.userName,
|
||||
'password': $scope.loginParams.password
|
||||
})
|
||||
}).then(function successCallback(response) {
|
||||
}).then(function successCallback (response) {
|
||||
$rootScope.ticket = response.data.body;
|
||||
angular.element('#loginModal').modal('toggle');
|
||||
$rootScope.$broadcast('loginSuccess', true);
|
||||
|
|
@ -41,21 +41,21 @@ 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() {
|
||||
$timeout(function () {
|
||||
var redirectLocation = $location.search()['ref'];
|
||||
$location.$$search = {};
|
||||
$location.path(redirectLocation);
|
||||
}, 100);
|
||||
|
||||
}
|
||||
}, function errorCallback(errorResponse) {
|
||||
}, function errorCallback (errorResponse) {
|
||||
$scope.loginParams.errorText = 'The username and password that you entered don\'t match.';
|
||||
$scope.SigningIn = false;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var initValues = function() {
|
||||
var initValues = function () {
|
||||
$scope.loginParams = {
|
||||
userName: '',
|
||||
password: ''
|
||||
|
|
@ -63,12 +63,12 @@ function LoginCtrl($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv,
|
|||
};
|
||||
|
||||
// handle session logout message received from WebSocket
|
||||
$rootScope.$on('session_logout', function(event, data) {
|
||||
$rootScope.$on('session_logout', function (event, data) {
|
||||
if ($rootScope.userName !== '') {
|
||||
$rootScope.userName = '';
|
||||
$rootScope.ticket = undefined;
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$scope.loginParams = {};
|
||||
$scope.loginParams.errorText = data.info;
|
||||
angular.element('.nav-login-btn').click();
|
||||
|
|
@ -81,7 +81,7 @@ function LoginCtrl($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv,
|
|||
/*
|
||||
** $scope.$on functions below
|
||||
*/
|
||||
$scope.$on('initLoginValues', function() {
|
||||
$scope.$on('initLoginValues', function () {
|
||||
initValues();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('NavCtrl', NavCtrl);
|
||||
|
||||
function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
||||
function NavCtrl ($scope, $rootScope, $http, $routeParams, $location,
|
||||
noteListDataFactory, baseUrlSrv, websocketMsgSrv,
|
||||
arrayOrderingSrv, searchService, TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
|
@ -35,21 +35,21 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
|||
|
||||
initController();
|
||||
|
||||
function getZeppelinVersion() {
|
||||
function getZeppelinVersion () {
|
||||
$http.get(baseUrlSrv.getRestApiBase() + '/version').success(
|
||||
function(data, status, headers, config) {
|
||||
function (data, status, headers, config) {
|
||||
$rootScope.zeppelinVersion = data.body;
|
||||
}).error(
|
||||
function(data, status, headers, config) {
|
||||
function (data, status, headers, config) {
|
||||
console.log('Error %o %o', status, data.message);
|
||||
});
|
||||
}
|
||||
|
||||
function initController() {
|
||||
function initController () {
|
||||
$scope.isDrawNavbarNoteList = false;
|
||||
angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true});
|
||||
|
||||
angular.element(document).click(function() {
|
||||
angular.element(document).click(function () {
|
||||
$scope.query.q = '';
|
||||
});
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
|||
loadNotes();
|
||||
}
|
||||
|
||||
function isFilterNote(note) {
|
||||
function isFilterNote (note) {
|
||||
if (!$scope.query.q) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -69,30 +69,30 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
|||
return false;
|
||||
}
|
||||
|
||||
function isActive(noteId) {
|
||||
function isActive (noteId) {
|
||||
return ($routeParams.noteId === noteId);
|
||||
}
|
||||
|
||||
function listConfigurations() {
|
||||
function listConfigurations () {
|
||||
websocketMsgSrv.listConfigurations();
|
||||
}
|
||||
|
||||
function loadNotes() {
|
||||
function loadNotes () {
|
||||
websocketMsgSrv.getNoteList();
|
||||
}
|
||||
|
||||
function getHomeNote() {
|
||||
function getHomeNote () {
|
||||
websocketMsgSrv.getHomeNote();
|
||||
}
|
||||
|
||||
function logout() {
|
||||
function logout () {
|
||||
var logoutURL = baseUrlSrv.getRestApiBase() + '/login/logout';
|
||||
|
||||
// for firefox and safari
|
||||
logoutURL = logoutURL.replace('//', '//false:false@');
|
||||
$http.post(logoutURL).error(function() {
|
||||
$http.post(logoutURL).error(function () {
|
||||
// force authcBasic (if configured) to logout
|
||||
$http.post(logoutURL).error(function() {
|
||||
$http.post(logoutURL).error(function () {
|
||||
$rootScope.userName = '';
|
||||
$rootScope.ticket.principal = '';
|
||||
$rootScope.ticket.ticket = '';
|
||||
|
|
@ -100,19 +100,19 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
|||
BootstrapDialog.show({
|
||||
message: 'Logout Success'
|
||||
});
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
window.location.replace('/');
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function search(searchTerm) {
|
||||
function search (searchTerm) {
|
||||
$location.path('/search/' + searchTerm);
|
||||
}
|
||||
|
||||
function showLoginWindow() {
|
||||
setTimeout(function() {
|
||||
function showLoginWindow () {
|
||||
setTimeout(function () {
|
||||
angular.element('#userName').focus();
|
||||
}, 500);
|
||||
}
|
||||
|
|
@ -121,16 +121,16 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
|||
** $scope.$on functions below
|
||||
*/
|
||||
|
||||
$scope.$on('setNoteMenu', function(event, notes) {
|
||||
$scope.$on('setNoteMenu', function (event, notes) {
|
||||
noteListDataFactory.setNotes(notes);
|
||||
initNotebookListEventListener();
|
||||
});
|
||||
|
||||
$scope.$on('setConnectedStatus', function(event, param) {
|
||||
$scope.$on('setConnectedStatus', function (event, param) {
|
||||
vm.connected = param;
|
||||
});
|
||||
|
||||
$scope.$on('loginSuccess', function(event, param) {
|
||||
$scope.$on('loginSuccess', function (event, param) {
|
||||
listConfigurations();
|
||||
loadNotes();
|
||||
getHomeNote();
|
||||
|
|
@ -139,13 +139,13 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
|||
/*
|
||||
** Performance optimization for Browser Render.
|
||||
*/
|
||||
function initNotebookListEventListener() {
|
||||
angular.element(document).ready(function() {
|
||||
angular.element('.notebook-list-dropdown').on('show.bs.dropdown', function() {
|
||||
function initNotebookListEventListener () {
|
||||
angular.element(document).ready(function () {
|
||||
angular.element('.notebook-list-dropdown').on('show.bs.dropdown', function () {
|
||||
$scope.isDrawNavbarNoteList = true;
|
||||
});
|
||||
|
||||
angular.element('.notebook-list-dropdown').on('hide.bs.dropdown', function() {
|
||||
angular.element('.notebook-list-dropdown').on('hide.bs.dropdown', function () {
|
||||
$scope.isDrawNavbarNoteList = false;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
describe('Controller: NavCtrl', function() {
|
||||
describe('Controller: NavCtrl', function () {
|
||||
// load the controller's module
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
var NavCtrl;
|
||||
var scope;
|
||||
// Initialize the controller and a mock scope
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
beforeEach(inject(function ($controller, $rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
NavCtrl = $controller('NavCtrl', {
|
||||
$scope: scope
|
||||
});
|
||||
|
||||
it('NavCtrl to toBeDefined', function() {
|
||||
it('NavCtrl to toBeDefined', function () {
|
||||
expect(NavCtrl).toBeDefined();
|
||||
expect(NavCtrl.loadNotes).toBeDefined();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('ngEnter', ngEnter);
|
||||
|
||||
function ngEnter() {
|
||||
return function(scope, element, attrs) {
|
||||
element.bind('keydown keypress', function(event) {
|
||||
function ngEnter () {
|
||||
return function (scope, element, attrs) {
|
||||
element.bind('keydown keypress', function (event) {
|
||||
if (event.which === 13) {
|
||||
if (!event.shiftKey) {
|
||||
scope.$apply(function() {
|
||||
scope.$apply(function () {
|
||||
scope.$eval(attrs.ngEnter);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
describe('Directive: ngEnter', function() {
|
||||
describe('Directive: ngEnter', function () {
|
||||
|
||||
// load the directive's module
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
|
@ -6,11 +6,11 @@ describe('Directive: ngEnter', function() {
|
|||
var element;
|
||||
var scope;
|
||||
|
||||
beforeEach(inject(function($rootScope) {
|
||||
beforeEach(inject(function ($rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
}));
|
||||
|
||||
it('should be define', inject(function($compile) {
|
||||
it('should be define', inject(function ($compile) {
|
||||
element = angular.element('<ng-enter></ng-enter>');
|
||||
element = $compile(element)(scope);
|
||||
expect(element.text()).toBeDefined();
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('ngEscape', ngEscape);
|
||||
|
||||
function ngEscape() {
|
||||
return function(scope, element, attrs) {
|
||||
element.bind('keydown keyup', function(event) {
|
||||
function ngEscape () {
|
||||
return function (scope, element, attrs) {
|
||||
element.bind('keydown keyup', function (event) {
|
||||
if (event.which === 27) {
|
||||
scope.$apply(function() {
|
||||
scope.$apply(function () {
|
||||
scope.$eval(attrs.ngEscape);
|
||||
});
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('noteActionSrv', noteActionSrv);
|
||||
|
||||
function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactory) {
|
||||
function noteActionSrv (websocketMsgSrv, $location, renameSrv, noteListDataFactory) {
|
||||
'ngInject';
|
||||
|
||||
this.moveNoteToTrash = function(noteId, redirectToHome) {
|
||||
this.moveNoteToTrash = function (noteId, redirectToHome) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: 'Move this note to trash?',
|
||||
message: 'This note will be moved to <strong>trash</strong>.',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.moveNoteToTrash(noteId);
|
||||
if (redirectToHome) {
|
||||
|
|
@ -33,12 +33,12 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.moveFolderToTrash = function(folderId) {
|
||||
this.moveFolderToTrash = function (folderId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: 'Move this folder to trash?',
|
||||
message: 'This folder will be moved to <strong>trash</strong>.',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.moveFolderToTrash(folderId);
|
||||
}
|
||||
|
|
@ -46,13 +46,13 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.removeNote = function(noteId, redirectToHome) {
|
||||
this.removeNote = function (noteId, redirectToHome) {
|
||||
BootstrapDialog.confirm({
|
||||
type: BootstrapDialog.TYPE_WARNING,
|
||||
closable: true,
|
||||
title: 'WARNING! This note will be removed permanently',
|
||||
message: 'This cannot be undone. Are you sure?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.deleteNote(noteId);
|
||||
if (redirectToHome) {
|
||||
|
|
@ -63,13 +63,13 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.removeFolder = function(folderId) {
|
||||
this.removeFolder = function (folderId) {
|
||||
BootstrapDialog.confirm({
|
||||
type: BootstrapDialog.TYPE_WARNING,
|
||||
closable: true,
|
||||
title: 'WARNING! This folder will be removed permanently',
|
||||
message: 'This cannot be undone. Are you sure?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.removeFolder(folderId);
|
||||
}
|
||||
|
|
@ -77,13 +77,13 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.restoreAll = function() {
|
||||
this.restoreAll = function () {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: 'Are you sure want to restore all notes in the trash?',
|
||||
message: 'Folders and notes in the trash will be ' +
|
||||
'<strong>merged</strong> into their original position.',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.restoreAll();
|
||||
}
|
||||
|
|
@ -91,13 +91,13 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.emptyTrash = function() {
|
||||
this.emptyTrash = function () {
|
||||
BootstrapDialog.confirm({
|
||||
type: BootstrapDialog.TYPE_WARNING,
|
||||
closable: true,
|
||||
title: 'WARNING! Notes under trash will be removed permanently',
|
||||
message: 'This cannot be undone. Are you sure?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.emptyTrash();
|
||||
}
|
||||
|
|
@ -105,12 +105,12 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.clearAllParagraphOutput = function(noteId) {
|
||||
this.clearAllParagraphOutput = function (noteId) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Do you want to clear all output?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.clearAllParagraphOutput(noteId);
|
||||
}
|
||||
|
|
@ -118,21 +118,21 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
this.renameNote = function(noteId, notePath) {
|
||||
this.renameNote = function (noteId, notePath) {
|
||||
renameSrv.openRenameModal({
|
||||
title: 'Rename note',
|
||||
oldName: notePath,
|
||||
callback: function(newName) {
|
||||
callback: function (newName) {
|
||||
websocketMsgSrv.renameNote(noteId, newName);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.renameFolder = function(folderId) {
|
||||
this.renameFolder = function (folderId) {
|
||||
renameSrv.openRenameModal({
|
||||
title: 'Rename folder',
|
||||
oldName: folderId,
|
||||
callback: function(newName) {
|
||||
callback: function (newName) {
|
||||
var newFolderId = normalizeFolderId(newName);
|
||||
if (_.has(noteListDataFactory.flatFolderMap, newFolderId)) {
|
||||
BootstrapDialog.confirm({
|
||||
|
|
@ -140,7 +140,7 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
closable: true,
|
||||
title: 'WARNING! The folder will be MERGED',
|
||||
message: 'The folder will be merged into <strong>' + newFolderId + '</strong>. Are you sure?',
|
||||
callback: function(result) {
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.renameFolder(folderId, newFolderId);
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactor
|
|||
});
|
||||
};
|
||||
|
||||
function normalizeFolderId(folderId) {
|
||||
function normalizeFolderId (folderId) {
|
||||
folderId = folderId.trim();
|
||||
|
||||
while (folderId.indexOf('\\') > -1) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').factory('noteListDataFactory', noteListDataFactory);
|
||||
|
||||
function noteListDataFactory(TRASH_FOLDER_ID) {
|
||||
function noteListDataFactory (TRASH_FOLDER_ID) {
|
||||
'ngInject';
|
||||
|
||||
var notes = {
|
||||
|
|
@ -22,7 +22,7 @@ function noteListDataFactory(TRASH_FOLDER_ID) {
|
|||
flatList: [],
|
||||
flatFolderMap: {},
|
||||
|
||||
setNotes: function(notesList) {
|
||||
setNotes: function (notesList) {
|
||||
// a flat list to boost searching
|
||||
notes.flatList = _.map(notesList, (note) => {
|
||||
note.isTrash = note.name
|
||||
|
|
@ -33,7 +33,7 @@ function noteListDataFactory(TRASH_FOLDER_ID) {
|
|||
// construct the folder-based tree
|
||||
notes.root = {children: []};
|
||||
notes.flatFolderMap = {};
|
||||
_.reduce(notesList, function(root, note) {
|
||||
_.reduce(notesList, function (root, note) {
|
||||
var noteName = note.name || note.id;
|
||||
var nodes = noteName.match(/([^\/][^\/]*)/g);
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ function noteListDataFactory(TRASH_FOLDER_ID) {
|
|||
}
|
||||
};
|
||||
|
||||
var addNode = function(curDir, nodes, noteId) {
|
||||
var addNode = function (curDir, nodes, noteId) {
|
||||
if (nodes.length === 1) { // the leaf
|
||||
curDir.children.push({
|
||||
name: nodes[0],
|
||||
|
|
@ -56,7 +56,7 @@ function noteListDataFactory(TRASH_FOLDER_ID) {
|
|||
} else { // a folder node
|
||||
var node = nodes.shift();
|
||||
var dir = _.find(curDir.children,
|
||||
function(c) { return c.name === node && c.children !== undefined; });
|
||||
function (c) { return c.name === node && c.children !== undefined; });
|
||||
if (dir !== undefined) { // found an existing dir
|
||||
addNode(dir, nodes, noteId);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
describe('Factory: NoteList', function() {
|
||||
describe('Factory: NoteList', function () {
|
||||
|
||||
var noteList;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
angular.mock.module('zeppelinWebApp');
|
||||
|
||||
inject(function($injector) {
|
||||
inject(function ($injector) {
|
||||
noteList = $injector.get('noteListDataFactory');
|
||||
});
|
||||
});
|
||||
|
||||
it('should generate both flat list and folder-based list properly', function() {
|
||||
it('should generate both flat list and folder-based list properly', function () {
|
||||
var notesList = [
|
||||
{name: 'A', id: '000001'},
|
||||
{name: 'B', id: '000002'},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('NotenameCtrl', NotenameCtrl);
|
||||
|
||||
function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv) {
|
||||
function NotenameCtrl ($scope, noteListDataFactory, $routeParams, websocketMsgSrv) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
|
|
@ -25,7 +25,7 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
|
|||
$scope.interpreterSettings = {};
|
||||
$scope.note.defaultInterpreter = null;
|
||||
|
||||
vm.createNote = function() {
|
||||
vm.createNote = function () {
|
||||
if (!vm.clone) {
|
||||
var defaultInterpreterId = '';
|
||||
if ($scope.note.defaultInterpreter !== null) {
|
||||
|
|
@ -39,7 +39,7 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
|
|||
}
|
||||
};
|
||||
|
||||
vm.handleNameEnter = function() {
|
||||
vm.handleNameEnter = function () {
|
||||
angular.element('#noteNameModal').modal('toggle');
|
||||
vm.createNote();
|
||||
};
|
||||
|
|
@ -53,7 +53,7 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
|
|||
|
||||
vm.newNoteName = function(path) {
|
||||
var newCount = 1;
|
||||
angular.forEach(vm.notes.flatList, function(noteName) {
|
||||
angular.forEach(vm.notes.flatList, function (noteName) {
|
||||
noteName = noteName.name;
|
||||
if (noteName.match(/^Untitled Note [0-9]*$/)) {
|
||||
var lastCount = noteName.substr(14) * 1;
|
||||
|
|
@ -65,7 +65,7 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
|
|||
return (path ? path + '/' : '') +'Untitled Note ' + newCount;
|
||||
};
|
||||
|
||||
vm.cloneNoteName = function() {
|
||||
vm.cloneNoteName = function () {
|
||||
var copyCount = 1;
|
||||
var newCloneName = '';
|
||||
var lastIndex = vm.sourceNoteName.lastIndexOf(' ');
|
||||
|
|
@ -73,7 +73,7 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
|
|||
var noteNamePrefix = endsWithNumber ? vm.sourceNoteName.substr(0, lastIndex) : vm.sourceNoteName;
|
||||
var regexp = new RegExp('^' + noteNamePrefix + ' .+');
|
||||
|
||||
angular.forEach(vm.notes.flatList, function(noteName) {
|
||||
angular.forEach(vm.notes.flatList, function (noteName) {
|
||||
noteName = noteName.name;
|
||||
if (noteName.match(regexp)) {
|
||||
var lastCopyCount = noteName.substr(lastIndex).trim();
|
||||
|
|
@ -91,11 +91,11 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
|
|||
return newCloneName + ' ' + copyCount;
|
||||
};
|
||||
|
||||
vm.getInterpreterSettings = function() {
|
||||
vm.getInterpreterSettings = function () {
|
||||
vm.websocketMsgSrv.getInterpreterSettings();
|
||||
};
|
||||
|
||||
$scope.$on('interpreterSettings', function(event, data) {
|
||||
$scope.$on('interpreterSettings', function (event, data) {
|
||||
$scope.interpreterSettings = data.interpreterSettings;
|
||||
|
||||
// initialize default interpreter with Spark interpreter
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
describe('Controller: NotenameCtrl', function() {
|
||||
describe('Controller: NotenameCtrl', function () {
|
||||
beforeEach(angular.mock.module('zeppelinWebApp'));
|
||||
|
||||
var scope;
|
||||
var ctrl;
|
||||
var noteList;
|
||||
|
||||
beforeEach(inject(function($injector, $rootScope, $controller) {
|
||||
beforeEach(inject(function ($injector, $rootScope, $controller) {
|
||||
noteList = $injector.get('noteListDataFactory');
|
||||
scope = $rootScope.$new();
|
||||
ctrl = $controller('NotenameCtrl', {
|
||||
|
|
@ -14,7 +14,7 @@ describe('Controller: NotenameCtrl', function() {
|
|||
});
|
||||
}));
|
||||
|
||||
it('should create a new name from current name when cloneNoteName is called', function() {
|
||||
it('should create a new name from current name when cloneNoteName is called', function () {
|
||||
var notesList = [
|
||||
{name: 'dsds 1', id: '1'},
|
||||
{name: 'dsds 2', id: '2'},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('modalvisible', modalvisible);
|
||||
|
||||
function modalvisible() {
|
||||
function modalvisible () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
|
|
@ -22,11 +22,11 @@ function modalvisible() {
|
|||
postVisibleCallback: '&postvisiblecallback',
|
||||
targetinput: '@targetinput'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
link: function (scope, element, attrs) {
|
||||
// Add some listeners
|
||||
var previsibleMethod = scope.preVisibleCallback;
|
||||
var postVisibleMethod = scope.postVisibleCallback;
|
||||
element.on('show.bs.modal', function(e) {
|
||||
element.on('show.bs.modal', function (e) {
|
||||
var relatedTarget = angular.element(e.relatedTarget);
|
||||
var clone = relatedTarget.data('clone');
|
||||
var sourceNoteName = relatedTarget.data('source-note-name');
|
||||
|
|
@ -34,7 +34,7 @@ function modalvisible() {
|
|||
var cloneNote = clone ? true : false;
|
||||
previsibleMethod()(cloneNote, sourceNoteName, path);
|
||||
});
|
||||
element.on('shown.bs.modal', function(e) {
|
||||
element.on('shown.bs.modal', function (e) {
|
||||
if (scope.targetinput) {
|
||||
angular.element(e.target).find('input#' + scope.targetinput).select();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('NoteImportCtrl', NoteImportCtrl);
|
||||
|
||||
function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
||||
function NoteImportCtrl ($scope, $timeout, websocketMsgSrv) {
|
||||
'ngInject';
|
||||
|
||||
var vm = this;
|
||||
|
|
@ -25,23 +25,23 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
|||
var limit = 0;
|
||||
|
||||
websocketMsgSrv.listConfigurations();
|
||||
$scope.$on('configurationsInfo', function(scope, event) {
|
||||
$scope.$on('configurationsInfo', function (scope, event) {
|
||||
limit = event.configurations['zeppelin.websocket.max.text.message.size'];
|
||||
$scope.maxLimit = Math.round(limit / 1048576);
|
||||
});
|
||||
|
||||
vm.resetFlags = function() {
|
||||
vm.resetFlags = function () {
|
||||
$scope.note = {};
|
||||
$scope.note.step1 = true;
|
||||
$scope.note.step2 = false;
|
||||
angular.element('#noteImportFile').val('');
|
||||
};
|
||||
|
||||
$scope.uploadFile = function() {
|
||||
$scope.uploadFile = function () {
|
||||
angular.element('#noteImportFile').click();
|
||||
};
|
||||
|
||||
$scope.importFile = function(element) {
|
||||
$scope.importFile = function (element) {
|
||||
$scope.note.errorText = '';
|
||||
$scope.note.importFile = element.files[0];
|
||||
var file = $scope.note.importFile;
|
||||
|
|
@ -53,7 +53,7 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
|||
return;
|
||||
}
|
||||
|
||||
reader.onloadend = function() {
|
||||
reader.onloadend = function () {
|
||||
vm.processImportJson(reader.result);
|
||||
};
|
||||
|
||||
|
|
@ -62,23 +62,23 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
|||
}
|
||||
};
|
||||
|
||||
$scope.uploadURL = function() {
|
||||
$scope.uploadURL = function () {
|
||||
$scope.note.errorText = '';
|
||||
$scope.note.step1 = false;
|
||||
$timeout(function() {
|
||||
$timeout(function () {
|
||||
$scope.note.step2 = true;
|
||||
}, 400);
|
||||
};
|
||||
|
||||
vm.importBack = function() {
|
||||
vm.importBack = function () {
|
||||
$scope.note.errorText = '';
|
||||
$timeout(function() {
|
||||
$timeout(function () {
|
||||
$scope.note.step1 = true;
|
||||
}, 400);
|
||||
$scope.note.step2 = false;
|
||||
};
|
||||
|
||||
vm.importNote = function() {
|
||||
vm.importNote = function () {
|
||||
$scope.note.errorText = '';
|
||||
if ($scope.note.importUrl) {
|
||||
jQuery.ajax({
|
||||
|
|
@ -89,10 +89,10 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
|||
xhrFields: {
|
||||
withCredentials: false
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
$scope.note.errorText = 'Unable to Fetch URL';
|
||||
$scope.$apply();
|
||||
}}).done(function(data) {
|
||||
}}).done(function (data) {
|
||||
vm.processImportJson(data);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -101,7 +101,7 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
|||
}
|
||||
};
|
||||
|
||||
vm.processImportJson = function(result) {
|
||||
vm.processImportJson = function (result) {
|
||||
if (typeof result !== 'object') {
|
||||
try {
|
||||
result = JSON.parse(result);
|
||||
|
|
@ -130,7 +130,7 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) {
|
|||
** $scope.$on functions below
|
||||
*/
|
||||
|
||||
$scope.$on('setNoteMenu', function(event, notes) {
|
||||
$scope.$on('setNoteMenu', function (event, notes) {
|
||||
vm.resetFlags();
|
||||
angular.element('#noteImportModal').modal('hide');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,24 +14,24 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('noteVarShareService', noteVarShareService);
|
||||
|
||||
function noteVarShareService() {
|
||||
function noteVarShareService () {
|
||||
'ngInject';
|
||||
|
||||
var store = {};
|
||||
|
||||
this.clear = function() {
|
||||
this.clear = function () {
|
||||
store = {};
|
||||
};
|
||||
|
||||
this.put = function(key, value) {
|
||||
this.put = function (key, value) {
|
||||
store[key] = value;
|
||||
};
|
||||
|
||||
this.get = function(key) {
|
||||
this.get = function (key) {
|
||||
return store[key];
|
||||
};
|
||||
|
||||
this.del = function(key) {
|
||||
this.del = function (key) {
|
||||
var v = store[key];
|
||||
delete store[key];
|
||||
return v;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('popoverHtmlUnsafePopup', popoverHtmlUnsafePopup);
|
||||
|
||||
function popoverHtmlUnsafePopup() {
|
||||
function popoverHtmlUnsafePopup () {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
replace: true,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('popoverHtmlUnsafe', popoverHtmlUnsafe);
|
||||
|
||||
function popoverHtmlUnsafe($tooltip) {
|
||||
function popoverHtmlUnsafe ($tooltip) {
|
||||
'ngInject';
|
||||
|
||||
return $tooltip('popoverHtmlUnsafe', 'popover', 'click');
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').controller('RenameCtrl', RenameCtrl);
|
||||
|
||||
function RenameCtrl($scope) {
|
||||
function RenameCtrl ($scope) {
|
||||
'ngInject';
|
||||
|
||||
var self = this;
|
||||
|
|
@ -22,25 +22,25 @@ function RenameCtrl($scope) {
|
|||
$scope.params = {newName: ''};
|
||||
$scope.isValid = true;
|
||||
|
||||
$scope.rename = function() {
|
||||
$scope.rename = function () {
|
||||
angular.element('#renameModal').modal('hide');
|
||||
self.callback($scope.params.newName);
|
||||
};
|
||||
|
||||
$scope.$on('openRenameModal', function(event, options) {
|
||||
$scope.$on('openRenameModal', function (event, options) {
|
||||
self.validator = options.validator || defaultValidator;
|
||||
self.callback = options.callback || function() {};
|
||||
self.callback = options.callback || function () {};
|
||||
|
||||
$scope.title = options.title || 'Rename';
|
||||
$scope.params.newName = options.oldName || '';
|
||||
$scope.validate = function() {
|
||||
$scope.validate = function () {
|
||||
$scope.isValid = self.validator($scope.params.newName);
|
||||
};
|
||||
|
||||
angular.element('#renameModal').modal('show');
|
||||
});
|
||||
|
||||
function defaultValidator(str) {
|
||||
function defaultValidator (str) {
|
||||
return !!str.trim();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('renameSrv', renameSrv);
|
||||
|
||||
function renameSrv($rootScope) {
|
||||
function renameSrv ($rootScope) {
|
||||
'ngInject';
|
||||
|
||||
var self = this;
|
||||
|
|
@ -26,7 +26,7 @@ function renameSrv($rootScope) {
|
|||
* callback: (newName: string)=>void - callback onButtonClick
|
||||
* validator: (str: string)=>boolean - input validator
|
||||
*/
|
||||
self.openRenameModal = function(options) {
|
||||
self.openRenameModal = function (options) {
|
||||
$rootScope.$broadcast('openRenameModal', options);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
angular.module('zeppelinWebApp').directive('resizable', resizable);
|
||||
|
||||
function resizable() {
|
||||
function resizable () {
|
||||
var resizableConfig = {
|
||||
autoHide: true,
|
||||
handles: 'se',
|
||||
helper: 'resizable-helper',
|
||||
stop: function() {
|
||||
stop: function () {
|
||||
angular.element(this).css({'width': '100%', 'height': '100%'});
|
||||
}
|
||||
};
|
||||
|
|
@ -29,9 +29,9 @@ function resizable() {
|
|||
scope: {
|
||||
callback: '&onResize'
|
||||
},
|
||||
link: function postLink(scope, elem, attrs) {
|
||||
attrs.$observe('resize', function(resize) {
|
||||
var resetResize = function(elem, resize) {
|
||||
link: function postLink (scope, elem, attrs) {
|
||||
attrs.$observe('resize', function (resize) {
|
||||
var resetResize = function (elem, resize) {
|
||||
var colStep = window.innerWidth / 12;
|
||||
elem.off('resizestop');
|
||||
var conf = angular.copy(resizableConfig);
|
||||
|
|
@ -45,7 +45,7 @@ function resizable() {
|
|||
conf.maxWidth = window.innerWidth;
|
||||
|
||||
elem.resizable(conf);
|
||||
elem.on('resizestop', function() {
|
||||
elem.on('resizestop', function () {
|
||||
if (scope.callback) {
|
||||
var height = elem.height();
|
||||
if (height < 50) {
|
||||
|
|
@ -59,7 +59,7 @@ function resizable() {
|
|||
resize = JSON.parse(resize);
|
||||
if (resize.allowresize === 'true') {
|
||||
resetResize(elem, resize);
|
||||
angular.element(window).resize(function() {
|
||||
angular.element(window).resize(function () {
|
||||
resetResize(elem, resize);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('saveAsService', saveAsService);
|
||||
|
||||
function saveAsService(browserDetectService) {
|
||||
function saveAsService (browserDetectService) {
|
||||
'ngInject';
|
||||
|
||||
this.saveAs = function(content, filename, extension) {
|
||||
this.saveAs = function (content, filename, extension) {
|
||||
var BOM = '\uFEFF';
|
||||
if (browserDetectService.detectIE()) {
|
||||
angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>');
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('searchService', searchService);
|
||||
|
||||
function searchService($resource, baseUrlSrv) {
|
||||
function searchService ($resource, baseUrlSrv) {
|
||||
'ngInject';
|
||||
|
||||
this.search = function(term) {
|
||||
this.search = function (term) {
|
||||
this.searchTerm = term.q;
|
||||
console.log('Searching for: %o', term.q);
|
||||
if (!term.q) { // TODO(bzz): empty string check
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
angular.module('zeppelinWebApp').factory('websocketEvents', websocketEvents);
|
||||
|
||||
function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
||||
function websocketEvents ($rootScope, $websocket, $location, baseUrlSrv) {
|
||||
'ngInject';
|
||||
|
||||
var websocketCalls = {};
|
||||
|
|
@ -23,15 +23,15 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl());
|
||||
websocketCalls.ws.reconnectIfNotNormalClose = true;
|
||||
|
||||
websocketCalls.ws.onOpen(function() {
|
||||
websocketCalls.ws.onOpen(function () {
|
||||
console.log('Websocket created');
|
||||
$rootScope.$broadcast('setConnectedStatus', true);
|
||||
pingIntervalId = setInterval(function() {
|
||||
pingIntervalId = setInterval(function () {
|
||||
websocketCalls.sendNewEvent({op: 'PING'});
|
||||
}, 10000);
|
||||
});
|
||||
|
||||
websocketCalls.sendNewEvent = function(data) {
|
||||
websocketCalls.sendNewEvent = function (data) {
|
||||
if ($rootScope.ticket !== undefined) {
|
||||
data.principal = $rootScope.ticket.principal;
|
||||
data.ticket = $rootScope.ticket.ticket;
|
||||
|
|
@ -45,11 +45,11 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
websocketCalls.ws.send(JSON.stringify(data));
|
||||
};
|
||||
|
||||
websocketCalls.isConnected = function() {
|
||||
websocketCalls.isConnected = function () {
|
||||
return (websocketCalls.ws.socket.readyState === 1);
|
||||
};
|
||||
|
||||
websocketCalls.ws.onMessage(function(event) {
|
||||
websocketCalls.ws.onMessage(function (event) {
|
||||
var payload;
|
||||
if (event.data) {
|
||||
payload = angular.fromJson(event.data);
|
||||
|
|
@ -73,14 +73,14 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
if ($rootScope.ticket.roles === '[]') {
|
||||
btn = [{
|
||||
label: 'Close',
|
||||
action: function(dialog) {
|
||||
action: function (dialog) {
|
||||
dialog.close();
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
btn = [{
|
||||
label: 'Login',
|
||||
action: function(dialog) {
|
||||
action: function (dialog) {
|
||||
dialog.close();
|
||||
angular.element('#loginModal').modal({
|
||||
show: 'true'
|
||||
|
|
@ -88,11 +88,11 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
}
|
||||
}, {
|
||||
label: 'Cancel',
|
||||
action: function(dialog) {
|
||||
action: function (dialog) {
|
||||
dialog.close();
|
||||
// using $rootScope.apply to trigger angular digest cycle
|
||||
// changing $location.path inside bootstrap modal wont trigger digest
|
||||
$rootScope.$apply(function() {
|
||||
$rootScope.$apply(function () {
|
||||
$location.path('/');
|
||||
});
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
buttons: [{
|
||||
// close all the dialogs when there are error on running all paragraphs
|
||||
label: 'Close',
|
||||
action: function() {
|
||||
action: function () {
|
||||
BootstrapDialog.closeAll();
|
||||
}
|
||||
}]
|
||||
|
|
@ -178,12 +178,12 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) {
|
|||
}
|
||||
});
|
||||
|
||||
websocketCalls.ws.onError(function(event) {
|
||||
websocketCalls.ws.onError(function (event) {
|
||||
console.log('error message: ', event);
|
||||
$rootScope.$broadcast('setConnectedStatus', false);
|
||||
});
|
||||
|
||||
websocketCalls.ws.onClose(function(event) {
|
||||
websocketCalls.ws.onClose(function (event) {
|
||||
console.log('close message: ', event);
|
||||
if (pingIntervalId !== undefined) {
|
||||
clearInterval(pingIntervalId);
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('websocketMsgSrv', websocketMsgSrv);
|
||||
|
||||
function websocketMsgSrv($rootScope, websocketEvents) {
|
||||
function websocketMsgSrv ($rootScope, websocketEvents) {
|
||||
'ngInject';
|
||||
|
||||
return {
|
||||
|
||||
getHomeNote: function() {
|
||||
getHomeNote: function () {
|
||||
websocketEvents.sendNewEvent({op: 'GET_HOME_NOTE'});
|
||||
},
|
||||
|
||||
createNotebook: function(noteName, defaultInterpreterId) {
|
||||
createNotebook: function (noteName, defaultInterpreterId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'NEW_NOTE',
|
||||
data: {
|
||||
|
|
@ -33,79 +33,79 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
moveNoteToTrash: function(noteId) {
|
||||
moveNoteToTrash: function (noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'MOVE_NOTE_TO_TRASH', data: {id: noteId}});
|
||||
},
|
||||
|
||||
moveFolderToTrash: function(folderId) {
|
||||
moveFolderToTrash: function (folderId) {
|
||||
websocketEvents.sendNewEvent({op: 'MOVE_FOLDER_TO_TRASH', data: {id: folderId}});
|
||||
},
|
||||
|
||||
restoreNote: function(noteId) {
|
||||
restoreNote: function (noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'RESTORE_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
restoreFolder: function(folderId) {
|
||||
restoreFolder: function (folderId) {
|
||||
websocketEvents.sendNewEvent({op: 'RESTORE_FOLDER', data: {id: folderId}});
|
||||
},
|
||||
|
||||
restoreAll: function() {
|
||||
restoreAll: function () {
|
||||
websocketEvents.sendNewEvent({op: 'RESTORE_ALL'});
|
||||
},
|
||||
|
||||
deleteNote: function(noteId) {
|
||||
deleteNote: function (noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
removeFolder: function(folderId) {
|
||||
removeFolder: function (folderId) {
|
||||
websocketEvents.sendNewEvent({op: 'REMOVE_FOLDER', data: {id: folderId}});
|
||||
},
|
||||
|
||||
emptyTrash: function() {
|
||||
emptyTrash: function () {
|
||||
websocketEvents.sendNewEvent({op: 'EMPTY_TRASH'});
|
||||
},
|
||||
|
||||
cloneNote: function(noteIdToClone, newNoteName) {
|
||||
cloneNote: function (noteIdToClone, newNoteName) {
|
||||
websocketEvents.sendNewEvent({op: 'CLONE_NOTE', data: {id: noteIdToClone, name: newNoteName}});
|
||||
},
|
||||
|
||||
getNoteList: function() {
|
||||
getNoteList: function () {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTES'});
|
||||
},
|
||||
|
||||
reloadAllNotesFromRepo: function() {
|
||||
reloadAllNotesFromRepo: function () {
|
||||
websocketEvents.sendNewEvent({op: 'RELOAD_NOTES_FROM_REPO'});
|
||||
},
|
||||
|
||||
getNote: function(noteId) {
|
||||
getNote: function (noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
updateNote: function(noteId, noteName, noteConfig) {
|
||||
updateNote: function (noteId, noteName, noteConfig) {
|
||||
websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config: noteConfig}});
|
||||
},
|
||||
|
||||
updatePersonalizedMode: function(noteId, modeValue) {
|
||||
updatePersonalizedMode: function (noteId, modeValue) {
|
||||
websocketEvents.sendNewEvent({op: 'UPDATE_PERSONALIZED_MODE', data: {id: noteId, personalized: modeValue}});
|
||||
},
|
||||
|
||||
renameNote: function(noteId, noteName) {
|
||||
renameNote: function (noteId, noteName) {
|
||||
websocketEvents.sendNewEvent({op: 'NOTE_RENAME', data: {id: noteId, name: noteName}});
|
||||
},
|
||||
|
||||
renameFolder: function(folderId, folderName) {
|
||||
renameFolder: function (folderId, folderName) {
|
||||
websocketEvents.sendNewEvent({op: 'FOLDER_RENAME', data: {id: folderId, name: folderName}});
|
||||
},
|
||||
|
||||
moveParagraph: function(paragraphId, newIndex) {
|
||||
moveParagraph: function (paragraphId, newIndex) {
|
||||
websocketEvents.sendNewEvent({op: 'MOVE_PARAGRAPH', data: {id: paragraphId, index: newIndex}});
|
||||
},
|
||||
|
||||
insertParagraph: function(newIndex) {
|
||||
insertParagraph: function (newIndex) {
|
||||
websocketEvents.sendNewEvent({op: 'INSERT_PARAGRAPH', data: {index: newIndex}});
|
||||
},
|
||||
|
||||
copyParagraph: function(newIndex, paragraphTitle, paragraphData,
|
||||
copyParagraph: function (newIndex, paragraphTitle, paragraphData,
|
||||
paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'COPY_PARAGRAPH',
|
||||
|
|
@ -119,7 +119,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
updateAngularObject: function(noteId, paragraphId, name, value, interpreterGroupId) {
|
||||
updateAngularObject: function (noteId, paragraphId, name, value, interpreterGroupId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'ANGULAR_OBJECT_UPDATED',
|
||||
data: {
|
||||
|
|
@ -132,7 +132,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
clientBindAngularObject: function(noteId, name, value, paragraphId) {
|
||||
clientBindAngularObject: function (noteId, name, value, paragraphId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'ANGULAR_OBJECT_CLIENT_BIND',
|
||||
data: {
|
||||
|
|
@ -144,7 +144,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
clientUnbindAngularObject: function(noteId, name, paragraphId) {
|
||||
clientUnbindAngularObject: function (noteId, name, paragraphId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'ANGULAR_OBJECT_CLIENT_UNBIND',
|
||||
data: {
|
||||
|
|
@ -155,11 +155,11 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
cancelParagraphRun: function(paragraphId) {
|
||||
cancelParagraphRun: function (paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}});
|
||||
},
|
||||
|
||||
paragraphExecutedBySpell: function(paragraphId, paragraphTitle,
|
||||
paragraphExecutedBySpell: function (paragraphId, paragraphTitle,
|
||||
paragraphText, paragraphResultsMsg,
|
||||
paragraphStatus, paragraphErrorMessage,
|
||||
paragraphConfig, paragraphParams) {
|
||||
|
|
@ -184,7 +184,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
runParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
runParagraph: function (paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'RUN_PARAGRAPH',
|
||||
data: {
|
||||
|
|
@ -197,7 +197,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
runAllParagraphs: function(noteId, paragraphs) {
|
||||
runAllParagraphs: function (noteId, paragraphs) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'RUN_ALL_PARAGRAPHS',
|
||||
data: {
|
||||
|
|
@ -207,19 +207,19 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
removeParagraph: function(paragraphId) {
|
||||
removeParagraph: function (paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}});
|
||||
},
|
||||
|
||||
clearParagraphOutput: function(paragraphId) {
|
||||
clearParagraphOutput: function (paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_OUTPUT', data: {id: paragraphId}});
|
||||
},
|
||||
|
||||
clearAllParagraphOutput: function(noteId) {
|
||||
clearAllParagraphOutput: function (noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_ALL_OUTPUT', data: {id: noteId}});
|
||||
},
|
||||
|
||||
completion: function(paragraphId, buf, cursor) {
|
||||
completion: function (paragraphId, buf, cursor) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'COMPLETION',
|
||||
data: {
|
||||
|
|
@ -230,7 +230,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
commitParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
commitParagraph: function (paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'COMMIT_PARAGRAPH',
|
||||
data: {
|
||||
|
|
@ -243,7 +243,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
importNote: function(note) {
|
||||
importNote: function (note) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'IMPORT_NOTE',
|
||||
data: {
|
||||
|
|
@ -252,7 +252,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
checkpointNote: function(noteId, commitMessage) {
|
||||
checkpointNote: function (noteId, commitMessage) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'CHECKPOINT_NOTE',
|
||||
data: {
|
||||
|
|
@ -262,7 +262,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
setNoteRevision: function(noteId, revisionId) {
|
||||
setNoteRevision: function (noteId, revisionId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'SET_NOTE_REVISION',
|
||||
data: {
|
||||
|
|
@ -272,7 +272,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
listRevisionHistory: function(noteId) {
|
||||
listRevisionHistory: function (noteId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'LIST_REVISION_HISTORY',
|
||||
data: {
|
||||
|
|
@ -281,7 +281,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
getNoteByRevision: function(noteId, revisionId) {
|
||||
getNoteByRevision: function (noteId, revisionId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'NOTE_REVISION',
|
||||
data: {
|
||||
|
|
@ -291,7 +291,7 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
getEditorSetting: function(paragraphId, replName) {
|
||||
getEditorSetting: function (paragraphId, replName) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'EDITOR_SETTING',
|
||||
data: {
|
||||
|
|
@ -301,38 +301,38 @@ function websocketMsgSrv($rootScope, websocketEvents) {
|
|||
});
|
||||
},
|
||||
|
||||
isConnected: function() {
|
||||
isConnected: function () {
|
||||
return websocketEvents.isConnected();
|
||||
},
|
||||
|
||||
getNoteJobsList: function() {
|
||||
getNoteJobsList: function () {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTE_JOBS'});
|
||||
},
|
||||
|
||||
getUpdateNoteJobsList: function(lastUpdateServerUnixTime) {
|
||||
getUpdateNoteJobsList: function (lastUpdateServerUnixTime) {
|
||||
websocketEvents.sendNewEvent(
|
||||
{op: 'LIST_UPDATE_NOTE_JOBS', data: {lastUpdateUnixTime: lastUpdateServerUnixTime * 1}}
|
||||
);
|
||||
},
|
||||
|
||||
unsubscribeJobManager: function() {
|
||||
unsubscribeJobManager: function () {
|
||||
websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTE_JOBS'});
|
||||
},
|
||||
|
||||
getInterpreterBindings: function(noteId) {
|
||||
getInterpreterBindings: function (noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteId: noteId}});
|
||||
},
|
||||
|
||||
saveInterpreterBindings: function(noteId, selectedSettingIds) {
|
||||
saveInterpreterBindings: function (noteId, selectedSettingIds) {
|
||||
websocketEvents.sendNewEvent({op: 'SAVE_INTERPRETER_BINDINGS',
|
||||
data: {noteId: noteId, selectedSettingIds: selectedSettingIds}});
|
||||
},
|
||||
|
||||
listConfigurations: function() {
|
||||
listConfigurations: function () {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_CONFIGURATIONS'});
|
||||
},
|
||||
|
||||
getInterpreterSettings: function() {
|
||||
getInterpreterSettings: function () {
|
||||
websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_SETTINGS'});
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue