Skip to content

Commit ef627e1

Browse files
committed
enable backwards compatibility and separation between the export schema and the import one
1 parent 80e0dff commit ef627e1

File tree

22 files changed

+140
-76
lines changed

22 files changed

+140
-76
lines changed

electron/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ ipcMain.handle('getVersion', () => {
218218
version: `v${app.getVersion()}`,
219219
platform: process.platform,
220220
arch: process.arch,
221+
integrityVersion: INTEGRITY_VERSION_NUMBER,
221222
}
222223
})
223224

web/src/components/MapViewingOptions/MapViewingOptions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ const MapViewingOptions: React.FC<MapViewingOptionsProps> = ({
4949
selectedOptionId={selectedLayeringAlgo}
5050
options={[
5151
{
52-
id: LayeringAlgorithm.LongestPath,
52+
id: "LongestPath",
5353
text: 'Minimum Height',
5454
},
5555
{
56-
id: LayeringAlgorithm.CoffmanGraham,
56+
id: "CoffmanGraham",
5757
text: 'Constrained Width',
5858
},
5959
]}

web/src/drawing/layoutFormula.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ function layoutForGraph(
9797
// TODO: add back in when we figure out how to not have it crash
9898
// case LayeringAlgorithm.Simplex:
9999
// return simplex
100-
case LayeringAlgorithm.LongestPath:
100+
case "LongestPath":
101101
return longestPath
102-
case LayeringAlgorithm.CoffmanGraham:
102+
case "CoffmanGraham":
103103
return coffmanGraham
104104
default:
105105
return coffmanGraham

web/src/hooks/useVersionChecker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ export default function useVersionChecker(
9898
isTest?: boolean
9999
): {
100100
currentVersion: string
101+
integrityVersion: number
101102
platform: string
102103
arch: string
103104
newReleaseVersion: string
104105
releaseNotes: string
105106
sizeForPlatform: string
106107
} {
107108
const [currentVersion, setCurrentVersion] = useState('')
109+
const [integrityVersion, setIntegrityVersion] = useState<number>(null)
108110
const [platform, setPlatform] = useState('')
109111
const [arch, setArch] = useState('')
110112
const [newReleaseVersion, setNewReleaseVersion] = useState('')
@@ -119,10 +121,12 @@ export default function useVersionChecker(
119121
.then(
120122
(currentVersionInfo: {
121123
version: string
124+
integrityVersion: number
122125
platform: string
123126
arch: string
124127
}) => {
125128
setCurrentVersion(currentVersionInfo.version)
129+
setIntegrityVersion(currentVersionInfo.integrityVersion)
126130
setPlatform(currentVersionInfo.platform)
127131
setArch(currentVersionInfo.arch)
128132
}
@@ -160,6 +164,7 @@ export default function useVersionChecker(
160164
return newReleaseVersion
161165
? {
162166
currentVersion,
167+
integrityVersion,
163168
platform,
164169
arch,
165170
newReleaseVersion,

web/src/migrating/export.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
import { AllProjectsDataExport, ProjectExportDataV1 } from 'zod-models'
12
import constructProjectDataFetchers from '../api/projectDataFetchers'
23
import ProjectsZomeApi from '../api/projectsApi'
34
import { getAppWs } from '../hcWebsockets'
45
import { RootState } from '../redux/reducer'
56
import { ProjectMeta } from '../types'
67
import { ActionHashB64, CellIdString } from '../types/shared'
78
import { cellIdFromString } from '../utils'
8-
import { AllProjectsDataExport } from './model/allProjectsDataExport'
9-
import { ProjectExportDataV1 } from './model/projectExportData'
109

1110
export type ExportType = 'csv' | 'json'
1211

@@ -31,7 +30,7 @@ export async function internalExportProjectsData(
3130
store: any,
3231
toVersion: string,
3332
onStep: (completed: number, toComplete: number) => void,
34-
integrityVersion: string
33+
integrityVersion: number
3534
): Promise<AllProjectsDataExport | null> {
3635
const initialState: RootState = store.getState()
3736

@@ -105,6 +104,7 @@ export async function internalExportProjectsData(
105104
export default async function exportProjectsData(
106105
store: any,
107106
toVersion: string,
107+
fromIntegrityVersion: number,
108108
onStep: (completed: number, toComplete: number) => void
109109
) {
110110
return internalExportProjectsData(
@@ -114,8 +114,7 @@ export default async function exportProjectsData(
114114
store,
115115
toVersion,
116116
onStep,
117-
'8' // TODO: replace with INTEGRITY_VERSION_NUMBER
118-
// INTEGRITY_VERSION_NUMBER
117+
fromIntegrityVersion
119118
)
120119
}
121120

web/src/migrating/import/cloneFunctions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const cloneProjectMeta = (
108108
// add a fallback layering algorithm in case the project has none
109109
layeringAlgorithm: old['layeringAlgorithm']
110110
? old['layeringAlgorithm']
111-
: LayeringAlgorithm.LongestPath,
111+
: "LongestPath",
112112
createdAt: Date.now(),
113113
creatorAgentPubKey: agentAddress,
114114
passphrase: passphrase,

web/src/redux/ephemeral/animations/layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function performLayoutAnimation(
7171

7272
const projectMeta = nextState.projects.projectMeta
7373
const layeringAlgorithm =
74-
projectMeta[projectId]?.layeringAlgorithm || LayeringAlgorithm.LongestPath
74+
projectMeta[projectId]?.layeringAlgorithm || "LongestPath"
7575
// this is our final destination layout
7676
// that we'll be animating to
7777
const newLayout = layoutFormula(

web/src/redux/ephemeral/map-view-settings/reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface CollapsedOutcomesState {
1616
const defaultState: CollapsedOutcomesState = {
1717
hiddenAchievedOutcomes: [],
1818
hiddenSmallOutcomes: [],
19-
selectedLayeringAlgo: LayeringAlgorithm.LongestPath,
19+
selectedLayeringAlgo: "LongestPath",
2020
}
2121

2222
export default function (

web/src/routes/App.connector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function mapStateToProps(state: RootState): AppStateProps {
7474

7575
const selectedLayeringAlgo = activeProjectMeta
7676
? activeProjectMeta.layeringAlgorithm
77-
: LayeringAlgorithm.LongestPath
77+
: "LongestPath"
7878

7979
return {
8080
profilesCellIdString,

web/src/routes/Dashboard/Dashboard.connector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function mapDispatchToProps(dispatch): DashboardDispatchProps {
118118
creatorAgentPubKey: agentAddress,
119119
createdAt: Date.now(),
120120
isImported: false,
121-
layeringAlgorithm: LayeringAlgorithm.CoffmanGraham,
121+
layeringAlgorithm: "CoffmanGraham",
122122
topPriorityOutcomes: [],
123123
isMigrated: null,
124124
}

0 commit comments

Comments
 (0)