});
});
- it('can view favourites in workflow', () => {
+ it.only('can edit project in favorites', () => {
+ cy.createProject({
+ owningUser: adminUser,
+ targetUser: activeUser,
+ projectName: 'mySharedWritableProject',
+ description: 'test 123123',
+ canWrite: true,
+ addToFavorites: true
+ });
+
+ cy.createCollection(adminUser.token, {
+ owner_uuid: activeUser.user.uuid,
+ name: `Test target collection ${Math.floor(Math.random() * 999999)}`,
+ }).as('testTargetCollection').then(function (testTargetCollection) {
+ cy.addToFavorites(activeUser.token, activeUser.user.uuid, testTargetCollection.uuid);
+ });
+
+ cy.getAll('@mySharedWritableProject', '@testTargetCollection')
+ .then(function ([mySharedWritableProject, testTargetCollection]) {
+ cy.loginAs(activeUser);
+
+ cy.get('[data-cy=side-panel-tree]').contains('My Favorites').click();
+
+ cy.get('main').contains(mySharedWritableProject.name).rightclick();
+ cy.get('[data-cy=context-menu]').contains('Edit project').click();
+ cy.get('[data-cy=form-dialog]').within(() => {
+ cy.get('input[name=name]').should('have.value', mySharedWritableProject.name);
+ cy.get('[data-cy=form-cancel-btn]').click();
+ });
+
+ cy.get('main').contains(testTargetCollection.name).rightclick();
+ cy.get('[data-cy=context-menu]').contains('Edit collection').click();
+ cy.get('[data-cy=form-dialog]').within(() => {
+ cy.get('input[name=name]').should('have.value', testTargetCollection.name);
+ cy.get('[data-cy=form-cancel-btn]').click();
+ });
+ });
+ });
+
+ it('can view favorites in workflow', () => {
cy.createProject({
owningUser: adminUser,
targetUser: activeUser,
import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
import { createTree } from '~/models/tree';
import { getSimpleObjectTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
-import { ResourcesState } from '~/store/resources/resources';
+import { getResource, ResourcesState } from '~/store/resources/resources';
+import { GroupContentsResource } from '~/services/groups-service/groups-service';
+import { GroupClass, GroupResource } from '~/models/group';
+import { getProperty } from '~/store/properties/properties';
+import { PROJECT_PANEL_CURRENT_UUID } from '~/store/project-panel/project-panel-action';
type CssRules = "toolbar" | "button";
];
interface FavoritePanelDataProps {
+ currentItemId: any;
favorites: FavoritesState;
resources: ResourcesState;
userUuid: string;
favorites: state.favorites,
resources: state.resources,
userUuid: state.auth.user!.uuid,
+ currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
});
type FavoritePanelProps = FavoritePanelDataProps & FavoritePanelActionProps & DispatchProp
class extends React.Component<FavoritePanelProps> {
handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
- const menuKind = this.props.dispatch<any>(resourceUuidToContextMenuKind(resourceUuid));
- if (menuKind) {
+ const { resources } = this.props;
+ const resource = getResource<GroupContentsResource>(resourceUuid)(resources);
+
+ 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: '',
+ // uuid: resourceUuid,
+ // ownerUuid: '',
+ // kind: ResourceKind.NONE,
+ // menuKind
+ // }));
this.props.dispatch<any>(openContextMenu(event, {
- name: '',
- uuid: resourceUuid,
- ownerUuid: '',
- kind: ResourceKind.NONE,
- menuKind
+ name: resource.name,
+ uuid: resource.uuid,
+ ownerUuid: resource.ownerUuid,
+ isTrashed: ('isTrashed' in resource) ? resource.isTrashed: false,
+ kind: resource.kind,
+ menuKind,
+ description: resource.description,
}));
}
this.props.dispatch<any>(loadDetailsPanel(resourceUuid));