diff --git a/addons/api/addon-test-support/handlers/client-daemon-search.js b/addons/api/addon-test-support/handlers/cache-daemon-search.js similarity index 81% rename from addons/api/addon-test-support/handlers/client-daemon-search.js rename to addons/api/addon-test-support/handlers/cache-daemon-search.js index e4a37d3c9..23784fb76 100644 --- a/addons/api/addon-test-support/handlers/client-daemon-search.js +++ b/addons/api/addon-test-support/handlers/cache-daemon-search.js @@ -5,7 +5,7 @@ import sinon from 'sinon'; import { typeOf } from '@ember/utils'; -import { resourceNames } from 'api/handlers/client-daemon-handler'; +import { resourceNames } from 'api/handlers/cache-daemon-handler'; import { singularize } from 'ember-inflector'; /** @@ -13,7 +13,7 @@ import { singularize } from 'ember-inflector'; * Must be called after setupMirage. * * ```js - * import setupStubs from 'api/test-support/handlers/client-daemon-search'; + * import setupStubs from 'api/test-support/handlers/cache-daemon-search'; * * module('Acceptance | my test', function(hooks) { * setupApplicationTest(hooks); @@ -25,7 +25,7 @@ import { singularize } from 'ember-inflector'; * ``` * * This will setup a stub for the IPC service and include helper methods to - * help setup what the client daemon search command returns. + * help setup what the cache daemon search command returns. * * @module Test Helpers * @public @@ -38,20 +38,20 @@ export default function setupStubs(hooks) { this.ipcStub = sinon.stub(ipcService, 'invoke'); /** - * We aim to still use mirage data when stubbing out the client daemon + * We aim to still use mirage data when stubbing out the cache daemon * search. However, the handler expects the search data to be raw JSON from * the API which will get serialized. We add back the scope object for it to * get correctly normalized and other fields such as "attributes" from the * API will already be hoisted and will not be re-normalized from mirage data. * * This convenience method can take in multiple types, - * e.g. this.stubClientDaemonSearch('targets', 'sessions'). + * e.g. this.stubCacheDaemonSearch('targets', 'sessions'). * This will have sinon stub out each call so the first call to search will * provide all the models from the first parameter you specify, * the second call will provide all the models from the second argument, etc. * @param types */ - this.stubClientDaemonSearch = (...types) => { + this.stubCacheDaemonSearch = (...types) => { stubTypes = types; types.forEach((type, i) => { @@ -66,7 +66,7 @@ export default function setupStubs(hooks) { } this.ipcStub - .withArgs('searchClientDaemon') + .withArgs('searchCacheDaemon') .onCall(i) .returns({ [resourceName]: models.map((model) => { @@ -76,7 +76,7 @@ export default function setupStubs(hooks) { this.server.serializerOrRegistry.serialize(model); // Serialize the data properly to standard JSON as that is what - // we're expecting from the client daemon response + // we're expecting from the cache daemon response return JSON.parse(JSON.stringify(modelData)); }), }); @@ -86,16 +86,16 @@ export default function setupStubs(hooks) { hooks.afterEach(function () { // Verify the number of mocks we set up match with how - // many times the client daemon was called with + // many times the cache daemon was called with sinon.assert.callCount( - this.ipcStub.withArgs('searchClientDaemon'), + this.ipcStub.withArgs('searchCacheDaemon'), stubTypes.length, ); stubTypes.forEach((type, i) => { // Assert that the stub was called with the resource we're trying to mock // so we don't mistakenly mock the wrong resource - const ipcCall = this.ipcStub.withArgs('searchClientDaemon').getCall(i); + const ipcCall = this.ipcStub.withArgs('searchCacheDaemon').getCall(i); let resource = type; if (typeOf(type) === 'object') { resource = type.resource; diff --git a/addons/api/addon/handlers/client-daemon-handler.js b/addons/api/addon/handlers/cache-daemon-handler.js similarity index 85% rename from addons/api/addon/handlers/client-daemon-handler.js rename to addons/api/addon/handlers/cache-daemon-handler.js index 5c981b072..3817aba4c 100644 --- a/addons/api/addon/handlers/client-daemon-handler.js +++ b/addons/api/addon/handlers/cache-daemon-handler.js @@ -10,7 +10,7 @@ import { generateMQLExpression } from '../utils/mql-query'; import { paginateResults } from '../utils/paginate-results'; /** - * Not all types are yet supported by the client daemon so we'll + * Not all types are yet supported by the cache daemon so we'll * just whitelist the ones we need to start with. Keys are the resource * types and the values are the fields that are searchable by the client. * @type {{session: string[], alias: string[], target: string[]}} @@ -22,7 +22,7 @@ const supportedTypes = { }; /** - * Map the model resource name to the client daemon resource name + * Map the model resource name to the cache daemon resource name * @type {{session: string, alias: string, target: string}} */ export const resourceNames = { @@ -34,11 +34,11 @@ export const resourceNames = { const fetchControllerData = async (context, next) => { const { data } = context.request; const { query: originalQuery } = data; - // remove client daemon specific query params + // remove cache daemon specific query params // eslint-disable-next-line no-unused-vars const { query, page, pageSize, ...remainingQuery } = originalQuery; - // If we get an error or client daemon is unavailable, fall back to calling the API + // If we get an error or cache daemon is unavailable, fall back to calling the API context.request.data.query = remainingQuery; const results = await next(context.request); const models = results.content.toArray(); @@ -52,7 +52,7 @@ const fetchControllerData = async (context, next) => { * Handler to sit in front of the API request layer * so we can request from the daemon first */ -export default class ClientDaemonHandler { +export default class CacheDaemonHandler { @service session; @service ipc; @@ -65,8 +65,8 @@ export default class ClientDaemonHandler { case 'query': { const { store, data } = context.request; const { type, query, options: { pushToStore = true } = {} } = data; - const isClientDaemonRunning = await this.ipc.invoke( - 'isClientDaemonRunning', + const isCacheDaemonRunning = await this.ipc.invoke( + 'isCacheDaemonRunning', ); // eslint-disable-next-line no-unused-vars @@ -75,7 +75,7 @@ export default class ClientDaemonHandler { if ( !Object.keys(supportedTypes).includes(type) || - !isClientDaemonRunning + !isCacheDaemonRunning ) { return fetchControllerData(context, next); } @@ -102,14 +102,14 @@ export default class ClientDaemonHandler { resource: resourceNames[type], }; - let clientDaemonResults = {}; + let cacheDaemonResults = {}; try { - clientDaemonResults = await this.ipc.invoke( - 'searchClientDaemon', + cacheDaemonResults = await this.ipc.invoke( + 'searchCacheDaemon', remainingQuery, ); } catch (e) { - // If we got a 403, most likely the client daemon was restarted and our token is no longer valid + // If we got a 403, most likely the cache daemon was restarted and our token is no longer valid // I'm not sure if we can get a 401 since we always send a token but we'll handle it in the same way if (e.statusCode === 403 || e.statusCode === 401) { try { @@ -117,8 +117,8 @@ export default class ClientDaemonHandler { tokenId: auth_token_id, token, }); - clientDaemonResults = await this.ipc.invoke( - 'searchClientDaemon', + cacheDaemonResults = await this.ipc.invoke( + 'searchCacheDaemon', remainingQuery, ); } catch (err) { @@ -138,7 +138,7 @@ export default class ClientDaemonHandler { // Currently returns with a singular top level field with resource name // e.g. { targets: [...] } or { sessions: [..] } // So this just unwraps to the array, or undefined - const [results] = Object.values(clientDaemonResults); + const [results] = Object.values(cacheDaemonResults); const payload = { items: paginateResults(results, page, pageSize) }; const schema = store.modelFor(type); diff --git a/addons/api/addon/utils/mql-query.js b/addons/api/addon/utils/mql-query.js index 8c5200763..957391bc9 100644 --- a/addons/api/addon/utils/mql-query.js +++ b/addons/api/addon/utils/mql-query.js @@ -5,7 +5,7 @@ /** * Takes a POJO representing a filter query and converts it to an - * MQL expression string which is understood by the client daemon. + * MQL expression string which is understood by the cache daemon. * * @example * const filter = generateMQLFilterExpression({ @@ -68,7 +68,7 @@ export function generateMQLFilterExpression(filterObj) { /** * Takes a POJO representing a search query and converts it to an - * MQL expression string which is understood by the client daemon. + * MQL expression string which is understood by the cache daemon. * * @example * const search = generateMQLSearchExpression({ diff --git a/addons/api/app/handlers/client-daemon-handler.js b/addons/api/app/handlers/client-daemon-handler.js index 4ab9b5d20..90da954a0 100644 --- a/addons/api/app/handlers/client-daemon-handler.js +++ b/addons/api/app/handlers/client-daemon-handler.js @@ -3,4 +3,4 @@ * SPDX-License-Identifier: BUSL-1.1 */ -export { default, resourceNames } from 'api/handlers/client-daemon-handler'; +export { default, resourceNames } from 'api/handlers/cache-daemon-handler'; diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index aea0ed6b1..d2b54b917 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -183,8 +183,8 @@ export default function initializeMockIPC(server, config) { return faker.system.filePath(); } addTokenToDaemons() {} - searchClientDaemon() {} - isClientDaemonRunning() { + searchCacheDaemon() {} + isCacheDaemonRunning() { return false; } isClientAgentRunning() { diff --git a/ui/desktop/app/routes/application.js b/ui/desktop/app/routes/application.js index ceb672f6e..176429211 100644 --- a/ui/desktop/app/routes/application.js +++ b/ui/desktop/app/routes/application.js @@ -38,7 +38,7 @@ export default class ApplicationRoute extends Route { this.toggleTheme(theme); await this.clusterUrl.updateClusterUrl(); - // Add token to client daemon after a successful authentication restoration + // Add token to cache daemon after a successful authentication restoration if (this.session.isAuthenticated) { const sessionData = this.session.data?.authenticated; await this.ipc.invoke('addTokenToDaemons', { diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js b/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js index f9bfa7ac7..23d089aec 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js @@ -118,7 +118,7 @@ export default class ScopesScopeProjectsSessionsIndexRoute extends Route { allSessions: this.allSessions, allTargets: this.allTargets, totalItems, - isClientDaemonRunning: await this.ipc.invoke('isClientDaemonRunning'), + isCacheDaemonRunning: await this.ipc.invoke('isCacheDaemonRunning'), }; } diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js index 070c1553e..e19d37c4d 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js @@ -154,7 +154,7 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route { projects, allTargets: this.allTargets, totalItems, - isClientDaemonRunning: await this.ipc.invoke('isClientDaemonRunning'), + isCacheDaemonRunning: await this.ipc.invoke('isCacheDaemonRunning'), }; } diff --git a/ui/desktop/app/services/session.js b/ui/desktop/app/services/session.js index 7306851f0..e4c6b302d 100644 --- a/ui/desktop/app/services/session.js +++ b/ui/desktop/app/services/session.js @@ -12,7 +12,7 @@ export default class SessionService extends BaseSessionService { /** * Extend ember simple auth's handleAuthentication method - * so we can hook in and add the user's token to the client daemon + * so we can hook in and add the user's token to the cache daemon */ @notifyError(({ message }) => message, { catch: true }) async handleAuthentication() { diff --git a/ui/desktop/app/services/store.js b/ui/desktop/app/services/store.js index a97a44cf4..6d8c12494 100644 --- a/ui/desktop/app/services/store.js +++ b/ui/desktop/app/services/store.js @@ -6,7 +6,7 @@ import Store, { CacheHandler } from '@ember-data/store'; import RequestManager from '@ember-data/request'; import { LegacyNetworkHandler } from '@ember-data/legacy-compat'; -import ClientDaemonHandler from 'api/handlers/client-daemon-handler'; +import CacheDaemonHandler from 'api/handlers/cache-daemon-handler'; export default class extends Store { requestManager = new RequestManager(); @@ -14,9 +14,9 @@ export default class extends Store { constructor(args) { super(args); - const clientDaemonHandler = new ClientDaemonHandler(this); + const cacheDaemonHandler = new CacheDaemonHandler(this); - this.requestManager.use([clientDaemonHandler, LegacyNetworkHandler]); + this.requestManager.use([cacheDaemonHandler, LegacyNetworkHandler]); this.requestManager.useCache(CacheHandler); } } diff --git a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs index 06026d320..838550bdd 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs @@ -4,7 +4,7 @@ }} {{#if (or @model.sessions @model.allSessions)}} - {{#if @model.isClientDaemonRunning}} + {{#if @model.isCacheDaemonRunning}}