Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add info trial license #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 11 additions & 0 deletions src/app/app.page/app.definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/app/app.page/app.page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

<div class="col-lg-12 col-sm-12">

<div *ngIf="!isEnterpriseEdition" class="isEnterprise text-center"><label>Get <a target="_blank"
href="https://antmedia.io/#contact">Enterprise Edition</a> for Ultra Low Latency
Streaming</label></div>
<div *ngIf="!isEnterpriseEdition || licenseText" class="isEnterprise text-center" [innerHTML]="licenseText" ></div> <!--licenseText.lenght>0-->

</div>

Expand Down
21 changes: 19 additions & 2 deletions src/app/app.page/app.page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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 = <Licence>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 = "<label>Your Enterprise Edition trial expires in "+daysDiff+" days. Now is a good time to upgrade and get all the awesome benefits. <a target=\"_blank\" href=\"https://antmedia.io/#product\">Buy now</label>";
}
}, error => { show403Error(error); });
}
else{
this.licenseText = "<label>Get <a target=\"_blank\" href=\"https://antmedia.io/#contact\">Enterprise Edition</a> for Ultra Low Latency Streaming</label>";
}
}, error => { show403Error(error); });

if (scope == "system") {
Expand Down
3 changes: 1 addition & 2 deletions src/app/dashboard/overview/overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/app/rest/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
11 changes: 1 addition & 10 deletions src/app/server.settings/server.settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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',
Expand Down