Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
60 additions
and
60 deletions.
There are no files selected for viewing
120 changes: 60 additions & 60 deletions
120
src/automatica.core/Automatica.WebNew/src/app/pages/license/license.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { LicenseService } from "src/app/services/license.service"; | ||
import { AppService } from "src/app/services/app.service"; | ||
import { TranslationService } from "angular-l10n"; | ||
import { NotifyService } from "src/app/services/notify.service"; | ||
import { BaseComponent } from "src/app/base/base-component"; | ||
import { CustomMenuItem } from "src/app/base/model/custom-menu-item"; | ||
|
||
@Component({ | ||
selector: "app-license", | ||
templateUrl: "./license.component.html", | ||
styleUrls: ["./license.component.scss"] | ||
}) | ||
export class LicenseComponent extends BaseComponent implements OnInit { | ||
|
||
menuItems: CustomMenuItem[] = []; | ||
|
||
menuSave: CustomMenuItem = { | ||
id: "save", | ||
label: "Save", | ||
icon: "fa-save", | ||
items: undefined, | ||
command: (event) => { this.save(); } | ||
} | ||
|
||
|
||
license: string = ""; | ||
constructor(private licenseService: LicenseService, appService: AppService, translate: TranslationService, notify: NotifyService) { | ||
super(notify, translate); | ||
|
||
appService.setAppTitle("LICENESE.NAME"); | ||
|
||
this.menuItems.push(this.menuSave); | ||
this.menuSave.label = translate.translate("COMMON.SAVE"); | ||
} | ||
|
||
async ngOnInit() { | ||
const lic = await this.licenseService.getLicense(); | ||
this.license = lic.License; | ||
} | ||
|
||
|
||
itemClick($event) { | ||
const item: CustomMenuItem = $event.itemData; | ||
|
||
if (item && item.command) { | ||
item.command($event); | ||
} | ||
} | ||
|
||
async save() { | ||
try { | ||
await this.licenseService.saveLicense(this.license); | ||
this.notifyService.notifySuccess("COMMON.SAVED"); | ||
} catch (error) { | ||
this.handleError(error); | ||
} | ||
} | ||
|
||
} | ||
import { Component, OnInit } from "@angular/core"; | ||
import { LicenseService } from "src/app/services/license.service"; | ||
import { AppService } from "src/app/services/app.service"; | ||
import { TranslationService } from "angular-l10n"; | ||
import { NotifyService } from "src/app/services/notify.service"; | ||
import { BaseComponent } from "src/app/base/base-component"; | ||
import { CustomMenuItem } from "src/app/base/model/custom-menu-item"; | ||
|
||
@Component({ | ||
selector: "app-license", | ||
templateUrl: "./license.component.html", | ||
styleUrls: ["./license.component.scss"] | ||
}) | ||
export class LicenseComponent extends BaseComponent implements OnInit { | ||
|
||
menuItems: CustomMenuItem[] = []; | ||
|
||
menuSave: CustomMenuItem = { | ||
id: "save", | ||
label: "Save", | ||
icon: "fa-save", | ||
items: undefined, | ||
command: (event) => { this.save(); } | ||
} | ||
|
||
|
||
license: string = ""; | ||
constructor(private licenseService: LicenseService, appService: AppService, translate: TranslationService, notify: NotifyService) { | ||
super(notify, translate); | ||
|
||
appService.setAppTitle("LICENSE.NAME"); | ||
|
||
this.menuItems.push(this.menuSave); | ||
this.menuSave.label = translate.translate("COMMON.SAVE"); | ||
} | ||
|
||
async ngOnInit() { | ||
const lic = await this.licenseService.getLicense(); | ||
this.license = lic.License; | ||
} | ||
|
||
|
||
itemClick($event) { | ||
const item: CustomMenuItem = $event.itemData; | ||
|
||
if (item && item.command) { | ||
item.command($event); | ||
} | ||
} | ||
|
||
async save() { | ||
try { | ||
await this.licenseService.saveLicense(this.license); | ||
this.notifyService.notifySuccess("COMMON.SAVED"); | ||
} catch (error) { | ||
this.handleError(error); | ||
} | ||
} | ||
|
||
} |