|
|
@ -1,6 +1,6 @@
|
|
|
|
import { Component, OnInit } from "@angular/core";
|
|
|
|
import { Component, OnInit } from "@angular/core";
|
|
|
|
|
|
|
|
|
|
|
|
import { ICustomizationSettings, IThemes } from "../../interfaces";
|
|
|
|
import { ICustomizationSettings } from "../../interfaces";
|
|
|
|
import { NotificationService } from "../../services";
|
|
|
|
import { NotificationService } from "../../services";
|
|
|
|
import { SettingsService } from "../../services";
|
|
|
|
import { SettingsService } from "../../services";
|
|
|
|
|
|
|
|
|
|
|
@ -10,7 +10,6 @@ import { SettingsService } from "../../services";
|
|
|
|
export class CustomizationComponent implements OnInit {
|
|
|
|
export class CustomizationComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
public settings: ICustomizationSettings;
|
|
|
|
public settings: ICustomizationSettings;
|
|
|
|
public themes: IThemes[];
|
|
|
|
|
|
|
|
public advanced: boolean;
|
|
|
|
public advanced: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
|
|
|
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
|
|
@ -18,26 +17,6 @@ export class CustomizationComponent implements OnInit {
|
|
|
|
public ngOnInit() {
|
|
|
|
public ngOnInit() {
|
|
|
|
this.settingsService.getCustomization().subscribe(x => {
|
|
|
|
this.settingsService.getCustomization().subscribe(x => {
|
|
|
|
this.settings = x;
|
|
|
|
this.settings = x;
|
|
|
|
this.settingsService.getThemes().subscribe(t => {
|
|
|
|
|
|
|
|
this.themes = t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const existingTheme = this.themes.filter((item) => {
|
|
|
|
|
|
|
|
return item.fullName === this.settings.presetThemeName;
|
|
|
|
|
|
|
|
})[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (existingTheme) {
|
|
|
|
|
|
|
|
const index = this.themes.indexOf(existingTheme, 0);
|
|
|
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
|
|
|
this.themes.splice(index, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x.hasPresetTheme) {
|
|
|
|
|
|
|
|
this.themes.unshift({displayName: x.presetThemeDisplayName, fullName: x.presetThemeName, url: existingTheme.url, version: x.presetThemeVersion});
|
|
|
|
|
|
|
|
this.themes.unshift({displayName: "None", fullName: "None", url: "", version: ""});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.themes.unshift({displayName: "Please Select", fullName: "-1", url: "-1", version: ""});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -62,26 +41,4 @@ export class CustomizationComponent implements OnInit {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public dropDownChange(event: any): void {
|
|
|
|
|
|
|
|
const selectedThemeFullName = <string> event.target.value;
|
|
|
|
|
|
|
|
const selectedTheme = this.themes.filter((val) => {
|
|
|
|
|
|
|
|
return val.fullName === selectedThemeFullName;
|
|
|
|
|
|
|
|
})[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedTheme.fullName === this.settings.presetThemeName) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedTheme.fullName === "None" || selectedTheme.fullName === "-1") {
|
|
|
|
|
|
|
|
this.settings.presetThemeName = "";
|
|
|
|
|
|
|
|
this.settings.presetThemeContent = "";
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.settings.presetThemeName = selectedThemeFullName;
|
|
|
|
|
|
|
|
this.settingsService.getThemeContent(selectedTheme.url).subscribe(x => {
|
|
|
|
|
|
|
|
this.settings.presetThemeContent = x;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|