Skip to content

Commit f2296cb

Browse files
committed
Merge pull request #14 from ParsePlatform/api-console-always
Enable API Console for all apps as it relies on no optional features
2 parents 4286cda + 35472bc commit f2296cb

File tree

5 files changed

+23
-35
lines changed

5 files changed

+23
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ You can also manage your apps that are hosted on Parse.com from the same dashboa
3737
"appId": "myAppId",
3838
"masterKey": "myMasterKey",
3939
"javascriptKey": "myJavascriptKey",
40-
"appName": "My App"
40+
"appName": "My Parse.Com App"
4141
},
4242
{
4343
"serverURL": "http://localhost:1337/parse",
4444
"appId": "myAppId",
4545
"masterKey": "myMasterKey",
46-
"appName": "My Parse.Com App"
46+
"appName": "My Parse Server App"
4747
}
4848
]
4949
}

dashboard/Dashboard.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class Dashboard extends React.Component {
101101
jobs: false, //jobs still goes through rails
102102
logs: true,
103103
config: true,
104-
apiConsole: false, //api console needs to be modified to use server url of the app
105104
//Other features would be much harder to add, although push console should just need the hiding
106105
//of scheduled push related stuff
107106
pushConsole: false,

dashboard/DashboardView.react.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@ export default class DashboardView extends React.Component {
7070
});
7171
}
7272

73-
if (this.context.currentApp.enabledFeatures.apiConsole) {
74-
coreSubsections.push({
75-
name: 'API Console',
76-
link: '/api_console'
77-
});
78-
}
73+
coreSubsections.push({
74+
name: 'API Console',
75+
link: '/api_console'
76+
});
7977

8078
if (this.context.currentApp.migration) {
8179
coreSubsections.push({

dashboard/Data/ApiConsole/request.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ import Parse from 'parse';
1010
export default function request(app, method, path, body, options) {
1111
let xhr = new XMLHttpRequest();
1212
let promise = new Parse.Promise();
13-
if (path[0] === '/') {
13+
if (path.startsWith('/') && app.serverURL.endsWith('/')) {
1414
path = path.substr(1);
1515
}
16-
let url = location.protocol + '//' + location.host + '/1/' + path;
17-
xhr.open(method, url, true);
16+
if (!path.startsWith('/') && !app.serverURL.endsWith('/')) {
17+
path = '/' + path;
18+
}
19+
xhr.open(method, app.serverURL + path, true);
1820
xhr.setRequestHeader('X-Parse-Application-Id', app.applicationId);
1921
if (options.useMasterKey) {
2022
xhr.setRequestHeader('X-Parse-Master-Key', app.masterKey);
21-
} else {
23+
} else if (app.restKey) {
2224
xhr.setRequestHeader('X-Parse-REST-API-Key', app.restKey);
2325
}
2426
if (options.sessionToken) {

lib/ParseApp.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,37 @@ function setEnablePushSource(setting, enable) {
2323

2424
export default class ParseApp {
2525
constructor({
26-
name,
2726
appName,
2827
created_at,
29-
key,
30-
applicationId,
28+
clientKey,
3129
appId,
32-
friendly_id,
3330
appNameForURL,
3431
dashboardURL,
35-
secret,
36-
clientKey,
37-
javascript_key,
3832
javascriptKey,
39-
push_key,
4033
masterKey,
41-
rest_api_key,
4234
restKey,
43-
windows_key,
4435
windowsKey,
45-
webhook_key,
4636
webhookKey,
47-
api_key,
4837
apiKey,
4938
serverURL,
5039
enabledFeatures,
5140
...params,
5241
}) {
53-
this.name = name || appName;
42+
this.name = appName;
5443
this.createdAt = created_at ? new Date(created_at) : new Date();
55-
this.applicationId = appId || key || applicationId;
56-
this.slug = friendly_id || appNameForURL || appName;
44+
this.applicationId = appId;
45+
this.slug = appNameForURL || appName;
5746
if (!this.slug && dashboardURL) {
5847
let pieces = dashboardURL.split('/');
5948
this.slug = pieces[pieces.length - 1];
6049
}
61-
this.clientKey = secret || clientKey;
62-
this.javascriptKey = javascript_key || javascriptKey;
63-
this.masterKey = push_key || masterKey;
64-
this.restKey = rest_api_key || restKey;
65-
this.windowsKey = windows_key || windowsKey;
66-
this.webhookKey = webhook_key || webhookKey;
67-
this.fileKey = api_key || apiKey;
50+
this.clientKey = clientKey;
51+
this.javascriptKey = javascriptKey;
52+
this.masterKey = masterKey;
53+
this.restKey = restKey;
54+
this.windowsKey = windowsKey;
55+
this.webhookKey = webhookKey;
56+
this.fileKey = apiKey;
6857
this.production = !!params['is_production?'];
6958
this.serverURL = serverURL;
7059
this.enabledFeatures = enabledFeatures;

0 commit comments

Comments
 (0)