-
Notifications
You must be signed in to change notification settings - Fork 32
feat: 🎸 Refactor session recording filters #2981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7a88855
feat: 🎸 Refactor session recording filters
ZedLi 470ceeb
refactor: 💡 Add loading indicator for initial loads
ZedLi 2c73c4d
refactor: 💡 Refactor select query generation
ZedLi e33bde2
refactor: 💡 Add a db service as intermediate for direct queries
ZedLi 6a6d53b
Add missing copyright headers
ZedLi 361fdf6
fixup! refactor: 💡 Refactor select query generation
ZedLi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
|
|
||
| import Service, { service } from '@ember/service'; | ||
| import { modelMapping } from 'api/services/sqlite'; | ||
| import { assert } from '@ember/debug'; | ||
| import { generateSQLExpressions } from '../utils/sqlite-query'; | ||
|
|
||
| /** | ||
| * Database service for querying Boundary resources from storage. | ||
| * Provides a high-level interface for executing queries against the local database. | ||
| */ | ||
| export default class DbService extends Service { | ||
| @service sqlite; | ||
|
|
||
| /** | ||
| * Query resources from the database by type. | ||
| * | ||
| * @param {string} type - The resource type (e.g., 'scope', 'user', 'target'). | ||
| * Must be a supported model type defined in modelMapping. | ||
| * @param {Object} query - Query configuration object | ||
| * @returns {Promise<Object>} Promise resolving to query results from sqlite service | ||
| * @throws {Error} Assertion error if resource type is not supported | ||
| */ | ||
| query(type, query) { | ||
| const supportedModels = Object.keys(modelMapping); | ||
| assert('Resource type is not supported.', supportedModels.includes(type)); | ||
|
|
||
| let { page, pageSize, select, query: queryObj } = query; | ||
|
|
||
| const { sql, parameters } = generateSQLExpressions(type, queryObj, { | ||
| page, | ||
| pageSize, | ||
| select, | ||
| }); | ||
|
|
||
| return this.sqlite.fetchResource({ | ||
| sql, | ||
| parameters, | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
|
|
||
| export { default } from 'api/services/db'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
|
|
||
| import { module, test } from 'qunit'; | ||
| import { setupTest } from 'dummy/tests/helpers'; | ||
|
|
||
| module('Unit | Service | db', function (hooks) { | ||
| setupTest(hooks); | ||
|
|
||
| test('query throws assertion error for unsupported resource type', function (assert) { | ||
| let service = this.owner.lookup('service:db'); | ||
|
|
||
| assert.throws(() => { | ||
| service.query('unsupported-type', { query: {} }); | ||
| }, /Resource type is not supported/); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.