2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 /// <reference path="../../../references"/>
21 module Sdc.ViewModels {
25 export interface IDashboardCoverViewModelScope extends ng.IScope {
28 modalInstance:ng.ui.bootstrap.IModalServiceInstance;
31 export class DashboardCoverViewModel {
35 'Sdc.Services.CacheService',
42 constructor(private $scope:IDashboardCoverViewModelScope,
43 private $stateParams:any,
44 private cacheService:Services.CacheService,
45 private $templateCache:ng.ITemplateCacheService,
47 private $modal:ng.ui.bootstrap.IModalService,
48 private sdcConfig:Models.IAppConfigurtaion) {
50 // Show the tutorial if needed when the dashboard page is opened.<script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
51 // This is called from the welcome page.
52 if (this.$stateParams.show === 'tutorial') {
53 this.$scope.showTutorial = true;
54 } else if (this.$stateParams.show === 'whatsnew') {
55 this.$scope.version = this.cacheService.get('version');
56 this.openWhatsNewModal(this.$scope);
62 private initScope = ():void => {
66 private openWhatsNewModal = (scope:IDashboardCoverViewModelScope):void => {
68 let onOk = ():void => {};
70 let onCancel = ():void => {
71 this.$state.go('dashboard.welcome', {show: ''});
74 let modalOptions:ng.ui.bootstrap.IModalSettings = {
75 template: this.$templateCache.get('/app/scripts/view-models/whats-new/whats-new-view.html'),
76 controller: 'Sdc.ViewModels.WhatsNewViewModel',
81 'version': scope.version
85 scope.modalInstance = this.$modal.open(modalOptions);
86 scope.modalInstance.result.then(onOk, onCancel);