1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { reduxForm } from 'redux-form';
6 import { compose } from 'redux';
7 import { connect } from 'react-redux';
8 import SharingPublicAccessFormComponent from './sharing-public-access-form-component';
9 import { SHARING_PUBLIC_ACCESS_FORM_NAME, VisibilityLevel } from 'store/sharing-dialog/sharing-dialog-types';
10 import { RootState } from 'store/store';
11 import { getSharingPublicAccessFormData } from '../../store/sharing-dialog/sharing-dialog-types';
17 export const SharingPublicAccessForm = compose(
18 reduxForm<{}, SaveProps>(
19 { form: SHARING_PUBLIC_ACCESS_FORM_NAME }
22 (state: RootState) => {
23 const { visibility } = getSharingPublicAccessFormData(state) || { visibility: VisibilityLevel.PRIVATE };
24 const includePublic = state.auth.config.clusterConfig.Users.AnonymousUserToken.length > 0;
25 return { visibility, includePublic };
28 )(SharingPublicAccessFormComponent);