Skip to content

Commit

Permalink
Merge pull request #49 from advanced-rest-client/release/12.1.0
Browse files Browse the repository at this point in the history
Release/12.1.0
  • Loading branch information
jarrodek authored Feb 12, 2018
2 parents c41f3d9 + ed8a58f commit 3b2016b
Show file tree
Hide file tree
Showing 20 changed files with 250 additions and 169 deletions.
6 changes: 3 additions & 3 deletions appresources/themes/default-theme/default-theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@
margin-top: 24px;
};

--code-type-text-value-color: #0d47a1;
--code-type-text-value-color: #283593;
--code-type-number-value-color: #03a9f4;
--code-type-boolean-value-color: #0288d1;
--code-type-null-value-color: #0288d1;
--code-punctuation-value-color: #757575;
--code-type-link-color: #757575;
--code-array-index-color: rgba(1, 87, 155, 0.57);
--code-type-link-color: #424242;
--code-array-index-color: #558B2F;
--code-background-color: #F4F5F6;

--paper-checkbox-label: {
Expand Down
5 changes: 3 additions & 2 deletions components/anypoint/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"network-state": "advanced-rest-client/network-state#^0.1.1",
"arc-loader-screen": "advanced-rest-client/arc-loader-screen#^0.1.1",
"response-view": "advanced-rest-client/response-view#^0.1.10",
"request-panel": "advanced-rest-client/request-panel#^0.2.2",
"request-panel": "advanced-rest-client/request-panel#^0.4.0",
"request-saver": "advanced-rest-client/request-saver#^0.1.0",
"variables-manager": "advanced-rest-client/variables-manager#^0.1.8",
"variables-evaluator": "advanced-rest-client/variables-evaluator#^0.1.14",
Expand Down Expand Up @@ -108,7 +108,8 @@
"paper-dropdown-menu": "mulesoft/paper-dropdown-menu#^1.5.3",
"iron-validatable-behavior": "advanced-rest-client/iron-validatable-behavior#^1.9.0",
"iron-validator-behavior": "advanced-rest-client/iron-validator-behavior#^1.9.0",
"raml-path-selector": "advanced-rest-client/raml-path-selector#anypoint"
"raml-path-selector": "advanced-rest-client/raml-path-selector#anypoint",
"request-hooks-logic": "advanced-rest-client/request-hooks-logic#^0.1.1"
},
"devDependencies": {
"web-component-tester": "*",
Expand Down
1 change: 1 addition & 0 deletions components/anypoint/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@
<link rel="import" href="bower_components/headers-parser-behavior/headers-parser-behavior.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="bower_components/paper-tabs/paper-tab.html">
<link rel="import" href="bower_components/request-hooks-logic/request-hooks-logic.html">
5 changes: 3 additions & 2 deletions components/default/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"network-state": "advanced-rest-client/network-state#^0.1.1",
"arc-loader-screen": "advanced-rest-client/arc-loader-screen#^0.1.1",
"response-view": "advanced-rest-client/response-view#^0.1.10",
"request-panel": "advanced-rest-client/request-panel#^0.2.2",
"request-panel": "advanced-rest-client/request-panel#^0.4.0",
"request-saver": "advanced-rest-client/request-saver#^0.1.0",
"variables-manager": "advanced-rest-client/variables-manager#^0.1.8",
"variables-evaluator": "advanced-rest-client/variables-evaluator#^0.1.14",
Expand Down Expand Up @@ -103,7 +103,8 @@
"anypoint-styles": "advanced-rest-client/anypoint-styles#^0.1.9",
"themes-panel": "advanced-rest-client/themes-panel#^0.1.1",
"polymer-styles-analyzer": "advanced-rest-client/polymer-styles-analyzer#^0.1.5",
"polymer-styles-editor": "advanced-rest-client/polymer-styles-editor#^0.1.1"
"polymer-styles-editor": "advanced-rest-client/polymer-styles-editor#^0.1.1",
"request-hooks-logic": "advanced-rest-client/request-hooks-logic#^0.1.1"
},
"devDependencies": {
"web-component-tester": "*",
Expand Down
1 change: 1 addition & 0 deletions components/default/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@
<link rel="import" href="bower_components/headers-parser-behavior/headers-parser-behavior.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="bower_components/paper-tabs/paper-tab.html">
<link rel="import" href="bower_components/request-hooks-logic/request-hooks-logic.html">
5 changes: 5 additions & 0 deletions dev-changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
8-02-2018 - Fixed issues with OAuth2 authorization for Google Drive.
9-02-2018 - Added support for Request actions
11-02-2018 - Added enable / disable option to the URL query parameters
11-02-2018 - Added authorization panel to the request editor.
11-02-2018 - Changed colors for JSON viewer to make it more readable.
Binary file added docs/images/request-actions-editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/request-condition-editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 10 additions & 138 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {ipcMain, dialog, app, BrowserWindow} = require('electron');
const {ipcMain, app} = require('electron');
const {ArcWindowsManager} = require('./scripts/main/windows-manager');
const {UpdateStatus} = require('./scripts/main/update-status');
const {ArcMainMenu} = require('./scripts/main/main-menu');
Expand All @@ -9,6 +9,7 @@ const {AppOptions} = require('./scripts/main/app-options');
const {RemoteApi} = require('./scripts/main/remote-api');
const {AppDefaults} = require('./scripts/main/app-defaults');
const {ContentSearchService} = require('./scripts/main/search-service');
const {AppPrompts} = require('./scripts/main/app-prompts.js');
const log = require('electron-log');

/**
Expand All @@ -23,6 +24,8 @@ class Arc {
this.us = new UpdateStatus(this.wm, this.menu);
this.sm = new SessionManager(this.wm);
this.remote = new RemoteApi(this.wm);
this.prompts = new AppPrompts();
this.gdrive = new DriveExport();
this._listenMenu(this.menu);
}

Expand Down Expand Up @@ -70,6 +73,11 @@ class Arc {
})
.then(() => {
log.info('Application is now ready');
ArcIdentity.listen();
this.wm.listen();
this.prompts.listen();
this.us.listen();
this.gdrive.listen();
this.wm.open();
if (!this.isDebug()) {
this.us.start();
Expand Down Expand Up @@ -189,147 +197,11 @@ if (process.env.NODE_ENV === 'test') {
if (arcApp.isDebug()) {
global.arcApp = arcApp;
}

// TODO: // move this to seperate file that is responsible for IPC
ipcMain.on('save-dialog', function(event, args) {
args = args || {};
const options = {
title: 'Save to file'
};
if (args.file) {
options.defaultPath = args.file;
}
dialog.showSaveDialog(options, function(filename) {
event.sender.send('saved-file', filename);
});
});

ipcMain.on('new-window', function() {
arcApp.wm.open();
});

ipcMain.on('toggle-devtools', (event) => {
event.sender.webContents.toggleDevTools();
});

ipcMain.on('oauth-2-get-token', (event, options) => {
ArcIdentity.getAuthToken(options)
.then((token) => {
event.sender.send('oauth-2-token-ready', token);
})
.catch((cause) => {
event.sender.send('oauth-2-token-error', cause);
});
});
ipcMain.on('oauth-2-launch-web-flow', (event, options, id) => {
ArcIdentity.launchWebAuthFlow(options)
.then((token) => {
event.sender.send('oauth-2-token-ready', token, id);
})
.catch((cause) => {
event.sender.send('oauth-2-token-error', cause, id);
});
});
ipcMain.on('check-for-update', () => {
arcApp.us.check({
notify: false
});
});
ipcMain.on('install-update', () => {
arcApp.us.installUpdate();
});

ipcMain.on('google-drive-data-save', (event, requestId,
content, type, fileName) => {
let config = {
resource: {
name: fileName,
description: 'Advanced REST client data export file.'
},
media: {
mimeType: type || 'application/json',
body: content
}
};
const drive = new DriveExport();
drive.create(config)
.then((result) => {
event.sender.send('google-drive-data-save-result', requestId, result);
})
.catch((cause) => {
event.sender.send('google-drive-data-save-error', requestId, cause);
});
});

ipcMain.on('drive-request-save', (event, requestId, request, fileName) => {
let driveId;
if (request.driveId) {
driveId = request.driveId;
delete request.driveId;
}
let config = {
resource: {
name: fileName + '.arc',
},
media: {
mimeType: 'application/json',
body: request
}
};
const drive = new DriveExport();
let promise;
if (driveId) {
promise = drive.update(driveId, config);
} else {
config.resource.description = request.description ||
'Advanced REST client export file.';
promise = drive.create(config);
}

promise
.then((result) => {
event.sender.send('drive-request-save-result', requestId, result);
})
.catch((cause) => {
let result = {
message: cause.message || 'Unknown Goodle Drive save error',
stack: cause.stack || ''
};
event.sender.send('drive-request-save-error', requestId, result);
});
});

ipcMain.on('open-web-url', (event, url, purpose) => {
switch (purpose) {
case 'web-session': arcApp.sm.openWebBrowser(url); break;
}
});

ipcMain.on('cookies-session', (event, data) => {
arcApp.sm.handleRequest(event.sender, data);
});

// Dev...
ipcMain.on('open-theme-editor', (event, data) => {
log.info('Starting theme editor');
const windowId = event.sender.id;
const {ThemesEditor} = require('./scripts/main/themes-editor.js');
const editor = new ThemesEditor(windowId, data);
editor.run();
});

ipcMain.on('reload-app-required', (event, message) => {
message = message || 'To complete the action reload the application.';
const win = BrowserWindow.fromWebContents(event.sender);
dialog.showMessageBox(win, {
type: 'info',
buttons: ['Reload', 'Later'],
defaultId: 0,
cancelId: 1,
title: 'Reload Advanced REST Client?',
message: message,
}, (response) => {
if (response === 0) {
arcApp.wm.reloadWindows();
}
});
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "advanced-rest-client",
"description": "The Advanced REST Client desktop application.",
"version": "12.0.1",
"version": "12.1.0",
"homepage": "https://advancedrestclient.com/",
"license": "LICENSE.md",
"author": {
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"build": {
"appId": "com.mulesoft.arc",
"productName": "arc",
"productName": "AdvancedRestClient",
"artifactName": "arc-${version}-${arch}.${ext}",
"asar": true,
"copyright": "Copyright © 2018 Mulesoft",
Expand Down
21 changes: 21 additions & 0 deletions scripts/main/app-prompts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const {dialog, ipcMain} = require('electron');

class AppPrompts {
listen() {
ipcMain.on('save-dialog', this._saveDialogHandler.bind(this));
}

_saveDialogHandler(event, args) {
args = args || {};
const options = {
title: 'Save to file'
};
if (args.file) {
options.defaultPath = args.file;
}
dialog.showSaveDialog(options, function(filename) {
event.sender.send('saved-file', filename);
});
}
}
exports.AppPrompts = AppPrompts;
Loading

0 comments on commit 3b2016b

Please sign in to comment.