Skip to content

Commit

Permalink
Fix: Various national cloud issues(Multi window, caching, persiting l…
Browse files Browse the repository at this point in the history
…ogin) (#1571)
  • Loading branch information
timotheeguerin authored Aug 29, 2018
1 parent b90310d commit d0b1406
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* Cannot upload files to file group in govt cloud [\#1557](https://github.com/Azure/BatchExplorer/issues/1557)
* Cannot login to GOVT cloud [\#1548](https://github.com/Azure/BatchExplorer/issues/1548)
* Pricing broken, due to api breaking change [\#1562](https://github.com/Azure/BatchExplorer/issues/1562)
* Opening BatchExplorer in Govt cloud opens 2 application windows [\#1561](https://github.com/Azure/BatchExplorer/issues/1561)
* Not persisting the last login and the last selected cloud [\#1542](https://github.com/Azure/BatchExplorer/issues/1542)
* Caching issue on national clouds [\#1559](https://github.com/Azure/BatchExplorer/issues/1559)

# 0.17.1
[All items](https://github.com/Azure/BatchExplorer/milestone/25?closed=1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class DownloadFolderComponent {
}

private get _defaultDownloadFolder() {
return path.join(this.fs.commonFolders.downloads, "batch-labs");
return path.join(this.fs.commonFolders.downloads, "batch-explorer");
}

private _getSubdirectoryPath(filePath: string) {
Expand Down
3 changes: 2 additions & 1 deletion app/services/azure-batch/core/batch-http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class AzureBatchHttpService extends HttpService {
}

options.headers = (options.headers as any)
.set("Content-Type", "application/json; odata=minimalmetadata; charset=utf-8");
.set("Content-Type", "application/json; odata=minimalmetadata; charset=utf-8")
.set("Cache-Control", "no-cache");

return options;
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "batch-labs",
"name": "batch-explorer",
"productName": "Batch Explorer",
"description": "Batch Explorer is a tool to manage your Azure Batch accounts",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/client/core/batch-explorer-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ export class BatchExplorerApplication {
*/
public async updateAzureEnvironment(env: AzureEnvironment) {
await this.aadService.logout();
this.localStorage.setItem(Constants.localStorageKey.azureEnvironment, env.id);
this.windows.closeAll();
await this.localStorage.setItem(Constants.localStorageKey.azureEnvironment, env.id);
this._azureEnvironment.next(env);
await this.aadService.login();
this.windows.openNewWindow();
Expand Down
6 changes: 5 additions & 1 deletion src/client/core/local-data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class LocalDataStore extends InMemoryDataStore implements DataStore {
}

private async _save(): Promise<void> {
await this.localFileStorage.set(fileKey, this._data);
const obj = {};
for (const [key, value] of this._data.entries()) {
obj[key] = value;
}
await this.localFileStorage.set(fileKey, obj);
}
}
14 changes: 11 additions & 3 deletions src/client/core/unique-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export abstract class GenericWindow {
* @param focus If we should focus on the window if it is already visible. @default false
*/
public show(focus: boolean = false) {
if (!this._window) {
this.create();
}
if (focus || !this._window.isVisible()) {
this._window.show();
}
Expand Down Expand Up @@ -101,4 +98,15 @@ export abstract class UniqueWindow extends GenericWindow {
this.batchExplorerApp.quit();
});
}

/**
* Display the window only if not already visible
* @param focus If we should focus on the window if it is already visible. @default false
*/
public show(focus: boolean = false) {
if (!this._window) {
this.create();
}
super.show(focus);
}
}
2 changes: 1 addition & 1 deletion src/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "./init";

// 2. Update electron user data folder
import { app } from "electron";
app.setPath("userData", path.join(app.getPath("appData"), "batch-labs"));
app.setPath("userData", path.join(app.getPath("appData"), "BatchExplorer"));

// 3. Initialize the logger
import { initLogger } from "client/logger";
Expand Down

0 comments on commit d0b1406

Please sign in to comment.