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 fb130d244..1a98bd37b 100644 --- a/frontend/src/app/components/connect-db/connect-db.component.html +++ b/frontend/src/app/components/connect-db/connect-db.component.html @@ -34,6 +34,7 @@

PostgreSQL MongoDB DynamoDB + Cassandra Oracle MS SQL IBM DB2 @@ -127,6 +128,20 @@

(masterKeyChange)="handleMasterKeyChange($event)"> + + + + 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 on internal IP use Pinggy + (how-to) + or for agent connection. + + 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. + + + + Database name + + Name should not be empty. + + + + Data center + + + + + + + + Advanced settings + + + +
+ + + + + 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/cassandra-credentials-form/cassandra-credentials-form.component.spec.ts b/frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.spec.ts new file mode 100644 index 000000000..6d664484a --- /dev/null +++ b/frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.spec.ts @@ -0,0 +1,36 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Angulartics2Module } from 'angulartics2'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { CassandraCredentialsFormComponent } from './cassandra-credentials-form.component'; +import { provideHttpClient } from '@angular/common/http'; + +describe('CassandraCredentialsFormComponent', () => { + let component: CassandraCredentialsFormComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + BrowserAnimationsModule, + Angulartics2Module.forRoot(), + CassandraCredentialsFormComponent + ], + providers: [provideHttpClient()] + }) + .compileComponents(); + + fixture = TestBed.createComponent(CassandraCredentialsFormComponent); + component = fixture.componentInstance; + + component.connection = { + id: "12345678" + } as any; + + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.ts b/frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.ts new file mode 100644 index 000000000..a0896f29e --- /dev/null +++ b/frontend/src/app/components/connect-db/db-credentials-forms/cassandra-credentials-form/cassandra-credentials-form.component.ts @@ -0,0 +1,32 @@ +import { Component } from '@angular/core'; +import { Angulartics2Module } from 'angulartics2'; +import { BaseCredentialsFormComponent } from '../base-credentials-form/base-credentials-form.component'; +import { FormsModule } from '@angular/forms'; +import { HostnameValidationDirective } from 'src/app/directives/hostnameValidator.directive'; +import { MasterEncryptionPasswordComponent } from '../../master-encryption-password/master-encryption-password.component'; +import { MatExpansionModule } from '@angular/material/expansion'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { NgIf } from '@angular/common'; +import { MatCheckboxModule } from '@angular/material/checkbox'; + +@Component({ + selector: 'app-cassandra-credentials-form', + templateUrl: './cassandra-credentials-form.component.html', + styleUrls: ['../base-credentials-form/base-credentials-form.component.css', './cassandra-credentials-form.component.css'], + imports: [ + NgIf, + FormsModule, + MatFormFieldModule, + MatInputModule, + MatCheckboxModule, + MatExpansionModule, + HostnameValidationDirective, + MasterEncryptionPasswordComponent, + Angulartics2Module + ] +}) + +export class CassandraCredentialsFormComponent extends BaseCredentialsFormComponent { + +} diff --git a/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts b/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts index be6396baa..366a08b38 100644 --- a/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts +++ b/frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.ts @@ -585,7 +585,7 @@ export class DbTableRowEditComponent implements OnInit { //parse json fields const jsonFields = Object.entries(this.tableTypes) - .filter(([key, value]) => value === 'json' || value === 'jsonb' || value === 'array' || value === 'ARRAY' || value === 'object') + .filter(([key, value]) => value === 'json' || value === 'jsonb' || value === 'array' || value === 'ARRAY' || value === 'object' || value === 'set' || value === 'list' || value === 'map') .map(jsonField => jsonField[0]); if (jsonFields.length) { for (const jsonField of jsonFields) { diff --git a/frontend/src/app/consts/record-edit-types.ts b/frontend/src/app/consts/record-edit-types.ts index efefaa413..5a2d300d5 100644 --- a/frontend/src/app/consts/record-edit-types.ts +++ b/frontend/src/app/consts/record-edit-types.ts @@ -274,5 +274,31 @@ export const recordEditTypes = { array: JsonEditorEditComponent, json: JsonEditorEditComponent, binary: FileEditComponent, + }, + cassandra: { + int: NumberEditComponent, + bigint: NumberEditComponent, + varint: NumberEditComponent, + decimal: NumberEditComponent, + float: NumberEditComponent, + double: NumberEditComponent, + + boolean: BooleanEditComponent, + + timeuuid: IdEditComponent, + + timestamp: DateTimeEditComponent, + date: DateEditComponent, + time: TimeEditComponent, + + uuid: TextEditComponent, + varchar: TextEditComponent, + inet: TextEditComponent, + ascii: TextEditComponent, + text: LongTextEditComponent, + + list: JsonEditorEditComponent, + map: JsonEditorEditComponent, + set: JsonEditorEditComponent, } } diff --git a/frontend/src/app/consts/record-view-types.ts b/frontend/src/app/consts/record-view-types.ts deleted file mode 100644 index 6323d1595..000000000 --- a/frontend/src/app/consts/record-view-types.ts +++ /dev/null @@ -1,270 +0,0 @@ -import { BinaryDataCaptionViewComponent } from '../components/ui-components/record-view-fields/binary-data-caption/binary-data-caption.component'; -import { BooleanViewComponent } from 'src/app/components/ui-components/record-view-fields/boolean/boolean.component' -import { CodeViewComponent } from '../components/ui-components/record-view-fields/code/code.component'; -import { CountryViewComponent } from '../components/ui-components/record-view-fields/country/country.component'; -import { DateTimeViewComponent } from '../components/ui-components/record-view-fields/date-time/date-time.component'; -import { DateViewComponent } from '../components/ui-components/record-view-fields/date/date.component'; -import { FileViewComponent } from '../components/ui-components/record-view-fields/file/file.component'; -import { ForeignKeyViewComponent } from '../components/ui-components/record-view-fields/foreign-key/foreign-key.component'; -import { IdViewComponent } from '../components/ui-components/record-view-fields/id/id.component'; -import { ImageViewComponent } from '../components/ui-components/record-view-fields/image/image.component'; -import { JsonEditorViewComponent } from '../components/ui-components/record-view-fields/json-editor/json-editor.component'; -import { LongTextViewComponent } from 'src/app/components/ui-components/record-view-fields/long-text/long-text.component' -import { MoneyViewComponent } from '../components/ui-components/record-view-fields/money/money.component'; -import { NumberViewComponent } from 'src/app/components/ui-components/record-view-fields/number/number.component'; -import { PasswordViewComponent } from '../components/ui-components/record-view-fields/password/password.component'; -import { PhoneViewComponent } from '../components/ui-components/record-view-fields/phone/phone.component'; -import { PointViewComponent } from 'src/app/components/ui-components/record-view-fields/point/point.component'; -import { SelectViewComponent } from '../components/ui-components/record-view-fields/select/select.component'; -import { StaticTextViewComponent } from '../components/ui-components/record-view-fields/static-text/static-text.component'; -import { TextViewComponent } from 'src/app/components/ui-components/record-view-fields/text/text.component'; -import { TimeIntervalViewComponent } from '../components/ui-components/record-view-fields/time-interval/time-interval.component'; -import { TimeViewComponent } from '../components/ui-components/record-view-fields/time/time.component'; -import { UrlViewComponent } from '../components/ui-components/record-view-fields/url/url.component'; - -export const UIwidgets = { - Default: '', - Boolean: BooleanViewComponent, - Date: DateViewComponent, - Time: TimeViewComponent, - DateTime: DateTimeViewComponent, - JSON: JsonEditorViewComponent, - Textarea: LongTextViewComponent, - String: TextViewComponent, - Readonly: StaticTextViewComponent, - Number: NumberViewComponent, - Select: SelectViewComponent, - Password: PasswordViewComponent, - File: FileViewComponent, - Code: CodeViewComponent, - Image: ImageViewComponent, - URL: UrlViewComponent, - Country: CountryViewComponent, - Phone: PhoneViewComponent, - Money: MoneyViewComponent, - Foreign_key: ForeignKeyViewComponent, -} - -export const recordViewTypes = { - postgres: { - // numbers (number) - real: NumberViewComponent, - "double precision": NumberViewComponent, - smallint: NumberViewComponent, - integer: NumberViewComponent, - bigint: NumberViewComponent, - numeric: NumberViewComponent, - - //boolean (checkbox) - boolean: BooleanViewComponent, - - //datetime (datepicker) - "timestamp without time zone": DateTimeViewComponent, - "timestamp with time zone": DateTimeViewComponent, - "time without time zone": TimeViewComponent, - "time with time zone": TimeViewComponent, - date: DateViewComponent, - abstime: DateTimeViewComponent, - realtime: DateTimeViewComponent, - interval: TimeIntervalViewComponent, - - // short text (text) - "character varying": TextViewComponent, - macaddr: TextViewComponent, - macaddr8: TextViewComponent, - cidr: TextViewComponent, - inet: TextViewComponent, - uuid: TextViewComponent, - - //long text (textarea) - text: LongTextViewComponent, - xml: LongTextViewComponent, - - //select (select) - enum: SelectViewComponent, - - // json-editor - json: JsonEditorViewComponent, - jsonb: JsonEditorViewComponent, - ARRAY: JsonEditorViewComponent, - - //file - bytea: FileViewComponent, - - //etc - money: MoneyViewComponent, - - //mess (math) - point: PointViewComponent, - line: TextViewComponent, - circle: TextViewComponent, - path: TextViewComponent, - box: TextViewComponent, - lseg: TextViewComponent, - - "foreign key": ForeignKeyViewComponent - }, - - mysql: { - // numbers (number) - tinyint: NumberViewComponent, - smallint: NumberViewComponent, - mediumint: NumberViewComponent, - int: NumberViewComponent, - bigint: NumberViewComponent, - decimal: NumberViewComponent, - float: NumberViewComponent, - double: NumberViewComponent, - year: NumberViewComponent, - - //boolean (radiogroup) - boolean: BooleanViewComponent, - - //datetime (datepicker) - date: DateViewComponent, - time: TimeViewComponent, - datetime: DateTimeViewComponent, - timestamp: DateTimeViewComponent, - - // short text (text) - char: TextViewComponent, - varchar: TextViewComponent, - - //long text (textarea) - text: LongTextViewComponent, - tinytext: LongTextViewComponent, - mediumtext: LongTextViewComponent, - longtext: LongTextViewComponent, - - json: JsonEditorViewComponent, //json-editor - - //select (select) - enum: SelectViewComponent, - - //file - binary: FileViewComponent, - varbinary: FileViewComponent, - blob: FileViewComponent, - tinyblob: FileViewComponent, - mediumblob: FileViewComponent, - longblob: FileViewComponent, - - //etc - set: TextViewComponent, - - "foreign key": ForeignKeyViewComponent - }, - - oracledb: { - // numbers (number) - NUMBER: NumberViewComponent, - FLOAT: NumberViewComponent, - BINARY_FLOAT: NumberViewComponent, - BINARY_DOUBLE: NumberViewComponent, - "INTERVAL YEAR": NumberViewComponent, - "INTERVAL DAY": NumberViewComponent, - - //datetime (datepicker) - DATE: DateViewComponent, - TIMESTAMP: DateTimeViewComponent, - - // short text (text) - CHAR: TextViewComponent, - NCHAR: TextViewComponent, - CLOB: TextViewComponent, - NCLOB: TextViewComponent, - VARCHAR2: TextViewComponent, - VARCHAR: TextViewComponent, - NVARCHAR2: TextViewComponent, - - //file - BLOB: FileViewComponent, - BFILE: FileViewComponent, - RAW: FileViewComponent, - "LONG RAW": FileViewComponent, - LONG: FileViewComponent, - - "foreign key": ForeignKeyViewComponent - }, - - mssql: { - // numbers (number) - bigint: NumberViewComponent, - int: NumberViewComponent, - smallint: NumberViewComponent, - tinyint: NumberViewComponent, - decimal: NumberViewComponent, - bitdecimal: NumberViewComponent, - numeric: NumberViewComponent, - real: NumberViewComponent, - - // short text (text) - uniqueidentifier: IdViewComponent, - char: TextViewComponent, - varchar: TextViewComponent, - - //long text (textarea) - text: LongTextViewComponent, - nchar: LongTextViewComponent, - nvarchar: LongTextViewComponent, - ntext: LongTextViewComponent, - - //datetime (datepicker) - date: DateViewComponent, - datetime: DateTimeViewComponent, - smalldatetime: DateTimeViewComponent, - timestamp: DateTimeViewComponent, - - //file - binary: FileViewComponent, - varbinary: FileViewComponent, - image: ImageViewComponent, - - // etc - money: MoneyViewComponent, - smallmoney: MoneyViewComponent, - - "foreign key": ForeignKeyViewComponent - }, - mongodb: { - // numbers (number) - number: NumberViewComponent, - double: NumberViewComponent, - int32: NumberViewComponent, - long: NumberViewComponent, - decimal128: NumberViewComponent, - - //boolean (radiogroup) - boolean: BooleanViewComponent, - - //datetime (datepicker) - date: DateViewComponent, - timestamp: DateTimeViewComponent, - - // short text (text) - string: TextViewComponent, - regexp: TextViewComponent, - objectid: TextViewComponent, - - //file - binary: FileViewComponent, - - //json - object: JsonEditorViewComponent, - array: JsonEditorViewComponent, - - //etc - unknown: TextViewComponent, - - "foreign key": ForeignKeyViewComponent - }, - dynamodb: { - string: TextViewComponent, - number: NumberViewComponent, - boolean: BooleanViewComponent, - null: StaticTextViewComponent, - array: JsonEditorViewComponent, - json: JsonEditorViewComponent, - binary: FileViewComponent, - } -} diff --git a/frontend/src/app/consts/table-display-types.ts b/frontend/src/app/consts/table-display-types.ts index 9dd1a089f..282f5005a 100644 --- a/frontend/src/app/consts/table-display-types.ts +++ b/frontend/src/app/consts/table-display-types.ts @@ -267,5 +267,31 @@ export const tableDisplayTypes = { array: JsonEditorDisplayComponent, json: JsonEditorDisplayComponent, binary: FileDisplayComponent, - } + }, + cassandra: { + int: NumberDisplayComponent, + bigint: NumberDisplayComponent, + varint: NumberDisplayComponent, + decimal: NumberDisplayComponent, + float: NumberDisplayComponent, + double: NumberDisplayComponent, + + boolean: BooleanDisplayComponent, + + timeuuid: IdDisplayComponent, + + timestamp: DateTimeDisplayComponent, + date: DateDisplayComponent, + time: TimeDisplayComponent, + + uuid: TextDisplayComponent, + varchar: TextDisplayComponent, + inet: TextDisplayComponent, + ascii: TextDisplayComponent, + text: LongTextDisplayComponent, + + list: JsonEditorDisplayComponent, + map: JsonEditorDisplayComponent, + set: JsonEditorDisplayComponent, + }, } diff --git a/frontend/src/app/models/connection.ts b/frontend/src/app/models/connection.ts index 8f9838757..4a022b1aa 100644 --- a/frontend/src/app/models/connection.ts +++ b/frontend/src/app/models/connection.ts @@ -7,6 +7,7 @@ export enum DBtype { MSSQL = 'mssql', Mongo = 'mongodb', Dynamo = 'dynamodb', + Cassandra = 'cassandra', DB2 = 'ibmdb2' } @@ -40,7 +41,8 @@ export interface Connection { connectionType: ConnectionType, schema?: string, signing_key?: string, - isTestConnection?: boolean + isTestConnection?: boolean, + dataCenter?: string } export interface ConnectionItem {