File
Implements
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Constructor
constructor(router: Router, resourceService: ResourceService, activatedRoute: ActivatedRoute)
|
|
Parameters :
Name |
Type |
Optional |
router |
Router
|
No
|
resourceService |
ResourceService
|
No
|
activatedRoute |
ActivatedRoute
|
No
|
|
Methods
navigateToDownloadApkPage
|
navigateToDownloadApkPage()
|
|
|
showOfflineBanner
|
showOfflineBanner()
|
|
determines whether to show the banner for offline desktop apk download or not
|
Public
activatedRoute
|
Type : ActivatedRoute
|
|
Public
appDownloadUrl
|
Default value : (<HTMLInputElement>document.getElementById('offlineDesktopAppDownloadUrl')) ?
(<HTMLInputElement>document.getElementById('offlineDesktopAppDownloadUrl')).value : ''
|
|
Public
desktopAppVersion
|
Default value : (<HTMLInputElement>document.getElementById('offlineDesktopAppVersion')) ?
(<HTMLInputElement>document.getElementById('offlineDesktopAppVersion')).value : ''
|
|
Public
orgList
|
Default value : (<HTMLInputElement>document.getElementById('offlineDesktopAppTenant')) ?
(<HTMLInputElement>document.getElementById('offlineDesktopAppTenant')).value.toLowerCase().split(',') : []
|
|
Public
router
|
Type : Router
|
|
import { Router, ActivatedRoute } from '@angular/router';
import { Component, OnInit, Input } from '@angular/core';
import { ResourceService } from './../../services';
import * as _ from 'lodash-es';
@Component({
selector: 'app-offline-banner',
templateUrl: './offline-banner.component.html',
styleUrls: ['./offline-banner.component.scss']
})
export class OfflineBannerComponent implements OnInit {
/* to get the slug from explore-component*/
@Input() slug: string;
showBanner: boolean;
public pageId: string;
instance: string;
/* list of states for which banner to be shown */
public orgList = (<HTMLInputElement>document.getElementById('offlineDesktopAppTenant')) ?
(<HTMLInputElement>document.getElementById('offlineDesktopAppTenant')).value.toLowerCase().split(',') : [];
/* stores the offline desktop app version from envHelper variable */
public desktopAppVersion = (<HTMLInputElement>document.getElementById('offlineDesktopAppVersion')) ?
(<HTMLInputElement>document.getElementById('offlineDesktopAppVersion')).value : '';
/* stores the offline desktop download url from envHelper variable */
public appDownloadUrl = (<HTMLInputElement>document.getElementById('offlineDesktopAppDownloadUrl')) ?
(<HTMLInputElement>document.getElementById('offlineDesktopAppDownloadUrl')).value : '';
constructor(public router: Router, public resourceService: ResourceService, public activatedRoute: ActivatedRoute) {
this.pageId = _.get(this.activatedRoute, 'snapshot.data.telemetry.pageid');
}
ngOnInit() {
this.showOfflineBanner();
this.instance = _.upperCase(this.resourceService.instance);
}
/** determines whether to show the banner for offline desktop apk download or not */
showOfflineBanner() {
if (this.orgList.includes(_.lowerCase(this.slug))) {
this.showBanner = true;
} else {
this.showBanner = false;
}
}
/* navigate to apk download page */
navigateToDownloadApkPage() {
const path = this.slug ? this.slug + '/download/desktopapp' : 'download/desktopapp';
this.router.navigate([path]);
}
}
<div *ngIf="appDownloadUrl && showBanner" class="ui fluid container computer only sb-sticky-bottom" >
<div class="ui container sb-banner mt-24">
<div class="sb-banner-content">
<div class="sb-banner-content-right">
<div class="sb-banner-heading">
{{resourceService?.frmelmnts?.lbl?.downloadAppLite | interpolate:'{instance}': instance}}
</div>
<dl class="mt-8 mb-0">
<div class="d-flex" *ngIf="desktopAppVersion">
<dt class="description-list-key">{{resourceService?.frmelmnts?.lbl?.versionKey}}</dt>
<dd class="description-list-value">{{desktopAppVersion}}</dd>
</div>
</dl>
</div>
<div class="sb-banner-content-left">
<button appTelemetryInteract [telemetryInteractEdata]="{id:'offlineApp-button' , type:'click' , pageid:pageId }" class="sb-btn sb-btn-primary sb-btn-normal" tabindex="0" (click)="navigateToDownloadApkPage()">{{resourceService?.frmelmnts?.btn?.downloadDesktopApp}}‎</button>
</div>
</div>
</div>
</div>
Legend
Html element with directive