Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const orderDetail = new OrderDetail({
model,
removeOnClose: true,
returnText: app.polyglot.t(`transactions.${type}s.returnToFromOrder`),
...opts.modalOptions,
});
orderDetail.render().open();
if (opts.addToRoute) {
// add the order / case id to the url
const params = deparam(location.hash.split('?')[1] || '');
delete params.orderId;
delete params.caseId;
params[type === 'case' ? 'caseId' : 'orderId'] = id;
app.router.navigate(`${location.hash.split('?')[0]}?${$.param(params)}`);
}
// remove it from the url on close of the modal
const onClose = () => {
const params = deparam(location.hash.split('?')[1] || '');
delete params.orderId;
delete params.caseId;
app.router.navigate(`${location.hash.split('?')[0]}?${$.param(params)}`);
};
this.listenTo(orderDetail, 'close', onClose);
// Do not alter the url if the user is routing to a new route. The
// user has already altered the url.
this.listenTo(app.router, 'will-route', () => {
this.stopListening(orderDetail, 'close', onClose);
if ($container.length === 0) {
return;
}
var params = {
timezone: options.timezone,
anonymous: options.anonymous,
minimal: options.minimal
};
if (options.welcome) {
/* jshint camelcase: false */
params.welcome_msg = options.welcome;
}
var url = options.url + (options.url.indexOf('?') > 0 ? '&' : '?') + $.param(params);
if (url.indexOf('https://') !== 0) {
url = 'https://' + url;
}
var w = options.width || '100%';
var h = options.height || 500;
var nf = (options.noframes || '');
$container.html('');
}
}
var ajaxPost = function(data, successCallback, failureCallback) {
var request = new XMLHttpRequest();
request.open('POST', window.vcAjaxUrl, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
successCallback(request);
} else {
if ('function' === typeof failureCallback) {
failureCallback(request);
}
}
};
request.send($.param(data));
};
Data.subscribe('app:init', function() {
prototype.prepareOpts = function(options) {
if (options.collapsibleResults) {
options.populateResults = populateCollapsibleResults;
const matcher = options.matcher || $.fn.select2.defaults.matcher;
options.matcher = function(term, text, option) {
return !option.children && matcher.call(this, term, text, option);
};
}
const additionalRequestParams = options.element.data('select2_query_additional_params');
if (additionalRequestParams && options.ajax !== undefined) {
options.ajax.url += (options.ajax.url.indexOf('?') < 0 ? '?' : '&') + $.param(additionalRequestParams);
}
const preparedOptions = prepareOpts.call(this, options);
const query = preparedOptions.query;
preparedOptions.query = function(queryOptions, ...rest) {
queryOptions.term = queryOptions.term && queryOptions.term.trim();
return query.call(this, queryOptions, ...rest);
};
preparedOptions.populateResults = _.wrap(preparedOptions.populateResults,
function(original, container, results, query) {
original.call(this, container, results, query);
const $results = $(container).find('.select2-result');
fetchData() {
let params = this.props.params;
let queryParams = this.props.location.query;
let querystring = jQuery.param(queryParams);
this.setState({
loading: true,
error: false
});
this.api.request('/issues/' + this.getGroup().id + '/tags/' + params.tagKey + '/', {
success: (data) => {
this.setState({
tagKey: data,
loading: this.state.tagValueList === null
});
},
error: (error) => {
this.setState({
error: true,
let newHash = {};
if (filterChecks.endsWith('-category')) {
newHash = {
filter: 'checks',
category: filterChecks.slice(0, -9),
};
} else {
newHash = {
filter: 'checks',
checks: filterChecks,
};
}
if (sortBy !== 'default') {
newHash.sort = sortBy;
}
$.history.load($.param(newHash));
}
return true;
},
onChartClicked(params, chart) {
if (params && params.dataIndex >= 0) {
let root_url = '/' + this.props.params.orgId + '/' + this.props.params.projectId + '/?';
let email = this.state.statsData[params.dataIndex].email;
if (email) {
let qs = jQuery.param({
query: "assigned:" + email
});
window.open(root_url + qs, "_blank");
}
}
},
render() {
url: function(queryParams) {
var encodedQueryParams = queryParams ? '?' + $.param(queryParams) : '';
if (this.get('job')) {
return '/' + this.get('taskType') + '/jobs/' + this.get('job') + '/';
} else {
return '/' + this.get('taskType') + '/' + this.get('taskName') + '/' + encodedQueryParams;
}
},
getProjectReleasesEndpoint() {
let params = this.props.params;
let queryParams = {
...this.props.location.query,
limit: 50,
query: this.state.query
};
return '/projects/' + params.orgId + '/' + params.projectId + '/releases/?' + jQuery.param(queryParams);
},
function getObservationIconUrlForEvent(eventId, formId, primary, variant) {
var url = '/api/events/' + eventId + '/icons';
if (formId) {
url += '/' + formId;
}
if (primary) {
url += '/' + primary;
}
if (variant) {
url += '/' + variant;
}
return url + '?' + $.param({access_token: LocalStorageService.getToken()});
}