uuid: string;
name: string;
description?: string;
+ storageClassesDesired?: string[];
}
export const COLLECTION_UPDATE_FORM_NAME = 'collectionUpdateFormName';
services.collectionService.update(uuid, {
name: collection.name,
+ storageClassesDesired: collection.storageClassesDesired,
description: collection.description }
).then(updatedCollection => {
dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: updatedCollection as CollectionResource }));
isEditable?: boolean;
outputUuid?: string;
workflowUuid?: string;
+ storageClassesDesired?: string[];
};
export const isKeyboardClick = (event: React.MouseEvent<HTMLElement>) => event.nativeEvent.detail === 0;
dispatch<any>(openContextMenu(event, {
name: collection.name,
uuid: collection.uuid,
+ description: collection.description,
+ storageClassesDesired: collection.storageClassesDesired,
ownerUuid: collection.ownerUuid,
isTrashed: collection.isTrashed,
kind: collection.kind,
//
// SPDX-License-Identifier: AGPL-3.0
-import { compose } from "redux";
+import { compose, Dispatch } from "redux";
import { reduxForm } from 'redux-form';
import { withDialog } from "store/dialog/with-dialog";
import { DialogCollectionUpdate } from 'views-components/dialog-update/dialog-collection-update';
-import { COLLECTION_UPDATE_FORM_NAME, CollectionUpdateFormDialogData, updateCollection } from 'store/collections/collection-update-actions';
+import {
+ COLLECTION_UPDATE_FORM_NAME,
+ CollectionUpdateFormDialogData,
+ updateCollection
+} from 'store/collections/collection-update-actions';
export const UpdateCollectionDialog = compose(
withDialog(COLLECTION_UPDATE_FORM_NAME),
reduxForm<CollectionUpdateFormDialogData>({
touchOnChange: true,
form: COLLECTION_UPDATE_FORM_NAME,
- onSubmit: (data, dispatch) => {
- dispatch(updateCollection(data));
+ onSubmit: (data: CollectionUpdateFormDialogData, dispatch: Dispatch) => {
+ dispatch<any>(updateCollection(data));
}
})
)(DialogCollectionUpdate);
\ No newline at end of file
import { WithDialogProps } from 'store/dialog/with-dialog';
import { CollectionUpdateFormDialogData } from 'store/collections/collection-update-actions';
import { FormDialog } from 'components/form-dialog/form-dialog';
-import { CollectionNameField, CollectionDescriptionField } from 'views-components/form-fields/collection-form-fields';
+import {
+ CollectionNameField,
+ CollectionDescriptionField,
+ CollectionStorageClassesField
+} from 'views-components/form-fields/collection-form-fields';
type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionUpdateFormDialogData>;
const CollectionEditFields = () => <span>
<CollectionNameField />
<CollectionDescriptionField />
+ <CollectionStorageClassesField />
</span>;
import { PickerIdProp } from 'store/tree-picker/picker-id';
import { connect } from "react-redux";
import { RootState } from "store/store";
+import { MultiCheckboxField } from "components/checkbox-field/checkbox-field";
+import { getStorageClasses } from "common/config";
interface CollectionNameFieldProps {
validate: Validator[];
pickerId={props.pickerId}
component={CollectionTreePickerField}
validate={COLLECTION_PROJECT_VALIDATION} />;
+
+interface StorageClassesProps {
+ items: string[];
+}
+
+export const CollectionStorageClassesField = connect(
+ (state: RootState) => {
+ return {
+ items: getStorageClasses(state.auth.config)
+ };
+ })(
+ (props: StorageClassesProps) =>
+ <Field
+ name='storageClassesDesired'
+ label='Storage classes'
+ minSelection={1}
+ rowLayout={true}
+ helperText='At least one class should be selected'
+ component={MultiCheckboxField}
+ items={props.items} />);
\ No newline at end of file
ResourceLastModifiedDate,
ResourceStatus
} from 'views-components/data-explorer/renderers';
+import { getResource, ResourcesState } from 'store/resources/resources';
+import { RootState } from 'store/store';
+import { CollectionResource } from 'models/collection';
type CssRules = 'backLink' | 'backIcon' | 'card' | 'title' | 'iconHeader' | 'link';
}
];
-export interface CollectionContentAddressPanelActionProps {
- onContextMenu: (event: React.MouseEvent<any>, uuid: string) => void;
+interface CollectionContentAddressPanelActionProps {
+ onContextMenu: (resources: ResourcesState) => (event: React.MouseEvent<any>, uuid: string) => void;
onItemClick: (item: string) => void;
onItemDoubleClick: (item: string) => void;
}
+interface CollectionContentAddressPanelDataProps {
+ resources: ResourcesState;
+}
+
+const mapStateToProps = ({ resources }: RootState): CollectionContentAddressPanelDataProps => ({
+ resources
+})
+
const mapDispatchToProps = (dispatch: Dispatch): CollectionContentAddressPanelActionProps => ({
- onContextMenu: (event, resourceUuid) => {
+ onContextMenu: (resources: ResourcesState) => (event, resourceUuid) => {
+ const resource = getResource<CollectionResource>(resourceUuid)(resources);
const kind = dispatch<any>(resourceUuidToContextMenuKind(resourceUuid));
if (kind) {
dispatch<any>(openContextMenu(event, {
- name: '',
+ name: resource ? resource.name : '',
+ description: resource ? resource.description : '',
+ storageClassesDesired: resource ? resource.storageClassesDesired : [],
uuid: resourceUuid,
ownerUuid: '',
kind: ResourceKind.NONE,
}
export const CollectionsContentAddressPanel = withStyles(styles)(
- connect(null, mapDispatchToProps)(
- class extends React.Component<CollectionContentAddressPanelActionProps & CollectionContentAddressDataProps & WithStyles<CssRules>> {
+ connect(mapStateToProps, mapDispatchToProps)(
+ class extends React.Component<CollectionContentAddressPanelActionProps & CollectionContentAddressPanelDataProps & CollectionContentAddressDataProps & WithStyles<CssRules>> {
render() {
return <Grid item xs={12}>
<Button
hideSearchInput
onRowClick={this.props.onItemClick}
onRowDoubleClick={this.props.onItemDoubleClick}
- onContextMenu={this.props.onContextMenu}
+ onContextMenu={this.props.onContextMenu(this.props.resources)}
contextMenuColumn={true}
title={`Content address: ${this.props.match.params.id}`}
dataTableDefaultView={
import { GroupClass, GroupResource } from 'models/group';
import { getProperty } from 'store/properties/properties';
import { PROJECT_PANEL_CURRENT_UUID } from 'store/project-panel/project-panel-action';
+import { CollectionResource } from 'models/collection';
type CssRules = "toolbar" | "button";
const menuKind = this.props.dispatch<any>(resourceUuidToContextMenuKind(resourceUuid, readonly));
- if (menuKind&& resource) {
+ if (menuKind && resource) {
this.props.dispatch<any>(openContextMenu(event, {
name: resource.name,
uuid: resource.uuid,
kind: resource.kind,
menuKind,
description: resource.description,
+ storageClassesDesired: (resource as CollectionResource).storageClassesDesired,
}));
}
this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
} from 'store/resource-type-filters/resource-type-filters';
import { GroupContentsResource } from 'services/groups-service/groups-service';
import { GroupClass, GroupResource } from 'models/group';
+import { CollectionResource } from 'models/collection';
type CssRules = 'root' | "button";
kind: resource.kind,
menuKind,
description: resource.description,
+ storageClassesDesired: (resource as CollectionResource).storageClassesDesired,
}));
}
this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
import { PublicFavoritesState } from 'store/public-favorites/public-favorites-reducer';
import { getResource, ResourcesState } from 'store/resources/resources';
import { GroupContentsResource } from 'services/groups-service/groups-service';
+import { CollectionResource } from 'models/collection';
type CssRules = "toolbar" | "button";
dispatch<any>(openContextMenu(event, {
name: resource.name,
description: resource.description,
+ storageClassesDesired: (resource as CollectionResource).storageClassesDesired,
uuid: resourceUuid,
ownerUuid: '',
kind: ResourceKind.NONE,