From 6c9fe536350dc177e0ae763e6a81c86a8a72d5ea Mon Sep 17 00:00:00 2001 From: Fabrizio Fiorucci Date: Wed, 5 Oct 2022 00:44:35 +0200 Subject: [PATCH] GUI updates --- contrib/GUI/etc/secondsight.properties | 8 +++ contrib/GUI/psql/psql-data.sql | 6 -- contrib/GUI/psql/psql-schema.sql | 77 ++++++++++++++++++++++---- contrib/GUI/secondsight-gui.yaml | 2 + 4 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 contrib/GUI/etc/secondsight.properties diff --git a/contrib/GUI/etc/secondsight.properties b/contrib/GUI/etc/secondsight.properties new file mode 100644 index 0000000..2749c18 --- /dev/null +++ b/contrib/GUI/etc/secondsight.properties @@ -0,0 +1,8 @@ +# +# Second Sight - Data Driven Customer Success +# Configuration file +# +secondsight.banner = Second Sight 4.9.1 + +secondsight.f5tt.helper.address = http://f5tt:5001 +secondsight.f5tt.address = http://f5tt:5000 diff --git a/contrib/GUI/psql/psql-data.sql b/contrib/GUI/psql/psql-data.sql index 5a07bd3..14b444d 100644 --- a/contrib/GUI/psql/psql-data.sql +++ b/contrib/GUI/psql/psql-data.sql @@ -1,12 +1,6 @@ -- -- Default & builtin data -- -insert into config (name,value) values -('dataplane.address','http://nim.test.lab'), -('dataplane.type','NGINX Management Suite'), -('f5tt.helper.address','http://f5tt:5001'), -('f5tt.address','http://f5tt:5000'); - insert into audit_types (id,tag,description) values (100,'user.login','User login'), (101,'user.logout','User logout'), diff --git a/contrib/GUI/psql/psql-schema.sql b/contrib/GUI/psql/psql-schema.sql index fc71342..cb1b4ee 100644 --- a/contrib/GUI/psql/psql-schema.sql +++ b/contrib/GUI/psql/psql-schema.sql @@ -20,11 +20,6 @@ create table if not exists contract_types ( description varchar(128) default ''::character varying not null ); -create table if not exists config ( - name varchar(128) primary key, - value varchar(4096) default ''::character varying not null -); - create table if not exists audit_log ( id serial primary key, ts timestamp with time zone default now(), @@ -111,19 +106,77 @@ create view all_json_reports as from json_reports, json_types where json_reports.typeid = json_types.id; -create table if not exists edw_data ( +create table if not exists edw_customers ( + id serial unique, + end_customer_name varchar(256) primary key unique +); + +create table if not exists edw_contracts ( + id serial unique, + legal_contract varchar(64), + start_date varchar(64), + end_date varchar(64), + end_customer integer, + + primary key (legal_contract), + foreign key (end_customer) references edw_customers(id) +); + +create table if not exists edw_salesorders ( id serial unique, - regkey varchar(33), - legal_contract_id varchar(64), sales_order varchar(64), + legal_contract_id integer, + + primary key (sales_order), + foreign key (legal_contract_id) references edw_contracts(id) +); + +create table if not exists edw_regkeys ( + id serial unique, + regkey varchar(33), serial_number varchar(64), - end_customer_name varchar(256), - legal_contract_start_date varchar(64), - legal_contract_end_date varchar(64), + sales_order_id integer, - primary key (regkey) + primary key (regkey), + foreign key (sales_order_id) references edw_salesorders(id) ); +create table if not exists edw_pool_reg_keys ( + id serial unique, + pool_reg_key varchar(33), + sales_order_id integer, + + primary key (pool_reg_key), + foreign key (sales_order_id) references edw_salesorders(id) +); + +create table if not exists edw_ve_hostnames ( + id serial unique, + hostname varchar(256), + pool_reg_key integer, + + primary key (hostname,pool_reg_key), + foreign key (pool_reg_key) references edw_pool_reg_keys(id) +); + +create view edw_ve_data as +select + edw_pool_reg_keys.pool_reg_key as regkey, + edw_contracts.legal_contract as legal_contract_id, + edw_salesorders.sales_order as sales_order, + '' as serial_number, + edw_customers.end_customer_name as end_customer_name, + edw_contracts.start_date as legal_contract_start_date, + edw_contracts.end_date as legal_contract_end_date, + edw_ve_hostnames.hostname as hostname +from + edw_customers,edw_contracts,edw_salesorders,edw_pool_reg_keys,edw_ve_hostnames +where + edw_customers.id = edw_contracts.end_customer and + edw_contracts.id = edw_salesorders.legal_contract_id and + edw_salesorders.id = edw_pool_reg_keys.sales_order_id and + edw_pool_reg_keys.id = edw_ve_hostnames.pool_reg_key; + -- -- General purpose views -- diff --git a/contrib/GUI/secondsight-gui.yaml b/contrib/GUI/secondsight-gui.yaml index c92e75d..dc153d0 100644 --- a/contrib/GUI/secondsight-gui.yaml +++ b/contrib/GUI/secondsight-gui.yaml @@ -54,6 +54,8 @@ services: pull_policy: always container_name: "secondsight-gui" restart: always + volumes: + - ./etc/secondsight.properties:/app/secondsight.properties depends_on: postgres: condition: service_healthy