| /******************************************************************************** |
| * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| ********************************************************************************/ |
| |
| |
| import {Component, OnInit} from '@angular/core'; |
| import {Router} from '@angular/router'; |
| |
| import { TRANSLATE } from '../core/mdm-core.module'; |
| import { PreferenceService, Preference } from '../core/preference.service'; |
| |
| @Component({ |
| selector: 'preference-module', |
| templateUrl: 'preference-module.component.html', |
| providers: [] |
| }) |
| export class PreferenceModuleComponent implements OnInit { |
| |
| preferences: Preference[]; |
| scope: string; |
| sub: any; |
| |
| links = [ |
| { name: TRANSLATE('administration.admin-modules.system'), path: 'system'}, |
| { name: TRANSLATE('administration.admin-modules.source'), path: 'source'}, |
| { name: TRANSLATE('administration.admin-modules.user'), path: 'user'} |
| ]; |
| constructor(private router: Router, |
| private preferenceService: PreferenceService) { } |
| |
| ngOnInit() { |
| this.onScopeChange('system'); |
| } |
| |
| onScopeChange(path: string) { |
| this.scope = path.toUpperCase(); |
| if (this.scope !== undefined) { |
| this.preferenceService.getPreferenceForScope(this.scope) |
| .subscribe(pref => this.preferences = pref); |
| } |
| } |
| } |