diff --git a/config/config.go b/config/config.go index dc73bd68f..b87a28f4d 100644 --- a/config/config.go +++ b/config/config.go @@ -17,6 +17,13 @@ import ( miniox "github.com/instill-ai/x/minio" ) +const ( + EditionLocalCE = "local-ce:dev" + EditionCloudDev = "cloud:dev" + EditionCloudStaging = "cloud:staging" + EditionCloudProd = "cloud:prod" +) + // Config - Global variable to export var Config AppConfig diff --git a/pkg/repository/repository.go b/pkg/repository/repository.go index ddb279204..713691fa0 100644 --- a/pkg/repository/repository.go +++ b/pkg/repository/repository.go @@ -767,9 +767,14 @@ func (r *repository) ListComponentDefinitionUIDs(_ context.Context, p ListCompon Where(where, whereArgs...). Where("is_visible IS TRUE") - if config.Config.Server.Edition == "local-ce:dev" { + + // TODO: refactor it with store.go in ins-7031 + if config.Config.Server.Edition == config.EditionLocalCE { skipComponentsInCE := []string{"instill-app"} queryBuilder = queryBuilder.Where("id NOT IN (?)", skipComponentsInCE) + } else if config.Config.Server.Edition == config.EditionCloudStaging || config.Config.Server.Edition == config.EditionCloudProd { + skipComponentsInCloud := []string{"google-drive", "google-sheets"} + queryBuilder = queryBuilder.Where("id NOT IN (?)", skipComponentsInCloud) } queryBuilder.Count(&totalSize)