From 0ec3884aa49d95c222c2a3861f1f704f854d1da1 Mon Sep 17 00:00:00 2001 From: Lyubov Voloshko Date: Fri, 21 Nov 2025 15:56:07 +0200 Subject: [PATCH 1/2] add elasticsearch creds form --- .../elastic-credentials-form.component.css | 14 ++ .../elastic-credentials-form.component.html | 188 ++++++++++++++++++ ...elastic-credentials-form.component.spec.ts | 61 ++++++ .../elastic-credentials-form.component.ts | 31 +++ 4 files changed, 294 insertions(+) create mode 100644 frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.css create mode 100644 frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.html create mode 100644 frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts create mode 100644 frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.css b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.css new file mode 100644 index 000000000..8b6ed6b0b --- /dev/null +++ b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.css @@ -0,0 +1,14 @@ +.connectForm__hostname, +.connectForm__port { + padding-bottom: 20px; +} + +@media (width <= 600px) { + .connectForm__hostname { + padding-bottom: 44px; + } + + .connectForm__port { + padding-bottom: 0; + } +} \ No newline at end of file diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.html b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.html new file mode 100644 index 000000000..d1d533860 --- /dev/null +++ b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.html @@ -0,0 +1,188 @@ + + Hostname + + + E.g. mongodb+srv://my-test-db.8a8grvb.mongoconnection.net
+ Connections from internal IPs (e.g. localhost) are not supported +
+ + + To connect a database to an internal IP, use something like Pinggy + (here's a guide), + or to connect through an agent + + Hostname is invalid +
+ + + Port + + Port should not be empty + + + + Username + + Username should not be empty + + + + Password + + To keep password the same keep this field blank + Password needed due to hostname/port change + + + + + + Advanced settings + + + +
+ + + + + Username + + Username should not be empty + + + + Database name + + Name should not be empty + + + + Use SSH tunnel + + + + Private SSH key + + Private SSH key should not be empty + + + + SSH host + + SSH host should not be empty + + + + SSH port + + SSH port should not be empty + + + + SSH username + + SSH username should not be empty + + + + Check SSL certificate + + + + SSL certificate + + SSL certificate should not be empty + +
+
\ No newline at end of file diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts new file mode 100644 index 000000000..ae83b4871 --- /dev/null +++ b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts @@ -0,0 +1,61 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Angulartics2Module } from 'angulartics2'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { FormsModule } from '@angular/forms'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { RedisCredentialsFormComponent } from './redis-credentials-form.component'; +import { provideHttpClient } from '@angular/common/http'; + +describe('RedisCredentialsFormComponent', () => { + let component: RedisCredentialsFormComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + FormsModule, + MatCheckboxModule, + BrowserAnimationsModule, + Angulartics2Module.forRoot({}), + RedisCredentialsFormComponent + ], + providers: [provideHttpClient()] +}) + .compileComponents(); + + fixture = TestBed.createComponent(RedisCredentialsFormComponent); + component = fixture.componentInstance; + + component.connection = { + id: "12345678" + } as any; + + // component.connection = { + // "title": "Test connection via SSH tunnel to mySQL", + // "masterEncryption": false, + // "type": DBtype.MySQL, + // "host": "database-2.cvfuxe8nltiq.us-east-2.rds.amazonaws.com", + // "port": "3306", + // "username": "admin", + // "database": "testDB", + // "schema": null, + // "sid": null, + // "id": "9d5f6d0f-9516-4598-91c4-e4fe6330b4d4", + // "ssh": true, + // "sshHost": "3.134.99.192", + // "sshPort": '22', + // "sshUsername": "ubuntu", + // "ssl": false, + // "cert": null, + // "connectionType": ConnectionType.Direct, + // "azure_encryption": false, + // "signing_key": '' + // }; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts new file mode 100644 index 000000000..fff5c7836 --- /dev/null +++ b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts @@ -0,0 +1,31 @@ +import { Angulartics2Module } from 'angulartics2'; +import { BaseCredentialsFormComponent } from '../base-credentials-form/base-credentials-form.component'; +import { Component } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { HostnameValidationDirective } from 'src/app/directives/hostnameValidator.directive'; +import { MasterEncryptionPasswordComponent } from '../../master-encryption-password/master-encryption-password.component'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { MatExpansionModule } from '@angular/material/expansion'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { NgIf } from '@angular/common'; + +@Component({ + selector: 'app-redis-credentials-form', + templateUrl: './redis-credentials-form.component.html', + styleUrls: ['../base-credentials-form/base-credentials-form.component.css', './redis-credentials-form.component.css'], + imports: [ + NgIf, + FormsModule, + MatFormFieldModule, + MatInputModule, + MatCheckboxModule, + MatExpansionModule, + HostnameValidationDirective, + MasterEncryptionPasswordComponent, + Angulartics2Module + ] +}) +export class RedisCredentialsFormComponent extends BaseCredentialsFormComponent { + +} From a6b1965a4aba216a63c7b0f0a54b7677a30c9093 Mon Sep 17 00:00:00 2001 From: Lyubov Voloshko Date: Fri, 21 Nov 2025 16:41:42 +0200 Subject: [PATCH 2/2] creds and components --- .../connect-db/connect-db.component.html | 14 ++++++++++++++ .../components/connect-db/connect-db.component.ts | 3 +++ .../elastic-credentials-form.component.html | 4 ++-- .../elastic-credentials-form.component.spec.ts | 12 ++++++------ .../elastic-credentials-form.component.ts | 8 ++++---- frontend/src/app/consts/databases.ts | 2 ++ frontend/src/app/consts/record-edit-types.ts | 9 +++++++++ frontend/src/app/consts/record-view-types.ts | 9 +++++++++ frontend/src/app/consts/table-display-types.ts | 9 +++++++++ frontend/src/app/models/connection.ts | 1 + 10 files changed, 59 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/components/connect-db/connect-db.component.html b/frontend/src/app/components/connect-db/connect-db.component.html index 28513afa8..8ebfb3796 100644 --- a/frontend/src/app/components/connect-db/connect-db.component.html +++ b/frontend/src/app/components/connect-db/connect-db.component.html @@ -179,6 +179,20 @@

(masterKeyChange)="handleMasterKeyChange($event)"> + + + - E.g. mongodb+srv://my-test-db.8a8grvb.mongoconnection.net
+ E.g. cluster-123456.es.europe-west1.gcp.elastic-cloud.com
Connections from internal IPs (e.g. localhost) are not supported
diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts index ae83b4871..4f24e4172 100644 --- a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts +++ b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.spec.ts @@ -2,14 +2,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Angulartics2Module } from 'angulartics2'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { ElasticCredentialsFormComponent } from './elastic-credentials-form.component'; import { FormsModule } from '@angular/forms'; import { MatCheckboxModule } from '@angular/material/checkbox'; -import { RedisCredentialsFormComponent } from './redis-credentials-form.component'; import { provideHttpClient } from '@angular/common/http'; -describe('RedisCredentialsFormComponent', () => { - let component: RedisCredentialsFormComponent; - let fixture: ComponentFixture; +describe('ElasticCredentialsFormComponent', () => { + let component: ElasticCredentialsFormComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ @@ -18,13 +18,13 @@ describe('RedisCredentialsFormComponent', () => { MatCheckboxModule, BrowserAnimationsModule, Angulartics2Module.forRoot({}), - RedisCredentialsFormComponent + ElasticCredentialsFormComponent ], providers: [provideHttpClient()] }) .compileComponents(); - fixture = TestBed.createComponent(RedisCredentialsFormComponent); + fixture = TestBed.createComponent(ElasticCredentialsFormComponent); component = fixture.componentInstance; component.connection = { diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts index fff5c7836..ee726283f 100644 --- a/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts +++ b/frontend/src/app/components/connect-db/db-credentials-forms/elastic-credentials-form/elastic-credentials-form.component.ts @@ -11,9 +11,9 @@ import { MatInputModule } from '@angular/material/input'; import { NgIf } from '@angular/common'; @Component({ - selector: 'app-redis-credentials-form', - templateUrl: './redis-credentials-form.component.html', - styleUrls: ['../base-credentials-form/base-credentials-form.component.css', './redis-credentials-form.component.css'], + selector: 'app-elastic-credentials-form', + templateUrl: './elastic-credentials-form.component.html', + styleUrls: ['../base-credentials-form/base-credentials-form.component.css', './elastic-credentials-form.component.css'], imports: [ NgIf, FormsModule, @@ -26,6 +26,6 @@ import { NgIf } from '@angular/common'; Angulartics2Module ] }) -export class RedisCredentialsFormComponent extends BaseCredentialsFormComponent { +export class ElasticCredentialsFormComponent extends BaseCredentialsFormComponent { } diff --git a/frontend/src/app/consts/databases.ts b/frontend/src/app/consts/databases.ts index deab3d674..82a05a714 100644 --- a/frontend/src/app/consts/databases.ts +++ b/frontend/src/app/consts/databases.ts @@ -7,6 +7,7 @@ export const supportedOrderedDatabases = [ "oracledb", "mssql", "redis", + "elasticsearch", "ibmdb2" ] @@ -19,5 +20,6 @@ export const supportedDatabasesTitles = { oracledb: "OracleDB", mssql: "SQL Server", redis: "Redis", + elasticsearch: "Elasticsearch", ibmdb2: "IBM DB2" } \ No newline at end of file diff --git a/frontend/src/app/consts/record-edit-types.ts b/frontend/src/app/consts/record-edit-types.ts index 81f791998..9e172b121 100644 --- a/frontend/src/app/consts/record-edit-types.ts +++ b/frontend/src/app/consts/record-edit-types.ts @@ -316,5 +316,14 @@ export const recordEditTypes = { boolean: BooleanEditComponent, array: JsonEditorEditComponent, json: JsonEditorEditComponent, + }, + elasticsearch: { + string: TextEditComponent, + number: NumberEditComponent, + boolean: BooleanEditComponent, + date: DateEditComponent, + object: JsonEditorEditComponent, + array: JsonEditorEditComponent, + binary: FileEditComponent, } } diff --git a/frontend/src/app/consts/record-view-types.ts b/frontend/src/app/consts/record-view-types.ts index ed5ddf714..2e663fa92 100644 --- a/frontend/src/app/consts/record-view-types.ts +++ b/frontend/src/app/consts/record-view-types.ts @@ -309,5 +309,14 @@ export const recordViewFieldTypes = { boolean: BooleanRecordViewComponent, array: JsonEditorRecordViewComponent, json: JsonEditorRecordViewComponent, + }, + elasticsearch: { + string: TextRecordViewComponent, + number: NumberRecordViewComponent, + boolean: BooleanRecordViewComponent, + date: DateRecordViewComponent, + object: JsonEditorRecordViewComponent, + array: JsonEditorRecordViewComponent, + binary: FileRecordViewComponent, } } diff --git a/frontend/src/app/consts/table-display-types.ts b/frontend/src/app/consts/table-display-types.ts index 417ff3771..0abf9ae22 100644 --- a/frontend/src/app/consts/table-display-types.ts +++ b/frontend/src/app/consts/table-display-types.ts @@ -309,5 +309,14 @@ export const tableDisplayTypes = { boolean: BooleanDisplayComponent, array: JsonEditorDisplayComponent, json: JsonEditorDisplayComponent, + }, + elasticsearch: { + string: TextDisplayComponent, + number: NumberDisplayComponent, + boolean: BooleanDisplayComponent, + date: DateDisplayComponent, + object: JsonEditorDisplayComponent, + array: JsonEditorDisplayComponent, + binary: FileDisplayComponent, } } diff --git a/frontend/src/app/models/connection.ts b/frontend/src/app/models/connection.ts index 79ec97fcd..45554fd38 100644 --- a/frontend/src/app/models/connection.ts +++ b/frontend/src/app/models/connection.ts @@ -9,6 +9,7 @@ export enum DBtype { Dynamo = 'dynamodb', Cassandra = 'cassandra', Redis = 'redis', + Elasticsearch = 'elasticsearch', DB2 = 'ibmdb2' }