Skip to content

Commit 49fecd6

Browse files
committed
Not deployed filter in app_status of app-list.
1 parent 73f1aa5 commit 49fecd6

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

internal/sql/repository/helper/AppListingRepositoryQueryBuilder.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,26 @@ func (impl AppListingRepositoryQueryBuilder) buildAppListingWhereCondition(appLi
282282
whereCondition = whereCondition + "and dga.deployment_group_id = " + strconv.Itoa(appListingFilter.DeploymentGroupId) + " "
283283
}
284284
//add app-status filter here
285+
var appStatusWithoutNotDeployed []string
286+
var isNotDeployedFilter bool
285287
if len(appListingFilter.AppStatuses) > 0 {
286-
appStatuses := util.ProcessAppStatuses(appListingFilter.AppStatuses)
287-
whereCondition = whereCondition + "and aps.status IN (" + appStatuses + ") "
288+
for _, status := range appListingFilter.AppStatuses {
289+
if status == "NOT DEPLOYED" {
290+
isNotDeployedFilter = true
291+
} else {
292+
appStatusWithoutNotDeployed = append(appStatusWithoutNotDeployed, status)
293+
}
294+
}
295+
}
296+
appStatuses := util.ProcessAppStatuses(appStatusWithoutNotDeployed)
297+
if isNotDeployedFilter {
298+
whereCondition = whereCondition + " and (p.deployment_app_created=false and p.deployment_app_type != 'manifest_download' or a.id NOT IN (SELECT app_id from pipeline) "
299+
if len(appStatuses) > 0 {
300+
whereCondition = whereCondition + " or aps.status IN (" + appStatuses + ") "
301+
}
302+
whereCondition = whereCondition + ") "
303+
} else if len(appStatuses) > 0 {
304+
whereCondition = whereCondition + "and aps.status IN (" + appStatuses + ")"
288305
}
289306

290307
if len(appListingFilter.AppIds) > 0 {

0 commit comments

Comments
 (0)