Skip to content

Update dashboard to handle updated server endpoint #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard/Apps/AppsIndex.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let AppCard = ({
</CountsSection>
<div className={styles.details}>
<a className={styles.appname}>{app.name}</a>
<div className={styles.serverVersion}>Server version: <span className={styles.ago}>{app.enabledFeatures.serverVersion || 'unknown'}</span></div>
<div className={styles.serverVersion}>Server version: <span className={styles.ago}>{app.serverInfo.serverVersion || 'unknown'}</span></div>
</div>
</li>

Expand Down
64 changes: 34 additions & 30 deletions dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,44 +93,48 @@ class Dashboard extends React.Component {
if (app.serverURL.startsWith('https://api.parse.com/1')) {
//api.parse.com doesn't have feature availability endpoint, fortunately we know which features
//it supports and can hard code them
app.enabledFeatures = {
schemas: {
addField: true,
removeField: true,
addClass: true,
removeClass: true,
clearAllDataFromClass: false, //This still goes through ruby
exportClass: false, //Still goes through ruby
},
cloudCode: {
viewCode: true,
},
hooks: {
create: true,
read: true,
update: true,
delete: true,
},
logs: {
info: true,
error: true,
},
globalConfig: {
create: true,
read: true,
update: true,
delete: true,
app.serverInfo = {
features: {
schemas: {
addField: true,
removeField: true,
addClass: true,
removeClass: true,
clearAllDataFromClass: false, //This still goes through ruby
exportClass: false, //Still goes through ruby
},
cloudCode: {
viewCode: true,
},
hooks: {
create: true,
read: true,
update: true,
delete: true,
},
logs: {
info: true,
error: true,
},
globalConfig: {
create: true,
read: true,
update: true,
delete: true,
},
},
serverVersion: 'Parse.com',
}
AppsManager.addApp(app)
} else {
app.serverInfo = {}
new ParseApp(app).apiRequest(
'GET',
'features',
'serverInfo',
{},
{ useMasterKey: true }
).then(enabledFeatures => {
app.enabledFeatures = enabledFeatures;
).then(serverInfo => {
app.serverInfo = serverInfo;
AppsManager.addApp(app)
this.forceUpdate();
});
Expand Down
2 changes: 1 addition & 1 deletion dashboard/DashboardView.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class DashboardView extends React.Component {
this.context.currentApp.getMigrations().promise.then(() => this.forceUpdate());
}

let features = this.context.currentApp.enabledFeatures;
let features = this.context.currentApp.serverInfo.features;

let coreSubsections = [];
if (features.schemas &&
Expand Down
6 changes: 3 additions & 3 deletions dashboard/Data/Browser/DataBrowser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ export default class DataBrowser extends React.Component {
className={SpecialClasses[className] || className}
classNameForPermissionsEditor={className}
setCurrent={this.setCurrent.bind(this)}
enableDeleteAllRows={this.context.currentApp.enabledFeatures.schemas.clearAllDataFromClass}
enableExportClass={this.context.currentApp.enabledFeatures.schemas.exportClass}
enableSecurityDialog={false /* this will eventually come from the enabledFeatures object, format TBD */}
enableDeleteAllRows={this.context.currentApp.serverInfo.features.schemas.clearAllDataFromClass}
enableExportClass={this.context.currentApp.serverInfo.features.schemas.exportClass}
enableSecurityDialog={false /* this will eventually come from the serverInfo object, format TBD */}
{...other}/>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions lib/ParseApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class ParseApp {
webhookKey,
apiKey,
serverURL,
enabledFeatures,
serverInfo,
...params,
}) {
this.name = appName;
Expand All @@ -56,7 +56,7 @@ export default class ParseApp {
this.fileKey = apiKey;
this.production = !!params['is_production?'];
this.serverURL = serverURL;
this.enabledFeatures = enabledFeatures;
this.serverInfo = serverInfo;

this.settings = {
fields: {},
Expand Down