Skip to content

Commit 963c36c

Browse files
committed
Merge pull request #29 from ParsePlatform/updated-serverInfo-endpoint
Update dashboard to handle updated server endpoint
2 parents 7501462 + ec4ecef commit 963c36c

File tree

5 files changed

+41
-37
lines changed

5 files changed

+41
-37
lines changed

dashboard/Apps/AppsIndex.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ let AppCard = ({
7171
</CountsSection>
7272
<div className={styles.details}>
7373
<a className={styles.appname}>{app.name}</a>
74-
<div className={styles.serverVersion}>Server version: <span className={styles.ago}>{app.enabledFeatures.serverVersion || 'unknown'}</span></div>
74+
<div className={styles.serverVersion}>Server version: <span className={styles.ago}>{app.serverInfo.serverVersion || 'unknown'}</span></div>
7575
</div>
7676
</li>
7777

dashboard/Dashboard.js

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -93,44 +93,48 @@ class Dashboard extends React.Component {
9393
if (app.serverURL.startsWith('https://api.parse.com/1')) {
9494
//api.parse.com doesn't have feature availability endpoint, fortunately we know which features
9595
//it supports and can hard code them
96-
app.enabledFeatures = {
97-
schemas: {
98-
addField: true,
99-
removeField: true,
100-
addClass: true,
101-
removeClass: true,
102-
clearAllDataFromClass: false, //This still goes through ruby
103-
exportClass: false, //Still goes through ruby
104-
},
105-
cloudCode: {
106-
viewCode: true,
107-
},
108-
hooks: {
109-
create: true,
110-
read: true,
111-
update: true,
112-
delete: true,
113-
},
114-
logs: {
115-
info: true,
116-
error: true,
117-
},
118-
globalConfig: {
119-
create: true,
120-
read: true,
121-
update: true,
122-
delete: true,
96+
app.serverInfo = {
97+
features: {
98+
schemas: {
99+
addField: true,
100+
removeField: true,
101+
addClass: true,
102+
removeClass: true,
103+
clearAllDataFromClass: false, //This still goes through ruby
104+
exportClass: false, //Still goes through ruby
105+
},
106+
cloudCode: {
107+
viewCode: true,
108+
},
109+
hooks: {
110+
create: true,
111+
read: true,
112+
update: true,
113+
delete: true,
114+
},
115+
logs: {
116+
info: true,
117+
error: true,
118+
},
119+
globalConfig: {
120+
create: true,
121+
read: true,
122+
update: true,
123+
delete: true,
124+
},
123125
},
126+
serverVersion: 'Parse.com',
124127
}
125128
AppsManager.addApp(app)
126129
} else {
130+
app.serverInfo = {}
127131
new ParseApp(app).apiRequest(
128132
'GET',
129-
'features',
133+
'serverInfo',
130134
{},
131135
{ useMasterKey: true }
132-
).then(enabledFeatures => {
133-
app.enabledFeatures = enabledFeatures;
136+
).then(serverInfo => {
137+
app.serverInfo = serverInfo;
134138
AppsManager.addApp(app)
135139
this.forceUpdate();
136140
});

dashboard/DashboardView.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class DashboardView extends React.Component {
2525
this.context.currentApp.getMigrations().promise.then(() => this.forceUpdate());
2626
}
2727

28-
let features = this.context.currentApp.enabledFeatures;
28+
let features = this.context.currentApp.serverInfo.features;
2929

3030
let coreSubsections = [];
3131
if (features.schemas &&

dashboard/Data/Browser/DataBrowser.react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ export default class DataBrowser extends React.Component {
196196
className={SpecialClasses[className] || className}
197197
classNameForPermissionsEditor={className}
198198
setCurrent={this.setCurrent.bind(this)}
199-
enableDeleteAllRows={this.context.currentApp.enabledFeatures.schemas.clearAllDataFromClass}
200-
enableExportClass={this.context.currentApp.enabledFeatures.schemas.exportClass}
201-
enableSecurityDialog={false /* this will eventually come from the enabledFeatures object, format TBD */}
199+
enableDeleteAllRows={this.context.currentApp.serverInfo.features.schemas.clearAllDataFromClass}
200+
enableExportClass={this.context.currentApp.serverInfo.features.schemas.exportClass}
201+
enableSecurityDialog={false /* this will eventually come from the serverInfo object, format TBD */}
202202
{...other}/>
203203
</div>
204204
);

lib/ParseApp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default class ParseApp {
3636
webhookKey,
3737
apiKey,
3838
serverURL,
39-
enabledFeatures,
39+
serverInfo,
4040
...params,
4141
}) {
4242
this.name = appName;
@@ -56,7 +56,7 @@ export default class ParseApp {
5656
this.fileKey = apiKey;
5757
this.production = !!params['is_production?'];
5858
this.serverURL = serverURL;
59-
this.enabledFeatures = enabledFeatures;
59+
this.serverInfo = serverInfo;
6060

6161
this.settings = {
6262
fields: {},

0 commit comments

Comments
 (0)