[ARVADOS-WORKBENCH2] created: 2.1.0-429-g836dde38
Git user
git at public.arvados.org
Thu Jun 24 17:55:22 UTC 2021
at 836dde381f828481fd0dc20ab1356bd4c877a236 (commit)
commit 836dde381f828481fd0dc20ab1356bd4c877a236
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date: Thu Jun 24 19:46:51 2021 +0200
16971: Fixed project edit issues and added tests
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
diff --git a/cypress/integration/favorites.spec.js b/cypress/integration/favorites.spec.js
index 6e9091e1..506cd251 100644
--- a/cypress/integration/favorites.spec.js
+++ b/cypress/integration/favorites.spec.js
@@ -132,7 +132,46 @@ describe('Favorites tests', function () {
});
});
- 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,
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index 800f57d9..6d8aef74 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -73,6 +73,7 @@ export const filterGroupActionSet: ContextMenuActionSet = [
icon: RenameIcon,
name: "Edit project",
execute: (dispatch, resource) => {
+ console.log(resource);
dispatch<any>(openProjectUpdateDialog(resource));
}
},
diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx
index 48a9e330..23b0c005 100644
--- a/src/views/favorite-panel/favorite-panel.tsx
+++ b/src/views/favorite-panel/favorite-panel.tsx
@@ -34,7 +34,11 @@ import { RootState } from '~/store/store';
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";
@@ -109,6 +113,7 @@ export const favoritePanelColumns: DataColumns<string> = [
];
interface FavoritePanelDataProps {
+ currentItemId: any;
favorites: FavoritesState;
resources: ResourcesState;
userUuid: string;
@@ -123,6 +128,7 @@ const mapStateToProps = (state : RootState): FavoritePanelDataProps => ({
favorites: state.favorites,
resources: state.resources,
userUuid: state.auth.user!.uuid,
+ currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
});
type FavoritePanelProps = FavoritePanelDataProps & FavoritePanelActionProps & DispatchProp
@@ -133,14 +139,34 @@ export const FavoritePanel = withStyles(styles)(
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));
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 35a7f9c1..4327d1b7 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -183,7 +183,8 @@ export const ProjectPanel = withStyles(styles)(
ownerUuid: resource.ownerUuid,
isTrashed: ('isTrashed' in resource) ? resource.isTrashed: false,
kind: resource.kind,
- menuKind
+ menuKind,
+ description: resource.description,
}));
}
this.props.dispatch<any>(loadDetailsPanel(resourceUuid));
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list