Skip to content

Enabling web hooks #584

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
Jan 31, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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