2018-03-31 03:30:30 +08:00
|
|
|
import {Component} 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 {BasicSettingsService} from './basic.settings.service';
|
|
|
|
import {BasicConfigDTO} from '../../../../common/entities/settings/BasicConfigDTO';
|
|
|
|
import {I18n} from '@ngx-translate/i18n-polyfill';
|
2017-07-15 22:09:48 +08:00
|
|
|
|
|
|
|
@Component({
|
2018-05-04 07:17:08 +08:00
|
|
|
selector: 'app-settings-basic',
|
2017-07-15 22:09:48 +08:00
|
|
|
templateUrl: './basic.settings.component.html',
|
|
|
|
styleUrls: ['./basic.settings.component.css',
|
|
|
|
'./../_abstract/abstract.settings.component.css'],
|
|
|
|
providers: [BasicSettingsService],
|
|
|
|
})
|
|
|
|
export class BasicSettingsComponent extends SettingsComponent<BasicConfigDTO> {
|
|
|
|
|
|
|
|
urlPlaceholder = location.origin;
|
|
|
|
|
|
|
|
constructor(_authService: AuthenticationService,
|
|
|
|
_navigation: NavigationService,
|
|
|
|
_settingsService: BasicSettingsService,
|
2018-03-30 08:30:23 +08:00
|
|
|
notification: NotificationService,
|
|
|
|
i18n: I18n) {
|
2018-03-31 03:30:30 +08:00
|
|
|
super(i18n('Basic'), _authService, _navigation, _settingsService, notification, i18n, s => ({
|
2017-07-15 23:29:40 +08:00
|
|
|
port: s.Server.port,
|
|
|
|
imagesFolder: s.Server.imagesFolder,
|
|
|
|
applicationTitle: s.Client.applicationTitle,
|
2018-05-13 00:19:51 +08:00
|
|
|
publicUrl: s.Client.publicUrl,
|
|
|
|
urlBase: s.Client.urlBase
|
2017-07-15 23:29:40 +08:00
|
|
|
}));
|
2017-07-15 22:09:48 +08:00
|
|
|
}
|
|
|
|
|
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) {
|
2018-05-14 04:59:57 +08:00
|
|
|
this.notification.info(this.i18n('Restart the server to apply the new settings'));
|
2017-07-15 22:31:43 +08:00
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-07-15 22:09:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|