PLT-2927/PLT-2924 Fixing issues with integration lists (#2974)

* Changed IntegrationStore to store integrations by team

* Fixed regenerating a command's token not causing the UI to update

* Re-added IntegrationStore.hasReceived methods
Этот коммит содержится в:
Harrison Healey
2016-05-12 11:30:53 -04:00
коммит произвёл Christopher Speller
родитель 82e6cf785c
Коммит d9f724f959
6 изменённых файлов: 116 добавлений и 79 удалений

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

@@ -5,6 +5,7 @@ import React from 'react';
import * as AsyncClient from 'utils/async_client.jsx';
import IntegrationStore from 'stores/integration_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import * as Utils from 'utils/utils.jsx';
import {FormattedMessage} from 'react-intl';
@@ -20,16 +21,18 @@ export default class InstalledCommands extends React.Component {
this.regenCommandToken = this.regenCommandToken.bind(this);
this.deleteCommand = this.deleteCommand.bind(this);
const teamId = TeamStore.getCurrentId();
this.state = {
commands: IntegrationStore.getCommands(),
loading: !IntegrationStore.hasReceivedCommands()
commands: IntegrationStore.getCommands(teamId),
loading: !IntegrationStore.hasReceivedCommands(teamId)
};
}
componentDidMount() {
IntegrationStore.addChangeListener(this.handleIntegrationChange);
if (window.mm_config.EnableCommands === 'true' && this.state.loading) {
if (window.mm_config.EnableCommands === 'true') {
AsyncClient.listTeamCommands();
}
}
@@ -39,9 +42,11 @@ export default class InstalledCommands extends React.Component {
}
handleIntegrationChange() {
const teamId = TeamStore.getCurrentId();
this.setState({
commands: IntegrationStore.getCommands(),
loading: !IntegrationStore.hasReceivedCommands()
commands: IntegrationStore.getCommands(teamId),
loading: !IntegrationStore.hasReceivedCommands(teamId)
});
}

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

@@ -5,6 +5,7 @@ import React from 'react';
import * as AsyncClient from 'utils/async_client.jsx';
import IntegrationStore from 'stores/integration_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import * as Utils from 'utils/utils.jsx';
import {FormattedMessage} from 'react-intl';
@@ -19,16 +20,18 @@ export default class InstalledIncomingWebhooks extends React.Component {
this.deleteIncomingWebhook = this.deleteIncomingWebhook.bind(this);
const teamId = TeamStore.getCurrentId();
this.state = {
incomingWebhooks: IntegrationStore.getIncomingWebhooks(),
loading: !IntegrationStore.hasReceivedIncomingWebhooks()
incomingWebhooks: IntegrationStore.getIncomingWebhooks(teamId),
loading: !IntegrationStore.hasReceivedIncomingWebhooks(teamId)
};
}
componentDidMount() {
IntegrationStore.addChangeListener(this.handleIntegrationChange);
if (window.mm_config.EnableIncomingWebhooks === 'true' && this.state.loading) {
if (window.mm_config.EnableIncomingWebhooks === 'true') {
AsyncClient.listIncomingHooks();
}
}
@@ -38,9 +41,11 @@ export default class InstalledIncomingWebhooks extends React.Component {
}
handleIntegrationChange() {
const teamId = TeamStore.getCurrentId();
this.setState({
incomingWebhooks: IntegrationStore.getIncomingWebhooks(),
loading: !IntegrationStore.hasReceivedIncomingWebhooks()
incomingWebhooks: IntegrationStore.getIncomingWebhooks(teamId),
loading: !IntegrationStore.hasReceivedIncomingWebhooks(teamId)
});
}

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

@@ -5,6 +5,7 @@ import React from 'react';
import * as AsyncClient from 'utils/async_client.jsx';
import IntegrationStore from 'stores/integration_store.jsx';
import TeamStore from 'stores/team_store.jsx';
import * as Utils from 'utils/utils.jsx';
import {FormattedMessage} from 'react-intl';
@@ -20,16 +21,18 @@ export default class InstalledOutgoingWebhooks extends React.Component {
this.regenOutgoingWebhookToken = this.regenOutgoingWebhookToken.bind(this);
this.deleteOutgoingWebhook = this.deleteOutgoingWebhook.bind(this);
const teamId = TeamStore.getCurrentId();
this.state = {
outgoingWebhooks: IntegrationStore.getOutgoingWebhooks(),
loading: !IntegrationStore.hasReceivedOutgoingWebhooks()
outgoingWebhooks: IntegrationStore.getOutgoingWebhooks(teamId),
loading: !IntegrationStore.hasReceivedOutgoingWebhooks(teamId)
};
}
componentDidMount() {
IntegrationStore.addChangeListener(this.handleIntegrationChange);
if (window.mm_config.EnableOutgoingWebhooks === 'true' && this.state.loading) {
if (window.mm_config.EnableOutgoingWebhooks === 'true') {
AsyncClient.listOutgoingHooks();
}
}
@@ -39,9 +42,11 @@ export default class InstalledOutgoingWebhooks extends React.Component {
}
handleIntegrationChange() {
const teamId = TeamStore.getCurrentId();
this.setState({
outgoingWebhooks: IntegrationStore.getOutgoingWebhooks(),
loading: !IntegrationStore.hasReceivedOutgoingWebhooks()
outgoingWebhooks: IntegrationStore.getOutgoingWebhooks(teamId),
loading: !IntegrationStore.hasReceivedOutgoingWebhooks(teamId)
});
}