Add the toggle switch for provisioning
parent
0a0e952691
commit
3391cc0d90
|
@ -27,3 +27,11 @@ limitations under the License.
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_SetIntegrationManager .mx_ToggleSwitch {
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
top: 9px;
|
||||||
|
|
||||||
|
@mixin mx_Settings_fullWidthField;
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ 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 sdk from '../../../index';
|
||||||
|
import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore";
|
||||||
|
|
||||||
export default class SetIntegrationManager extends React.Component {
|
export default class SetIntegrationManager extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -26,10 +28,24 @@ export default class SetIntegrationManager extends React.Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
currentManager,
|
currentManager,
|
||||||
|
provisioningEnabled: SettingsStore.getValue("integrationProvisioning"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onProvisioningToggled = () => {
|
||||||
|
const current = this.state.provisioningEnabled;
|
||||||
|
SettingsStore.setValue("integrationProvisioning", null, SettingLevel.ACCOUNT, !current).catch(err => {
|
||||||
|
console.error("Error changing integration manager provisioning");
|
||||||
|
console.error(err);
|
||||||
|
|
||||||
|
this.setState({provisioningEnabled: current});
|
||||||
|
});
|
||||||
|
this.setState({provisioningEnabled: !current});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const ToggleSwitch = sdk.getComponent("views.elements.ToggleSwitch");
|
||||||
|
|
||||||
const currentManager = this.state.currentManager;
|
const currentManager = this.state.currentManager;
|
||||||
let managerName;
|
let managerName;
|
||||||
let bodyText;
|
let bodyText;
|
||||||
|
@ -50,6 +66,7 @@ export default class SetIntegrationManager extends React.Component {
|
||||||
<div className="mx_SettingsTab_heading">
|
<div className="mx_SettingsTab_heading">
|
||||||
<span>{_t("Integrations")}</span>
|
<span>{_t("Integrations")}</span>
|
||||||
<span className="mx_SettingsTab_subheading">{managerName}</span>
|
<span className="mx_SettingsTab_subheading">{managerName}</span>
|
||||||
|
<ToggleSwitch checked={this.state.provisioningEnabled} onChange={this.onProvisioningToggled} />
|
||||||
</div>
|
</div>
|
||||||
<span className="mx_SettingsTab_subsectionText">
|
<span className="mx_SettingsTab_subsectionText">
|
||||||
{bodyText}
|
{bodyText}
|
||||||
|
|
Loading…
Reference in New Issue