Skip to content

Commit 0d9f05c

Browse files
committed
Handled FRACTAL_DEFAULT_GROUP_NAME environment variable
1 parent 0a1d02f commit 0d9f05c

37 files changed

+165
-82
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ FRACTAL_RUNNER_BACKEND=local
2323
#NEWS_INFO_PATH=/path/to/news.md
2424

2525
BODY_SIZE_LIMIT=5000000
26+
27+
FRACTAL_DEFAULT_GROUP_NAME=All

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ LOG_LEVEL_CONSOLE=info
2020
FRACTAL_RUNNER_BACKEND=local
2121
#WARNING_BANNER_PATH=/path/to/banner.txt
2222
#NEWS_INFO_PATH=/path/to/news.md
23+
24+
FRACTAL_DEFAULT_GROUP_NAME=All

.github/workflows/end_to_end_tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
run: npx playwright test
7474
env:
7575
FRACTAL_RUNNER_BACKEND: local
76+
FRACTAL_DEFAULT_GROUP_NAME: All
7677

7778
- name: Archive test results
7879
if: always()

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Handled user without profile as not verified users (\#862);
1717
* Added support for oneOf and discriminator (\#867);
1818
* Added resource filter on admin task and task-group pages (\#867);
19+
* Handled `FRACTAL_DEFAULT_GROUP_NAME` environment variable, to specify if a default group is used (\#870);
1920

2021
# 1.20.0
2122

__tests__/user_utilities.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { it, expect } from 'vitest';
22
import {
33
sortUsers,
4-
sortGroupByNameAllFirstComparator,
4+
getSortGroupByNameAllFirstComparator,
55
sortUserToImportSettings
66
} from '$lib/components/admin/user_utilities';
77
import { mockGroup, mockUser } from './mock/mock-types';
@@ -43,7 +43,7 @@ it('should sort groups by name, but keeping the All group first', () => {
4343
mockGroup({ id: 3, name: 'g3' })
4444
];
4545

46-
groups.sort(sortGroupByNameAllFirstComparator);
46+
groups.sort(getSortGroupByNameAllFirstComparator('All'));
4747

4848
expect(groups[0].name).eq('All');
4949
expect(groups[1].name).eq('g2');

__tests__/v2/AddSingleTask.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ describe('AddSingleTask', () => {
3333
render(AddSingleTask, {
3434
props: {
3535
user: mockedUser,
36-
addNewTasks: vi.fn()
36+
addNewTasks: vi.fn(),
37+
defaultGroupName: 'All'
3738
}
3839
});
3940

@@ -68,7 +69,8 @@ describe('AddSingleTask', () => {
6869
render(AddSingleTask, {
6970
props: {
7071
user: mockedUser,
71-
addNewTasks: vi.fn()
72+
addNewTasks: vi.fn(),
73+
defaultGroupName: 'All'
7274
}
7375
});
7476

__tests__/v2/TaskCollection.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('TaskCollection', () => {
6262
});
6363

6464
render(TaskCollection, {
65-
props: { user: mockedUser }
65+
props: { user: mockedUser, defaultGroupName: 'All' }
6666
});
6767

6868
await user.type(screen.getByRole('textbox', { name: 'Package' }), 'test-task');
@@ -94,7 +94,7 @@ describe('TaskCollection', () => {
9494
});
9595

9696
render(TaskCollection, {
97-
props: { user: mockedUser }
97+
props: { user: mockedUser, defaultGroupName: 'All' }
9898
});
9999

100100
await user.type(screen.getByRole('textbox', { name: 'Package' }), 'test-task');
@@ -124,7 +124,7 @@ describe('TaskCollection', () => {
124124
});
125125

126126
render(TaskCollection, {
127-
props: { user: mockedUser }
127+
props: { user: mockedUser, defaultGroupName: 'All' }
128128
});
129129

130130
const addPpvBtn = screen.getByRole('button', { name: 'Add pinned package version' });

__tests__/v2/UserEditor.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ describe('UserEditor', () => {
6363
slurm_accounts: [],
6464
project_dir: null
6565
},
66-
saveUser: mockSaveUser
66+
saveUser: mockSaveUser,
67+
defaultGroupName: 'All'
6768
}
6869
});
6970

@@ -109,7 +110,8 @@ describe('UserEditor', () => {
109110
slurm_accounts: [],
110111
project_dir: null
111112
},
112-
saveUser: mockSaveUser
113+
saveUser: mockSaveUser,
114+
defaultGroupName: 'All'
113115
}
114116
});
115117

@@ -144,7 +146,8 @@ describe('UserEditor', () => {
144146
slurm_accounts: [],
145147
project_dir: '/path/to/project/dir'
146148
},
147-
saveUser: mockSaveUser
149+
saveUser: mockSaveUser,
150+
defaultGroupName: 'All'
148151
}
149152
});
150153

@@ -185,7 +188,8 @@ describe('UserEditor', () => {
185188
slurm_accounts: ['foo', 'bar'],
186189
project_dir: '/path/to/project/dir'
187190
},
188-
saveUser: mockSaveUser
191+
saveUser: mockSaveUser,
192+
defaultGroupName: 'All'
189193
}
190194
});
191195

docs/environment-variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The following environment variables can be used to configure fractal-web.
2222
* `PUBLIC_FRACTAL_FEATURE_EXPLORER_URL`: URL to Fractal Feature Explorer (e.g. http://localhost:8501 for testing);
2323
* `WARNING_BANNER_PATH`: specifies the path to a text file containing the warning banner message displayed on the site; the banner is used to inform users about important issues, such as external resources downtime or maintenance alerts; if the variable is empty or unset no banner is displayed;
2424
* `NEWS_INFO_PATH`: specifies the path to a Markdown file containing the news section of the home page; the title of the section is automatically added; if the variable is empty or unset the news section is not displayed;
25+
* `FRACTAL_DEFAULT_GROUP_NAME`: specifies if a default group exists; allowed values are `All` or empty string (no default group).
2526

2627
When running directly using `node` command these extra variables can also be configured:
2728

docs/quickstart.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export FRACTAL_RUNNER_BACKEND=local
6969
#export AUTH_COOKIE_PATH=/
7070
#export AUTH_COOKIE_SAME_SITE=lax
7171
#export PUBLIC_UPDATE_JOBS_INTERVAL=3000
72+
#export FRACTAL_DEFAULT_GROUP_NAME=
7273

7374
node build/
7475
```

0 commit comments

Comments
 (0)