Matteo Scandolo | fc4b37b | 2017-02-02 12:18:47 -0800 | [diff] [blame] | 1 | /// <reference path="../typings/index.d.ts" /> |
| 2 | import * as angular from 'angular'; |
| 3 | |
| 4 | import 'angular-ui-router'; |
| 5 | import 'angular-resource'; |
| 6 | import 'angular-cookies'; |
| 7 | import routesConfig from './routes'; |
| 8 | import {xosDemoComponent} from './app/components/demo'; |
| 9 | import {xosDashboardExtensionComponent} from './app/components/dashboard-extension'; |
| 10 | |
| 11 | |
| 12 | |
| 13 | angular.module('xos-sample-gui-extension', [ |
| 14 | 'ui.router', |
| 15 | 'xosCore' |
| 16 | ]) |
| 17 | .config(routesConfig) |
| 18 | .component('demo', xosDemoComponent) |
| 19 | .component('dashboardExtension', xosDashboardExtensionComponent) |
| 20 | .run(function( |
| 21 | $log: ng.ILogService, |
| 22 | $state: ng.ui.IStateService, |
| 23 | NavigationService: any, |
| 24 | XosComponentInjector: any, |
| 25 | XosKeyboardShortcut: any) { |
| 26 | $log.info('[xos-sample-gui-extension] App is running'); |
| 27 | |
| 28 | NavigationService.add({ |
| 29 | label: 'Example Extension', |
| 30 | state: 'xos.xos-sample-gui-extension.example-route', |
| 31 | }); |
| 32 | |
| 33 | XosComponentInjector.injectComponent( |
| 34 | '#dashboard-component-container', |
| 35 | 'dashboardExtension', |
| 36 | {}, |
| 37 | '', |
| 38 | false |
| 39 | ); |
| 40 | |
| 41 | XosKeyboardShortcut.registerKeyBinding({ |
| 42 | key: 'd', |
| 43 | description: 'Alert popup', |
| 44 | cb: () => { |
| 45 | alert('This binding is provided by the "xos-sample-gui-extension"'); |
| 46 | }, |
| 47 | }, 'global'); |
| 48 | }); |