From 10f45372d798b24eb1bd59cdc9be747c8443231e Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 28 May 2016 10:11:18 +0100 Subject: [PATCH] feat(Extensions): Added processing of failed commands with growl notification Signed-off-by: Chris Jackson --- src/app/models/extensionModel.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/models/extensionModel.js b/src/app/models/extensionModel.js index de2a695e..f2a13f62 100644 --- a/src/app/models/extensionModel.js +++ b/src/app/models/extensionModel.js @@ -7,9 +7,12 @@ * * (c) 2014-2016 Chris Jackson (chris@cd-jackson.com) */ -angular.module('HABmin.extensionModel', []) +angular.module('HABmin.extensionModel', [ + 'angular-growl', + 'ngLocalize' +]) - .service('ExtensionModel', function ($http, $q, UserService, RestService) { + .service('ExtensionModel', function ($http, $q,locale, growl) { var extensionList = []; var extensionTypeList = []; var eventSrc; @@ -29,13 +32,19 @@ angular.module('HABmin.extensionModel', []) case 'ExtensionEvent': for (var i = 0; i < extensionList.length; i++) { if (extensionList[i].id == topic[2]) { + extensionList[i].inprogress = false; + if(topic[3] == "installed") { extensionList[i].installed = true; + growl.error(locale.getString("extensions.InstallOk", {extension: payload[0]})); } if(topic[3] == "uninstalled") { extensionList[i].installed = false; + growl.error(locale.getString("extensions.UninstallOk", {extension: payload[0]})); + } + if(topic[3] == "failed") { + growl.error(locale.getString("extensions.CommandFailed", {message: payload[1]})); } - extensionList[i].inprogress = false; break; } }