// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { IconButton, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+import { IconButton, StyleRulesCallback, WithStyles, withStyles, Tooltip } from '@material-ui/core';
import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
import { connect, DispatchProp } from 'react-redux';
import { DataColumns } from '~/components/data-table/data-table';
const resource = getResource<TrashableResource>(props.uuid)(state.resources);
return { resource, dispatch: props.dispatch };
})((props: { resource?: TrashableResource, dispatch?: Dispatch<any> }) =>
- <IconButton onClick={() => {
- if (props.resource && props.dispatch) {
- props.dispatch(toggleTrashed(
- props.resource.kind,
- props.resource.uuid,
- props.resource.ownerUuid,
- props.resource.isTrashed
- ));
- }
- }}>
- <RestoreFromTrashIcon />
- </IconButton>
+ <Tooltip title="Restore">
+ <IconButton onClick={() => {
+ if (props.resource && props.dispatch) {
+ props.dispatch(toggleTrashed(
+ props.resource.kind,
+ props.resource.uuid,
+ props.resource.ownerUuid,
+ props.resource.isTrashed
+ ));
+ }
+ }}>
+ <RestoreFromTrashIcon />
+ </IconButton>
+ </Tooltip>
);
export const trashPanelColumns: DataColumns<string, TrashPanelFilter> = [
configurable: true,
sortDirection: SortDirection.ASC,
filters: [],
- render: uuid => <ResourceName uuid={uuid} />,
- width: "450px"
+ render: uuid => <ResourceName uuid={uuid} />
},
{
name: TrashPanelColumnNames.TYPE,
selected: true,
type: ResourceKind.COLLECTION
},
- {
- name: resourceLabel(ResourceKind.PROCESS),
- selected: true,
- type: ResourceKind.PROCESS
- },
{
name: resourceLabel(ResourceKind.PROJECT),
selected: true,
}
],
render: uuid => <ResourceType uuid={uuid} />,
- width: "125px"
},
{
name: TrashPanelColumnNames.FILE_SIZE,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceFileSize uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceFileSize uuid={uuid} />
},
{
name: TrashPanelColumnNames.TRASHED_DATE,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceTrashDate uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceTrashDate uuid={uuid} />
},
{
name: TrashPanelColumnNames.TO_BE_DELETED,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceDeleteDate uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceDeleteDate uuid={uuid} />
},
{
name: '',
configurable: false,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceRestore uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceRestore uuid={uuid} />
}
];
}))(
class extends React.Component<TrashPanelProps> {
render() {
- return this.hasAnyTrashedResources()
- ? <DataExplorer
- id={TRASH_PANEL_ID}
- onRowClick={this.handleRowClick}
- onRowDoubleClick={this.handleRowDoubleClick}
- onContextMenu={this.handleContextMenu}
- contextMenuColumn={false}
- dataTableDefaultView={<DataTableDefaultView icon={TrashIcon}/>} />
- : <PanelDefaultView
- icon={TrashIcon}
- messages={['Your trash list is empty.']} />;
- }
-
- hasAnyTrashedResources = () => {
- // TODO: implement check if there is anything in the trash,
- // without taking pagination into the account
- return true;
+ return <DataExplorer
+ id={TRASH_PANEL_ID}
+ onRowClick={this.handleRowClick}
+ onRowDoubleClick={this.handleRowDoubleClick}
+ onContextMenu={this.handleContextMenu}
+ contextMenuColumn={false}
+ dataTableDefaultView={
+ <DataTableDefaultView
+ icon={TrashIcon}
+ messages={['Your trash list is empty.']}/>
+ } />;
}
handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {