Skip to content

Commit d07db6f

Browse files
committed
Enabling web hooks
1 parent 15e259b commit d07db6f

File tree

4 files changed

+5
-32
lines changed

4 files changed

+5
-32
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ npm-debug.log
99
// vim .swp
1010
*.swp
1111
.env
12+
.idea/

src/dashboard/DashboardView.react.js

-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ export default class DashboardView extends React.Component {
4747
}
4848

4949
//webhooks requires removal of heroku link code, then it should work.
50-
/*
5150
if (features.hooks && features.hooks.create && features.hooks.read && features.hooks.update && features.hooks.delete) {
5251
coreSubsections.push({
5352
name: 'Webhooks',
5453
link: '/webhooks'
5554
});
5655
}
57-
*/
5856

5957
if (features.cloudCode && features.cloudCode.jobs) {
6058
coreSubsections.push({

src/dashboard/Data/Webhooks/Webhooks.react.js

-12
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,6 @@ export default class Webhooks extends TableView {
230230
}
231231

232232
renderRow(hook) {
233-
if (hook.herokuAppId) {
234-
let openHerokuApp = () => {window.open('https://dashboard.heroku.com/apps/' + (hook.herokuAppName || hook.herokuAppId), '_blank')};
235-
return <tr
236-
onClick={openHerokuApp}
237-
key={hook.herokuAppId}>
238-
<td style={{ cursor: 'pointer' }} width={'15%'}>Heroku App</td>
239-
<td style={{ cursor: 'pointer' }} width={'15%'}></td>
240-
<td style={{ cursor: 'pointer' }} width={'20%'}></td>
241-
<td style={{ cursor: 'pointer' }} width={'40%'}><Icon name='heroku' fill='#343445' width={20} height={20}/> {hook.herokuAppName || hook.herokuAppId}</td>
242-
<td width={'10%'}>{hook.deleted ? <TableWarning text='Deleted' /> : null}</td>
243-
</tr>;
244-
}
245233
let showEdit = hook.url ? () => {
246234
this.setState({
247235
hookType: hook.functionName ? 'function' : hook.triggerName,

src/lib/stores/WebhookStore.js

+4-18
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,11 @@ function WebhookStore(state, action) {
3434
{},
3535
{ useMasterKey: true }
3636
);
37-
let herokuAppsPromise = get('/apps/' + action.app.slug + '/cloud_code/heroku_link').then(({ herokuApps }) => {
38-
herokuApps = herokuApps ? herokuApps : [];
39-
let appNamePromises = herokuApps.map(herokuApp => {
40-
return getHerokuAppName('https://api.heroku.com/apps/' + herokuApp.herokuAppId).then(({ name }) => {
41-
herokuApp.herokuAppName = name;
42-
return herokuApp;
43-
}).fail(() => {
44-
herokuApp.deleted = true;
45-
return herokuApp;
46-
});
47-
})
48-
return Parse.Promise.when(appNamePromises).always(() => Parse.Promise.as(herokuApps));
49-
});
50-
return Parse.Promise.when(functionsPromise, triggersPromise, herokuAppsPromise).then((
51-
{ results: functions },
52-
{ results: triggers },
53-
herokuApps
37+
return Parse.Promise.when(functionsPromise, triggersPromise).then((
38+
functions,
39+
triggers
5440
) => {
55-
return Map({ lastFetch: new Date(), webhooks: List(functions.concat(triggers).concat(herokuApps))});
41+
return Map({ lastFetch: new Date(), webhooks: List(functions.concat(triggers))});
5642
});
5743
case ActionTypes.CREATE:
5844
let addHookToStore = hook => state.set('webhooks', state.get('webhooks').push(hook));

0 commit comments

Comments
 (0)