2018-03-31 03:30:30 +08:00
|
|
|
import {Component, OnChanges} from '@angular/core';
|
|
|
|
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';
|
|
|
|
import {I18n} from '@ngx-translate/i18n-polyfill';
|
2018-05-29 02:03:12 +08:00
|
|
|
import {Utils} from '../../../../common/Utils';
|
|
|
|
import {SortingMethods} from '../../../../common/entities/SortingMethods';
|
2017-07-15 22:31:43 +08:00
|
|
|
|
|
|
|
@Component({
|
2018-05-04 07:17:08 +08:00
|
|
|
selector: 'app-settings-other',
|
2017-07-15 22:31:43 +08:00
|
|
|
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
|
|
|
|
2018-05-29 02:03:12 +08:00
|
|
|
|
|
|
|
types: { key: number; value: string }[] = [];
|
2018-11-02 23:24:37 +08:00
|
|
|
threads: number[] = Utils.createRange(1, 100);
|
2018-05-29 02:03:12 +08:00
|
|
|
|
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) {
|
2018-03-31 03:30:30 +08:00
|
|
|
super(i18n('Other'), _authService, _navigation, _settingsService, notification, i18n, s => ({
|
2018-11-02 23:24:37 +08:00
|
|
|
Server: s.Server.threading,
|
|
|
|
Client: s.Client.Other
|
2017-07-15 23:29:40 +08:00
|
|
|
}));
|
2018-05-29 02:03:12 +08:00
|
|
|
this.types = Utils.enumToArray(SortingMethods);
|
|
|
|
this.hasAvailableSettings = !this.simplifiedMode;
|
2017-07-15 23:29:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnChanges(): void {
|
|
|
|
this.hasAvailableSettings = !this.simplifiedMode;
|
2017-07-15 22:31:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async save(): Promise<boolean> {
|
|
|
|
const val = await super.save();
|
2018-05-04 07:17:08 +08:00
|
|
|
if (val === true) {
|
2017-07-15 22:31:43 +08:00
|
|
|
|
2018-03-31 03:30:30 +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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|