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