- event.preventDefault();
- const resource = getResource(resourceUuid)(this.props.resources) as CollectionResource | ProjectResource | undefined;
- if (resource) {
- let kind: ContextMenuKind;
-
- if (resource.kind === ResourceKind.PROJECT) {
- kind = ContextMenuKind.PROJECT;
- } else if (resource.kind === ResourceKind.COLLECTION) {
- kind = ContextMenuKind.COLLECTION_RESOURCE;
- } else {
- kind = ContextMenuKind.RESOURCE;
- }
- if (kind !== ContextMenuKind.RESOURCE) {
- this.props.dispatch(
- contextMenuActions.OPEN_CONTEXT_MENU({
- position: { x: event.clientX, y: event.clientY },
- resource: {
- uuid: resource.uuid,
- name: resource.name || '',
- description: resource.description,
- kind,
- }
- })
- );
- }
+ const { resources } = this.props;
+ const resource = getResource<GroupContentsResource>(resourceUuid)(resources);
+ // When viewing the contents of a filter group, all contents should be treated as read only.
+ let readonly = false;
+ const project = getResource<GroupResource>(this.props.currentItemId)(resources);
+ if (project && project.groupClass === GroupClass.FILTER) {
+ readonly = true;
+ }
+
+ const menuKind = this.props.dispatch<any>(resourceUuidToContextMenuKind(resourceUuid, readonly));
+ if (menuKind && resource) {
+ this.props.dispatch<any>(openContextMenu(event, {
+ name: resource.name,
+ uuid: resource.uuid,
+ ownerUuid: resource.ownerUuid,
+ isTrashed: ('isTrashed' in resource) ? resource.isTrashed: false,
+ kind: resource.kind,
+ menuKind,
+ description: resource.description,
+ }));