You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "ArkVex (via GitHub)" <gi...@apache.org> on 2025/03/13 06:19:11 UTC
[PR] hello ui [incubator-devlake]
ArkVex opened a new pull request, #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
### ⚠️ Pre Checklist
> Please complete _ALL_ items in this checklist, and remove before submitting
- [yes ] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).
- [ yes] I have added relevant tests.
- [yes ] I have added relevant documentation.
- [ yes] I will add labels to the PR, such as `pr-type/bug-fix`, `pr-type/feature-development`, etc.
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes.
Please fill out as many sections below as possible.
-->
### Summary
This PR introduces a project tagging system, allowing users to assign and manage tags for better organization. It updates the database schema to store tags, enhances the API to support tag-based filtering, and improves the UI for easy tag management. This feature helps tech leads and engineering managers track projects efficiently and create dashboards based on shared tags.
### Does this close any open issues?
Closes #8279
### Screenshots
Include any relevant screenshots here.
### Other Information
Any other information that is important to this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "mieliespoor (via GitHub)" <gi...@apache.org>.
mieliespoor commented on code in PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#discussion_r2009210597
##########
api/project.go:
##########
@@ -0,0 +1,64 @@
+package main
+
+import (
+ "strings"
+ "github.com/gin-gonic/gin"
+ "gorm.io/gorm"
+ "myapp/models"
+ "myapp/shared"
+)
+
+var db *gorm.DB
+
+// listProjects returns all projects with optional tag filtering
+func listProjects(c *gin.Context) {
+ // Get tag filter params if any
+ tagFilter := c.Query("tags")
+
+ var projects []models.Project
+ query := db.Model(&models.Project{})
+
+ // Apply tag filtering if provided
+ if tagFilter != "" {
+ tags := strings.Split(tagFilter, ",")
+ query = query.Joins("JOIN _devlake_project_tags pt ON pt.project_id = projects.id").
+ Joins("JOIN tags t ON t.id = pt.tag_id").
+ Where("t.name IN ?", tags).
+ Group("projects.id").
+ Having("COUNT(DISTINCT t.name) = ?", len(tags))
+ }
+
+ // Execute the query
+ if err := query.Find(&projects).Error; err != nil {
+ shared.ApiErrorHandler(c, err)
+ return
+ }
+
+ // Load the tags for each project
+ for i := range projects {
+ db.Model(&projects[i]).Association("Tags").Find(&projects[i].Tags)
+ }
+
+ c.JSON(200, projects)
+}
+
+// getProject returns a specific project
+func getProject(c *gin.Context) {
+ var project models.Project
+ if err := db.First(&project, c.Param("id")).Error; err != nil {
+ shared.ApiErrorHandler(c, err)
+ return
+ }
+
+ // Load associated tags
+ db.Model(&project).Association("Tags").Find(&project.Tags)
+
+ c.JSON(200, project)
Review Comment:
```suggestion
c.JSON(http.StatusOK, project)
```
Should this not also be http.StatusOK instead of the explicit 200? Makes for easier reading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "mieliespoor (via GitHub)" <gi...@apache.org>.
mieliespoor commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-3120057818
@ArkVex are you still interested in this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-4195777074
This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #8334: Add tags on projects
URL: https://github.com/apache/incubator-devlake/pull/8334
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] hello ui [incubator-devlake]
Posted by "mieliespoor (via GitHub)" <gi...@apache.org>.
mieliespoor commented on code in PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#discussion_r1994307671
##########
env.example:
##########
Review Comment:
I think these changes can be excluded from the PR. This is mainly local dev requirements, so not sure we should include it in the PR?
##########
models/project.go:
##########
@@ -0,0 +1,68 @@
+
Review Comment:
can you remove this whitespace?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "ArkVex (via GitHub)" <gi...@apache.org>.
ArkVex commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-2740502009
@mieliespoor what's the status?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "ArkVex (via GitHub)" <gi...@apache.org>.
ArkVex commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-2746132606
helo @mieliespoor @klesh somebody plz review this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-3567208973
This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] hello ui [incubator-devlake]
Posted by "mieliespoor (via GitHub)" <gi...@apache.org>.
mieliespoor commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-2722715363
Can you change the title of the PR from Hello UI to something more relevant to the changes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "varsis (via GitHub)" <gi...@apache.org>.
varsis commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-3584433800
Any chance of this being merged in to the project soon? @ArkVex
I'd rather not maintain my own image for this feature if possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] hello ui [incubator-devlake]
Posted by "ArkVex (via GitHub)" <gi...@apache.org>.
ArkVex commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-2726367088
> Can you change the title of the PR from Hello UI to something more relevant to the changes?
Ohhk i will do that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "mieliespoor (via GitHub)" <gi...@apache.org>.
mieliespoor commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-2746389600
Added one more comment around readability and consistency. Looks good on a highlevel.
Two things I would say that is missing on this PR:
1. Some screenshots on how the UI would look after the changes?
2. Missing unit tests. No unit tests were added or changed as part of this.
Other than that, I would allow the code owners to also review this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh commented on code in PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#discussion_r2013608326
##########
models/project.go:
##########
@@ -0,0 +1,19 @@
+package models
+
+import (
+ "gorm.io/gorm"
+)
+
+// Project represents a DevLake project
+type Project struct {
Review Comment:
There is a Project model located in https://github.com/apache/incubator-devlake/blob/main/backend/core/models/project.go
Please following the existing folder convention.
1. All backend code should be placed in the `backend` folder.
2. UI code should go to the `config-ui` folder
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-3115404577
This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "d4x1 (via GitHub)" <gi...@apache.org>.
d4x1 commented on code in PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#discussion_r2573624312
##########
models/tag.go:
##########
@@ -0,0 +1,24 @@
+package models
+
+import (
+ "github.com/apache/incubator-devlake/core/models/common"
+)
+
+// Tag represents a tag that can be assigned to projects
+type Tag struct {
+ common.DynamicMapBase
Review Comment:
I cannot find the definition of `DynamicMapBase` in common package.
##########
config/migration/migrationscripts/20230901_add_tags.go:
##########
@@ -0,0 +1,52 @@
+package migrationscripts
Review Comment:
Please write migration scripts like this
https://github.com/apache/incubator-devlake/blob/main/backend/core/models/migrationscripts/20251022_fix_null_priority.go
https://github.com/apache/incubator-devlake/blob/main/backend/core/models/migrationscripts/register.go#L25
##########
models/tag.go:
##########
@@ -0,0 +1,24 @@
+package models
+
+import (
+ "github.com/apache/incubator-devlake/core/models/common"
+)
+
+// Tag represents a tag that can be assigned to projects
+type Tag struct {
+ common.DynamicMapBase
+ Name string `json:"name" gorm:"type:varchar(255);uniqueIndex"`
+ Description string `json:"description" gorm:"type:varchar(255)"`
+ Color string `json:"color" gorm:"type:varchar(50)"`
+}
+
+// ProjectTag represents the many-to-many relationship between projects and tags
+type ProjectTag struct {
+ ProjectId string `json:"projectId" gorm:"primaryKey;type:varchar(255)"`
Review Comment:
`Project` in package common doesn't have `ProjectId` field, I think it should be `ProjectName` here.
##########
models/tag.go:
##########
@@ -0,0 +1,24 @@
+package models
+
+import (
+ "github.com/apache/incubator-devlake/core/models/common"
+)
+
+// Tag represents a tag that can be assigned to projects
+type Tag struct {
+ common.DynamicMapBase
+ Name string `json:"name" gorm:"type:varchar(255);uniqueIndex"`
+ Description string `json:"description" gorm:"type:varchar(255)"`
+ Color string `json:"color" gorm:"type:varchar(50)"`
+}
+
+// ProjectTag represents the many-to-many relationship between projects and tags
+type ProjectTag struct {
+ ProjectId string `json:"projectId" gorm:"primaryKey;type:varchar(255)"`
+ TagId string `json:"tagId" gorm:"primaryKey;type:varchar(255)"`
Review Comment:
Since `Tag.Name` has an unique index, we can use `TagName` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "mieliespoor (via GitHub)" <gi...@apache.org>.
mieliespoor commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-3587079179
I think he lost interest. I will take a look at this and try make time to get this merged in as I myself need this relatively soonish.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tags on projects [incubator-devlake]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8334:
URL: https://github.com/apache/incubator-devlake/pull/8334#issuecomment-4159045888
This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org