|
@@ -29,9 +29,11 @@ import useLoadData from '../../../utils/hooks/useLoadData';
|
|
|
import './StorageBrowserTab.scss';
|
|
import './StorageBrowserTab.scss';
|
|
|
import StorageFilePage from '../StorageFilePage/StorageFilePage';
|
|
import StorageFilePage from '../StorageFilePage/StorageFilePage';
|
|
|
import changeURL from '../../../utils/url/changeURL';
|
|
import changeURL from '../../../utils/url/changeURL';
|
|
|
|
|
+import { getFileSystemAndPath } from '../../../reactComponents/PathBrowser/PathBrowser.util';
|
|
|
|
|
|
|
|
interface StorageBrowserTabProps {
|
|
interface StorageBrowserTabProps {
|
|
|
homeDir: string;
|
|
homeDir: string;
|
|
|
|
|
+ fileSystem: string;
|
|
|
testId?: string;
|
|
testId?: string;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -39,9 +41,16 @@ const defaultProps = {
|
|
|
testId: 'hue-storage-browser-tab-content'
|
|
testId: 'hue-storage-browser-tab-content'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const StorageBrowserTab = ({ homeDir, testId }: StorageBrowserTabProps): JSX.Element => {
|
|
|
|
|
|
|
+const StorageBrowserTab = ({
|
|
|
|
|
+ homeDir,
|
|
|
|
|
+ fileSystem,
|
|
|
|
|
+ testId
|
|
|
|
|
+}: StorageBrowserTabProps): JSX.Element => {
|
|
|
const [urlPathname, urlFilePath] = decodeURIComponent(window.location.pathname).split('view=');
|
|
const [urlPathname, urlFilePath] = decodeURIComponent(window.location.pathname).split('view=');
|
|
|
- const [filePath, setFilePath] = useState<string>(urlFilePath || homeDir);
|
|
|
|
|
|
|
+ const { fileSystem: urlFileSystem } = getFileSystemAndPath(urlFilePath);
|
|
|
|
|
+ const initialFilePath = urlFileSystem === fileSystem ? urlFilePath : homeDir;
|
|
|
|
|
+
|
|
|
|
|
+ const [filePath, setFilePath] = useState<string>(initialFilePath);
|
|
|
const fileName = filePath.split('/').pop() ?? '';
|
|
const fileName = filePath.split('/').pop() ?? '';
|
|
|
|
|
|
|
|
const { t } = i18nReact.useTranslation();
|
|
const { t } = i18nReact.useTranslation();
|
|
@@ -51,9 +60,7 @@ const StorageBrowserTab = ({ homeDir, testId }: StorageBrowserTabProps): JSX.Ele
|
|
|
loading,
|
|
loading,
|
|
|
reloadData
|
|
reloadData
|
|
|
} = useLoadData<FileStats>(FILE_STATS_API_URL, {
|
|
} = useLoadData<FileStats>(FILE_STATS_API_URL, {
|
|
|
- params: {
|
|
|
|
|
- path: filePath
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ params: { path: filePath },
|
|
|
skip: !filePath
|
|
skip: !filePath
|
|
|
});
|
|
});
|
|
|
|
|
|