/** * This file is part of Anis Client. * * @copyright Laboratoire d'Astrophysique de Marseille / CNRS * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { Component } from '@angular/core'; import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import { Instance } from 'src/app/metamodel/models'; import * as instanceActions from 'src/app/metamodel/actions/instance.actions'; import * as instanceSelector from 'src/app/metamodel/selectors/instance.selector'; @Component({ selector: 'app-edit-instance', templateUrl: 'edit-instance.component.html' }) export class EditInstanceComponent { public instance: Observable<Instance>; constructor(private store: Store<{ }>) { this.instance = store.select(instanceSelector.selectInstanceByRouteName); } editInstance(instance: Instance) { this.store.dispatch(instanceActions.editInstance({ instance })); } }