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)"> + + + + Hostname + + + E.g. cluster-123456.es.europe-west1.gcp.elastic-cloud.com
+ 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..4f24e4172 --- /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 { ElasticCredentialsFormComponent } from './elastic-credentials-form.component'; +import { FormsModule } from '@angular/forms'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { provideHttpClient } from '@angular/common/http'; + +describe('ElasticCredentialsFormComponent', () => { + let component: ElasticCredentialsFormComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + FormsModule, + MatCheckboxModule, + BrowserAnimationsModule, + Angulartics2Module.forRoot({}), + ElasticCredentialsFormComponent + ], + providers: [provideHttpClient()] +}) + .compileComponents(); + + fixture = TestBed.createComponent(ElasticCredentialsFormComponent); + 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..ee726283f --- /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-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, + MatFormFieldModule, + MatInputModule, + MatCheckboxModule, + MatExpansionModule, + HostnameValidationDirective, + MasterEncryptionPasswordComponent, + Angulartics2Module + ] +}) +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' }