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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import {Component, OnInit} from '@angular/core';
import {AppService, HttpService, LocalStorageService} from '@app/services';
import {connectEvt} from '@app/globals';
import {ConnectEvt} from '@app/model';
// import {DataStore} from '@app/globals';
// import * as jQuery from 'jquery/dist/jquery.min.js';
import {View, ViewAction} from '@app/model';
@Component({
selector: 'pages-connect',
templateUrl: './connect.component.html',
styleUrls: ['./connect.component.scss']
})
export class PagesConnectComponent implements OnInit {
token: string;
system: string;
view: View;
constructor(private _appService: AppService,
private _http: HttpService,
private _localStorage: LocalStorageService) {
}
onNewView(view) {
view.active = true;
this.view = view;
}
ngOnInit() {
this.system = this._appService.getQueryString('system');
this.token = this._appService.getQueryString('token');
const assetId = this._appService.getQueryString('asset');
const remoteAppId = this._appService.getQueryString('remote_app');
if (assetId) {
this._http.filterMyGrantedAssetsById(assetId).subscribe(
nodes => {
if (!nodes) {
return;
}
const evt = new ConnectEvt(nodes[0], 'asset');
connectEvt.next(evt);
}
);
}
if (remoteAppId) {
this._http.getMyGrantedRemoteApps(remoteAppId).subscribe(
nodes => {
if (!nodes) {
return;
}
const evt = new ConnectEvt(nodes[0], 'asset');
connectEvt.next(evt);
}
);
}
}
}