Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>
import { DataTableFilters } from '../data-table-filters/data-table-filters-tree';
import { DataTableFiltersPopover } from '../data-table-filters/data-table-filters-popover';
import { countNodes } from 'models/tree';
+import { ProjectIcon } from 'components/icon/icon';
import { SvgIconProps } from '@material-ui/core/SvgIcon';
import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward';
background: theme.palette.background.paper
},
loader: {
- top: '50%',
left: '50%',
- marginTop: '-15px',
- marginLeft: '-15px',
+ marginLeft: '-84px',
position: 'absolute'
},
noItemsInfo: {
</TableHead>
<TableBody className={classes.tableBody}>
{
- this.props.working ?
- null :
- items.map(this.renderBodyRow)
+ this.props.working ?
+ <div className={classes.loader}>
+ <DataTableDefaultView
+ icon={ProjectIcon}
+ messages={['Loading data, please wait.']} />
+ </div> : items.map(this.renderBodyRow)
}
</TableBody>
</Table>
working?: boolean;
}
-const mapStateToProps = (state: RootState, { id, working: parentWorking }: Props) => {
+let data: any[] = [];
+let href: string = '';
+
+const mapStateToProps = (state: RootState, { id }: Props) => {
const progress = state.progressIndicator.find(p => p.id === id);
- const working = (progress && progress.working) || parentWorking;
+ const dataExplorerState = getDataExplorer(state.dataExplorer, id);
const currentRoute = state.router.location ? state.router.location.pathname : '';
const currentItemUuid = currentRoute === '/workflows' ? state.properties.workflowPanelDetailsUuid : state.detailsPanel.resourceUuid;
- return { ...getDataExplorer(state.dataExplorer, id), working, paperKey: currentRoute, currentItemUuid };
+
+ let loading = false;
+
+ if (dataExplorerState.items.length > 0 && data === dataExplorerState.items && href !== window.location.href) {
+ loading = true
+ } else {
+ href = window.location.href;
+ data = dataExplorerState.items;
+ }
+
+ const working = (progress && progress.working) || loading;
+
+ return { ...dataExplorerState, working, paperKey: currentRoute, currentItemUuid };
};
const mapDispatchToProps = () => {
type ProjectPanelProps = ProjectPanelDataProps & DispatchProp
& WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
-let data: any[] = [];
-let href: string = '';
export const ProjectPanel = withStyles(styles)(
connect((state: RootState) => ({
currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
resources: state.resources,
- userUuid: state.auth.user!.uuid,
- dataExplorerItems: state.dataExplorer?.projectPanel.items,
+ userUuid: state.auth.user!.uuid
}))(
class extends React.Component<ProjectPanelProps> {
render() {
- const { classes, dataExplorerItems } = this.props;
- let loading = false;
-
- if (dataExplorerItems.length > 0 && data === dataExplorerItems && href !== window.location.href) {
- loading = true
- } else {
- href = window.location.href;
- data = dataExplorerItems;
- }
+ const { classes } = this.props;
return <div data-cy='project-panel' className={classes.root}>
<DataExplorer
- working={loading}
id={PROJECT_PANEL_ID}
onRowClick={this.handleRowClick}
onRowDoubleClick={this.handleRowDoubleClick}