Skip to content
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
8 changes: 4 additions & 4 deletions pkg/plugin/GlobalPluginService.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (impl *GlobalPluginServiceImpl) ListAllPlugins(stageTypeReq string) ([]*bea

//getting all plugins metadata(without tags)
if len(stageTypeReq) == 0 {
pluginsMetadata, err = impl.globalPluginRepository.GetMetaDataForAllPlugins()
pluginsMetadata, err = impl.globalPluginRepository.GetMetaDataForAllPlugins(true)
if err != nil {
impl.logger.Errorw("error in getting plugins", "err", err)
return nil, err
Expand Down Expand Up @@ -1749,7 +1749,7 @@ func (impl *GlobalPluginServiceImpl) GetPluginParentMetadataDtos(parentIdVsPlugi

func (impl *GlobalPluginServiceImpl) ListAllPluginsV2(filter *bean2.PluginsListFilter) (*bean2.PluginsDto, error) {
impl.logger.Infow("request received, ListAllPluginsV2", "filter", filter)
pluginVersionsMetadata, err := impl.globalPluginRepository.GetMetaDataForAllPlugins()
pluginVersionsMetadata, err := impl.globalPluginRepository.GetMetaDataForAllPlugins(true)
if err != nil {
impl.logger.Errorw("ListAllPluginsV2, error in getting plugins", "err", err)
return nil, err
Expand Down Expand Up @@ -1821,7 +1821,7 @@ func (impl *GlobalPluginServiceImpl) GetPluginDetailV2(queryParams bean2.GlobalP
}
queryParams.ParentPluginIds = append(queryParams.ParentPluginIds, additionalPluginParentIds...)
queryParams.ParentPluginIds = sliceUtil.GetUniqueElements(queryParams.ParentPluginIds)
pluginVersionsMetadata, err := impl.globalPluginRepository.GetMetaDataForAllPlugins()
pluginVersionsMetadata, err := impl.globalPluginRepository.GetMetaDataForAllPlugins(false)
if err != nil {
impl.logger.Errorw("GetPluginDetailV2, error in getting all plugins versions metadata", "err", err)
return nil, err
Expand Down Expand Up @@ -1884,7 +1884,7 @@ func (impl *GlobalPluginServiceImpl) GetAllUniqueTags() (*bean2.PluginTagsDto, e
}

func (impl *GlobalPluginServiceImpl) MigratePluginData() error {
pluginVersionsMetadata, err := impl.globalPluginRepository.GetMetaDataForAllPlugins()
pluginVersionsMetadata, err := impl.globalPluginRepository.GetMetaDataForAllPlugins(false)
if err != nil {
impl.logger.Errorw("MigratePluginData, error in getting plugins", "err", err)
return err
Expand Down
15 changes: 9 additions & 6 deletions pkg/plugin/repository/GlobalPluginRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ type PluginStageMapping struct {
}

type GlobalPluginRepository interface {
GetMetaDataForAllPlugins() ([]*PluginMetadata, error)
GetMetaDataForAllPlugins(excludeDeprecated bool) ([]*PluginMetadata, error)
GetMetaDataForPluginWithStageType(stageType int) ([]*PluginMetadata, error)
GetMetaDataByPluginId(pluginId int) (*PluginMetadata, error)
GetMetaDataByPluginIds(pluginIds []int) ([]*PluginMetadata, error)
Expand Down Expand Up @@ -403,12 +403,15 @@ func (impl *GlobalPluginRepositoryImpl) GetConnection() (dbConnection *pg.DB) {
return impl.dbConnection
}

func (impl *GlobalPluginRepositoryImpl) GetMetaDataForAllPlugins() ([]*PluginMetadata, error) {
func (impl *GlobalPluginRepositoryImpl) GetMetaDataForAllPlugins(excludeDeprecated bool) ([]*PluginMetadata, error) {
var plugins []*PluginMetadata
err := impl.dbConnection.Model(&plugins).
query := impl.dbConnection.Model(&plugins).
Where("deleted = ?", false).
Order("id").
Select()
Order("id")
if excludeDeprecated {
query = query.Where("is_deprecated = ?", false)
}
err := query.Select()
if err != nil {
impl.logger.Errorw("err in getting all plugins", "err", err)
return nil, err
Expand Down Expand Up @@ -872,7 +875,7 @@ func (impl *GlobalPluginRepositoryImpl) GetAllFilteredPluginParentMetadata(searc
var plugins []*PluginParentMetadata
query := "select ppm.id, ppm.identifier,ppm.name,ppm.description,ppm.type,ppm.icon,ppm.deleted,ppm.created_by, ppm.created_on,ppm.updated_by,ppm.updated_on from plugin_parent_metadata ppm" +
" inner join plugin_metadata pm on pm.plugin_parent_metadata_id=ppm.id"
whereCondition := fmt.Sprintf(" where ppm.deleted=false AND pm.deleted=false AND pm.is_latest=true")
whereCondition := fmt.Sprintf(" where ppm.deleted=false AND pm.deleted=false AND pm.is_latest=true and pm.is_deprecated=false")
if len(tags) > 0 {
tagFilterSubQuery := fmt.Sprintf("select ptr.plugin_id from plugin_tag_relation ptr inner join plugin_tag pt on ptr.tag_id =pt.id where pt.deleted =false and pt.name in (%s) group by ptr.plugin_id having count(ptr.plugin_id )=%d", helper.GetCommaSepratedStringWithComma(tags), len(tags))
whereCondition += fmt.Sprintf(" AND pm.id in (%s)", tagFilterSubQuery)
Expand Down
1 change: 1 addition & 0 deletions scripts/sql/30502300_deprecating_plugins.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- empty script to maintain script number common across repo
1 change: 1 addition & 0 deletions scripts/sql/30502300_deprecating_plugins.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- empty script to maintain script number common across repo
Loading