Project

General

Profile

« Previous | Next » 

Revision 57706

[Monitor Dashboard]: Merge create and edit modals. Rename SidebarService to LayoutService and add hasSidebar on it

View differences:

app.component.ts
5 5
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
6 6
import {User} from './openaireLibrary/login/utils/helper.class';
7 7
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
8
import {SideBarService} from "./library/sharedComponents/sidebar/sideBar.service";
9 8
import {StakeholderService} from "./services/stakeholder.service";
10 9
import {Subscriber} from "rxjs";
10
import {LayoutService} from "./library/sharedComponents/sidebar/layout.service";
11 11

  
12 12

  
13 13
@Component({
......
19 19
  user: User;
20 20
  loginCheck: boolean = false;
21 21
  hasSidebar: boolean = false;
22
  hasHeader: boolean = false;
22 23
  private subscriptions: any[] = [];
23 24

  
24 25
  constructor(private  route: ActivatedRoute,
25 26
              private propertiesService: EnvironmentSpecificService,
26 27
              private router: Router,
27 28
              private userManagementService: UserManagementService,
28
              private sidebarService: SideBarService,
29
              private layoutService: LayoutService,
29 30
              private stakeholderService: StakeholderService,
30 31
              private cdr: ChangeDetectorRef) {
31 32
  }
......
46 47
                  this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
47 48
                  this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
48 49
                    this.stakeholderService.setStakeholder(stakeholder);
49
                    console.log(stakeholder);
50
                    this.sidebarService.setOpen(true);
50
                    this.layoutService.setOpen(true);
51 51
                  });
52 52
                }
53 53
              } else {
......
64 64
          console.log(error);
65 65
        });
66 66
      });
67
    this.subscriptions.push(this.sidebarService.hasSidebar.subscribe(hasSidebar => {
67
    this.subscriptions.push(this.layoutService.hasSidebar.subscribe(hasSidebar => {
68 68
      this.hasSidebar = hasSidebar;
69 69
      this.cdr.detectChanges();
70 70
    }));
71
    this.subscriptions.push(this.layoutService.hasHeader.subscribe(hasHeader => {
72
      this.hasHeader = hasHeader;
73
      console.log(this.hasHeader);
74
      this.cdr.detectChanges();
75
    }));
71 76
  }
72 77

  
73 78
  public ngOnDestroy() {
......
79 84
  }
80 85

  
81 86
  public get open() {
82
    return this.sidebarService.open;
87
    return this.layoutService.open;
83 88
  }
84 89

  
85 90
  public toggleOpen(event = null) {
86 91
    if (!event) {
87
      this.sidebarService.setOpen(!this.open);
92
      this.layoutService.setOpen(!this.open);
88 93
    } else if (event && event['value'] === true) {
89
      this.sidebarService.setOpen(false);
94
      this.layoutService.setOpen(false);
90 95
    }
91 96
  }
92 97
}

Also available in: Unified diff