Migrate SetIntegrationManager to TypeScript
This commit is contained in:
parent
ef2848664f
commit
ef4d58c0d9
1 changed files with 15 additions and 5 deletions
|
@ -17,15 +17,25 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import { IntegrationManagers } from "../../../integrations/IntegrationManagers";
|
import { IntegrationManagers } from "../../../integrations/IntegrationManagers";
|
||||||
|
import { IntegrationManagerInstance } from "../../../integrations/IntegrationManagerInstance";
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import { SettingLevel } from "../../../settings/SettingLevel";
|
import { SettingLevel } from "../../../settings/SettingLevel";
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IState {
|
||||||
|
currentManager: IntegrationManagerInstance;
|
||||||
|
provisioningEnabled: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.settings.SetIntegrationManager")
|
@replaceableComponent("views.settings.SetIntegrationManager")
|
||||||
export default class SetIntegrationManager extends React.Component {
|
export default class SetIntegrationManager extends React.Component<IProps, IState> {
|
||||||
constructor() {
|
constructor(props: IProps) {
|
||||||
super();
|
super(props);
|
||||||
|
|
||||||
const currentManager = IntegrationManagers.sharedInstance().getPrimaryManager();
|
const currentManager = IntegrationManagers.sharedInstance().getPrimaryManager();
|
||||||
|
|
||||||
|
@ -35,7 +45,7 @@ export default class SetIntegrationManager extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onProvisioningToggled = () => {
|
private onProvisioningToggled = (): void => {
|
||||||
const current = this.state.provisioningEnabled;
|
const current = this.state.provisioningEnabled;
|
||||||
SettingsStore.setValue("integrationProvisioning", null, SettingLevel.ACCOUNT, !current).catch(err => {
|
SettingsStore.setValue("integrationProvisioning", null, SettingLevel.ACCOUNT, !current).catch(err => {
|
||||||
console.error("Error changing integration manager provisioning");
|
console.error("Error changing integration manager provisioning");
|
||||||
|
@ -46,7 +56,7 @@ export default class SetIntegrationManager extends React.Component {
|
||||||
this.setState({ provisioningEnabled: !current });
|
this.setState({ provisioningEnabled: !current });
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
public render(): React.ReactNode {
|
||||||
const ToggleSwitch = sdk.getComponent("views.elements.ToggleSwitch");
|
const ToggleSwitch = sdk.getComponent("views.elements.ToggleSwitch");
|
||||||
|
|
||||||
const currentManager = this.state.currentManager;
|
const currentManager = this.state.currentManager;
|
Loading…
Reference in a new issue