diff --git a/package.json b/package.json index ec7af640..34d584bf 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "postinstall": "node patch.js", "ng": "ng", "start": "ng serve", - "build": "ng build", + "build": "ng build --prod", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" diff --git a/src/app/app.page/app.definitions.ts b/src/app/app.page/app.definitions.ts index c2cc78f3..116f9251 100644 --- a/src/app/app.page/app.definitions.ts +++ b/src/app/app.page/app.definitions.ts @@ -177,6 +177,17 @@ export class ServerSettings { ) {} } + +export declare class Licence { + licenceId: string; + startDate: number; + endDate: number; + type: string; + licenceCount: string; + owner: string; + status: string; +} + export class AppSettings { constructor(public mp4MuxingEnabled: boolean, diff --git a/src/app/app.page/app.page.component.html b/src/app/app.page/app.page.component.html index 67e38826..7173d5fa 100644 --- a/src/app/app.page/app.page.component.html +++ b/src/app/app.page/app.page.component.html @@ -4,9 +4,7 @@
-
+
diff --git a/src/app/app.page/app.page.component.ts b/src/app/app.page/app.page.component.ts index 9dd8fe75..b6631d4f 100644 --- a/src/app/app.page/app.page.component.ts +++ b/src/app/app.page/app.page.component.ts @@ -22,7 +22,7 @@ import { MatPaginator, MatPaginatorIntl, PageEvent } from "@angular/material/pag import { MatTableDataSource } from "@angular/material/table" import { MatSort } from "@angular/material/sort" import "rxjs/add/operator/toPromise"; -import { AppSettings, ServerSettings } from "./app.definitions"; +import { AppSettings, ServerSettings, Licence } from "./app.definitions"; import { SelectionModel } from "@angular/cdk/collections"; import { @@ -57,7 +57,6 @@ declare var Chartist: any; declare var swal: any; declare var classie: any; - const ERROR_SOCIAL_ENDPOINT_UNDEFINED_CLIENT_ID = -1; const ERROR_SOCIAL_ENDPOINT_UNDEFINED_ENDPOINT = -2; @@ -188,6 +187,8 @@ export class AppPageComponent implements OnInit, OnDestroy, AfterViewInit { public clusterNodes: ClusterNode[]; public user: User; public currentClusterNode: string; + public currentLicence : Licence; + public licenseText:string; public appSettings: AppSettings; // = new AppSettings(false, true, true, 5, 2, "event", "no clientid", "no fb secret", "no youtube cid", "no youtube secre", "no pers cid", "no pers sec"); @@ -443,6 +444,22 @@ export class AppPageComponent implements OnInit, OnDestroy, AfterViewInit { this.getSettings(); this.restService.isEnterpriseEdition().subscribe(data => { this.isEnterpriseEdition = data["success"]; + if(this.isEnterpriseEdition){ + this.restService.getLastLicenseStatus().subscribe(data => { + this.currentLicence = data; + const currentDate = new Date(); + const licenseDate = new Date(this.currentLicence.endDate); + + const daysDiff:number = Math.floor(Math.abs(Number(licenseDate) - Number(currentDate)) / (1000*60*60*24)); + + if(this.currentLicence.type == "trial" && daysDiff < 7){ + this.licenseText = ""; + } + }, error => { show403Error(error); }); + } + else{ + this.licenseText = "Enterprise Edition for Ultra Low Latency Streaming"; + } }, error => { show403Error(error); }); if (scope == "system") { diff --git a/src/app/dashboard/overview/overview.component.ts b/src/app/dashboard/overview/overview.component.ts index bb2f190f..0fa4504f 100644 --- a/src/app/dashboard/overview/overview.component.ts +++ b/src/app/dashboard/overview/overview.component.ts @@ -4,10 +4,9 @@ import {SupportRestService} from '../../rest/support.service'; import {Router} from '@angular/router'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; -import {Licence} from "../../server.settings/server.settings.component"; import {AuthService, show403Error} from "../../rest/auth.service"; import {SupportRequest} from "../../support/support.definitions"; -import {ServerSettings} from "../../app.page/app.definitions"; +import {ServerSettings,Licence} from "../../app.page/app.definitions"; import {Locale} from "../../locale/locale"; declare var $: any; diff --git a/src/app/rest/auth.service.ts b/src/app/rest/auth.service.ts index 000a4d60..5c881e9e 100644 --- a/src/app/rest/auth.service.ts +++ b/src/app/rest/auth.service.ts @@ -2,8 +2,7 @@ import {Injectable} from '@angular/core'; import {Observable} from 'rxjs'; import {CanActivate, Router} from '@angular/router'; import {RestService, User} from './rest.service'; -import {Licence} from "../server.settings/server.settings.component"; -import {ServerSettings} from "../app.page/app.definitions"; +import {ServerSettings,Licence} from "../app.page/app.definitions"; import {DatePipe} from '@angular/common'; import { LOCAL_STORAGE_SCOPE_KEY } from 'app/pages/login/login.component'; diff --git a/src/app/server.settings/server.settings.component.ts b/src/app/server.settings/server.settings.component.ts index 33dbd6fa..c8986272 100644 --- a/src/app/server.settings/server.settings.component.ts +++ b/src/app/server.settings/server.settings.component.ts @@ -7,7 +7,7 @@ import {MatDialog } from '@angular/material/dialog'; import {AfterViewInit, Component, Injectable, OnInit, OnDestroy, ChangeDetectorRef, ViewChild, Input, Output} from '@angular/core'; -import {ServerSettings, UserInfoTable, UserInf} from "../app.page/app.definitions"; +import {ServerSettings, UserInfoTable, UserInf, Licence} from "../app.page/app.definitions"; import {Locale} from "../locale/locale"; import {AuthService, show403Error} from "../rest/auth.service"; import {RestService, User} from "../rest/rest.service"; @@ -27,15 +27,6 @@ import 'rxjs/add/operator/catch'; declare var $:any; declare var swal: any; -export class Licence { - licenceId: string; - startDate: number; - endDate: number; - type: string; - licenceCount: string; - owner: string; - status: string;} - @Component({ moduleId: module.id, selector: 'server.settings',