import { TreeItem, TreeItemStatus } from '../tree/tree';
import { FileTreeData } from '../file-tree/file-tree-data';
import { FileTree } from '../file-tree/file-tree';
-import { IconButton, Grid, Typography, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core';
+import { IconButton, Grid, Typography, StyleRulesCallback, withStyles, WithStyles, CardHeader, CardContent, Card } from '@material-ui/core';
import { CustomizeTableIcon } from '../icon/icon';
export interface CollectionPanelFilesProps {
onCollapseToggle: (id: string, status: TreeItemStatus) => void;
}
-type CssRules = 'nameHeader' | 'fileSizeHeader';
+type CssRules = 'root' | 'nameHeader' | 'fileSizeHeader';
const styles: StyleRulesCallback<CssRules> = theme => ({
+ root: {
+ paddingBottom: theme.spacing.unit
+ },
nameHeader: {
marginLeft: '75px'
},
export const CollectionPanelFiles = withStyles(styles)(
({ onItemMenuOpen, onOptionsMenuOpen, classes, ...treeProps }: CollectionPanelFilesProps & WithStyles<CssRules>) =>
- <div>
- <Grid container justify="flex-end">
- <IconButton onClick={onOptionsMenuOpen}>
- <CustomizeTableIcon />
- </IconButton>
- </Grid>
+ <Card className={classes.root}>
+ <CardHeader
+ title="Files"
+ action={
+ <IconButton onClick={onOptionsMenuOpen}>
+ <CustomizeTableIcon />
+ </IconButton>
+ } />
<Grid container justify="space-between">
<Typography variant="caption" className={classes.nameHeader}>
Name
- </Typography>
+ </Typography>
<Typography variant="caption" className={classes.fileSizeHeader}>
File size
- </Typography>
+ </Typography>
</Grid>
<FileTree onMenuOpen={onItemMenuOpen} {...treeProps} />
- </div>);
+ </Card>);
},
button: {
width: theme.spacing.unit * 3,
- height: theme.spacing.unit * 3
+ height: theme.spacing.unit * 3,
+ marginRight: theme.spacing.unit
}
});
// SPDX-License-Identifier: AGPL-3.0
import { unionize, ofType, UnionOf } from "unionize";
-import { CommonResourceService } from "../../common/api/common-resource-service";
-import { apiClient } from "../../common/api/server-api";
import { Dispatch } from "redux";
import { ResourceKind } from "../../models/resource";
import { CollectionResource } from "../../models/collection";
+import { collectionService } from "../../services/services";
+import { collectionPanelFilesAction } from "./collection-panel-files/collection-panel-files-actions";
+import { parseKeepManifestText } from "../../models/keep-manifest";
export const collectionPanelActions = unionize({
LOAD_COLLECTION: ofType<{ uuid: string, kind: ResourceKind }>(),
export const loadCollection = (uuid: string, kind: ResourceKind) =>
(dispatch: Dispatch) => {
dispatch(collectionPanelActions.LOAD_COLLECTION({ uuid, kind }));
- return new CommonResourceService(apiClient, "collections")
+ return collectionService
.get(uuid)
.then(item => {
- dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: item as CollectionResource }));
+ dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item }));
+ const manifest = parseKeepManifestText(item.manifestText);
+ dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES({ manifest }));
});
};
import { MoreOptionsIcon, CollectionIcon } from '../../components/icon/icon';
import { DetailsAttribute } from '../../components/details-attribute/details-attribute';
import { CollectionResource } from '../../models/collection';
+import { CollectionPanelFiles } from '../../views-components/collection-panel-files/collection-panel-files';
type CssRules = 'card' | 'iconHeader';
</Grid>
</CardContent>
</Card>
-
- <Card className={classes.card}>
- <CardHeader title="Files" />
- <CardContent>
- <Grid container direction="column">
- <Grid item xs={4}>
- Tags
- </Grid>
- </Grid>
- </CardContent>
- </Card>
+ <div className={classes.card}>
+ <CollectionPanelFiles/>
+ </div>
</div>;
}
import { CurrentTokenDialog } from '../../views-components/current-token-dialog/current-token-dialog';
import { dataExplorerActions } from '../../store/data-explorer/data-explorer-action';
import { Snackbar } from '../../views-components/snackbar/snackbar';
-import { CollectionPanelFiles } from '../../views-components/collection-panel-files/collection-panel-files';
import { CreateCollectionDialog } from '../../views-components/create-collection-dialog/create-collection-dialog';
import { CollectionPanel } from '../collection-panel/collection-panel';
import { loadCollection } from '../../store/collection-panel/collection-panel-action';
<Route path="/projects/:id" render={this.renderProjectPanel} />
<Route path="/favorites" render={this.renderFavoritePanel} />
<Route path="/collections/:id" render={this.renderCollectionPanel} />
- <Route path="/" render={() => <CollectionPanelFiles />} />
</Switch>
</div>
{user && <DetailsPanel />}