Skip to content

Add project management feature - #1360

Merged
Yicong-Huang merged 24 commits into
apache:masterfrom
ethanwong16:ethan-project-management
Feb 4, 2022
Merged

Yicong-Huang merged 24 commits into
apache:masterfrom
ethanwong16:ethan-project-management

Conversation

@ethanwong16

@ethanwong16 ethanwong16 commented Nov 5, 2021 •

Copy link
Copy Markdown
Contributor

Introduction


This PR introduces a "user project" feature which acts like a label to help organize a user's workflows and files. As the number of workflows and files of a user begins to grow too large to manage individually, the user may group them into various, easier-to-manage projects. The main goals of this PR are to allow a user to:

  • Create / rename / delete projects
  • View a list of their projects
  • Add workflows / files to a project
  • Remove workflows / files from a project
  • View a particular project and its workflows / files

Solution


The main design goal is to minimize cluttering in the UserDashboard component by having each project display only relevant information, such as only the workflows and files that belong to that project. Also, rather than displaying all project information in a single component, there are two components that separate seeing a user's list of projects from seeing what a single project contains.

To address these requirements, a new feature has been added to the User Dashboard, and a typical use case is as follows:

  • Navigate to the User Dashboard
  • Click on "User Projects" from the Feature Bar
  • View / rename / delete / sort the user's list of projects
  • Click on a particular project
  • View / add / remove workflows and files of that particular project
  • Manage the workflows / files themselves from within a project

Currently projects are backwards compatible with workflows and files (workflows / files features function completely independently of projects). Workflows and files do not have to be associated with a user project.

On the database layer, a new user_project table was created to store information about each project: a project's id, a project owner's id, the name of the project, and its time of creation. New tables workflow_of_project and file_of_project were also created to store mappings between a project and the workflows / files it contains. These mapping tables have dependencies on the user_project, workflow, and user_file tables, and any deletions will cascade to the mappings as well.

A new backend API endpoint was created at 'api/project' in ProjectResource.scala handling requests from the frontend.

On the frontend, the following were created to implement the user project feature:

  • UserProjectListComponent : a child component of UserDashboard which lists all the projects of a user
  • UserProjectSectionComponent : another child component of UserDashboard listing a single project and the workflows / files it contains
  • UserProjectService : handling requests to backend API
  • NgbdModalAddProjectFileComponent, NgbdModalRemoveProjectFileComponent, NgbdModalAddProjectWorkflowComponent, NgbdModalRemoveProjectWorkflowComponent : modals to enable adding / removing workflows / files of project

Demo


user-project-demo.mov

Current Issues


Currently there is some usage of non read-only data structures to enable sorting of projects / workflows, but ideally it should be fixed to be ReadOnly. There are also some instances of duplicate logic introduced such as in the UserProjectSectionComponent to avoid updating the SavedWorkflowSectionComponent and UserFileSectionComponent. However, to improve maintainability such components should be modified to support user projects and reused.

Future TODOs


The basic features of a user project are included in this PR, but other immediate goals include refactoring the current code to reduce duplicate logic and switching to purely read-only data structures. Enhancements to the user project feature also include introducing colors to projects to allow for clearer visual indication of organization and potentially introducing sharing of projects.

- Update texera_db schema to include projects
- Regenerate JOOQ files
- Create ProjectResource Scala model
- Add ability to get, create, delete, update projects
- Add ability to get / delete workflows and files of a project
- Add new API endpoint '/project' in TexeraWebApplication.scala
@ethanwong16 ethanwong16 closed this Nov 5, 2021
@ethanwong16

Copy link
Copy Markdown
Contributor Author

closed on accident

Comment thread core/scripts/sql/texera_ddl.sql Resolved

@shengquan-ni shengquan-ni left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a minor comment. Will approve this PR when both frontend and backend changes are completed.

@Xiao-zhen-Liu

Copy link
Copy Markdown
Contributor

Group discussion 1/11: @shengquan-ni will ask @ethanwong16 to finish it soon

- Backend Changes
	1) check for creating projects with duplicated names
	2) creating a project returns new Project object
- Changed Frontend Features
	1) User Projects Page (lists a user's projects)
		- error message when renaming / creating project with duplicate names
		- utilize front end cache to minimize need to refresh list of projects after creating / deleting a project
	2) Single Project Page (a project and all of its files / workflows)
		- files are no longer stored in cache, modeled off of UserFileService and refreshing after an update
		- finish implementation for deleting file from this page
		- finish implementation of adding workflows created on this page to the project as well
@ethanwong16 ethanwong16 changed the title Add project management API endpoint + data schema Add project management feature Jan 21, 2022
@ethanwong16

Copy link
Copy Markdown
Contributor Author

Full List of Changes / Features

Backend Changes

  • Update texera_db schema to include projects, workflows of projects, and files of projects
  • Regenerate JOOQ files to include project table data access
  • Create ProjectResource Scala model
  • Add ability to get, create, delete, update projects
  • Add ability to get / delete workflows and files of a project
  • Add new API endpoint '/project' in TexeraWebApplication.scala

Frontend Changes

  • Create new Dashboard section for user projects
  • Create User Project Page to view list of projects belonging to a user
  • Enable creating, renaming, deleting, sorting displayed order of projects
  • Create Single Project Page to view list of workflows and files belonging to a particular project
  • Enable adding, removing workflows and files that belong to a project
  • Enable sharing, duplicating, and deleting workflows themselves from single project page
  • Enable sharing, downloading, and deleting files themselves from single project page

@shengquan-ni shengquan-ni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left minor comments but I think this PR can be merged directly.

@Yicong-Huang Yicong-Huang left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I see most of logics make good sense. I have not tested the GUI, but will do it in the next round. Some comments and suggestions:

  1. use UserFile instead of file or File in all occurrences. This is to avoid confusion as UserFile is a specific term.
  2. use UserProject instead of project in all occurrences. project is quite general and could be ambiguous when referred.
  3. remove frontend caches of data. this is to reduce the un-synchronization situation when we use those services in co-editing context.
  4. reduce the number of db queries in each backend endpoints. pay attention to complexity of those backend endpoints as project content can scale up in the long run.
  5. many of the logics are completely duplicate from WorkflowSectionComponent and UserFileSectionComponent. please make sure to leave one copy only. we do not want to maintain two copies of logics.

Comment thread core/scripts/sql/texera_ddl.sql Resolved
- in texera_db, renamed 'project' table into 'user_project' table
- regenerated JOOQ tables and data access objects for 'user_project'
- updated ProjectResource.scala API endpoint paths as requested
- updated frontend user-project.service.ts to call updated endpoints
- added @permitAll to ProjectResource.scala to allow all users to access
- updated logic for ProjectResource.scala listProjectWorkflows and listProjectFiles to use DB join
- updated logic for ProjectResource.scala createProject to use try / catch and minimize number of queries
- updated logic for ProjectResource.scala updateProjectName to use try / catch to validate name
- now performs name validation for whitespace or empty renaming
- also checks for renaming to an already existing project name
- rename ownerId to use 'ID' instead of 'Id'
- created utility function to validate project names
- utilized NotificationService to display error messages
- UserProjectSection --> UserProjectList : this component lists a user's projects
- ProjectPage --> UserProjectSection     : this component is for a single user project
- updated some routing / variables to use user project instead of project

@Yicong-Huang Yicong-Huang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better now!
Some comments:

  1. when backend return a non-200 status code, frontend observable will break. make sure you handle those cases to show error messages correctly to users. One example is when renaming a project, if failed on backend, we should send notification to user.
  2. some 's are "s, are they typo, or intentional?

- updated UserProjectList component functions for create / rename project to handle error messages from server
- removed minor typos in comments
- minor update to backend API endpoint for rename project to perform name validation first
@Yicong-Huang
Yicong-Huang merged commit 05c9609 into apache:master Feb 4, 2022
@zuozhiw zuozhiw added the ddl-change Changes to the TexeraDB DDL label Jul 21, 2022
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
### Introduction
---
This PR introduces a "user project" feature which acts as a label to help organize a user's workflows and files.  As the number of workflows and files of a user begins to grow too large to manage individually, the user may group them into various, easier-to-manage projects.  The main goals of this PR are to allow a user to:

- Create / rename / delete projects
- View a list of their projects
- Add workflows / files to a project
- Remove workflows / files from a project
- View a particular project and its workflows / files

### Solution
---
The main design goal is to minimize cluttering in the UserDashboard component by having each project display only relevant information, such as only the workflows and files that belong to that project.  Also, rather than displaying all project information in a single component, there are two components that separate seeing a user's list of projects from seeing what a single project contains.

To address these requirements, a new feature has been added to the User Dashboard, and a typical use case is as follows: 
- Navigate to the User Dashboard
- Click on "User Projects" from the Feature Bar
- View / rename / delete / sort the user's list of projects
- Click on a particular project
- View / add / remove workflows and files of that particular project
- Manage the workflows / files themselves from within a project

Currently, projects are backward compatible with workflows and files (workflows / files features function completely independently of projects).  Workflows and files do not have to be associated with a user project.

On the database layer, a new `user_project` table was created to store information about each project: a project's id, a project owner's id, the name of the project, and its time of creation.  New tables `workflow_of_project` and `file_of_project` were also created to store mappings between a project and the workflows / files it contains.  These mapping tables have dependencies on the `user_project`, `workflow`, and `user_file` tables, and any deletions will cascade to the mappings as well.

A new backend API endpoint was created at 'api/project' in `ProjectResource.scala` handling requests from the frontend.  

On the frontend, the following were created to implement the user project feature:
- `UserProjectListComponent`: a child component of `UserDashboard` which lists all the projects of a user
- `UserProjectSectionComponent` : another child component of `UserDashboard` listing a single project and the workflows / files it contains
- `UserProjectService`: handling requests to backend API 
- `NgbdModalAddProjectFileComponent`, `NgbdModalRemoveProjectFileComponent`, `NgbdModalAddProjectWorkflowComponent`, `NgbdModalRemoveProjectWorkflowComponent` : modals to enable adding / removing workflows / files of project

### Demo
---
https://user-images.githubusercontent.com/57075492/151860398-487346e4-0588-410b-88e4-538e024e4228.mov

### Current Issues 
---
Currently, there is some usage of non read-only data structures to enable sorting of projects / workflows, but ideally, it should be fixed to be ReadOnly.  There are also some instances of duplicate logic introduced such as in the `UserProjectSectionComponent` to avoid updating the `SavedWorkflowSectionComponent` and `UserFileSectionComponent`.  However, to improve maintainability such components should be modified to support user projects and reused. 

### Future TODOs
---
The basic features of a user project are included in this PR, but other immediate goals include refactoring the current code to reduce duplicate logic and switching to purely read-only data structures.  Enhancements to the user project feature also include introducing colors to projects to allow for clearer visual indication of organization and potentially introducing sharing of projects.

Co-authored-by: Shengquan Ni <[email protected]>
Co-authored-by: Yicong Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ddl-change Changes to the TexeraDB DDL feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants