Skip to content

Commit

Permalink
Added showAlert on vi-app
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleeckx committed Jun 29, 2016
1 parent 47dc1d6 commit b0344cb
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/WebComponents/App/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,26 @@ namespace Vidyano.WebComponents {
return this.showDialog(new Vidyano.WebComponents.MessageDialog(options));
}

showAlert(notification: string, type: Vidyano.NotificationType = Vidyano.NotificationType.Notice, duration: number = 3000) {
switch (type) {
case NotificationType.Error:
alertify.log(notification, "error", duration);
break;

case NotificationType.OK:
alertify.log(notification, "success", duration);
break;

case NotificationType.Warning:
alertify.log(notification, "warning", duration);
break;

case NotificationType.Notice:
alertify.log(notification, "notice", duration);
break;
}
}

private _computeIsProfiling(isSignedIn: boolean, profile: boolean, profilerLoaded: boolean): boolean {
const isProfiling = isSignedIn && profile;
if (isProfiling && !Polymer.isInstance(this.$["profiler"])) {
Expand Down Expand Up @@ -904,23 +924,7 @@ namespace Vidyano.WebComponents {
if (typeof notification === "object")
notification = notification["message"];

switch (type) {
case NotificationType.Error:
alertify.log(notification, "error", duration);
break;

case NotificationType.OK:
alertify.log(notification, "success", duration);
break;

case NotificationType.Warning:
alertify.log(notification, "warning", duration);
break;

case NotificationType.Notice:
alertify.log(notification, "notice", duration);
break;
}
this.app.showAlert(notification, type, duration);
}

onSelectReference(query: Vidyano.Query): Promise<QueryResultItem[]> {
Expand Down

0 comments on commit b0344cb

Please sign in to comment.