}
openCopyAlerts() {
- this.copyAlertsDialog.inPlaceMode = true;
+ this.copyAlertsDialog.inPlaceCreateMode = true;
this.copyAlertsDialog.copyIds = this.context.copyList().map(c => c.id());
this.copyAlertsDialog.open({size: 'lg'}).subscribe(
}
openCopyTags() {
- this.copyTagsDialog.inPlaceMode = true;
+ this.copyTagsDialog.inPlaceCreateMode = true;
this.copyTagsDialog.copyIds = this.context.copyList().map(c => c.id());
this.copyTagsDialog.open({size: 'lg'}).subscribe(newTags => {
}
openCopyNotes() {
- this.copyNotesDialog.inPlaceMode = true;
+ this.copyNotesDialog.inPlaceCreateMode = true;
this.copyNotesDialog.copyIds = this.context.copyList().map(c => c.id());
this.copyNotesDialog.open({size: 'lg'}).subscribe(newNotes => {
extends DialogComponent implements OnInit {
// If there are multiple copyIds, only new alerts may be applied.
- // If there is only one copyId, then tags may be applied or removed.
+ // If there is only one copyId, then alerts may be applied or removed.
@Input() copyIds: number[] = [];
mode: string; // create | manage
- // If true, no attempt is made to save the new alerts to the
+ // If true, no attempt is made to save new alerts to the
// database. It's assumed this takes place in the calling code.
- // This is useful for creating alerts for new copies.
- @Input() inPlaceMode = false;
+ @Input() inPlaceCreateMode = false;
// In 'create' mode, we may be adding notes to multiple copies.
copies: IdlObject[];
this.newAlert = this.idl.create('aca');
this.newAlert.create_staff(this.auth.user().id());
- if (this.copyIds.length === 0 && !this.inPlaceMode) {
+ if (this.copyIds.length === 0 && !this.inPlaceCreateMode) {
return throwError('copy ID required');
}
// In manage mode, we can only manage a single copy.
- // But in create mode, we can add tags to multiple copies.
- if (this.copyIds.length === 1 && !this.inPlaceMode) {
+ // But in create mode, we can add alerts to multiple copies.
+ if (this.copyIds.length === 1) {
this.mode = 'manage';
} else {
this.mode = 'create';
}
getCopies(): Promise<any> {
- if (this.inPlaceMode) { return Promise.resolve(); }
-
return this.pcrud.search('acp', {id: this.copyIds}, {}, {atomic: true})
.toPromise().then(copies => {
this.copies = copies;
// acknowledged by staff and are within org unit range of
// the alert type.
getCopyAlerts(): Promise<any> {
- const copyIds = this.copies.map(c => c.id());
const typeIds = this.alertTypes.map(a => a.id);
return this.pcrud.search('aca',
- {copy: copyIds, ack_time: null, alert_type: typeIds},
+ {copy: this.copyIds, ack_time: null, alert_type: typeIds},
{}, {atomic: true})
.toPromise().then(alerts => {
alerts.forEach(a => {
addNew() {
if (!this.newAlert.alert_type()) { return; }
- if (this.inPlaceMode) {
+ if (this.inPlaceCreateMode) {
this.close(this.newAlert);
return;
}
// If true, no attempt is made to save the new notes to the
// database. It's assumed this takes place in the calling code.
- // This is useful for creating notes for new copies.
- @Input() inPlaceMode = false;
+ @Input() inPlaceCreateMode = false;
// In 'create' mode, we may be adding notes to multiple copies.
copies: IdlObject[] = [];
this.copies = [];
this.newNotes = [];
- if (this.copyIds.length === 0 && !this.inPlaceMode) {
+ if (this.copyIds.length === 0 && !this.inPlaceCreateMode) {
return throwError('copy ID required');
}
// In manage mode, we can only manage a single copy.
// But in create mode, we can add notes to multiple copies.
- if (this.copyIds.length === 1 && !this.inPlaceMode) {
+ if (this.copyIds.length === 1) {
this.mode = 'manage';
} else {
this.mode = 'create';
}
getCopies(): Promise<any> {
- if (this.inPlaceMode) { return Promise.resolve(); }
-
return this.pcrud.search('acp', {id: this.copyIds},
{flesh: 1, flesh_fields: {acp: ['notes']}},
{atomic: true}
applyChanges() {
- if (this.inPlaceMode) {
+ if (this.inPlaceCreateMode) {
this.close(this.newNotes);
return;
}
// If true, no attempt is made to save the new tags to the
// database. It's assumed this takes place in the calling code.
- // This is useful for creating tags for new copies.
- @Input() inPlaceMode = false;
+ @Input() inPlaceCreateMode = false;
// In 'create' mode, we may be adding notes to multiple copies.
copies: IdlObject[] = [];
this.newTags = [];
this.deletedMaps = [];
- if (this.copyIds.length === 0 && !this.inPlaceMode) {
+ if (this.copyIds.length === 0 && !this.inPlaceCreateMode) {
return throwError('copy ID required');
}
// In manage mode, we can only manage a single copy.
// But in create mode, we can add tags to multiple copies.
- if (this.copyIds.length === 1 && !this.inPlaceMode) {
+ if (this.copyIds.length === 1) {
this.mode = 'manage';
} else {
this.mode = 'create';
}
getCopies(): Promise<any> {
- if (this.inPlaceMode) { return Promise.resolve(); }
-
return this.pcrud.search('acp', {id: this.copyIds},
{flesh: 3, flesh_fields: {
acp: ['tags'], acptcm: ['tag'], acpt: ['tag_type']}},
applyChanges() {
- if (this.inPlaceMode) {
+ if (this.inPlaceCreateMode) {
this.close(this.newTags);
return;
}