summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/shared-service.ts
blob: 47128130c7a62399106c657b69bad5b83546036d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Injectable } from '@angular/core';

import { Observable, of, BehaviorSubject } from 'rxjs';

@Injectable({
    providedIn: 'root'
})
export class SharedService {

    // based on edit Mode, edit=false
    mode = new BehaviorSubject(false);
    list = new BehaviorSubject('');
    modeState: Observable<boolean>;
    listState: Observable<string>;
    constructor() {
        this.mode = new BehaviorSubject(false);
        this.list = new BehaviorSubject('');
        this.modeState = this.mode.asObservable();
        this.listState = this.list.asObservable();
    }

    isEdit(): Observable<boolean> {
        return this.modeState;
    }
    enableEdit() {
        this.mode.next(true);
    }
    disableEdit() {
        this.mode.next(false);
    }

    // from file from tempplate&mapping list
    deleteFromList(filename) {
        this.list.next(filename);
    }
    listAction(): Observable<string> {
        return this.listState;
    }

}