-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
+ <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Arvados Workbench 2</title>
+ <script>FontAwesomeConfig = { autoReplaceSvg: 'nest' }</script>
+ <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js" integrity="sha384-xymdQtn1n3lH2wcu0qhcdaOpQwyoarkgLVxC/wZ5q7h9gHtxICrpcaSUfygqZGOe" crossorigin="anonymous"></script>
</head>
<body>
<noscript>
const level = this.props.level ? this.props.level : 0;
return <List component="div">
{this.props.items && this.props.items.map((it: TreeItem<T>, idx: number) =>
- <div key={`item/${level}/${idx}`}>
- <ListItem button onClick={() => this.props.toggleItem(it.id)} style={{paddingLeft: (level + 1) * 30}}>
+ <div key={`item/${level}/${idx}`}>
+ <ListItem button onClick={() => this.props.toggleItem(it.id)} style={{paddingLeft: (level + 1) * 20}}>
+ <i style={{marginRight: "10px"}} className={it.open ? "fas fa-caret-down" : "fas fa-caret-right"} />
{this.props.render(it.data)}
</ListItem>
{it.items && it.items.length > 0 &&
function buildProjectTree(tree: any[], level = 0): Array<TreeItem<Project>> {
const projects = tree.map((t, idx) => ({
- id: `l${level}i${idx}`,
+ id: `l${level}i${idx}${t[0]}`,
open: false,
data: {
name: t[0],
+ icon: level === 0 ? <i className="icon-th"/> : <i className="fas fa-folder"/>,
createdAt: '2018-05-05',
},
items: t.length > 1 ? buildProjectTree(t[1], level + 1) : []
<Provider store={store}>
<ConnectedRouter history={history}>
<div>
- <Route path="/" component={Workbench}/>
+ <Route path="/" component={Workbench} />
</div>
</ConnectedRouter>
</Provider>;
ReactDOM.render(
- <App/>,
+ <App />,
document.getElementById('root') as HTMLElement
);
export interface Project {
name: string;
createdAt: string;
+ icon?: any;
}
import { actions as projectActions } from "../../store/project-action";
import ListItemText from "@material-ui/core/ListItemText/ListItemText";
+import ListItemIcon from '@material-ui/core/ListItemIcon';
const drawerWidth = 240;
-type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'toolbar';
+type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'row' | 'toolbar';
const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
root: {
padding: theme.spacing.unit * 3,
minWidth: 0,
},
+ row: {
+ display: 'flex'
+ },
toolbar: theme.mixins.toolbar
});
class Workbench extends React.Component<WorkbenchProps & WithStyles<CssRules>, WorkbenchState> {
render() {
- const {classes} = this.props;
+ const {classes, projects} = this.props;
return (
<div className={classes.root}>
<AppBar position="absolute" className={classes.appBar}>
paper: classes.drawerPaper,
}}>
<div className={classes.toolbar}/>
- <Tree items={this.props.projects}
+ <Tree items={projects}
toggleItem={this.props.toggleProjectTreeItem}
- render={(p: Project) => <ListItemText primary={p.name}/>}
+ render={(p: Project) => <span className={classes.row}>
+ <div style={{marginTop: "3px"}}><ListItemIcon>{p.icon}</ListItemIcon></div>
+ <div><ListItemText primary={p.name}/></div>
+ </span>}
/>
</Drawer>
<main className={classes.content}>
csstype "^2.0.0"
indefinite-observable "^1.0.1"
-"@types/lodash@^4.14.109":
+"@types/lodash@4.14.109":
version "4.14.109"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.109.tgz#b1c4442239730bf35cabaf493c772b18c045886d"
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
-"lodash@>=3.5 <5", lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0:
+lodash@4.17.10, "lodash@>=3.5 <5", lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"