You've already forked mattermost-webapp
mirror of
https://github.com/zerotier/mattermost-webapp.git
synced 2026-05-22 16:23:25 -07:00
45188b9750
* New admin console page for manage system schemas * Tunning header and footer styles * WIP * Improving styles * Improved subgrous rendering and management * Fixed SVG attributes * New group toggle behavior changed * Improved trnslations * Some work in the Checkboxes behavior * Fixing tests * Updating editable permissions * replacing code with id, and restructured the constants usage * Fixing Schemes plural usage * Fixing a syntax problem in translation * Fix small problem in eslint * Setting the permission name to fixed size * Change link color inherited permissions description * Change the behavior to the new proposed group change behavior * Added auto expand/collapse on toggle group * Fixed problem with empty groups * Nicer animation on open/close permissions groups * Added scroll to the permission * Adding tests for auto expand/collapse feature * Adding tests for state change behavior * eslint fix * Add rowhighlight animation for selected permission * Open callapsed role on select permission * Appliying changes from header-footer in master PR * Some fixes * Updating tests snapshots * Changed Highlight color * Changed how is selected the current selected row * Removing/combining permissions * Back to permalink color on parent permission * Polishing a bit select permission * Fixed combined permissions groups * Fixing tests and styles * Tooltips working * Minor UI updates * Add menu footer error tooltip * Scroll to permissions-block beginning on expand * Some tests fixes * Some eslint fixes * Fixed styles after merge * Addining missed translation * Re-applying transparency to description in permission rows * Reverting scroll to permissions group on expand
84 lines
2.1 KiB
React
84 lines
2.1 KiB
React
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
|
|
export default class FormError extends React.Component {
|
|
static get propTypes() {
|
|
// accepts either a single error or an array of errors
|
|
return {
|
|
type: PropTypes.node,
|
|
error: PropTypes.node,
|
|
margin: PropTypes.bool,
|
|
errors: PropTypes.arrayOf(PropTypes.node),
|
|
};
|
|
}
|
|
|
|
static get defaultProps() {
|
|
return {
|
|
error: null,
|
|
errors: [],
|
|
};
|
|
}
|
|
|
|
render() {
|
|
if (!this.props.error && this.props.errors.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
// look for the first truthy error to display
|
|
let message = this.props.error;
|
|
|
|
if (!message) {
|
|
for (const error of this.props.errors) {
|
|
if (error) {
|
|
message = error;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!message) {
|
|
return null;
|
|
}
|
|
|
|
if (this.props.type === 'modal') {
|
|
return (
|
|
<div className='form-group'>
|
|
<label className='col-sm-12 has-error'>
|
|
{message}
|
|
</label>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (this.props.type === 'backstage') {
|
|
return (
|
|
<div className='pull-left has-error'>
|
|
<label className='control-label'>
|
|
{message}
|
|
</label>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (this.props.margin) {
|
|
return (
|
|
<div className='form-group has-error'>
|
|
<label className='control-label'>
|
|
{message}
|
|
</label>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className='col-sm-12 has-error'>
|
|
<label className='control-label'>
|
|
<i className='fa fa-exclamation-circle'/> {message}
|
|
</label>
|
|
</div>
|
|
);
|
|
}
|
|
}
|