Skip to content

Commit

Permalink
Use showAlert for errors only (connects #774) (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupesh87 authored and paulbert committed May 2, 2018
1 parent cb0b6ee commit 0c16291
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/app/configuration/configuration.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ConfigurationComponent implements OnInit {
{ domain: environment.centerAddress })
.subscribe((data) => {
this.nations = data.docs;
}, (error) => this.planetMessageService.showMessage('There is a problem getting the list of nations'));
}, (error) => this.planetMessageService.showAlert('There is a problem getting the list of nations'));
}

onChange(selectedValue: string) {
Expand Down Expand Up @@ -136,7 +136,7 @@ export class ConfigurationComponent implements OnInit {
]).debug('Sending request to parent planet').subscribe((data) => {
this.planetMessageService.showMessage('Admin created: ' + data[1].id.replace('org.couchdb.user:', ''));
this.router.navigate([ '/login' ]);
}, (error) => this.planetMessageService.showMessage('There was an error creating planet'));
}, (error) => this.planetMessageService.showAlert('There was an error creating planet'));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/courses/courses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class CoursesComponent implements OnInit, AfterViewInit {
this.courses.data = this.courses.data.filter((c: any) => data.id !== c._id);
this.deleteDialog.close();
this.selection.clear();
this.planetMessageService.showAlert('Course deleted: ' + course.courseTitle);
this.planetMessageService.showMessage('Course deleted: ' + course.courseTitle);
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting this course.');
};
}
Expand All @@ -177,7 +177,7 @@ export class CoursesComponent implements OnInit, AfterViewInit {
this.getCourses();
this.selection.clear();
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted selected courses');
this.planetMessageService.showMessage('You have deleted selected courses');
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting this course.');
};
}
Expand Down Expand Up @@ -230,7 +230,7 @@ export class CoursesComponent implements OnInit, AfterViewInit {
newShelf._rev = res.rev;
this.userService.setShelf(newShelf);
this.setupList(this.courses.data, this.userShelf.courseIds);
this.planetMessageService.showAlert(message);
this.planetMessageService.showMessage(message);
}, (error) => (error));
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/feedback/feedback.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class FeedbackComponent implements OnInit, AfterViewInit {
// It's safer to remove the item from the array based on its id than to splice based on the index
this.feedback.data = this.feedback.data.filter((fback: any) => data.id !== fback._id);
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted feedback.');
this.planetMessageService.showMessage('You have deleted feedback.');
}, (error) => this.deleteDialog.componentInstance.message = 'There is a problem deleting this feedback.');
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/login/login-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class LoginFormComponent {
return forkJoin(obsArr);
})).subscribe((res) => {

}, (error) => this.planetMessageService.showMessage('Username and/or password do not match'));
}, (error) => this.planetMessageService.showAlert('Username and/or password do not match'));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/meetups/meetups.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class MeetupsComponent implements OnInit, AfterViewInit, OnDestroy {
this.meetups.data = this.meetups.data.filter((meet: any) => data.id !== meet._id);
this.selection.clear();
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted Meetup ' + meetup.title);
this.planetMessageService.showMessage('You have deleted Meetup ' + meetup.title);
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting this meetup');
};
}
Expand All @@ -126,7 +126,7 @@ export class MeetupsComponent implements OnInit, AfterViewInit, OnDestroy {
this.meetupService.updateMeetups();
this.selection.clear();
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted selected meetups');
this.planetMessageService.showMessage('You have deleted selected meetups');
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting these meetups.');
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/meetups/meetups.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class MeetupService {
this.userShelf._rev = res.rev;
this.userService.setShelf(this.userShelf);
const msg = participate ? 'left' : 'joined';
this.planetMessageService.showAlert('You have ' + msg + ' selected meetup.');
this.planetMessageService.showMessage('You have ' + msg + ' selected meetup.');
}, (error) => (error));
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/nation/nation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class NationComponent implements OnInit, AfterViewInit {
// It's safer to remove the item from the array based on its id than to splice based on the index
this.nations.data = this.nations.data.filter((nat: any) => data.id !== nat._id);
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted nation: ' + nation.name);
this.planetMessageService.showMessage('You have deleted nation: ' + nation.name);
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting this nation');
};
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/resources/resources.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class ResourcesComponent implements OnInit, AfterViewInit, OnDestroy {
.subscribe((data) => {
this.resources.data = this.resources.data.filter((res: any) => data.id !== res._id);
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted resource: ' + resource.title);
this.planetMessageService.showMessage('You have deleted resource: ' + resource.title);
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting this resource.');
};
}
Expand All @@ -220,7 +220,7 @@ export class ResourcesComponent implements OnInit, AfterViewInit, OnDestroy {
this.resourcesService.updateResources({ opts: this.getOpts });
this.selection.clear();
this.deleteDialog.close();
this.planetMessageService.showAlert('You have deleted all resources');
this.planetMessageService.showMessage('You have deleted all resources');
}, (error) => this.deleteDialog.componentInstance.message = 'There was a problem deleting this resource.');
};
}
Expand All @@ -241,7 +241,7 @@ export class ResourcesComponent implements OnInit, AfterViewInit, OnDestroy {
newShelf._rev = res.rev;
this.userService.setShelf(newShelf);
this.selection.clear();
this.planetMessageService.showAlert(msg + ' myLibrary');
this.planetMessageService.showMessage(msg + ' mylibrary');
}, (error) => (error));
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/users/users-profile/users-profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class UsersProfileComponent implements OnInit {
if (res.ok === true) {
this.planetMessageService.showMessage('Password successfully updated');
}
}, (error) => this.planetMessageService.showMessage('Error changing password'));
}, (error) => this.planetMessageService.showAlert('Error changing password'));
}

changePasswordRequest(userData) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/users/users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class UsersComponent implements OnInit, AfterViewInit {
this.couchService.put('shelf/' + this.userService.get()._id, { ...userShelf, myTeamIds }).subscribe((res) => {
this.userService.setShelf({ ...userShelf, _rev: res.rev, myTeamIds });

this.planetMessageService.showAlert(msg + ' your shelf');
this.planetMessageService.showMessage(msg + ' your shelf');
}, (error) => (error));
}

Expand Down

0 comments on commit 0c16291

Please sign in to comment.