-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Space Avatar with selector in main Kibana menu
- Loading branch information
Showing
15 changed files
with
210 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/spaces/public/views/components/space_card.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiCard, | ||
EuiAvatar, | ||
EuiText | ||
} from '@elastic/eui'; | ||
import './space_card.less'; | ||
|
||
export const SpaceCard = (props) => { | ||
const { | ||
space, | ||
onClick | ||
} = props; | ||
|
||
return ( | ||
<EuiCard | ||
className="spaceCard" | ||
title={renderSpaceTitle(space)} | ||
description={space.description} | ||
onClick={onClick} | ||
/> | ||
); | ||
}; | ||
|
||
function renderSpaceTitle(space) { | ||
return ( | ||
<div className="spaceCardTitle"> | ||
<EuiAvatar name={space.name} size="m" /> | ||
<EuiText><h3>{space.name}</h3></EuiText> | ||
</div> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
x-pack/plugins/spaces/public/views/components/space_card.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.spaceCard { | ||
width: 225px; | ||
} |
33 changes: 33 additions & 0 deletions
33
x-pack/plugins/spaces/public/views/components/space_cards.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { SpaceCard } from './space_card'; | ||
import { | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '@elastic/eui'; | ||
|
||
export class SpaceCards extends Component { | ||
render() { | ||
return ( | ||
<EuiFlexGroup gutterSize="l" justifyContent="spaceEvenly" className="spacesGroup"> | ||
{this.props.spaces.map(this.renderSpace)} | ||
</EuiFlexGroup> | ||
); | ||
} | ||
|
||
renderSpace = (space) => ( | ||
<EuiFlexItem key={space.id}> | ||
<SpaceCard space={space} onClick={() => {}} /> | ||
</EuiFlexItem> | ||
); | ||
} | ||
|
||
SpaceCards.propTypes = { | ||
spaces: PropTypes.array.isRequired | ||
}; |
7 changes: 1 addition & 6 deletions
7
x-pack/plugins/spaces/public/views/nav_control/nav_control.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
<div ng-controller="spacesNavController"> | ||
<global-nav-link | ||
kbn-route="route" | ||
icon="'plugins/spaces/images/demo.png'" | ||
tooltip-content="'Clicking this should do something'" | ||
label="'Engineering Space'" | ||
></global-nav-link> | ||
<div id="spacesNavReactRoot" /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
x-pack/plugins/spaces/public/views/nav_control/nav_control.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.global-nav-link__icon .euiAvatar { | ||
margin-top: 0.5em; | ||
} |
63 changes: 63 additions & 0 deletions
63
x-pack/plugins/spaces/public/views/nav_control/nav_control_modal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { Component } from 'react'; | ||
import { | ||
EuiModal, | ||
EuiModalHeader, | ||
EuiModalHeaderTitle, | ||
EuiModalBody, | ||
EuiOverlayMask, | ||
EuiAvatar, | ||
} from '@elastic/eui'; | ||
import { SpaceCards } from '../components/space_cards'; | ||
|
||
export class NavControlModal extends Component { | ||
state = { | ||
isOpen: false | ||
} | ||
|
||
render() { | ||
const button = ( | ||
<div className="global-nav-link"> | ||
<a className="global-nav-link__anchor" onClick={this.togglePortal}> | ||
<div className="global-nav-link__icon"><EuiAvatar size={'s'} name={'Engineering'} /></div> | ||
<div className="global-nav-link__title">Engineering</div> | ||
</a> | ||
</div> | ||
); | ||
|
||
let modal; | ||
if (this.state.isOpen) { | ||
modal = ( | ||
<EuiOverlayMask> | ||
<EuiModal onClose={this.closePortal}> | ||
<EuiModalHeader><EuiModalHeaderTitle>Select a space</EuiModalHeaderTitle></EuiModalHeader> | ||
<EuiModalBody> | ||
<SpaceCards spaces={this.props.spaces} /> | ||
</EuiModalBody> | ||
</EuiModal> | ||
</EuiOverlayMask> | ||
); | ||
} | ||
|
||
return ( | ||
<div>{button}{modal}</div> | ||
); | ||
} | ||
|
||
togglePortal = () => { | ||
this.setState({ | ||
isOpen: !this.state.isOpen | ||
}); | ||
} | ||
|
||
closePortal = () => { | ||
this.setState({ | ||
isOpen: false | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import url from 'url'; | ||
export function requestFixture({ | ||
headers = { accept: 'something/html' }, | ||
path = '/wat', | ||
search = '', | ||
payload | ||
} = {}) { | ||
return { | ||
raw: { req: { headers } }, | ||
headers, | ||
url: { path, search }, | ||
query: search ? url.parse(search, { parseQueryString: true }).query : {}, | ||
payload, | ||
state: { user: 'these are the contents of the user client cookie' } | ||
}; | ||
} |
File renamed without changes.
File renamed without changes.