Skip to content

Commit a94820b

Browse files
committed
Changed home page text and improved version switcher
1 parent 64ffe97 commit a94820b

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

src/lib/common/selected_api_version.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { goto } from "$app/navigation";
22

3-
export const versionsLabels = {
4-
v1: 'legacy',
5-
v2: 'current'
6-
};
7-
83
/**
94
* Save the selected API version in the cookie and reload the page.
105
* This function is called from the Svelte frontend.

src/routes/+layout.server.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FRACTAL_SERVER_HOST } from '$env/static/private';
22
import { getCurrentUser } from '$lib/server/api/v1/auth_api';
33

4-
export async function load({ fetch, cookies, request }) {
4+
export async function load({ fetch, cookies }) {
55
// This is a mark to notify and log when the server is running SSR
66
console.log('SSR - Main layout');
77

@@ -16,17 +16,14 @@ export async function load({ fetch, cookies, request }) {
1616
console.error(error);
1717
});
1818

19-
const apiVersion = request.url.includes('/v1/') ? 'v1' : 'v2';
20-
2119
// Check user info
2220
// Check auth cookie is present
2321
const fastApiUsersAuth = cookies.get('fastapiusersauth');
2422
if (!fastApiUsersAuth) {
2523
console.log('No auth cookie found');
2624
return {
2725
serverInfo,
28-
userInfo: null,
29-
apiVersion
26+
userInfo: null
3027
};
3128
}
3229

@@ -38,7 +35,6 @@ export async function load({ fetch, cookies, request }) {
3835

3936
return {
4037
serverInfo,
41-
userInfo,
42-
apiVersion
38+
userInfo
4339
};
4440
}

src/routes/+layout.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$: isAdmin = userLoggedIn && $page.data.userInfo.is_superuser;
1010
$: server = $page.data.serverInfo || {};
1111
/** @type {'v1'|'v2'} */
12-
let apiVersion = $page.data.apiVersion;
12+
$: apiVersion = $page.url.pathname.startsWith('/v1') ? 'v1': 'v2';
1313
// @ts-ignore
1414
// eslint-disable-next-line no-undef
1515
let clientVersion = __APP_VERSION__;
@@ -81,7 +81,6 @@
8181
* @param {'v1'|'v2'} version
8282
*/
8383
function setSelecteApiVersion(version) {
84-
apiVersion = version;
8584
reloadVersionedPage($page.url.pathname, version);
8685
}
8786

src/routes/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
<p>
3333
This is the new version 2 of Fractal. Your older projects and workflows are still available in
34-
the legacy version that you can access here (links to legacy project page). We encourage you to
35-
switch to Fractal V2 for all new projects and report any issues you find.
34+
the legacy version that you can access in <a href="/v1/projects">the legacy project page</a>. We
35+
encourage you to switch to Fractal V2 for all new projects and report any issues you find.
3636
</p>
3737
<p>
3838
We strictly separate projects, datasets and workflows into Fractal V2 and legacy. You can use

0 commit comments

Comments
 (0)