WiP updates

This commit is contained in:
Tomas Bures 2018-04-22 09:00:04 +02:00
parent 6706d93bc1
commit 4fce4b6f81
27 changed files with 763 additions and 85 deletions

View file

@ -123,6 +123,32 @@ class DropdownMenu extends Component {
}
}
class DropdownMenuItem extends Component {
static propTypes = {
label: PropTypes.string,
icon: PropTypes.string,
className: PropTypes.string
}
render() {
const props = this.props;
let className = 'dropdown';
if (props.className) {
className = className + ' ' + props.className;
}
return (
<li className={className}>
<a href="#" className="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{props.icon && <Icon icon={props.icon}/>}{props.label}{' '}<span className="caret"></span></a>
<ul className="dropdown-menu">
{props.children}
</ul>
</li>
);
}
}
@withErrorHandling
class ActionLink extends Component {
static propTypes = {
@ -261,6 +287,7 @@ class ModalDialog extends Component {
export {
Button,
DropdownMenu,
DropdownMenuItem,
ActionLink,
DismissibleAlert,
ModalDialog,

View file

@ -417,6 +417,7 @@ class TextArea extends Component {
static propTypes = {
id: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
placeholder: PropTypes.string,
help: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
format: PropTypes.string
}
@ -432,7 +433,7 @@ class TextArea extends Component {
const htmlId = 'form_' + id;
return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help,
<textarea id={htmlId} value={owner.getFormValue(id) || ''} className="form-control" aria-describedby={htmlId + '_help'} onChange={evt => owner.updateFormValue(id, evt.target.value)}></textarea>
<textarea id={htmlId} placeholder={props.placeholder} value={owner.getFormValue(id) || ''} className="form-control" aria-describedby={htmlId + '_help'} onChange={evt => owner.updateFormValue(id, evt.target.value)}></textarea>
);
}
}

View file

@ -437,16 +437,17 @@ class NavButton extends Component {
}
}
class DropdownLink extends Component {
class MenuLink extends Component {
static propTypes = {
to: PropTypes.string
to: PropTypes.string,
className: PropTypes.string
}
render() {
const props = this.props;
return (
<li><Link to={props.to}>{props.children}</Link></li>
<li className={props.className}><Link to={props.to}>{props.children}</Link></li>
);
}
}
@ -473,7 +474,7 @@ export {
Title,
Toolbar,
NavButton,
DropdownLink,
MenuLink,
withPageHelpers,
requiresAuthenticatedUser
};

View file

@ -41,7 +41,7 @@ export class UntrustedContentHost extends Component {
}
isInitialized() {
return !!this.accessToken;
return !!this.accessToken && !!this.props.contentProps;
}
receiveMessage(evt) {
@ -73,7 +73,6 @@ export class UntrustedContentHost extends Component {
const msgId = this.rpcCounter;
this.sendMessage('rpcRequest', {
method,
params,
msgId
});
@ -126,6 +125,10 @@ export class UntrustedContentHost extends Component {
this.handleUpdate();
}
componentDidUpdate() {
this.handleUpdate();
}
componentWillUnmount() {
clearTimeout(this.refreshAccessTokenTimeout);
window.removeEventListener('message', this.receiveMessageHandler, false);