Skip to content

fix: plugin exposed flags default value #6332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/plugin/GlobalPluginService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ func (impl *GlobalPluginServiceImpl) MigratePluginDataToParentPluginMetadata(plu
continue
}
parentMetadata := repository.NewPluginParentMetadata()
parentMetadata.SetParentPluginMetadata(pluginMetadata).CreateAuditLog(bean.SystemUserId)
parentMetadata.SetParentPluginMetadata(pluginMetadata).CreateAuditLog(bean.SystemUserId).WithIsExposed(true)
parentMetadata.Identifier = identifier
parentMetadata, err = impl.globalPluginRepository.SavePluginParentMetadata(tx, parentMetadata)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/plugin/adaptor/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (

func GetPluginParentMetadataDbObject(pluginDto *pluginBean.PluginParentMetadataDto, userId int32) *repository.PluginParentMetadata {
return repository.NewPluginParentMetadata().CreateAuditLog(userId).
WithBasicMetadata(pluginDto.Name, pluginDto.PluginIdentifier, pluginDto.Description, pluginDto.Icon, repository.PLUGIN_TYPE_SHARED)
WithBasicMetadata(pluginDto.Name, pluginDto.PluginIdentifier, pluginDto.Description, pluginDto.Icon, repository.PLUGIN_TYPE_SHARED, pluginDto.IsExposed)
}

func GetPluginVersionMetadataDbObject(pluginDto *pluginBean.PluginParentMetadataDto, userId int32) *repository.PluginMetadata {
versionDto := pluginDto.Versions.DetailedPluginVersionData[0]
return repository.NewPluginVersionMetadata().CreateAuditLog(userId).WithBasicMetadata(pluginDto.Name, versionDto.Description, versionDto.Version, versionDto.DocLink)
return repository.NewPluginVersionMetadata().CreateAuditLog(userId).WithBasicMetadata(pluginDto.Name, versionDto.Description, versionDto.Version, versionDto.DocLink, versionDto.IsExposed)
}

func GetPluginStepDbObject(pluginStepDto *pluginBean.PluginStepsDto, pluginVersionMetadataId int, userId int32) *repository.PluginStep {
Expand Down
2 changes: 2 additions & 0 deletions pkg/plugin/bean/bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type PluginMetadataDto struct {
PluginStage string `json:"pluginStage,omitempty"`
PluginSteps []*PluginStepsDto `json:"pluginSteps,omitempty"`
AreNewTagsPresent bool `json:"areNewTagsPresent,omitempty"`
IsExposed *bool `json:"-"`
}

type PluginMinDto struct {
Expand Down Expand Up @@ -127,6 +128,7 @@ type PluginParentMetadataDto struct {
Icon string `json:"icon,omitempty"`
PluginStageType string `json:"pluginStageType,omitempty"`
Versions *PluginVersions `json:"pluginVersions"`
IsExposed *bool `json:"-"`
}

func NewPluginParentMetadataDto() *PluginParentMetadataDto {
Expand Down
20 changes: 18 additions & 2 deletions pkg/plugin/repository/GlobalPluginRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,24 @@ func (r *PluginParentMetadata) CreateAuditLog(userId int32) *PluginParentMetadat
r.UpdatedOn = time.Now()
return r
}
func (r *PluginParentMetadata) WithIsExposed(isExposed bool) *PluginParentMetadata {
r.IsExposed = isExposed
return r
}

func (r *PluginParentMetadata) WithBasicMetadata(name, identifier, description, icon string, pluginType PluginType) *PluginParentMetadata {
func (r *PluginParentMetadata) WithBasicMetadata(name, identifier, description, icon string, pluginType PluginType, isExposed *bool) *PluginParentMetadata {
r.Name = name
r.Identifier = identifier
r.Description = description
r.Icon = icon
r.Type = pluginType
r.Deleted = false
if isExposed != nil {
r.IsExposed = *isExposed
} else {
//default set true
r.IsExposed = true
}
return r
}

Expand Down Expand Up @@ -189,13 +199,19 @@ func (r *PluginMetadata) CreateAuditLog(userId int32) *PluginMetadata {
return r
}

func (r *PluginMetadata) WithBasicMetadata(name, description, pluginVersion, docLink string) *PluginMetadata {
func (r *PluginMetadata) WithBasicMetadata(name, description, pluginVersion, docLink string, isExposed *bool) *PluginMetadata {
r.Name = name
r.PluginVersion = pluginVersion
r.Description = description
r.DocLink = docLink
r.Deleted = false
r.IsDeprecated = false
if isExposed != nil {
r.IsExposed = *isExposed
} else {
//default value is true
r.IsExposed = true
}
return r
}

Expand Down
Loading