From 3fba8e42b140c1189bf3c06882cce5e2231e63da Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Fri, 8 Jan 2016 12:41:26 -0600 Subject: partial fix for UI --- web/react/utils/client.jsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index e1c331aff..56c8c4b3e 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -839,7 +839,7 @@ export function getChannelExtraInfo(id, success, error) { export function executeCommand(channelId, command, suggest, success, error) { $.ajax({ - url: '/api/v1/command', + url: '/api/v1/commands/execute', dataType: 'json', contentType: 'application/json', type: 'POST', @@ -852,6 +852,20 @@ export function executeCommand(channelId, command, suggest, success, error) { }); } +export function listCommands(success, error) { + $.ajax({ + url: '/api/v1/commands/list', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + success, + error: function onError(xhr, status, err) { + var e = handleError('listCommands', xhr, status, err); + error(e); + } + }); +} + export function getPostsPage(channelId, offset, limit, success, error, complete) { $.ajax({ cache: false, -- cgit v1.2.3-1-g7c22 From 3edcf960a0502fbeb3e4b46e87ecb958646eeb39 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sat, 9 Jan 2016 09:22:14 -0600 Subject: Fixing unit tests --- web/react/utils/client.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 56c8c4b3e..39629b529 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -857,7 +857,7 @@ export function listCommands(success, error) { url: '/api/v1/commands/list', dataType: 'json', contentType: 'application/json', - type: 'POST', + type: 'GET', success, error: function onError(xhr, status, err) { var e = handleError('listCommands', xhr, status, err); -- cgit v1.2.3-1-g7c22 From 586967b757a869dbb5f3677e605009a1f5c61005 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 14 Jan 2016 10:52:14 -0600 Subject: finishing up commands UI --- web/react/utils/client.jsx | 60 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) (limited to 'web/react/utils/client.jsx') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 9ff76f824..07982b7be 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -850,7 +850,7 @@ export function executeCommand(channelId, command, suggest, success, error) { dataType: 'json', contentType: 'application/json', type: 'POST', - data: JSON.stringify({channelId: channelId, command: command, suggest: '' + suggest}), + data: JSON.stringify({channelId, command, suggest: '' + suggest}), success, error: function onError(xhr, status, err) { var e = handleError('executeCommand', xhr, status, err); @@ -859,6 +859,64 @@ export function executeCommand(channelId, command, suggest, success, error) { }); } +export function addCommand(cmd, success, error) { + $.ajax({ + url: '/api/v1/commands/create', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(cmd), + success, + error: (xhr, status, err) => { + var e = handleError('addCommand', xhr, status, err); + error(e); + } + }); +} + +export function deleteCommand(data, success, error) { + $.ajax({ + url: '/api/v1/commands/delete', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: (xhr, status, err) => { + var e = handleError('deleteCommand', xhr, status, err); + error(e); + } + }); +} + +export function listTeamCommands(success, error) { + $.ajax({ + url: '/api/v1/commands/list_team_commands', + dataType: 'json', + type: 'GET', + success, + error: (xhr, status, err) => { + var e = handleError('listTeamCommands', xhr, status, err); + error(e); + } + }); +} + +export function regenCommandToken(data, success, error) { + $.ajax({ + url: '/api/v1/commands/regen_token', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: (xhr, status, err) => { + var e = handleError('regenCommandToken', xhr, status, err); + error(e); + } + }); +} + export function listCommands(success, error) { $.ajax({ url: '/api/v1/commands/list', -- cgit v1.2.3-1-g7c22