PLT-1750 Moved slash commands to backstage

* Added slash commands to InstalledIntegrations page

* Reset installed integration type filter if there is no longer any integrations of the selected type

* Added pages to backstage to add slash commands

* Cleaned up internationalization for slash commands

* Added ability to regen slash command tokens from backstage

* Removed Integrations tab from UserSettings
Этот коммит содержится в:
Harrison Healey
2016-04-05 09:29:01 -04:00
коммит произвёл Christopher Speller
родитель c12d997f24
Коммит b3edd32aee
19 изменённых файлов: 995 добавлений и 1013 удалений

Просмотреть файл

@@ -20,6 +20,9 @@ class IntegrationStore extends EventEmitter {
this.outgoingWebhooks = [];
this.receivedOutgoingWebhooks = false;
this.commands = [];
this.receivedCommands = false;
}
addChangeListener(callback) {
@@ -61,7 +64,7 @@ class IntegrationStore extends EventEmitter {
}
hasReceivedOutgoingWebhooks() {
return this.receivedIncomingWebhooks;
return this.receivedOutgoingWebhooks;
}
getOutgoingWebhooks() {
@@ -95,6 +98,41 @@ class IntegrationStore extends EventEmitter {
}
}
hasReceivedCommands() {
return this.receivedCommands;
}
getCommands() {
return this.commands;
}
setCommands(commands) {
this.commands = commands;
this.receivedCommands = true;
}
addCommand(command) {
this.commands.push(command);
}
updateCommand(command) {
for (let i = 0; i < this.commands.length; i++) {
if (this.commands[i].id === command.id) {
this.commands[i] = command;
break;
}
}
}
removeCommand(id) {
for (let i = 0; i < this.commands.length; i++) {
if (this.commands[i].id === id) {
this.commands.splice(i, 1);
break;
}
}
}
handleEventPayload(payload) {
const action = payload.action;
@@ -127,8 +165,27 @@ class IntegrationStore extends EventEmitter {
this.removeOutgoingWebhook(action.id);
this.emitChange();
break;
case ActionTypes.RECEIVED_COMMANDS:
this.setCommands(action.commands);
this.emitChange();
break;
case ActionTypes.RECEIVED_COMMAND:
this.addCommand(action.command);
this.emitChange();
break;
case ActionTypes.UPDATED_COMMAND:
this.updateCommand(action.command);
this.emitChange();
break;
case ActionTypes.REMOVED_COMMAND:
this.removeCommand(action.id);
this.emitChange();
break;
}
}
}
export default new IntegrationStore();
const instance = new IntegrationStore();
export default instance;
window.IntegrationStore = instance;