From bea40ec6222ae1b4100c9ce85119d3235acf131c Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Wed, 17 Jul 2024 15:58:51 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Add=20feature=20flag=20?= =?UTF-8?q?for=20client-agent=20work=20(#2397)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/routes/scopes/scope/projects.js | 23 +++++++++++-------- .../scopes/scope/projects/sessions/session.js | 2 ++ ui/desktop/config/environment.js | 6 ++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ui/desktop/app/routes/scopes/scope/projects.js b/ui/desktop/app/routes/scopes/scope/projects.js index 2d37e18a3..d8f6e0bbb 100644 --- a/ui/desktop/app/routes/scopes/scope/projects.js +++ b/ui/desktop/app/routes/scopes/scope/projects.js @@ -36,6 +36,7 @@ export default class ScopesScopeProjectsRoute extends Route { @service clientAgentSessions; @service pollster; @service flashMessages; + @service features; // =methods @@ -48,18 +49,22 @@ export default class ScopesScopeProjectsRoute extends Route { /** * Primes the store with _all project scopes_ under global. - * @return {Promise{ScopeModel}} + * @return {Promise} */ async model() { - // Setup the poller job - if (!this.job) { - this.boundPoller = this.poller.bind(this); - this.job = this.pollster.findOrCreateJob(this.boundPoller, 2000); - } + if (this.features.isEnabled('client-agent')) { + // Setup the poller job + if (!this.job) { + this.boundPoller = this.poller.bind(this); + this.job = this.pollster.findOrCreateJob(this.boundPoller, 2000); + } - const isClientAgentRunning = await this.ipc.invoke('isClientAgentRunning'); - if (isClientAgentRunning) { - this.job.start(); + const isClientAgentRunning = await this.ipc.invoke( + 'isClientAgentRunning', + ); + if (isClientAgentRunning) { + this.job.start(); + } } const { id: scope_id } = this.modelFor('scopes.scope'); diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions/session.js b/ui/desktop/app/routes/scopes/scope/projects/sessions/session.js index 2fe6171ef..53ea5d197 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions/session.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions/session.js @@ -14,6 +14,7 @@ export default class ScopesScopeProjectsSessionsSessionRoute extends Route { @service clientAgentSessions; @service flashMessages; @service intl; + @service features; // =methods @@ -29,6 +30,7 @@ export default class ScopesScopeProjectsSessionsSessionRoute extends Route { // If we don't have any credentials, we'll try to fetch them from the client agent in case this session // was initiated through the client agent. if ( + this.features.isEnabled('client-agent') && !session.credentials.length && (await this.ipc.invoke('isClientAgentRunning')) ) { diff --git a/ui/desktop/config/environment.js b/ui/desktop/config/environment.js index bb1024e22..d3ae0cfaf 100644 --- a/ui/desktop/config/environment.js +++ b/ui/desktop/config/environment.js @@ -61,9 +61,7 @@ module.exports = function (environment) { }, featureFlags: { - search: false, - filter: true, - 'post-connection-workflow': false, + 'client-agent': false, }, }; @@ -84,7 +82,7 @@ module.exports = function (environment) { : true; // Enable features in development - ENV.featureFlags['post-connection-workflow'] = true; + ENV.featureFlags['client-agent'] = true; } if (environment === 'test') {