pull/5370/head
filip mertens 3 years ago
parent e81b4dc4a9
commit 50193a1599
  1. 12
      apps/remix-ide/src/app/components/preload.tsx
  2. 3
      apps/remix-ide/src/app/files/filesystems/fileSystemUtility.ts

@ -5,7 +5,7 @@ import * as packageJson from '../../../../../package.json'
import { fileSystem, fileSystems } from '../files/fileSystem' import { fileSystem, fileSystems } from '../files/fileSystem'
import { indexedDBFileSystem } from '../files/filesystems/indexedDB' import { indexedDBFileSystem } from '../files/filesystems/indexedDB'
import { localStorageFS } from '../files/filesystems/localStorage' import { localStorageFS } from '../files/filesystems/localStorage'
import { fileSystemUtility } from '../files/filesystems/fileSystemUtility' import { fileSystemUtility, migrationTestData } from '../files/filesystems/fileSystemUtility'
import './styles/preload.css' import './styles/preload.css'
export const Preload = () => { export const Preload = () => {
@ -56,10 +56,20 @@ export const Preload = () => {
} }
} }
const testmigration = async() => {
// load dummy data for e2e test
const testmigration = window.location.hash.includes('e2e_testmigration=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:'
const fsUtility = new fileSystemUtility()
if (testmigration) {
fsUtility.populateWorkspace(migrationTestData, remixFileSystems.current.fileSystems['localstorage'].fs)
}
}
useEffect(() => { useEffect(() => {
async function loadStorage() { async function loadStorage() {
await remixFileSystems.current.addFileSystem(remixIndexedDB.current) await remixFileSystems.current.addFileSystem(remixIndexedDB.current)
await remixFileSystems.current.addFileSystem(localStorageFileSystem.current) await remixFileSystems.current.addFileSystem(localStorageFileSystem.current)
await testmigration()
remixIndexedDB.current.loaded && await remixIndexedDB.current.checkWorkspaces() remixIndexedDB.current.loaded && await remixIndexedDB.current.checkWorkspaces()
localStorageFileSystem.current.loaded && await localStorageFileSystem.current.checkWorkspaces() localStorageFileSystem.current.loaded && await localStorageFileSystem.current.checkWorkspaces()
remixIndexedDB.current.loaded && ( (remixIndexedDB.current.hasWorkSpaces || !localStorageFileSystem.current.hasWorkSpaces)? await setFileSystems():setShowDownloader(true)) remixIndexedDB.current.loaded && ( (remixIndexedDB.current.hasWorkSpaces || !localStorageFileSystem.current.hasWorkSpaces)? await setFileSystems():setShowDownloader(true))

@ -18,7 +18,6 @@ export class fileSystemUtility {
return true return true
} }
await this.populateWorkspace(testData, fsFrom.fs)
const fromFiles = await this.copyFolderToJson('/', null, null, fsFrom.fs) const fromFiles = await this.copyFolderToJson('/', null, null, fsFrom.fs)
console.log(fsFrom.name, hashMessage(JSON.stringify(fromFiles)), fromFiles) console.log(fsFrom.name, hashMessage(JSON.stringify(fromFiles)), fromFiles)
await this.populateWorkspace(fromFiles, fsTo.fs) await this.populateWorkspace(fromFiles, fsTo.fs)
@ -150,7 +149,7 @@ export class fileSystemUtility {
/* eslint-disable no-template-curly-in-string */ /* eslint-disable no-template-curly-in-string */
const testData = { export const migrationTestData = {
'.workspaces': { '.workspaces': {
children: { children: {
'.workspaces/default_workspace': { '.workspaces/default_workspace': {

Loading…
Cancel
Save