Redis db#1444
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds Redis database support to the application, enabling users to connect to and manage Redis databases through the platform. The implementation follows the existing pattern used for other database types like MongoDB, MySQL, Cassandra, etc.
- Adds Redis as a new database type to the system with appropriate enum and configuration entries
- Implements Redis-specific UI components for database credentials input and data display
- Adds field type mappings for Redis data types (string, integer, decimal, boolean, array, json) to corresponding display and edit components
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/app/models/connection.ts | Adds Redis enum value to DBtype |
| frontend/src/app/consts/table-display-types.ts | Maps Redis data types to display components |
| frontend/src/app/consts/record-view-types.ts | Maps Redis data types to record view components |
| frontend/src/app/consts/record-edit-types.ts | Maps Redis data types to edit components |
| frontend/src/app/consts/databases.ts | Registers Redis in supported databases list and titles |
| frontend/src/app/components/connect-db/db-credentials-forms/redis-credentials-form/redis-credentials-form.component.ts | Implements Redis credentials form component |
| frontend/src/app/components/connect-db/db-credentials-forms/redis-credentials-form/redis-credentials-form.component.spec.ts | Adds unit tests for Redis credentials form (contains bugs) |
| frontend/src/app/components/connect-db/db-credentials-forms/redis-credentials-form/redis-credentials-form.component.html | Provides HTML template for Redis connection form (contains MongoDB references) |
| frontend/src/app/components/connect-db/db-credentials-forms/redis-credentials-form/redis-credentials-form.component.css | Styles for Redis credentials form |
| frontend/src/app/components/connect-db/connect-db.component.ts | Integrates Redis form component and adds default port configuration |
| frontend/src/app/components/connect-db/connect-db.component.html | Adds Redis credentials form to connection UI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,61 @@ | |||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | |||
|
|
|||
| import { MongodbCredentialsFormComponent } from './mongodb-credentials-form.component'; | |||
There was a problem hiding this comment.
The test file imports the wrong component. This should import RedisCredentialsFormComponent instead of MongodbCredentialsFormComponent.
| describe('MongodbCredentialsFormComponent', () => { | ||
| let component: MongodbCredentialsFormComponent; | ||
| let fixture: ComponentFixture<MongodbCredentialsFormComponent>; | ||
|
|
||
| beforeEach(async () => { | ||
| await TestBed.configureTestingModule({ | ||
| imports: [ | ||
| FormsModule, | ||
| MatCheckboxModule, | ||
| BrowserAnimationsModule, | ||
| Angulartics2Module.forRoot({}), | ||
| MongodbCredentialsFormComponent | ||
| ], | ||
| providers: [provideHttpClient()] | ||
| }) | ||
| .compileComponents(); | ||
|
|
||
| fixture = TestBed.createComponent(MongodbCredentialsFormComponent); | ||
| component = fixture.componentInstance; |
There was a problem hiding this comment.
The test suite name and component references are incorrect. This should test RedisCredentialsFormComponent but references MongodbCredentialsFormComponent throughout. Update the describe block, component type, fixture type, and all component references to use RedisCredentialsFormComponent.
| data-testid="connection-hostname-input" | ||
| angulartics2On="change" | ||
| angularticsAction="Connection creds {{ connection.id ? 'edit' : 'add' }}: hostname is edited" | ||
| required hostnameValidator="mongodb" |
There was a problem hiding this comment.
The hostnameValidator attribute should not specify "mongodb" as the value. Based on other database forms (e.g., MySQL, Cassandra), this should be either hostnameValidator without a value, or hostnameValidator="redis" if Redis requires special hostname validation.
| required hostnameValidator="mongodb" | |
| required hostnameValidator |
| [disabled]="submitting" | ||
| [(ngModel)]="connection.host"> | ||
| <mat-hint> | ||
| E.g. <strong><code>mongodb+srv://my-test-db.8a8grvb.mongoconnection.net</code></strong><br> |
There was a problem hiding this comment.
The hostname example shows a MongoDB connection string instead of a Redis hostname. This should be updated to show a Redis-appropriate example, such as redis.example.com or my-redis-instance.cache.amazonaws.com.
| E.g. <strong><code>mongodb+srv://my-test-db.8a8grvb.mongoconnection.net</code></strong><br> | |
| E.g. <strong><code>redis.example.com</code></strong> or <strong><code>my-redis-instance.cache.amazonaws.com</code></strong><br> |
No description provided.