Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._reset();
this.onStart(files);
// NOTE: for...of loop results in a transpilation that errors in Edge,
// once we drop IE11 support we should be able to use native for...of
for (let i = 0; i < files.length; i += 1) {
let file = files[i];
let tracker = UploadTracker.create({file});
this._uploadTrackers.pushObject(tracker);
uploads.push(this._uploadFile.perform(tracker, file, i));
}
// populates this.errors and this.uploadUrls
yield all(uploads);
if (!isEmpty(this.errors)) {
this.onFailed(this.errors);
}
this.onComplete(this.uploadUrls);
}).drop(),
? relOptions.deep
: deep;
if (meta.kind === 'belongsTo') {
if (value && value.get(IS_COPYABLE)) {
attrs[name] = yield value
.get(COPY_TASK)
.perform(deepRel, relOptions, _meta);
} else {
attrs[name] = value;
}
} else if (meta.kind === 'hasMany') {
const firstObject = value.get('firstObject');
if (firstObject && firstObject.get(IS_COPYABLE)) {
attrs[name] = yield all(
value
.getEach(COPY_TASK)
.invoke('perform', deepRel, relOptions, _meta)
);
} else {
attrs[name] = value;
}
}
}
// Build the final attrs pojo by merging otherAttributes, the copied
// attributes, and ant overwrites specified.
attrs = assign(this.getProperties(otherAttributes), attrs, overwrite);
// Set the properties on the model
model.setProperties(attrs);
deleteManyTask: task(function* (manyArray) {
if (!manyArray) {
return;
}
let resolvedArray = yield manyArray;
if (isEmpty(resolvedArray)) {
// empty array: no records to delete
return;
}
let deleteRecordTask = this.get('deleteRecordTask');
let archivePromises = [];
resolvedArray.forEach((recordToDelete) => {
archivePromises.push(deleteRecordTask.perform(recordToDelete));
});
return yield all(archivePromises, 'async array deletion');
}).group('deleting'),
let childTasks = [];
scenarios.forEach(function(scenario) {
scenario.set('event-query-params', {
include: ['victim', 'goal'],
page: { number: 1, size: MAX_EVENTS },
sort: ['-reported_date', 'id'],
});
childTasks.push(scenario.belongsTo('report').reload());
childTasks.push(scenario.hasMany('events').reload());
});
this.set('scenarios', scenarios);
yield all(childTasks);
}).restartable(),
refreshTask: task(function * () {
deleteInvoicesTask: task(function* (patientInvoices) {
let invoices = yield patientInvoices;
let lineItems = yield all(invoices.mapBy('lineItems'));
let lineItemDetails = yield all(lineItems.mapBy('details'));
return yield all([
this.deleteMany(invoices),
this.deleteMany(lineItems),
this.deleteMany(lineItemDetails)
]);
}).group('deleting'),
updateSettingsTask: task(function* () {
const settingsTasks = [];
get(this, 'dirtySettings').forEach((setting) => {
settingsTasks.push(get(this, 'updateSettingTask').perform(setting));
});
yield get(this, 'session.account').save();
yield all(settingsTasks).then((results) => {
if (isEmpty(results.filter(result => result === undefined))) {
get(this, 'notify').success('Your notification settings were updated.');
}
});
}).drop(),
let procCharges = procedures.get('charges');
let labCharges = labs.get('charges');
let imagingCharges = imaging.get('charges');
let visitCharges = visit.get('charges');
pendingTasks.push(this.deleteMany(labs));
pendingTasks.push(this.deleteMany(labCharges));
pendingTasks.push(this.deleteMany(visit.get('patientNotes')));
pendingTasks.push(this.deleteMany(visit.get('vitals')));
pendingTasks.push(this.deleteMany(procedures));
pendingTasks.push(this.deleteMany(procCharges));
pendingTasks.push(this.deleteMany(visit.get('medication')));
pendingTasks.push(this.deleteMany(imaging));
pendingTasks.push(this.deleteMany(imagingCharges));
pendingTasks.push(this.deleteMany(visitCharges));
});
yield all(pendingTasks);
return yield this.deleteMany(visits);
}).group('deleting'),
_updateChronosSubmissions: task(function* () {
if (this.get('isOpen')) {
this.set('isOpen', false);
return;
} else {
this.set('isOpen', true);
}
const submissions = yield this.get('store').peekAll('chronos-submission');
const childTasks = [];
submissions.forEach(function (item) {
if (item.get('preprint.id') === this.get('preprint.id')) {
childTasks.push(this.get('_updateStatus').perform(item));
}
}.bind(this));
yield all(childTasks);
}).drop(),
/*
deleteFiles = task(function *(this: UserQuickfiles, files: File[]) {
const deleteFile = this.get('deleteFile');
yield all(files.map(file => deleteFile.perform(file)));
});
loadDefaultCitations: task(function *(this: CitationViewer) {
const responses: SingleResourceDocument[] = yield all(
defaultCitations.map(
c => this.currentUser.authenticatedAJAX({ url: citationUrl(this.citable, c.id) }),
),
);
return responses.map((r, i) => ({
...defaultCitations[i],
citation: r.data.attributes!.citation,
}));
}).on('init'),