Skip to content

Commit 8d674fc

Browse files
committed
Fix PR comments
1 parent b0dffe3 commit 8d674fc

5 files changed

Lines changed: 27 additions & 19 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: "shared",
104+
visibility: "PUBLIC", // Always use "PUBLIC" or "RESTRICTED" for backend compatibility
105105
name: "",
106106
projects: 0,
107107
}}
@@ -178,15 +178,16 @@ export function CreateDatasetForm({
178178
handleChange({
179179
target: {
180180
name: "visibility",
181-
value: checked ? "shared" : "restricted",
181+
value: checked ? "PUBLIC" : "RESTRICTED",
182182
},
183183
});
184184
setPublicVisibility(checked);
185185
}}
186186
defaultChecked
187187
/>
188188
<Label className="text-lg">
189-
{values.visibility === "shared" ? "shared" : "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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function DatasetForm({
4040
const canUpdate = permissions.includes("CanAdmin");
4141
// State control for viewers fields
4242
const [publicVisibility, setPublicVisibility] = useState<boolean>(
43-
dataset.visibility === "shared" ? true : false
43+
dataset.visibility === "PUBLIC" ? true : false
4444
);
4545

4646
// Making options suitable for React Select
@@ -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,
@@ -134,16 +134,17 @@ export function DatasetForm({
134134
handleChange({
135135
target: {
136136
name: "visibility",
137-
value: checked ? "shared" : "restricted",
137+
value: checked ? "PUBLIC" : "RESTRICTED",
138138
},
139139
});
140140
setPublicVisibility(checked);
141141
}}
142-
defaultChecked={dataset.visibility === "shared" ? true : false}
142+
defaultChecked={dataset.visibility === "PUBLIC" ? true : false}
143143
disabled={!canUpdate}
144144
/>
145145
<Label className="text-lg">
146-
{values.visibility === "shared" ? "shared" : "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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function CreateScanReportForm({
9494
dataset: 0,
9595
viewers: [],
9696
editors: [],
97-
visibility: "shared",
97+
visibility: "PUBLIC",
9898
name: "",
9999
scan_report_file: null,
100100
Data_dict: null
@@ -189,15 +189,16 @@ export function CreateScanReportForm({
189189
handleChange({
190190
target: {
191191
name: "visibility",
192-
value: checked ? "shared" : "restricted"
192+
value: checked ? "PUBLIC" : "RESTRICTED"
193193
}
194194
});
195195
setPublicVisibility(checked);
196196
}}
197-
defaultChecked
197+
checked={values.visibility === "PUBLIC"}
198198
/>
199199
<Label className="text-lg">
200-
{values.visibility === "shared" ? "shared" : "restricted"}
200+
{/* Show user-friendly label */}
201+
{values.visibility === "PUBLIC" ? "Shared" : "Restricted"}
201202
</Label>
202203
</div>
203204
{!publicVisibility && (

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function ScanReportDetailsForm({
3939
const canUpdate = permissions.includes("CanAdmin") || isAuthor;
4040
// State control for viewers fields
4141
const [publicVisibility, setPublicVisibility] = useState<boolean>(
42-
scanreport.visibility === "shared" ? true : false
42+
scanreport.visibility === "PUBLIC" ? true : false
4343
);
4444

4545
// Making options suitable for React Select
@@ -140,18 +140,17 @@ export function ScanReportDetailsForm({
140140
handleChange({
141141
target: {
142142
name: "visibility",
143-
value: checked ? "shared" : "restricted",
143+
value: checked ? "PUBLIC" : "RESTRICTED",
144144
},
145145
});
146146
setPublicVisibility(checked);
147147
}}
148-
defaultChecked={
149-
scanreport.visibility === "shared" ? true : false
150-
}
148+
checked={values.visibility === "PUBLIC"}
151149
disabled={!canUpdate}
152150
/>
153151
<Label className="text-lg">
154-
{values.visibility === "shared" ? "shared" : "restricted"}
152+
{/* Show user-friendly label */}
153+
{values.visibility === "PUBLIC" ? "Shared" : "Restricted"}
155154
</Label>
156155
</div>
157156
{!publicVisibility && (

0 commit comments

Comments
 (0)