Added possiblity to extend the dashboard programmatically
Change-Id: Ibf2c2f7e6d51e6f5a661021f3f9f4b15c9cbefa1
diff --git a/src/app/core/nav/nav.html b/src/app/core/nav/nav.html
index 402d2fa..ce495da 100644
--- a/src/app/core/nav/nav.html
+++ b/src/app/core/nav/nav.html
@@ -44,7 +44,8 @@
<a ng-click="vm.logout()" class="btn btn-accent btn-block btn-logout">Logout</a>
</div>
</div>
- <!--<a ng-click="vm.togglePanel()" class="btn btn-success">Open XSP</a>-->
+ <a ng-click="vm.togglePanel()" class="btn btn-success">Open XSP</a>
+ <a ng-click="vm.addToDashboard()" class="btn btn-success">Add to home</a>
</li>
</ul>
</nav>
diff --git a/src/app/core/nav/nav.spec.ts b/src/app/core/nav/nav.spec.ts
index f443d91..5101ba8 100644
--- a/src/app/core/nav/nav.spec.ts
+++ b/src/app/core/nav/nav.spec.ts
@@ -32,7 +32,8 @@
.service('NavigationService', NavigationService)
.value('AuthService', AuthMock)
.value('StyleConfig', {})
- .value('XosSidePanel', {});
+ .value('XosSidePanel', {})
+ .value('XosComponentInjector', {});
angular.mock.module('xosNav');
});
diff --git a/src/app/core/nav/nav.ts b/src/app/core/nav/nav.ts
index ec2d8b2..08ad48a 100644
--- a/src/app/core/nav/nav.ts
+++ b/src/app/core/nav/nav.ts
@@ -3,9 +3,10 @@
import {IXosAuthService} from '../../datasources/rest/auth.rest';
import {IXosStyleConfig} from '../../../index';
import {IXosSidePanelService} from '../side-panel/side-panel.service';
+import {IXosComponentInjectorService} from '../services/helpers/component-injector.helpers';
class NavCtrl {
- static $inject = ['$scope', '$state', 'NavigationService', 'AuthService', 'StyleConfig', 'XosSidePanel'];
+ static $inject = ['$scope', '$state', 'NavigationService', 'AuthService', 'StyleConfig', 'XosSidePanel', 'XosComponentInjector'];
public routes: IXosNavigationRoute[];
public navSelected: string;
public appName: string;
@@ -17,7 +18,8 @@
private navigationService: IXosNavigationService,
private authService: IXosAuthService,
private StyleConfig: IXosStyleConfig,
- private XosSidePanel: IXosSidePanelService
+ private XosSidePanel: IXosSidePanelService,
+ private XosComponentInjector: IXosComponentInjectorService
) {
// NOTE we'll need to have:
// - Base routes (defined from configuration based on BRAND)
@@ -62,6 +64,9 @@
togglePanel() {
this.XosSidePanel.injectComponent('xosAlert', {config: {type: 'danger'}, show: true}, 'Sample message');
}
+ addToDashboard() {
+ this.XosComponentInjector.injectComponent('#dashboard-component-container', 'xosAlert', {config: {type: 'danger'}, show: true}, 'Sample message', false);
+ }
logout() {
this.authService.logout()