X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3f809e0be2a712d1e576f1b2acf4aff73e0f16b0..2a7fd99c212c33a1ec9911f8529fa5afc59a7bb2:/src/views-components/sharing-dialog/sharing-public-access-form.tsx

diff --git a/src/views-components/sharing-dialog/sharing-public-access-form.tsx b/src/views-components/sharing-dialog/sharing-public-access-form.tsx
index bf64ba3277..eb337c38ad 100644
--- a/src/views-components/sharing-dialog/sharing-public-access-form.tsx
+++ b/src/views-components/sharing-dialog/sharing-public-access-form.tsx
@@ -3,17 +3,26 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { reduxForm } from 'redux-form';
-import { connect } from 'react-redux';
 import { compose } from 'redux';
+import { connect } from 'react-redux';
 import SharingPublicAccessFormComponent from './sharing-public-access-form-component';
-import { SHARING_PUBLIC_ACCESS_FORM_NAME } from '~/store/sharing-dialog/sharing-dialog-types';
-import { PermissionLevel } from '~/models/permission';
+import { SHARING_PUBLIC_ACCESS_FORM_NAME, VisibilityLevel } from 'store/sharing-dialog/sharing-dialog-types';
+import { RootState } from 'store/store';
+import { getSharingPublicAccessFormData } from '../../store/sharing-dialog/sharing-dialog-types';
+
+interface SaveProps {
+    onSave: () => void;
+}
+
 export const SharingPublicAccessForm = compose(
-    connect(() => ({
-        initialValues: {
-            enabled: false,
-            permissions: PermissionLevel.CAN_READ,
+    reduxForm<{}, SaveProps>(
+        { form: SHARING_PUBLIC_ACCESS_FORM_NAME }
+    ),
+    connect(
+        (state: RootState) => {
+            const { visibility } = getSharingPublicAccessFormData(state) || { visibility: VisibilityLevel.PRIVATE };
+            const includePublic = state.auth.config.clusterConfig.Users.AnonymousUserToken.length > 0;
+            return { visibility, includePublic };
         }
-    })),
-    reduxForm({ form: SHARING_PUBLIC_ACCESS_FORM_NAME })
-)(SharingPublicAccessFormComponent);
\ No newline at end of file
+    )
+)(SharingPublicAccessFormComponent);
