Skip to content

Commit

Permalink
Enabling web hooks (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
davimacedo authored and steven-supersolid committed Jan 31, 2017
1 parent cf0c7fb commit c428902
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,3 +9,4 @@ npm-debug.log
// vim .swp
*.swp
.env
.idea/
2 changes: 0 additions & 2 deletions src/dashboard/DashboardView.react.js
Expand Up @@ -47,14 +47,12 @@ export default class DashboardView extends React.Component {
}

//webhooks requires removal of heroku link code, then it should work.
/*
if (features.hooks && features.hooks.create && features.hooks.read && features.hooks.update && features.hooks.delete) {
coreSubsections.push({
name: 'Webhooks',
link: '/webhooks'
});
}
*/

if (features.cloudCode && features.cloudCode.jobs) {
coreSubsections.push({
Expand Down
12 changes: 0 additions & 12 deletions src/dashboard/Data/Webhooks/Webhooks.react.js
Expand Up @@ -230,18 +230,6 @@ export default class Webhooks extends TableView {
}

renderRow(hook) {
if (hook.herokuAppId) {
let openHerokuApp = () => {window.open('https://dashboard.heroku.com/apps/' + (hook.herokuAppName || hook.herokuAppId), '_blank')};
return <tr
onClick={openHerokuApp}
key={hook.herokuAppId}>
<td style={{ cursor: 'pointer' }} width={'15%'}>Heroku App</td>
<td style={{ cursor: 'pointer' }} width={'15%'}></td>
<td style={{ cursor: 'pointer' }} width={'20%'}></td>
<td style={{ cursor: 'pointer' }} width={'40%'}><Icon name='heroku' fill='#343445' width={20} height={20}/> {hook.herokuAppName || hook.herokuAppId}</td>
<td width={'10%'}>{hook.deleted ? <TableWarning text='Deleted' /> : null}</td>
</tr>;
}
let showEdit = hook.url ? () => {
this.setState({
hookType: hook.functionName ? 'function' : hook.triggerName,
Expand Down
22 changes: 4 additions & 18 deletions src/lib/stores/WebhookStore.js
Expand Up @@ -34,25 +34,11 @@ function WebhookStore(state, action) {
{},
{ useMasterKey: true }
);
let herokuAppsPromise = get('/apps/' + action.app.slug + '/cloud_code/heroku_link').then(({ herokuApps }) => {
herokuApps = herokuApps ? herokuApps : [];
let appNamePromises = herokuApps.map(herokuApp => {
return getHerokuAppName('https://api.heroku.com/apps/' + herokuApp.herokuAppId).then(({ name }) => {
herokuApp.herokuAppName = name;
return herokuApp;
}).fail(() => {
herokuApp.deleted = true;
return herokuApp;
});
})
return Parse.Promise.when(appNamePromises).always(() => Parse.Promise.as(herokuApps));
});
return Parse.Promise.when(functionsPromise, triggersPromise, herokuAppsPromise).then((
{ results: functions },
{ results: triggers },
herokuApps
return Parse.Promise.when(functionsPromise, triggersPromise).then((
functions,
triggers
) => {
return Map({ lastFetch: new Date(), webhooks: List(functions.concat(triggers).concat(herokuApps))});
return Map({ lastFetch: new Date(), webhooks: List(functions.concat(triggers))});
});
case ActionTypes.CREATE:
let addHookToStore = hook => state.set('webhooks', state.get('webhooks').push(hook));
Expand Down

0 comments on commit c428902

Please sign in to comment.