Skip to content

Commit 3f5ae70

Browse files
Merge stable to master
2 parents b8df7c1 + 1b53f23 commit 3f5ae70

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.12.1
2+
3+
### Hot fix:
4+
* Subscriptions not loading if not cached [\#1027](https://github.com/Azure/BatchLabs/issues/1027)
5+
16
# 0.12.0
27
[All items](https://github.com/Azure/BatchLabs/milestone/14?closed=1)
38

app/services/adal/adal.service.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as moment from "moment";
22

33
import { AdalService } from "app/services/adal";
44
import { AccessToken } from "client/core/aad/access-token/access-token.model";
5+
import { Observable } from "rxjs";
56
import { F } from "test/utils";
67

78
const tenant1 = "tenant-1";
@@ -18,10 +19,13 @@ const token1 = new AccessToken({
1819

1920
describe("AdalService spec", () => {
2021
let service: AdalService;
21-
const aadServiceSpy = {};
22+
let aadServiceSpy;
2223
let remoteSpy;
2324

2425
beforeEach(() => {
26+
aadServiceSpy = {
27+
tenantsIds: Observable.of([]),
28+
};
2529
remoteSpy = {
2630
getBatchLabsApp: () => ({ aadService: aadServiceSpy }),
2731
send: jasmine.createSpy("accessTokenData").and.returnValue(Promise.resolve(token1)),

app/services/adal/adal.service.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from "@angular/core";
2-
import { Observable } from "rxjs";
2+
import { BehaviorSubject, Observable } from "rxjs";
33

44
import { AADService } from "client/core/aad";
55
import { AccessTokenCache } from "client/core/aad/access-token/access-token-cache";
@@ -11,23 +11,27 @@ const defaultResource = Constants.AAD.defaultResource;
1111

1212
@Injectable()
1313
export class AdalService {
14+
public tenantsIds: Observable<string[]>;
15+
1416
private aadService: AADService;
1517
private tokenCache = new AccessTokenCache();
1618
private _waitingPromises: StringMap<Promise<AccessToken>> = {};
19+
private _tenantsIds = new BehaviorSubject<string[]>([]);
1720

1821
constructor(private remote: ElectronRemote) {
1922
this.aadService = remote.getBatchLabsApp().aadService;
23+
// Need to do this as aadService.tenantIds is in the node processs and electron lose information in the transfer
24+
this.aadService.tenantsIds.subscribe((val) => {
25+
this._tenantsIds.next(val);
26+
});
27+
this.tenantsIds = this._tenantsIds.asObservable();
2028
}
2129

2230
public logout() {
2331
this.aadService.logout();
2432
this._waitingPromises = {};
2533
}
2634

27-
public get tenantsIds() {
28-
return this.aadService.tenantsIds;
29-
}
30-
3135
public get currentUser() {
3236
return this.aadService.currentUser;
3337
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "Microsoft Corporation",
1010
"email": "tiguerin@microsoft.com"
1111
},
12-
"version": "0.12.0",
12+
"version": "0.12.1",
1313
"main": "build/client/main.prod.js",
1414
"scripts": {
1515
"ts": "ts-node --project tsconfig.node.json",

0 commit comments

Comments
 (0)