This commit is contained in:
Gregory Schier 2018-04-17 15:47:15 -04:00
parent d7db623c66
commit d18564c7dc

View File

@ -15,24 +15,24 @@ import {trackEvent} from '../../../common/analytics';
@autobind @autobind
class WorkspaceShareSettingsModal extends PureComponent { class WorkspaceShareSettingsModal extends PureComponent {
constructor (props) { constructor(props) {
super(props); super(props);
this.state = {}; this.state = {};
} }
_handleSubmit (e) { _handleSubmit(e) {
e.preventDefault(); e.preventDefault();
} }
_handleClose () { _handleClose() {
this.hide(); this.hide();
} }
_setModalRef (n) { _setModalRef(n) {
this.modal = n; this.modal = n;
} }
async _handleUnshare () { async _handleUnshare() {
if (!session.isLoggedIn()) { if (!session.isLoggedIn()) {
return; return;
} }
@ -50,7 +50,7 @@ class WorkspaceShareSettingsModal extends PureComponent {
} }
} }
_handleShareWithTeam (team) { _handleShareWithTeam(team) {
showPrompt({ showPrompt({
title: 'Share Workspace', title: 'Share Workspace',
label: 'Confirm password to share workspace', label: 'Confirm password to share workspace',
@ -71,7 +71,7 @@ class WorkspaceShareSettingsModal extends PureComponent {
}); });
} }
async _load () { async _load() {
if (!session.isLoggedIn()) { if (!session.isLoggedIn()) {
this._resetState({}); this._resetState({});
return; return;
@ -92,7 +92,7 @@ class WorkspaceShareSettingsModal extends PureComponent {
} }
} }
_resetState (patch = {}) { _resetState(patch = {}) {
this.setState(Object.assign({ this.setState(Object.assign({
teams: [], teams: [],
resourceGroup: null, resourceGroup: null,
@ -101,7 +101,7 @@ class WorkspaceShareSettingsModal extends PureComponent {
}, patch)); }, patch));
} }
async show () { async show() {
this._resetState(); this._resetState();
this.modal.show(); this.modal.show();
@ -109,15 +109,15 @@ class WorkspaceShareSettingsModal extends PureComponent {
await this._load(); await this._load();
} }
hide () { hide() {
this.modal.hide(); this.modal.hide();
} }
componentWillMount () { componentWillMount() {
this._resetState(); this._resetState();
} }
render () { render() {
const {teams, resourceGroup, error, loading} = this.state; const {teams, resourceGroup, error, loading} = this.state;
const {workspace} = this.props; const {workspace} = this.props;
return ( return (
@ -172,10 +172,15 @@ class WorkspaceShareSettingsModal extends PureComponent {
</DropdownItem> </DropdownItem>
</Dropdown> </Dropdown>
&nbsp;&nbsp; &nbsp;&nbsp;
<Link button className="btn btn--super-compact inline-block" {session.isLoggedIn() ? (
href="https://insomnia.rest/app/teams/"> <Link button className="btn btn--super-compact inline-block" href="https://insomnia.rest/app/teams/">
Manage Teams Manage Teams
</Link> </Link>
) : (
<Link button className="btn btn--super-compact inline-block" href="https://insomnia.rest/teams/">
Manage Teams
</Link>
)}
</div> </div>
</ModalBody> </ModalBody>
<ModalFooter key="footer"> <ModalFooter key="footer">