1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/settings/other/other.settings.component.ts

49 lines
1.7 KiB
TypeScript
Raw Normal View History

2017-07-15 23:29:40 +08:00
import {Component, OnChanges} from "@angular/core";
2017-07-15 22:31:43 +08:00
import {SettingsComponent} from "../_abstract/abstract.settings.component";
import {AuthenticationService} from "../../model/network/authentication.service";
import {NavigationService} from "../../model/navigation.service";
import {NotificationService} from "../../model/notification.service";
import {OtherSettingsService} from "./other.settings.service";
import {OtherConfigDTO} from "../../../../common/entities/settings/OtherConfigDTO";
2018-03-30 08:30:23 +08:00
import {I18n} from "@ngx-translate/i18n-polyfill";
2017-07-15 22:31:43 +08:00
@Component({
selector: 'settings-other',
templateUrl: './other.settings.component.html',
styleUrls: ['./other.settings.component.css',
'./../_abstract/abstract.settings.component.css'],
providers: [OtherSettingsService],
})
2017-07-15 23:29:40 +08:00
export class OtherSettingsComponent extends SettingsComponent<OtherConfigDTO> implements OnChanges {
2017-07-15 22:31:43 +08:00
constructor(_authService: AuthenticationService,
_navigation: NavigationService,
_settingsService: OtherSettingsService,
2018-03-30 08:30:23 +08:00
notification: NotificationService,
i18n: I18n) {
super(i18n("Other"), _authService, _navigation, _settingsService, notification, i18n, s => ({
2017-07-15 23:29:40 +08:00
enableThreading: s.Server.enableThreading,
enableOnScrollThumbnailPrioritising: s.Client.enableOnScrollThumbnailPrioritising,
enableOnScrollRendering: s.Client.enableOnScrollRendering,
enableCache: s.Client.enableCache
}));
}
ngOnChanges(): void {
this.hasAvailableSettings = !this.simplifiedMode;
2017-07-15 22:31:43 +08:00
}
public async save(): Promise<boolean> {
const val = await super.save();
if (val == true) {
2018-03-30 08:30:23 +08:00
this.notification.info(this.i18n('Restart the server to apply the new settings'), this.i18n("Info"));
2017-07-15 22:31:43 +08:00
}
return val;
}
}