Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/shared/model/north-connector.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const OIBUS_NORTH_TYPES = [
'file-writer',
'metroscope-lithium',
'oianalytics',
'postgresql',
'sftp',
'rest'
] as const;
Expand Down
21 changes: 21 additions & 0 deletions backend/shared/model/north-settings.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export interface NorthRESTSettingsQueryParams {
value: string;
}

export interface NorthPostgreSQLSettingsCustomIndexes {
name: string;
column: string;
unique: boolean;
order: string;
}

export interface NorthAmazonS3Settings {
bucket: string;
region: string;
Expand Down Expand Up @@ -94,6 +101,19 @@ export interface NorthOIAnalyticsSettings {
specificSettings?: NorthOIAnalyticsSettingsSpecificSettings | null;
}

export interface NorthPostgreSQLSettings {
host: string;
port: number;
database: string;
username: string;
password: string | null;
table: string;
createTableIfNotExists: boolean;
batchSize: number;
connectionTimeout: number;
customIndexes: Array<NorthPostgreSQLSettingsCustomIndexes> | null;
}

export interface NorthRESTSettings {
endpoint: string;
testPath: string;
Expand Down Expand Up @@ -129,5 +149,6 @@ export type NorthSettings =
| NorthFileWriterSettings
| NorthMetroscopeLithiumSettings
| NorthOIAnalyticsSettings
| NorthPostgreSQLSettings
| NorthRESTSettings
| NorthSFTPSettings;
146 changes: 146 additions & 0 deletions backend/src/north/north-postgresql/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import { NorthConnectorManifest } from '../../../shared/model/north-connector.model';

const manifest: NorthConnectorManifest = {
id: 'postgresql',
category: 'api',
modes: {
files: false,
points: true
},
settings: [
{
key: 'host',
type: 'OibText',
translationKey: 'north.postgresql.host',
newRow: true,
defaultValue: 'localhost',
displayInViewMode: true,
validators: [{ key: 'required' }],
class: 'col-6'
},
{
key: 'port',
type: 'OibNumber',
translationKey: 'north.postgresql.port',
defaultValue: 5432,
validators: [{ key: 'required' }, { key: 'min', params: { min: 1 } }, { key: 'max', params: { max: 65535 } }],
displayInViewMode: true,
class: 'col-3'
},
{
key: 'database',
type: 'OibText',
translationKey: 'north.postgresql.database',
newRow: true,
defaultValue: '',
displayInViewMode: true,
validators: [{ key: 'required' }],
class: 'col-6'
},
{
key: 'username',
type: 'OibText',
translationKey: 'north.postgresql.username',
defaultValue: '',
displayInViewMode: true,
validators: [{ key: 'required' }],
class: 'col-3'
},
{
key: 'password',
type: 'OibSecret',
translationKey: 'north.postgresql.password',
defaultValue: '',
class: 'col-3'
},
{
key: 'table',
type: 'OibText',
translationKey: 'north.postgresql.table',
newRow: true,
defaultValue: 'oibus_data',
displayInViewMode: true,
validators: [{ key: 'required' }],
class: 'col-6'
},
{
key: 'createTableIfNotExists',
type: 'OibCheckbox',
translationKey: 'north.postgresql.create-table-if-not-exists',
defaultValue: true,
displayInViewMode: true,
validators: [{ key: 'required' }],
class: 'col-3'
},
{
key: 'batchSize',
type: 'OibNumber',
translationKey: 'north.postgresql.batch-size',
defaultValue: 1000,
validators: [{ key: 'required' }, { key: 'min', params: { min: 1 } }, { key: 'max', params: { max: 10000 } }],
displayInViewMode: true,
class: 'col-3'
},
{
key: 'connectionTimeout',
type: 'OibNumber',
translationKey: 'north.postgresql.connection-timeout',
newRow: true,
defaultValue: 30,
unitLabel: 's',
validators: [{ key: 'required' }, { key: 'min', params: { min: 1 } }],
displayInViewMode: true,
class: 'col-3'
},
{
key: 'customIndexes',
type: 'OibArray',
translationKey: 'north.postgresql.custom-indexes.custom-index',
content: [
{
key: 'name',
translationKey: 'north.postgresql.custom-indexes.name',
type: 'OibText',
defaultValue: '',
validators: [{ key: 'required' }],
displayInViewMode: true,
class: 'col-4'
},
{
key: 'column',
translationKey: 'north.postgresql.custom-indexes.column',
type: 'OibSelect',
defaultValue: 'timestamp',
validators: [{ key: 'required' }],
displayInViewMode: true,
options: ['timestamp', 'point_id', 'data_value', 'data_quality', 'digital_value', 'created_at'],
class: 'col-4'
},
{
key: 'unique',
translationKey: 'north.postgresql.custom-indexes.unique',
type: 'OibCheckbox',
defaultValue: false,
displayInViewMode: true,
validators: [{ key: 'required' }],
class: 'col-2'
},
{
key: 'order',
translationKey: 'north.postgresql.custom-indexes.order',
type: 'OibSelect',
defaultValue: 'ASC',
validators: [{ key: 'required' }],
displayInViewMode: true,
options: ['ASC', 'DESC'],
class: 'col-2'
}
],
class: 'col',
newRow: true,
displayInViewMode: false
}
]
};

export default manifest;
Loading