This repository was archived by the owner on Feb 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from BlueBrain/Update-project-menu
Create project menu component
- Loading branch information
Showing
6 changed files
with
157 additions
and
84 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
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,95 @@ | ||
import * as React from 'react'; | ||
import { AccessControl } from '@bbp/react-nexus'; | ||
import { Link } from 'react-router-dom'; | ||
import { Divider, Button } from 'antd'; | ||
|
||
import SideMenu from '../components/Menu/SideMenu'; | ||
import FileUploadContainer from '../containers/FileUploadContainer'; | ||
import ResourceFormContainer from '../containers/ResourceFormContainer'; | ||
import StudioListContainer from '../containers/StudioListContainer'; | ||
|
||
const ProjectMenuContainer: React.FunctionComponent<{ | ||
menuVisible: boolean; | ||
setMenuVisible: (value: boolean) => void; | ||
orgLabel: string; | ||
projectLabel: string; | ||
}> = ({ menuVisible, orgLabel, projectLabel, setMenuVisible }) => { | ||
const [activeResourceMenuTab, setActiveResourceMenuTab] = React.useState( | ||
'resources' | ||
); | ||
|
||
const tabList = [ | ||
{ | ||
key: 'resources', | ||
tab: 'Resources', | ||
}, | ||
{ | ||
key: 'studios', | ||
tab: 'Studios', | ||
}, | ||
]; | ||
|
||
const menuContentList: { [key: string]: any } = { | ||
resources: [ | ||
<p> | ||
View resources in your project using pre-defined query-helper lists. | ||
</p>, | ||
<div className="project-menu__controls"> | ||
<AccessControl | ||
path={`/${orgLabel}/${projectLabel}`} | ||
permissions={['resources/write']} | ||
> | ||
<ResourceFormContainer | ||
orgLabel={orgLabel} | ||
projectLabel={projectLabel} | ||
/> | ||
</AccessControl> | ||
<Link to={`/${orgLabel}/${projectLabel}/nxv:defaultSparqlIndex/sparql`}> | ||
Sparql Query Editor | ||
</Link> | ||
<Link | ||
to={`/${orgLabel}/${projectLabel}/nxv:defaultElasticSearchIndex/_search`} | ||
> | ||
ElasticSearch Query Editor | ||
</Link> | ||
<Link to={`/${orgLabel}/${projectLabel}/_settings/acls`}> | ||
View Project's permissions | ||
</Link> | ||
</div>, | ||
<AccessControl | ||
path={`/${orgLabel}/${projectLabel}`} | ||
permissions={['files/write']} | ||
> | ||
<Divider /> | ||
<FileUploadContainer projectLabel={projectLabel} orgLabel={orgLabel} /> | ||
</AccessControl>, | ||
], | ||
studios: ( | ||
<StudioListContainer orgLabel={orgLabel} projectLabel={projectLabel} /> | ||
), | ||
}; | ||
|
||
return ( | ||
<div className="project-menu"> | ||
<SideMenu | ||
visible={menuVisible} | ||
tabList={tabList} | ||
onTabChange={(key: string) => setActiveResourceMenuTab(key)} | ||
activeTabKey={activeResourceMenuTab} | ||
tabBarExtraContent={ | ||
<Button | ||
icon="close" | ||
onClick={() => setMenuVisible(false)} | ||
style={{ border: 'none' }} | ||
/> | ||
} | ||
> | ||
<div className="project-menu__content"> | ||
{menuContentList[activeResourceMenuTab]} | ||
</div> | ||
</SideMenu> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProjectMenuContainer; |
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