-export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState) => ({
- auth: state.auth,
- collectionPanel: state.collectionPanel,
- collectionPanelFiles: state.collectionPanelFiles,
-}))((props: CollectionPanelFilesProps & WithStyles<CssRules> & { auth: AuthState }) => {
- const { classes, onItemMenuOpen, onUploadDataClick, isWritable, dispatch, collectionPanelFiles, collectionPanel } = props;
- const { apiToken, config } = props.auth;
-
- const webdavClient = new WebDAV();
- webdavClient.defaults.baseURL = config.keepWebServiceUrl;
- webdavClient.defaults.headers = {
- Authorization: `Bearer ${apiToken}`
- };
-
- const webDAVRequestConfig: WebDAVRequestConfig = {
- headers: {
- Depth: '1',
- },
- };
-
- const parentRef = React.useRef(null);
- const [path, setPath]: any = React.useState([]);
- const [pathData, setPathData]: any = React.useState({});
- const [isLoading, setIsLoading] = React.useState(false);
- const [collectionAutofetchEnabled, setCollectionAutofetchEnabled] = React.useState(false);
- const [leftSearch, setLeftSearch] = React.useState('');
- const [rightSearch, setRightSearch] = React.useState('');
-
- const leftKey = (path.length > 1 ? path.slice(0, path.length - 1) : path).join('/');
- const rightKey = path.join('/');
-
- const leftData = pathData[leftKey] || [];
- const rightData = pathData[rightKey];
-
- React.useEffect(() => {
- if (props.currentItemUuid) {
- setPathData({});
- setPath([props.currentItemUuid]);
- }
- }, [props.currentItemUuid]);
-
- const fetchData = (keys, ignoreCache = false) => {
- const keyArray = Array.isArray(keys) ? keys : [keys];
-
- Promise.all(keyArray
- .map((key) => {
- const dataExists = !!pathData[key];
- const runningRequest = pathPromise[key];
-
- if ((!dataExists || ignoreCache) && (!runningRequest || ignoreCache)) {
- if (!isLoading) {
- setIsLoading(true);
- }
+export const CollectionPanelFiles = withStyles(styles)(
+ connect((state: RootState) => ({
+ auth: state.auth,
+ collectionPanel: state.collectionPanel,
+ collectionPanelFiles: state.collectionPanelFiles,
+ }))((props: CollectionPanelFilesProps & WithStyles<CssRules> & { auth: AuthState }) => {
+ const { classes, onItemMenuOpen, onUploadDataClick, isWritable, dispatch, collectionPanelFiles, collectionPanel } = props;
+ const { apiToken, config } = props.auth;
+
+ const webdavClient = new WebDAV({
+ baseURL: config.keepWebServiceUrl,
+ headers: {
+ Authorization: `Bearer ${apiToken}`,
+ },
+ });
+
+ const webDAVRequestConfig: WebDAVRequestConfig = {
+ headers: {
+ Depth: "1",
+ },
+ };