From c417fdc152e953982d9c9af2c04ca2c04ced41b3 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 17 Mar 2016 10:30:49 -0400 Subject: Added initial backstage components and InstalledIntegrations page --- webapp/utils/async_client.jsx | 46 +++++++++++++++++++++++++++++++++++++++++++ webapp/utils/constants.jsx | 2 ++ webapp/utils/utils.jsx | 10 ++++++++++ 3 files changed, 58 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 6140fd9e0..2154fbe43 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -1121,3 +1121,49 @@ export function getRecentAndNewUsersAnalytics(teamId) { } ); } + +export function listIncomingHooks() { + if (isCallInProgress('listIncomingHooks')) { + return; + } + + callTracker.listIncomingHooks = utils.getTimestamp(); + + client.listIncomingHooks( + (data) => { + callTracker.listIncomingHooks = 0; + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_INCOMING_WEBHOOKS, + incomingWebhooks: data + }); + }, + (err) => { + callTracker.listIncomingHooks = 0; + dispatchError(err, 'getIncomingHooks'); + } + ); +} + +export function listOutgoingHooks() { + if (isCallInProgress('listOutgoingHooks')) { + return; + } + + callTracker.listOutgoingHooks = utils.getTimestamp(); + + client.listOutgoingHooks( + (data) => { + callTracker.listOutgoingHooks = 0; + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_OUTGOING_WEBHOOKS, + outgoingWebhooks: data + }); + }, + (err) => { + callTracker.listOutgoingHooks = 0; + dispatchError(err, 'getOutgoingHooks'); + } + ); +} diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index bcd2fadb9..1f316369a 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -68,6 +68,8 @@ export default { RECEIVED_PREFERENCE: null, RECEIVED_PREFERENCES: null, RECEIVED_FILE_INFO: null, + RECEIVED_INCOMING_WEBHOOKS: null, + RECEIVED_OUTGOING_WEBHOOKS: null, RECEIVED_MSG: null, diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 83519a6ec..33a3d8b27 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -1398,3 +1398,13 @@ export function localizeMessage(id, defaultMessage) { return id; } + +export function freezeArray(arr) { + for (const obj of arr) { + Object.freeze(obj); + } + + Object.freeze(arr); + + return arr; +} -- cgit v1.2.3-1-g7c22 From 3246d97d5ea00320f9d051318321e156eb0130a0 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 28 Mar 2016 09:41:03 -0400 Subject: Added basic screen to add incoming webhooks --- webapp/utils/async_client.jsx | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 2154fbe43..9ca2bd606 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -1167,3 +1167,49 @@ export function listOutgoingHooks() { } ); } + +export function addIncomingHook(hook, success, error) { + client.addIncomingHook( + hook, + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_INCOMING_WEBHOOK, + incomingWebhook: data + }); + + if (success) { + success(); + } + }, + (err) => { + dispatchError(err, 'addIncomingHook'); + + if (error) { + error(err); + } + } + ); +} + +export function addOutgoingHook(hook, success, error) { + client.addOutgoingHook( + hook, + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_OUTGOING_WEBHOOK, + outgoingWebhook: data + }); + + if (success) { + success(); + } + }, + (err) => { + dispatchError(err, 'addOutgoingHook'); + + if (error) { + error(err); + } + } + ); +} -- cgit v1.2.3-1-g7c22 From aa684f0b8b81aa576997dd26fb077882651830fc Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 28 Mar 2016 15:19:59 -0400 Subject: Added ChannelSelect component --- webapp/utils/constants.jsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 1f316369a..126324de8 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -69,7 +69,9 @@ export default { RECEIVED_PREFERENCES: null, RECEIVED_FILE_INFO: null, RECEIVED_INCOMING_WEBHOOKS: null, + RECEIVED_INCOMING_WEBHOOK: null, RECEIVED_OUTGOING_WEBHOOKS: null, + RECEIVED_OUTGOING_WEBHOOK: null, RECEIVED_MSG: null, -- cgit v1.2.3-1-g7c22 From bb13476326b81191ba4aa854c25224638735272c Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 28 Mar 2016 16:17:17 -0400 Subject: Added delete buttons to InstalledIntegrations --- webapp/utils/async_client.jsx | 30 ++++++++++++++++++++++++++++++ webapp/utils/constants.jsx | 3 +++ 2 files changed, 33 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 9ca2bd606..93eeee351 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -1213,3 +1213,33 @@ export function addOutgoingHook(hook, success, error) { } ); } + +export function deleteIncomingHook(id) { + client.deleteIncomingHook( + {id}, + () => { + AppDispatcher.handleServerAction({ + type: ActionTypes.REMOVED_INCOMING_WEBHOOK, + id + }); + }, + (err) => { + dispatchError(err, 'deleteIncomingHook'); + } + ); +} + +export function deleteOutgoingHook(id) { + client.deleteOutgoingHook( + {id}, + () => { + AppDispatcher.handleServerAction({ + type: ActionTypes.REMOVED_OUTGOING_WEBHOOK, + id + }); + }, + (err) => { + dispatchError(err, 'deleteOutgoingHook'); + } + ); +} diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 126324de8..89bf4e865 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -68,10 +68,13 @@ export default { RECEIVED_PREFERENCE: null, RECEIVED_PREFERENCES: null, RECEIVED_FILE_INFO: null, + RECEIVED_INCOMING_WEBHOOKS: null, RECEIVED_INCOMING_WEBHOOK: null, + REMOVED_INCOMING_WEBHOOK: null, RECEIVED_OUTGOING_WEBHOOKS: null, RECEIVED_OUTGOING_WEBHOOK: null, + REMOVED_OUTGOING_WEBHOOK: null, RECEIVED_MSG: null, -- cgit v1.2.3-1-g7c22 From 149c72cf8c136781864863bf71ae3bf0d516728d Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 29 Mar 2016 10:04:53 -0400 Subject: Added ability to regenerate outgoing webhook tokens on InstalledIntegrations page --- webapp/utils/async_client.jsx | 15 +++++++++++++++ webapp/utils/constants.jsx | 1 + 2 files changed, 16 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 93eeee351..cc19baa7e 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -1243,3 +1243,18 @@ export function deleteOutgoingHook(id) { } ); } + +export function regenOutgoingHookToken(id) { + client.regenOutgoingHookToken( + {id}, + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.UPDATED_OUTGOING_WEBHOOK, + outgoingWebhook: data + }); + }, + (err) => { + dispatchError(err, 'regenOutgoingHookToken'); + } + ); +} diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 89bf4e865..c7f61e9df 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -74,6 +74,7 @@ export default { REMOVED_INCOMING_WEBHOOK: null, RECEIVED_OUTGOING_WEBHOOKS: null, RECEIVED_OUTGOING_WEBHOOK: null, + UPDATED_OUTGOING_WEBHOOK: null, REMOVED_OUTGOING_WEBHOOK: null, RECEIVED_MSG: null, -- cgit v1.2.3-1-g7c22 From 17f10b1abad76d797e7c0b3b686f065a253f5c0b Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 29 Mar 2016 10:46:54 -0400 Subject: Added english localization for Backstage and additional cleanup --- webapp/utils/utils.jsx | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'webapp/utils') diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 33a3d8b27..83519a6ec 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -1398,13 +1398,3 @@ export function localizeMessage(id, defaultMessage) { return id; } - -export function freezeArray(arr) { - for (const obj of arr) { - Object.freeze(obj); - } - - Object.freeze(arr); - - return arr; -} -- cgit v1.2.3-1-g7c22