Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better matrix layout #14

Merged
merged 1 commit into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import './collapsible_panel/collapsible_panel';
@import './privileges/kibana/space_aware_privilege_section/index';
@import './privileges/kibana/feature_table/index';
@import './spaces_popover_list/spaces_popover_list';

.secPrivilegeFeatureIcon {
flex-shrink: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ export class FeatureTable extends Component<Props, {}> {
);
tooltipElement = (
<EuiIconTip
// TODO: Waiting on update from EUI
// iconProps={{
// className: 'eui-alignTop',
// }}
iconProps={{
className: 'eui-alignTop',
}}
type={'iInCircle'}
color={'subdued'}
content={tooltipContent}
Expand Down Expand Up @@ -207,15 +206,13 @@ export class FeatureTable extends Component<Props, {}> {
return {
id: `${featureId}_${priv}`,
label: _.capitalize(priv),
// TODO: Waiting on update from EUI
isDisabled: !enabledFeaturePrivileges.includes(priv),
};
});

options.push({
id: `${featureId}_${NO_PRIVILEGE_VALUE}`,
label: 'None',
// TODO: Waiting on update from EUI
isDisabled: !allowsNone,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* 1. Allow table to scroll both directions
*/

.secPrivilegeMatrix__modal,
.secPrivilegeMatrix__modal .euiModal__flex {
overflow: hidden; /* 1 */
}

.secPrivilegeMatrix__row--isBasePrivilege,
.secPrivilegeMatrix__cell--isGlobalPrivilege,
.secPrivilegeTable__row--isGlobalSpace, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ function getIconTip(iconType?: IconType, tooltipContent?: ReactNode) {

return (
<EuiIconTip
// TODO: Waiting on update from EUI
// iconProps={{
// className: 'eui-alignTop',
// }}
iconProps={{
className: 'eui-alignTop',
}}
color="subdued"
type={iconType}
content={tooltipContent}
size={'s'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class PrivilegeMatrix extends Component<Props, State> {
if (this.state.showModal) {
modal = (
<EuiOverlayMask>
<EuiModal onClose={this.hideModal}>
<EuiModal className="secPrivilegeMatrix__modal" onClose={this.hideModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<FormattedMessage
Expand Down Expand Up @@ -157,15 +157,15 @@ export class PrivilegeMatrix extends Component<Props, State> {
id: 'xpack.security.management.editRole.spacePrivilegeMatrix.featureColumnTitle',
defaultMessage: 'Feature',
}),
width: '230px',
render: (feature: Feature & { isBase: boolean }) => {
return feature.isBase ? (
<Fragment>
<strong>{feature.name}</strong>
<EuiIconTip
// TODO: Waiting on update from EUI
// iconProps={{
// className: 'eui-alignTop',
// }}
iconProps={{
className: 'eui-alignTop',
}}
type="questionInCircle"
content={intl.formatMessage({
id:
Expand All @@ -186,10 +186,20 @@ export class PrivilegeMatrix extends Component<Props, State> {
},
},
...spacesColumns.map(item => {
let columnWidth;
if (item.isGlobal) {
columnWidth = '100px';
} else if (item.spaces.length - SPACES_DISPLAY_COUNT) {
columnWidth = '90px';
} else {
columnWidth = '80px';
}

return {
// TODO: this is a hacky way to determine if we are looking at the global feature
// used for cellProps below...
field: item.isGlobal ? 'global' : 'feature',
width: columnWidth,
name: (
<div>
{item.spaces.slice(0, SPACES_DISPLAY_COUNT).map((space: Space) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.secSpacesPopoverList__buttonText {
font-size: $euiFontSizeXS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class SpacesPopoverList extends Component<Props, State> {
public render() {
const button = (
<EuiButtonEmpty size={'xs'} onClick={this.onButtonClick}>
{this.props.buttonText}
<span className="secSpacesPopoverList__buttonText">{this.props.buttonText}</span>
</EuiButtonEmpty>
);

Expand Down