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 httpEtagParseCacheKey (cacheId, url, params) {
cacheId = getFullCacheId(cacheId);
var keyParser = cacheService.get(cacheId).info().keyParser,
key, queryString;
if (angular.isFunction(keyParser))
key = keyParser(url, params);
// Failsafe
if (angular.isUndefined(key)) {
queryString = stringifyParams(params);
key = url + ((url.indexOf('?') == -1) ? '?' : '&') + queryString;
}
return key;
}
return Object.keys(obj || {}).reduce((prev, key) => {
const value = obj[key];
const config = (propsConfig || {})[key] || {};
/**
* wrap functions in a function that ensures they are scope.$applied
* ensures that when function is called from a React component
* the Angular digest cycle is run
*/
// @ts-ignore
prev[key] = angular.isFunction(value) && config.wrapApply !== false ? applied(value, scope) : value;
return prev;
}, {});
}
function handleDrag(event) {
// TODO offsetX/Y not on firefox
//$log.debug("tracking move: x="+event.pageX+",y="+event.pageY);
if (clickedElement && clickedElement.attr('metadata')) {
if (!viewBeingDragged) {
var dataOfClickedElement = clickedElement.attr('metadata');
// custom div if not already built.
$('<div>', {
id: 'palette-floater'
}).appendTo($('body'));
var floatergraph = new joint.dia.Graph();
floatergraph.attributes.type = joint.shapes.flo.FEEDBACK_TYPE;
var floaterpaper = new joint.dia.Paper({
el: $('#palette-floater'),
elementView: renderService && angular.isFunction(renderService.getNodeView) ? renderService.getNodeView() : joint.dia.ElementView,
gridSize:10,
model: floatergraph,
height: 400,
width: 200,
validateMagnet: function() {
return false;
},
validateConnection: function() {
return false;
}
});
// TODO float thing needs to be bigger otherwise icon label is missing
// Initiative drag and drop - create draggable element
var floaternode = shapesFactory.createNode({
'renderService': renderService,
'paper': floaterpaper,</div>
function getReactComponent(name: string, $injector: auto.IInjectorService) {
// if name is a function assume it is component and return it
if (angular.isFunction(name)) {
return name;
}
// a React component name must be specified
if (!name) {
throw new Error('ReactComponent name attribute must be specified');
}
// ensure the specified React component is accessible, and fail fast if it's not
let reactComponent;
try {
reactComponent = $injector.get(name);
} catch (e) {}
if (!reactComponent) {
try {
var body = $document.find("body").eq(0);
var modal_instance = {};
var controller = prepareControllerInjection(
scope,
modal_instance,
options,
resolved_dependencies
);
var compiled_modal = $compile(template)(scope);
var dom_modal_element = compiled_modal[0];
body.append(dom_modal_element);
modal_instance.tlp_modal = createModal(dom_modal_element, tlp_modal_options);
if (isFunction(controller.$onInit)) {
controller.$onInit();
}
modal_instance.tlp_modal.show();
modal_instance.tlp_modal.addEventListener("tlp-modal-hidden", function () {
compiled_modal.remove();
scope.$destroy();
delete modal_instance.tlp_modal;
});
return modal_instance.tlp_modal;
}
}
if (val && val[error]) {
message = val[error];
return true;
}
});
let context = {
error: error,
value: value,
viewValue: viewValue,
form: form,
schema: form.schema,
title: form.title || (form.schema && form.schema.title),
};
if (angular.isFunction(message)) {
return message(context);
}
else {
return $interpolate(message)(context);
}
};
async updateDiagram(variants, isLoading, error) {
if (isLoading) {
return;
}
if (!variants || variants.length === 0) {
this._scope.options.chart.noData = error || 'No Data Available';
this._scope.data = [];
} else {
this._scope.data = this.makeNvD3ChartObjectFromData(variants);
}
this._scope.api && angular.isFunction(this._scope.api.update) ? this._scope.api.update() : '';
}
}
}, (msg: any) =>{
if(errorCallback && angular.isFunction(errorCallback)) {
errorCallback(msg);
}
})
};
vm.remove = function() {
if (angular.isFunction(vm.intervalOptions.remove)) {
vm.intervalOptions.remove(vm.intervalOptions);
}
};