Skip to content

Commit 8546d71

Browse files
authored
Merge pull request #514 from fractal-analytics-platform/conditional-v1
Conditionally included V1 pages
2 parents 120f183 + 99d89a4 commit 8546d71

File tree

11 files changed

+92
-29
lines changed

11 files changed

+92
-29
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ PUBLIC_OAUTH_CLIENT_NAME=
1717
LOG_FILE=/tmp/fractal-web.log
1818
LOG_LEVEL_FILE=info
1919
LOG_LEVEL_CONSOLE=warn
20+
21+
FRACTAL_API_V1_MODE=include

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ PUBLIC_OAUTH_CLIENT_NAME=
1616
LOG_FILE=./fractal-web.log
1717
LOG_LEVEL_FILE=debug
1818
LOG_LEVEL_CONSOLE=info
19+
20+
FRACTAL_API_V1_MODE=include

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Unreleased
44

5+
* Conditionally included V1 pages (\#514);
56
* Added task version update sandbox page (\#509);
67
* JSON Schema form improvements (\#509):
78
* supported enums of any type;

docs/development/tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ LOCAL_PORT=8000
4343
REMOTE_USER=...
4444
REMOTE_HOST_IP=...
4545
46-
ssh $REMOTE_USER@$REMOTE_HOST_IP -L $LOCAL_PORT:$REMOTE_HOST_IP:$REMOTE_PORT -N
46+
ssh $REMOTE_USER@$REMOTE_HOST_IP -L $LOCAL_PORT:127.0.0.1:$REMOTE_PORT -N
4747
```
4848
should work and forward the remote port `REMOTE_PORT` to the `LOCAL_PORT` on
4949
localhost, so that `fractal-web` can use it from the local machine. Note that

docs/environment-variables.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ The following environment variables can be used to configure fractal-web.
1515
* `PUBLIC_OAUTH_CLIENT_NAME`: if set, the application enables the external account login via OAuth2; the name is used to create the authorization call sent to fractal-server (see [configuration page](../oauth2/));
1616
* `LOG_FILE`: the path of the file where logs will be written; by default is unset and no file will be created;
1717
* `LOG_LEVEL_FILE`: the log level of logs that will be written to the file; the default value is `info`;
18-
* `LOG_LEVEL_CONSOLE`: the log level of logs that will be written to the console; the default value is `warn`.
18+
* `LOG_LEVEL_CONSOLE`: the log level of logs that will be written to the console; the default value is `warn`;
19+
* `FRACTAL_API_V1_MODE`: include/exclude V1 pages and version switcher; the default value is `include`.
1920

2021
When running directly using `node` command these extra variables can also be configured:
2122

docs/quickstart.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export LOG_FILE=fractal-web.log
5555
# export LOG_LEVEL_FILE=info
5656
# export LOG_LEVEL_CONSOLE=warn
5757

58+
export FRACTAL_API_V1_MODE=include
59+
5860
# default values are usually fine for the following variables; remove comments if needed
5961
#export AUTH_COOKIE_NAME=fastapiusersauth
6062
#export AUTH_COOKIE_PATH=/

package-lock.json

Lines changed: 52 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/routes/+layout.server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { env } from '$env/dynamic/private';
12
import { getLogger } from '$lib/server/logger.js';
23

34
const logger = getLogger('page layout');
@@ -15,5 +16,8 @@ export async function load({ locals, request, url }) {
1516
logger.error('pageInfo is missing, it should have been loaded by hooks.server.js');
1617
}
1718

18-
return pageInfo;
19+
return {
20+
...pageInfo,
21+
v1Enabled: env.FRACTAL_API_V1_MODE !== 'exclude'
22+
};
1923
}

src/routes/+layout.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
let clientVersion = __APP_VERSION__;
1717
1818
$: displayVersionSelector =
19+
$page.data.v1Enabled &&
1920
(!isSubPage($page.url.pathname, apiVersion) ||
2021
$page.url.pathname === '/v2/admin/jobs' ||
2122
$page.url.pathname === '/v1/admin/jobs') &&

src/routes/+page.svelte

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@
3232
{/if}
3333
</div>
3434

35-
<p>
36-
This is the new version 2 of Fractal. Your older projects and workflows are still available in
37-
the legacy version that you can access in <a href="/v1/projects">the legacy project page</a>. We
38-
encourage you to switch to Fractal V2 for all new projects and report any issues you find.
39-
</p>
40-
<p>
41-
We strictly separate projects, datasets and workflows into Fractal V2 and legacy. You can use
42-
many of your existing tasks in the Fractal V2 version without any changes required. If you don't
43-
find the task you require in Fractal V2, please reach out to the support.
44-
</p>
35+
{#if $page.data.v1Enabled}
36+
<p>
37+
This is the new version 2 of Fractal. Your older projects and workflows are still available in
38+
the legacy version that you can access in <a href="/v1/projects">the legacy project page</a>.
39+
We encourage you to switch to Fractal V2 for all new projects and report any issues you find.
40+
</p>
41+
<p>
42+
We strictly separate projects, datasets and workflows into Fractal V2 and legacy. You can use
43+
many of your existing tasks in the Fractal V2 version without any changes required. If you
44+
don't find the task you require in Fractal V2, please reach out to the support.
45+
</p>
46+
{/if}
4547

4648
{#if env.PUBLIC_FRACTAL_ADMIN_SUPPORT_EMAIL}
4749
<h3 class="fw-light">Where to get support</h3>

0 commit comments

Comments
 (0)