Skip to content

Commit 6f1f908

Browse files
authored
Changed PUBLIC to Shared and RESTRICTED to Restricted (#1133)
1 parent 2609a48 commit 6f1f908

5 files changed

Lines changed: 28 additions & 20 deletions

File tree

app/next-client-app/app/(protected)/datasets/columns.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ export const columns: ColumnDef<DataSet>[] = [
6969
/>
7070
),
7171
enableHiding: true,
72-
enableSorting: true
72+
enableSorting: true,
73+
// Show Shared Visibility or Restricted Visibility
74+
cell: ({ row }) => (
75+
<span>
76+
{row.original.visibility === "PUBLIC" ? "Shared" : "Restricted"}
77+
</span>
78+
)
7379
},
7480

7581
{

app/next-client-app/components/datasets/CreateDatasetForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function CreateDatasetForm({
101101
viewers: [],
102102
editors: [],
103103
admins: [],
104-
visibility: "PUBLIC",
104+
visibility: "PUBLIC", // Always use "PUBLIC" or "RESTRICTED" for backend compatibility
105105
name: "",
106106
projects: 0,
107107
}}
@@ -169,7 +169,7 @@ export function CreateDatasetForm({
169169
<h3 className="flex">
170170
Visibility
171171
<Tooltips
172-
content="If a Dataset is PUBLIC, then all users with access to any project associated to the Dataset will have Dataset viewer permissions."
172+
content="If a Dataset is shared, then all users with access to any project associated to the Dataset will have Dataset viewer permissions."
173173
link="https://carrot4omop.ac.uk/Carrot-Mapper/projects-datasets-and-scanreports/#access-controls"
174174
/>
175175
</h3>
@@ -186,7 +186,8 @@ export function CreateDatasetForm({
186186
defaultChecked
187187
/>
188188
<Label className="text-lg">
189-
{values.visibility === "PUBLIC" ? "PUBLIC" : "RESTRICTED"}
189+
{/* Show user-friendly label */}
190+
{values.visibility === "PUBLIC" ? "Shared" : "Restricted"}
190191
</Label>
191192
</div>
192193
{!publicVisibility && (

app/next-client-app/components/datasets/DatasetForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function DatasetForm({
8383
<Formik
8484
initialValues={{
8585
name: dataset.name,
86-
visibility: dataset.visibility,
86+
visibility: dataset.visibility, // Should be "PUBLIC" or "RESTRICTED"
8787
viewers: initialViewersFilter.map((viewer) => viewer.value),
8888
editors: initialEditorsFilter.map((editor) => editor.value),
8989
dataPartner: initialPartnerFilter[0].value,
@@ -127,7 +127,7 @@ export function DatasetForm({
127127
<div className="flex items-center space-x-3">
128128
<h3 className="flex">
129129
Visibility
130-
<Tooltips content="If a Dataset is PUBLIC, then all users with access to any project associated to the Dataset can see them." />
130+
<Tooltips content="If a Dataset is shared, then all users with access to any project associated to the Dataset can see them." />
131131
</h3>
132132
<Switch
133133
onCheckedChange={(checked) => {
@@ -143,7 +143,8 @@ export function DatasetForm({
143143
disabled={!canUpdate}
144144
/>
145145
<Label className="text-lg">
146-
{values.visibility === "PUBLIC" ? "PUBLIC" : "RESTRICTED"}
146+
{/* Show user-friendly label */}
147+
{values.visibility === "PUBLIC" ? "Shared" : "Restricted"}
147148
</Label>
148149
</div>
149150
{!publicVisibility && (

app/next-client-app/components/scanreports/CreateScanReportForm.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,19 @@ export function CreateScanReportForm({
194194
});
195195
setPublicVisibility(checked);
196196
}}
197-
defaultChecked
197+
checked={values.visibility === "PUBLIC"}
198198
/>
199199
<Label className="text-lg">
200-
{values.visibility === "PUBLIC" ? "PUBLIC" : "RESTRICTED"}
200+
{/* Show user-friendly label */}
201+
{values.visibility === "PUBLIC" ? "Shared" : "Restricted"}
201202
</Label>
202203
</div>
203204
{!publicVisibility && (
204205
<div className="flex flex-col gap-2">
205206
<h3 className="flex">
206207
{" "}
207208
Viewers
208-
<Tooltips content="If the Scan Report is PUBLIC, then all users with access to the Dataset have viewer access to the Scan Report. Additionally, Dataset admins and editors have viewer access to the Scan Report in all cases." />
209+
<Tooltips content="If the Scan Report is shared, then all users with access to the Dataset have viewer access to the Scan Report. Additionally, Dataset admins and editors have viewer access to the Scan Report in all cases." />
209210
</h3>
210211
{/* Viewers field uses the same logic and data as Editors field */}
211212
<FormikSelectEditors

app/next-client-app/components/scanreports/ScanReportDetailsForm.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function ScanReportDetailsForm({
2727
scanreport,
2828
users,
2929
permissions,
30-
isAuthor,
30+
isAuthor
3131
}: {
3232
datasetList: DataSetSRList[];
3333
scanreport: ScanReport;
@@ -65,7 +65,7 @@ export function ScanReportDetailsForm({
6565
parent_dataset: data.parent_dataset,
6666
viewers: data.viewers || [],
6767
editors: data.editors || [],
68-
author: data.author,
68+
author: data.author
6969
};
7070

7171
const response = await updateScanReport(
@@ -88,7 +88,7 @@ export function ScanReportDetailsForm({
8888
author: initialAuthorFilter[0].value,
8989
viewers: initialViewersFilter.map((viewer) => viewer.value),
9090
editors: initialEditorsFilter.map((editor) => editor.value),
91-
parent_dataset: initialDatasetFilter[0].value,
91+
parent_dataset: initialDatasetFilter[0].value
9292
}}
9393
onSubmit={(data) => {
9494
handleSubmit(data);
@@ -131,7 +131,7 @@ export function ScanReportDetailsForm({
131131
<h3 className="flex">
132132
Visibility
133133
<Tooltips
134-
content="To see the contents of the Scan Report, the Scan Report must be PUBLIC, or users must be an author/editor/viewer of the Scan Report."
134+
content="To see the contents of the Scan Report, the Scan Report must be shared, or users must be an author/editor/viewer of the Scan Report."
135135
link="https://carrot4omop.ac.uk/Carrot-Mapper/projects-datasets-and-scanreports/#access-controls"
136136
/>
137137
</h3>
@@ -140,18 +140,17 @@ export function ScanReportDetailsForm({
140140
handleChange({
141141
target: {
142142
name: "visibility",
143-
value: checked ? "PUBLIC" : "RESTRICTED",
144-
},
143+
value: checked ? "PUBLIC" : "RESTRICTED"
144+
}
145145
});
146146
setPublicVisibility(checked);
147147
}}
148-
defaultChecked={
149-
scanreport.visibility === "PUBLIC" ? true : false
150-
}
148+
checked={values.visibility === "PUBLIC"}
151149
disabled={!canUpdate}
152150
/>
153151
<Label className="text-lg">
154-
{values.visibility === "PUBLIC" ? "PUBLIC" : "RESTRICTED"}
152+
{/* Show user-friendly label */}
153+
{values.visibility === "PUBLIC" ? "Shared" : "Restricted"}
155154
</Label>
156155
</div>
157156
{!publicVisibility && (

0 commit comments

Comments
 (0)