feat(env): add tag support for environment variables and task injection
- Add generic DataRelation and DataStorage models for tags - Update EnvService and EnvController to support tag assignment, querying, and filtering - Integrate EnvTagsConfig in Env settings for managing environment tags - Enhance TaskDialog environment selection to support searching and displaying env tags - Fix missing TaskLangConfig import in RepoDialog
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/engigu/baihu-panel/internal/constant"
|
||||
)
|
||||
|
||||
// DataRelation 通用数据关联表
|
||||
type DataRelation struct {
|
||||
ID string `json:"id" gorm:"primaryKey;size:20"`
|
||||
DataID string `json:"data_id" gorm:"size:20;index;not null"`
|
||||
RelateID string `json:"relate_id" gorm:"size:20;index;not null"`
|
||||
Type string `json:"type" gorm:"size:50;index;not null"`
|
||||
CreatedAt LocalTime `json:"created_at"`
|
||||
UpdatedAt LocalTime `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (DataRelation) TableName() string {
|
||||
return constant.TablePrefix + "data_relations"
|
||||
}
|
||||
|
||||
// DataStorage 通用数据存储表
|
||||
type DataStorage struct {
|
||||
ID string `json:"id" gorm:"primaryKey;size:20"`
|
||||
Type string `json:"type" gorm:"size:50;index;not null"`
|
||||
Name string `json:"name" gorm:"size:255;index;not null"`
|
||||
Data BigText `json:"data"`
|
||||
CreatedAt LocalTime `json:"created_at"`
|
||||
UpdatedAt LocalTime `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (DataStorage) TableName() string {
|
||||
return constant.TablePrefix + "data_storages"
|
||||
}
|
||||
@@ -14,6 +14,7 @@ type EnvironmentVariable struct {
|
||||
Hidden *bool `json:"hidden" gorm:"default:true"`
|
||||
Enabled *bool `json:"enabled" gorm:"default:true"`
|
||||
UserID string `json:"user_id" gorm:"size:20;index"`
|
||||
Tags string `json:"-" gorm:"-"`
|
||||
CreatedAt LocalTime `json:"created_at"`
|
||||
UpdatedAt LocalTime `json:"updated_at"`
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ type EnvVO struct {
|
||||
Value string `json:"value"`
|
||||
Remark string `json:"remark"`
|
||||
Type string `json:"type"`
|
||||
Tags string `json:"tags"`
|
||||
Hidden bool `json:"hidden"`
|
||||
Enabled bool `json:"enabled"`
|
||||
CreatedAt models.LocalTime `json:"created_at"`
|
||||
@@ -59,6 +60,7 @@ func ToEnvVO(env *models.EnvironmentVariable) *EnvVO {
|
||||
Value: val,
|
||||
Remark: env.Remark,
|
||||
Type: env.Type,
|
||||
Tags: env.Tags,
|
||||
Hidden: utils.DerefBool(env.Hidden, true),
|
||||
Enabled: utils.DerefBool(env.Enabled, true),
|
||||
CreatedAt: env.CreatedAt,
|
||||
|
||||
Reference in New Issue
Block a user