Skip to content

Commit 0208282

Browse files
committed
back4app1.1.2
1 parent c90c0b5 commit 0208282

File tree

7 files changed

+96
-72
lines changed

7 files changed

+96
-72
lines changed

src/dashboard/Data/Browser/AddColumnDialog.react.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,34 @@ export default class AddColumnDialog extends React.Component {
5555
}
5656

5757
render() {
58+
function checkVersion(t, props) {
59+
if (t === 'Polygon') {
60+
if (
61+
typeof props.app !== 'undefined' && typeof props.app.serverInfo.parseServerVersion !== 'undefined' &&
62+
props.app.serverInfo.parseServerVersion > '2.6'
63+
) {
64+
return true;
65+
} else {
66+
return false;
67+
}
68+
} else {
69+
return true
70+
}
71+
}
72+
function renderOptions(props) {
73+
return DataTypes.map((t) => {
74+
if (checkVersion(t, props)) {
75+
return <Option key={t} value={t}>{t}</Option>
76+
} else {
77+
return null;
78+
}
79+
}).filter((t => t !== null))
80+
}
5881
let typeDropdown = (
5982
<Dropdown
6083
value={this.state.type}
6184
onChange={(type) => this.setState({ type: type })}>
62-
{DataTypes.map((t) => <Option key={t} value={t}>{t}</Option>)}
85+
{renderOptions(this.props)}
6386
</Dropdown>
6487
);
6588
return (
@@ -92,4 +115,4 @@ export default class AddColumnDialog extends React.Component {
92115
</Modal>
93116
);
94117
}
95-
}
118+
}

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ export default class Browser extends DashboardView {
966966
});
967967
extras = (
968968
<AddColumnDialog
969+
app={this.context.currentApp}
969970
currentColumns={currentColumns}
970971
classes={this.props.schema.data.get('classes').keySeq().toArray()}
971972
onCancel={() => this.setState({ showAddColumnDialog: false })}

src/dashboard/Data/Jobs/Jobs.react.js

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import CategoryList from 'components/CategoryList/CategoryList.react';
1212
import EmptyState from 'components/EmptyState/EmptyState.react';
1313
import history from 'dashboard/history';
1414
import Icon from 'components/Icon/Icon.react';
15-
import JobScheduleReminder from 'dashboard/Data/Jobs/JobScheduleReminder.react';
1615
import Modal from 'components/Modal/Modal.react';
1716
import React from 'react';
1817
import ReleaseInfo from 'components/ReleaseInfo/ReleaseInfo';
@@ -28,7 +27,7 @@ import Toolbar from 'components/Toolbar/Toolbar.react';
2827

2928
let subsections = {
3029
all: 'All Jobs',
31-
scheduled: 'Scheduled Jobs',
30+
/*scheduled: 'Scheduled Jobs',*/
3231
status: 'Job Status'
3332
};
3433

@@ -110,8 +109,8 @@ export default class Jobs extends TableView {
110109
let current = this.props.params.section || '';
111110
return (
112111
<CategoryList current={current} linkPrefix={'jobs/'} categories={[
112+
/* { name: 'Scheduled Jobs', id: 'scheduled' }, */
113113
{ name: 'All Jobs', id: 'all' },
114-
{ name: 'Scheduled Jobs', id: 'scheduled' },
115114
{ name: 'Job Status', id: 'status' }
116115
]} />
117116
);
@@ -181,14 +180,6 @@ export default class Jobs extends TableView {
181180
}
182181
}
183182

184-
renderFooter() {
185-
if (this.props.params.section === 'scheduled') {
186-
return <JobScheduleReminder />
187-
}
188-
189-
return null;
190-
}
191-
192183
renderEmpty() {
193184
if (this.props.params.section === 'all') {
194185
return (
@@ -201,12 +192,7 @@ export default class Jobs extends TableView {
201192
return (
202193
<EmptyState
203194
title='Cloud Jobs'
204-
description=
205-
{<div>
206-
<p>{'On this page you can create JobSchedule objects.'}</p>
207-
<br/>
208-
<JobScheduleReminder />
209-
</div>}
195+
description='Scheduling jobs is not supported on parse-server'
210196
icon='cloud-happy' />
211197
);
212198
} else {
@@ -239,23 +225,7 @@ export default class Jobs extends TableView {
239225

240226
tableData() {
241227
let data = undefined;
242-
if (this.props.params.section === 'all') {
243-
if (this.props.availableJobs) {
244-
data = this.props.availableJobs;
245-
}
246-
if (this.props.jobsInUse) {
247-
if (data) {
248-
data = data.concat(this.props.jobsInUse);
249-
} else {
250-
data = this.props.jobsInUse;
251-
}
252-
}
253-
if (data) {
254-
data = data.map((jobName) => {
255-
return { jobName };
256-
});
257-
}
258-
} else if (this.props.params.section === 'scheduled' ) {
228+
if (this.props.params.section === 'scheduled' || this.props.params.section === 'all' ) {
259229
if (this.props.jobs.data) {
260230
let jobs = this.props.jobs.data.get('jobs');
261231
if (jobs) {

src/dashboard/Data/Jobs/JobsData.react.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default class JobsData extends React.Component {
2929
() => this.setState({ release: null })
3030
);
3131
}
32-
*/
32+
3333
fetchJobs(app) {
3434
app.getAvailableJobs().then(
3535
({ jobs, in_use }) => {
@@ -43,15 +43,17 @@ export default class JobsData extends React.Component {
4343
}, () => this.setState({ jobs: [], inUse: [] })
4444
);
4545
}
46+
*/
4647

4748
componentDidMount() {
48-
this.fetchJobs(this.context.currentApp);
49+
// this.fetchJobs(this.context.currentApp);
4950
// this.fetchRelease(this.context.currentApp);
5051
}
5152

5253
componentWillReceiveProps(props, context) {
5354
if (this.context !== context) {
54-
this.fetchJobs(context.currentApp);
55+
this.setState({ release: undefined, jobs: undefined, inUse: undefined });
56+
// this.fetchJobs(context.currentApp);
5557
// this.fetchRelease(context.currentApp);
5658
}
5759
}

src/dashboard/Push/PushNew.react.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,20 @@ export default class PushNew extends DashboardView {
159159

160160
const available = this.context.currentApp.isLocalizationAvailable();
161161
if (available) {
162-
const locales = this.context.currentApp.fetchPushLocales();
163-
const filteredLocales = locales.filter((locale) => !(locale === '' || locale === undefined));
164-
this.setState({
165-
isLocalizationAvailable: true,
166-
locales: filteredLocales,
167-
availableLocales: filteredLocales
168-
});
162+
this.context.currentApp.fetchPushLocales().promise
163+
.then((locales) => {
164+
console.log(locales);
165+
const filteredLocales = (locales || []).filter((locale) => !(locale === '' || locale === undefined));
166+
this.setState({
167+
isLocalizationAvailable: true,
168+
locales: filteredLocales,
169+
availableLocales: filteredLocales
170+
});
171+
this.setState({
172+
loadingLocale: false
173+
});
174+
});
169175
}
170-
this.setState({
171-
loadingLocale: false
172-
});
173176
}
174177

175178
componentWillUnmount() {

src/lib/ParseApp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ export default class ParseApp {
561561
}
562562

563563
getAvailableJobs() {
564-
let path = '/apps/' + this.slug + '/cloud_code/jobs/data';
565-
return Parse._request('GET', path);
564+
let path = 'cloud_code/jobs';
565+
return this.apiRequest('GET', path, {}, {useMasterKey:true});
566566
}
567567

568568
getJobStatus() {

src/lib/stores/PushAudiencesStore.js

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* This source code is licensed under the license found in the LICENSE file in
66
* the root directory of this source tree.
77
*/
8+
import { abortableGet, post, del } from 'lib/AJAX';
89
import keyMirror from 'lib/keyMirror';
910
import Parse from 'parse';
1011
import { List, Map } from 'immutable';
@@ -19,6 +20,7 @@ const LASTFETCHTIMEOUT = 60000;
1920
// - showMore: Flag to show/hide button to fetch all audiences
2021

2122
// xhr map, key value pair of xhrKey, xhr reference
23+
//let xhrMap = {};
2224

2325
function PushAudiencesStore(state, action) {
2426
action.app.setParseKeys();
@@ -29,36 +31,59 @@ function PushAudiencesStore(state, action) {
2931
return Parse.Promise.as(state);
3032
}
3133
}
32-
const path = action.limit ? `push_audiences?audience_limit=${action.limit}` : 'push_audiences';
33-
const promise = Parse._request('GET', path, {}, { useMasterKey: true });
34+
let promise = action.app.apiRequest(
35+
'GET',
36+
action.limit ? `push_audiences?audience_limit=${action.limit}` : 'push_audiences',
37+
{},
38+
{ useMasterKey: true }
39+
);
3440

41+
//xhrMap[action.xhrKey] = xhr;
42+
//
3543
return promise.then(({ results, showMore }) => {
3644
return Map({ lastFetch: new Date(), audiences: List(results), showMore: showMore});
3745
});
3846
case ActionTypes.CREATE:
39-
return Parse._request('POST', 'push_audiences', { query: action.query, name: action.name, }, { useMasterKey: true })
40-
.then(({ new_audience }) => {
41-
return state.update('audiences',(audiences) => {
42-
return audiences.unshift({
43-
createdAt: new Date(),
44-
name: action.name,
45-
objectId: new_audience ? new_audience.objectId || -1 : -1,
46-
count: 0,
47-
query: JSON.parse(action.query),
48-
});
49-
});
47+
return action.app.apiRequest(
48+
'POST',
49+
'push_audiences',
50+
{
51+
query: action.query,
52+
name: action.name,
53+
},
54+
{ useMasterKey: true }
55+
).then(({ new_audience }) => {
56+
return state.update('audiences',(audiences) => {
57+
return audiences.unshift({
58+
createdAt: new Date(),
59+
name: action.name,
60+
objectId: new_audience ? new_audience.objectId || -1 : -1,
61+
count: 0,
62+
query: JSON.parse(action.query),
5063
});
64+
});
65+
});
5166
case ActionTypes.DESTROY:
52-
return Parse._request('DELETE', `push_audiences/${action.objectId}`, {}, { useMasterKey: true })
53-
.then(() => {
54-
return state.update('audiences',(audiences) => {
55-
let index = audiences.findIndex(function(audience) {
56-
return audience.objectId === action.objectId;
57-
});
58-
return audiences.delete(index);
59-
});
67+
return action.app.apiRequest(
68+
'DELETE',
69+
`push_audiences/${action.objectId}`,
70+
{},
71+
{ useMasterKey: true }
72+
).then(() => {
73+
return state.update('audiences',(audiences) => {
74+
let index = audiences.findIndex(function(audience) {
75+
return audience.objectId === action.objectId;
6076
});
77+
return audiences.delete(index);
78+
});
79+
});
6180
case ActionTypes.ABORT_FETCH:
81+
82+
/*let xhrKey = action.xhrKey;
83+
if (xhrMap[xhrKey]) {
84+
xhrMap[xhrKey].abort();
85+
}*/
86+
6287
return Parse.Promise.as(state);
6388
}
6489
}

0 commit comments

Comments
 (0)