mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-13 13:48:59 +02:00
parent
09d9676d66
commit
1d427988f4
@ -164,6 +164,12 @@ class FeatureSearchStore implements IFeatureSearchStore {
|
||||
|
||||
selectColumns = [
|
||||
...selectColumns,
|
||||
this.db.raw(
|
||||
'has_strategies.feature_name IS NOT NULL AS has_strategies',
|
||||
),
|
||||
this.db.raw(
|
||||
'enabled_strategies.feature_name IS NOT NULL AS has_enabled_strategies',
|
||||
),
|
||||
this.db.raw(`CASE
|
||||
WHEN dependent_features.parent = features.name THEN 'parent'
|
||||
WHEN dependent_features.child = features.name THEN 'child'
|
||||
@ -242,6 +248,8 @@ class FeatureSearchStore implements IFeatureSearchStore {
|
||||
'features.created_by_user_id',
|
||||
);
|
||||
|
||||
this.applyStrategiesByEnvironment(query);
|
||||
|
||||
query.leftJoin('last_seen_at_metrics', function () {
|
||||
this.on(
|
||||
'last_seen_at_metrics.environment',
|
||||
@ -321,8 +329,6 @@ class FeatureSearchStore implements IFeatureSearchStore {
|
||||
.joinRaw('CROSS JOIN total_features')
|
||||
.whereBetween('final_rank', [offset + 1, offset + limit])
|
||||
.orderBy('final_rank');
|
||||
|
||||
this.applyStrategiesByEnvironment(finalQuery);
|
||||
if (featureLifecycleEnabled) {
|
||||
finalQuery.leftJoin(
|
||||
'lifecycle',
|
||||
@ -351,14 +357,6 @@ class FeatureSearchStore implements IFeatureSearchStore {
|
||||
}
|
||||
|
||||
private applyStrategiesByEnvironment(queryBuilder: Knex.QueryBuilder) {
|
||||
queryBuilder.select(
|
||||
this.db.raw(
|
||||
'has_strategies.feature_name IS NOT NULL AS has_strategies',
|
||||
),
|
||||
this.db.raw(
|
||||
'enabled_strategies.feature_name IS NOT NULL AS has_enabled_strategies',
|
||||
),
|
||||
);
|
||||
queryBuilder
|
||||
.leftJoin(
|
||||
this.db
|
||||
@ -372,11 +370,11 @@ class FeatureSearchStore implements IFeatureSearchStore {
|
||||
this.on(
|
||||
'enabled_strategies.feature_name',
|
||||
'=',
|
||||
'ranked_features.feature_name',
|
||||
'features.name',
|
||||
).andOn(
|
||||
'enabled_strategies.environment',
|
||||
'=',
|
||||
'ranked_features.environment',
|
||||
'feature_environments.environment',
|
||||
);
|
||||
},
|
||||
)
|
||||
@ -390,11 +388,11 @@ class FeatureSearchStore implements IFeatureSearchStore {
|
||||
this.on(
|
||||
'has_strategies.feature_name',
|
||||
'=',
|
||||
'ranked_features.feature_name',
|
||||
'features.name',
|
||||
).andOn(
|
||||
'has_strategies.environment',
|
||||
'=',
|
||||
'ranked_features.environment',
|
||||
'feature_environments.environment',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user