Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return $http.get('/parse', { params: {'text': definitionText}}).success(function(data) {
if (angular.isFunction(setErrorFn)) {
setErrorFn(null);
}
if (typeof data === 'string') {
data = angular.fromJson(data);
}
// TODO handle error case, clear the graph
$log.info('parse responded with data:\''+JSON.stringify(data)+'\'');
if (angular.isFunction(updateGraphFn)) {
updateGraphFn(data);
}
}).error(function(data, status, headers, config, statusText) { // jshint ignore:line
if (typeof data === 'string') {
}
})
}
}
function save() {
var filtered = _.filter(_.cloneDeep(tabs), tab => !!tab.tabType)
var cleaned = _.map(filtered, tab => ({
tabType: tab.tabType,
value: tab.value
}))
localStorageService.set('tabs', cleaned)
}
//load on startup
var loaded = angular.fromJson(localStorageService.get('tabs')) || []
_.each(loaded, tab => tabService.addTab(tab.tabType, tab.value))
return tabService
}
.respond(function(method, url, data) {
console.debug('POST ' + url);
data = angular.fromJson(data);
data = collection.insert(data);
console.debug(data);
return [201, angular.copy(data)];
});
let expiration: Date = new Date();
expiration.setTime((auth.expires - 300) * 1000);
if (expiration > new Date()){
this.$http.defaults.headers.common.Authorization = 'Bearer ' + auth.access_token;
this.$http.defaults.headers.common.SampleID = 'angular-connect-rest-sharepoint';
if (localStorage.getItem('user') === null){
this.graphHelper.me().then((results: any): void => {
let user = results.data;
localStorage.setItem('user', angular.toJson(user));
this.displayName = user.displayName;
});
}
else {
let user = angular.fromJson(localStorage.getItem('user'));
this.displayName = user.displayName;
}
}
}
private _processAuth(){
let auth: any = angular.fromJson(localStorage.getItem('auth'));
let expiration: Date = new Date();
expiration.setTime((auth.expires - 300) * 1000);
if (expiration > new Date()){
this.$http.defaults.headers.common.Authorization = 'Bearer ' + auth.access_token;
this.$http.defaults.headers.common.SampleID = 'angular-connect-rest-sharepoint';
if (localStorage.getItem('user') === null){
this.graphHelper.me().then((results: any): void => {
let user = results.data;
localStorage.setItem('user', angular.toJson(user));
this.displayName = user.displayName;
});
}
else {
$httpBackend.expectPOST(API.baseUrl + '/applications/appName/tasks', function (bodyString) {
submitted = angular.fromJson(bodyString);
return true;
}).respond(200, {ref: '/1'});
let listenRowJson = ganttDebounce(function (rowJson) {
if (rowJson !== undefined) {
let row = angular.fromJson(rowJson)
objectModel.cleanRow(row)
let tasks = row.tasks
delete row.tasks
delete row.drawTask
let rowModel = $scope.live.row
angular.merge(rowModel, row)
let newTasks = {}
let i
let l
if (tasks !== undefined) {
for (i = 0, l = tasks.length; i < l; i++) {
public getListItems(listId: string): void {
let auth: any = angular.fromJson(localStorage.getItem('auth'));
let expiration: Date = new Date();
expiration.setTime((auth.expires - 300) * 1000);
if (expiration > new Date()){
this.graphHelper.getListItems(this._siteId, listId).then((results: Array): void => {
this.$log.debug(results);
this.vwLsts = false;
this.vwLstItm = true;
this.itemCollection = results;
this._listId = listId;
});
}
else {
this.graphHelper.login();
}
}
public getLists(siteId: string): void {
let auth: any = angular.fromJson(localStorage.getItem('auth'));
let expiration: Date = new Date();
expiration.setTime((auth.expires - 300) * 1000);
if (expiration > new Date()){
this.graphHelper.getLists(siteId).then((results: Array): void => {
this.$log.debug(results);
this.vwSC = false;
this.vwLsts = true;
this.listCollection = results;
this._siteId = siteId;
});
}
else {
this.graphHelper.login();
}
}