From 171276ca807e576748056073fe2cc5c239e83294 Mon Sep 17 00:00:00 2001 From: Eduard Klimenko Date: Fri, 9 Sep 2022 14:26:14 +0300 Subject: [PATCH 1/4] fix: if SQL-query is empty, show 'No Data' --- angular.json | 14 +- .../pages/home.page/home.page.component.ts | 4 +- src/assets/test-data.js | 1693 ----------------- 3 files changed, 10 insertions(+), 1701 deletions(-) delete mode 100644 src/assets/test-data.js diff --git a/angular.json b/angular.json index 2679bcf..52f215a 100644 --- a/angular.json +++ b/angular.json @@ -26,23 +26,25 @@ "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", - "assets": ["src/favicon.ico", "src/assets", + "assets": [ + "src/favicon.ico", + "src/assets", { - "glob": "mode-sql.js", - "input": "./node_modules/ace-builds/src-min/", - "output": "/" + "glob": "mode-sql.js", + "input": "./node_modules/ace-builds/src-min/", + "output": "/" }, { "glob": "theme-sqlserver.js", "input": "./node_modules/ace-builds/src-min/", "output": "/" - }], + } + ], "styles": [ "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss" ], "scripts": [ - "src/assets/test-data.js", "node_modules/ace-builds/src-min/ace.js", "node_modules/ace-builds/src-min/theme-sqlserver.js", "node_modules/ace-builds/src-min/mode-sql.js" diff --git a/src/app/pages/home.page/home.page.component.ts b/src/app/pages/home.page/home.page.component.ts index fda54f3..5da697a 100644 --- a/src/app/pages/home.page/home.page.component.ts +++ b/src/app/pages/home.page/home.page.component.ts @@ -250,7 +250,7 @@ export class HomePageComponent implements OnInit { } formatData(data: any) { - data = data || (window as any).data || {}; + data = data || { meta: [], data: [] }; console.log(data); if (typeof data === 'string') { this.details = data; @@ -449,7 +449,7 @@ export class HomePageComponent implements OnInit { } }) } - bytesToSize(bytes: any): string | null{ + bytesToSize(bytes: any): string | null { const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes === 0) { return bytes + ' Bytes'; diff --git a/src/assets/test-data.js b/src/assets/test-data.js deleted file mode 100644 index 9306fb7..0000000 --- a/src/assets/test-data.js +++ /dev/null @@ -1,1693 +0,0 @@ -var data = { - "meta": [ - { - "name": "uuid", - "type": "UUID" - }, - { - "name": "update_ts", - "type": "UInt64" - }, - { - "name": "status", - "type": "UInt8" - }, - { - "name": "callid", - "type": "String" - }, - { - "name": "correlation_id", - "type": "String" - }, - { - "name": "ruri_user", - "type": "String" - }, - { - "name": "from_user", - "type": "String" - }, - { - "name": "to_user", - "type": "String" - }, - { - "name": "cdr_start", - "type": "UInt64" - }, - { - "name": "cdr_stop", - "type": "UInt64" - }, - { - "name": "cdr_connect", - "type": "UInt64" - }, - { - "name": "cdr_progress", - "type": "UInt64" - }, - { - "name": "cdr_ringing", - "type": "UInt64" - }, - { - "name": "family", - "type": "UInt8" - }, - { - "name": "auth_user", - "type": "String" - }, - { - "name": "pid_user", - "type": "String" - }, - { - "name": "contact_user", - "type": "String" - }, - { - "name": "diversion_user", - "type": "String" - }, - { - "name": "anumber_ext", - "type": "String" - }, - { - "name": "bnumber_ext", - "type": "String" - }, - { - "name": "source_ip", - "type": "String" - }, - { - "name": "source_port", - "type": "UInt16" - }, - { - "name": "destination_ip", - "type": "String" - }, - { - "name": "destination_port", - "type": "UInt16" - }, - { - "name": "vlan", - "type": "UInt8" - }, - { - "name": "uas", - "type": "String" - }, - { - "name": "geo_cc", - "type": "String" - }, - { - "name": "dest_cc", - "type": "String" - }, - { - "name": "rtp_stat_a", - "type": "String" - }, - { - "name": "rtp_stat_b", - "type": "String" - }, - { - "name": "vqr_a", - "type": "String" - }, - { - "name": "vqr_b", - "type": "String" - }, - { - "name": "vst", - "type": "UInt16" - }, - { - "name": "srd", - "type": "UInt16" - }, - { - "name": "sss", - "type": "UInt16" - }, - { - "name": "pdd", - "type": "UInt16" - }, - { - "name": "mos", - "type": "UInt16" - }, - { - "name": "duration", - "type": "UInt32" - }, - { - "name": "jitter", - "type": "UInt32" - }, - { - "name": "pl", - "type": "UInt32" - }, - { - "name": "msg_info", - "type": "String" - }, - { - "name": "custom_1", - "type": "String" - }, - { - "name": "custom_2", - "type": "String" - }, - { - "name": "custom_3", - "type": "String" - }, - { - "name": "custom_4", - "type": "String" - }, - { - "name": "custom_5", - "type": "String" - }, - { - "name": "custom_6", - "type": "String" - }, - { - "name": "termcode", - "type": "UInt16" - }, - { - "name": "termdir", - "type": "UInt8" - }, - { - "name": "usergroup", - "type": "String" - }, - { - "name": "xgroup", - "type": "String" - }, - { - "name": "ipgroup_in", - "type": "String" - }, - { - "name": "ipgroup_out", - "type": "String" - }, - { - "name": "server_type_in", - "type": "String" - }, - { - "name": "server_type_out", - "type": "String" - }, - { - "name": "event", - "type": "UInt16" - }, - { - "name": "captid", - "type": "UInt32" - }, - { - "name": "region_id", - "type": "String" - }, - { - "name": "data", - "type": "String" - }, - { - "name": "CustomString.Key", - "type": "Array(String)" - }, - { - "name": "CustomString.Value", - "type": "Array(String)" - }, - { - "name": "CustomUInt.Key", - "type": "Array(String)" - }, - { - "name": "CustomUInt.Value", - "type": "Array(UInt32)" - }, - { - "name": "Methods.Key", - "type": "Array(String)" - }, - { - "name": "Methods.Value", - "type": "Array(UInt32)" - }, - { - "name": "Correlations", - "type": "Array(String)" - }, - { - "name": "Metrics.Key", - "type": "Array(String)" - }, - { - "name": "Metrics.Value", - "type": "Array(Float32)" - }, - { - "name": "IPs", - "type": "Array(String)" - }, - { - "name": "updcounter", - "type": "UInt16" - }, - { - "name": "Codecs", - "type": "Array(String)" - } - ], - "data": [ - [ - "bef5f8bf-62b1-11ec-b8bf-000019432987", - "1640127637902781", - 2, - "484000778-1400313437-1898526529", - "", - "0018027711025", - "305", - "0018027711025", - "1640127609416723", - "0", - "0", - "0", - "0", - 1, - "", - "", - "305", - "", - "", - "", - "141.94.100.199", - 65419, - "136.243.16.181", - 5060, - 0, - "axzxccbvcnbxcbzxvssmnnsbscbs", - "GB", - "US", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 805, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 407, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":1,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"484000778-1400313437-1898526529\",\"codia\":0,\"sdpsid\":16264,\"sdpsver\":18299,\"sdpap\":25282,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"192.168.1.83\",\"sdpmedpr\":\"ipv4\",\"geocc\":\"GB\", \"geolat\": 50.796700, \"geolan\": -1.083300,\"destcc\":\"US\", \"destlat\": -37.833332, \"destlan\": 145.199997,\"sourcecc\":\"GR\", \"sourcelat\": 39.074207, \"sourcelan\": 21.824312,\"termdir\":0, \"termcode\": 407, \"reason\": 0}", - [], - [], - [], - [], - [ - "INVITE", - "407:INVITE" - ], - [ - 1, - 10 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 805, - 0, - 0, - 0 - ], - [ - "141.94.100.199", - "136.243.16.181" - ], - 4, - [] - ], - [ - "c19c9867-62b1-11ec-9867-000019432987", - "1640127617577187", - 8, - "1739148601-1157345768-2000494744", - "", - "0720046812111647", - "1001", - "0720046812111647", - "1640127613864151", - "1640127614076863", - "0", - "0", - "0", - 1, - "1001", - "", - "1001", - "", - "", - "", - "104.149.147.130", - 53225, - "136.243.16.181", - 5060, - 0, - "Cisco-SIPGateway", - "", - "RU", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 1140, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 403, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":6,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"1739148601-1157345768-2000494744\",\"codia\":8,\"sdpsid\":-492070186,\"sdpsver\":-492070186,\"sdpap\":4000,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"0.0.0.0\",\"sdpmedpr\":\"ipv4\",\"destcc\":\"RU\", \"destlat\": 61.524010, \"destlan\": 105.318756,\"sourcecc\":\"US\", \"sourcelat\": 37.090240, \"sourcelan\": -95.712891,\"termdir\":0, \"termcode\": 403, \"reason\": 0}", - [], - [], - [], - [], - [ - "ACK", - "INVITE", - "403:INVITE", - "407:INVITE" - ], - [ - 1, - 2, - 4, - 1 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1140, - 0, - 212712, - 0 - ], - [ - "104.149.147.130", - "136.243.16.181" - ], - 2, - [] - ], - [ - "c915e94f-62b1-11ec-a94f-000019432987", - "1640127630186603", - 8, - "429492239-2060285268-318433672", - "", - "003333346812400118", - "9001", - "003333346812400118", - "1640127626403259", - "1640127626685486", - "0", - "0", - "0", - 1, - "9001", - "", - "9001", - "", - "", - "", - "104.149.157.54", - 61164, - "136.243.16.181", - 5060, - 0, - "Cisco-SIPGateway", - "", - "FR", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 57058, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 403, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":7,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"429492239-2060285268-318433672\",\"codia\":8,\"sdpsid\":-492070186,\"sdpsver\":-492070186,\"sdpap\":4000,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"0.0.0.0\",\"sdpmedpr\":\"ipv4\",\"destcc\":\"FR\", \"destlat\": 46.227638, \"destlan\": 2.213749,\"sourcecc\":\"TR\", \"sourcelat\": 38.963745, \"sourcelan\": 35.243320,\"termdir\":0, \"termcode\": 403, \"reason\": 0}", - [], - [], - [], - [], - [ - "ACK", - "INVITE", - "403:INVITE", - "407:INVITE" - ], - [ - 1, - 2, - 4, - 1 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 122594, - 0, - 282227, - 0 - ], - [ - "104.149.157.54", - "136.243.16.181" - ], - 2, - [] - ], - [ - "cb948703-62b1-11ec-8703-000019432987", - "1640127658967871", - 2, - "715062210-1506432147-739595317", - "", - "00018027711025", - "305", - "00018027711025", - "1640127630588493", - "0", - "0", - "0", - "0", - 1, - "", - "", - "305", - "", - "", - "", - "141.94.100.199", - 50090, - "136.243.16.181", - 5060, - 0, - "axzxccbvcnbxcbzxvssmnnsbscbs", - "GB", - "US", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 1348, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 407, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":1,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"715062210-1506432147-739595317\",\"codia\":0,\"sdpsid\":16264,\"sdpsver\":18299,\"sdpap\":25282,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"192.168.1.83\",\"sdpmedpr\":\"ipv4\",\"geocc\":\"GB\", \"geolat\": 50.796700, \"geolan\": -1.083300,\"destcc\":\"US\", \"destlat\": -37.833332, \"destlan\": 145.199997,\"sourcecc\":\"GR\", \"sourcelat\": 39.074207, \"sourcelan\": 21.824312,\"termdir\":0, \"termcode\": 407, \"reason\": 0}", - [], - [], - [], - [], - [ - "INVITE", - "407:INVITE" - ], - [ - 1, - 10 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1348, - 0, - 0, - 0 - ], - [ - "141.94.100.199", - "136.243.16.181" - ], - 4, - [] - ], - [ - "d71238e1-62b1-11ec-b8e1-000019432987", - "1640127681981688", - 2, - "453479482-10353585-298943211", - "", - "90018027711025", - "305", - "90018027711025", - "1640127649867184", - "0", - "0", - "0", - "0", - 1, - "", - "", - "305", - "", - "", - "", - "141.94.100.199", - 51163, - "136.243.16.181", - 5060, - 0, - "axzxccbvcnbxcbzxvssmnnsbscbs", - "GB", - "TR", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 778, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 407, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":5,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"453479482-10353585-298943211\",\"codia\":0,\"sdpsid\":16264,\"sdpsver\":18299,\"sdpap\":25282,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"192.168.1.83\",\"sdpmedpr\":\"ipv4\",\"geocc\":\"GB\", \"geolat\": 50.796700, \"geolan\": -1.083300,\"destcc\":\"TR\", \"destlat\": 38.963745, \"destlan\": 35.243320,\"sourcecc\":\"GR\", \"sourcelat\": 39.074207, \"sourcelan\": 21.824312,\"termdir\":0, \"termcode\": 407, \"reason\": 0}", - [], - [], - [], - [], - [ - "INVITE", - "407:INVITE" - ], - [ - 1, - 11 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 778, - 0, - 0, - 0 - ], - [ - "141.94.100.199", - "136.243.16.181" - ], - 4, - [] - ], - [ - "e236abd5-62b1-11ec-abd5-000019432987", - "1640127697207417", - 2, - "1559588683-2077756368-1101710788", - "", - "+18027711025", - "305", - "+18027711025", - "1640127668560994", - "0", - "0", - "0", - "0", - 1, - "", - "", - "305", - "", - "", - "", - "141.94.100.199", - 51876, - "136.243.16.181", - 5060, - 0, - "axzxccbvcnbxcbzxvssmnnsbscbs", - "GB", - "US", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 21251, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 407, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":4,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"1559588683-2077756368-1101710788\",\"codia\":0,\"sdpsid\":16264,\"sdpsver\":18299,\"sdpap\":25282,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"192.168.1.83\",\"sdpmedpr\":\"ipv4\",\"geocc\":\"GB\", \"geolat\": 50.796700, \"geolan\": -1.083300,\"destcc\":\"US\", \"destlat\": -37.833332, \"destlan\": 145.199997,\"sourcecc\":\"GR\", \"sourcelat\": 39.074207, \"sourcelan\": 21.824312,\"termdir\":0, \"termcode\": 407, \"reason\": 0}", - [], - [], - [], - [], - [ - "INVITE", - "407:INVITE" - ], - [ - 1, - 10 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 86787, - 0, - 0, - 0 - ], - [ - "141.94.100.199", - "136.243.16.181" - ], - 4, - [] - ], - [ - "ebf3c7bb-62b1-11ec-87bb-000019432987", - "1640127688820639", - 8, - "2086054273-1950861926-258447397", - "", - "0730046812111647", - "1001", - "0730046812111647", - "1640127684899833", - "1640127685062129", - "0", - "0", - "0", - 1, - "1001", - "", - "1001", - "", - "", - "", - "104.149.147.130", - 55107, - "136.243.16.181", - 5060, - 0, - "Cisco-SIPGateway", - "", - "RU", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 1178, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 403, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":7,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"2086054273-1950861926-258447397\",\"codia\":8,\"sdpsid\":-492070186,\"sdpsver\":-492070186,\"sdpap\":4000,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"0.0.0.0\",\"sdpmedpr\":\"ipv4\",\"destcc\":\"RU\", \"destlat\": 61.524010, \"destlan\": 105.318756,\"sourcecc\":\"US\", \"sourcelat\": 37.090240, \"sourcelan\": -95.712891,\"termdir\":0, \"termcode\": 403, \"reason\": 0}", - [], - [], - [], - [], - [ - "ACK", - "INVITE", - "403:INVITE", - "407:INVITE" - ], - [ - 1, - 2, - 4, - 1 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1178, - 0, - 162296, - 0 - ], - [ - "104.149.147.130", - "136.243.16.181" - ], - 2, - [] - ], - [ - "ef4b58b1-62b1-11ec-98b1-000019432987", - "1640127718657890", - 2, - "317525345-811925605-190921518", - "", - "0018027711025", - "1010", - "0018027711025", - "1640127690506872", - "0", - "0", - "0", - "0", - 1, - "", - "", - "1010", - "", - "", - "", - "141.94.100.199", - 61310, - "136.243.16.181", - 5060, - 0, - "axzxccbvcnbxcbzxvssmnnsbscbs", - "GB", - "US", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 857, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 407, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":7,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"317525345-811925605-190921518\",\"codia\":0,\"sdpsid\":16264,\"sdpsver\":18299,\"sdpap\":25282,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"192.168.1.83\",\"sdpmedpr\":\"ipv4\",\"geocc\":\"GB\", \"geolat\": 50.796700, \"geolan\": -1.083300,\"destcc\":\"US\", \"destlat\": -37.833332, \"destlan\": 145.199997,\"sourcecc\":\"US\", \"sourcelat\": 37.090240, \"sourcelan\": -95.712891,\"termdir\":0, \"termcode\": 407, \"reason\": 0}", - [], - [], - [], - [], - [ - "INVITE", - "407:INVITE" - ], - [ - 1, - 10 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 857, - 0, - 0, - 0 - ], - [ - "141.94.100.199", - "136.243.16.181" - ], - 4, - [] - ], - [ - "f18768da-62b1-11ec-a8da-000019432987", - "1640127698105731", - 8, - "1394444753-420626403-1933372003", - "", - "004444446812400118", - "9001", - "004444446812400118", - "1640127694255945", - "1640127694472648", - "0", - "0", - "0", - 1, - "9001", - "", - "9001", - "", - "", - "", - "104.149.157.54", - 53022, - "136.243.16.181", - 5060, - 0, - "Cisco-SIPGateway", - "", - "UK", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 1418, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 403, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":2,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"1394444753-420626403-1933372003\",\"codia\":8,\"sdpsid\":-492070186,\"sdpsver\":-492070186,\"sdpap\":4000,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"0.0.0.0\",\"sdpmedpr\":\"ipv4\",\"destcc\":\"UK\", \"destlat\": 55.378052, \"destlan\": -3.435973,\"sourcecc\":\"TR\", \"sourcelat\": 38.963745, \"sourcelan\": 35.243320,\"termdir\":0, \"termcode\": 403, \"reason\": 0}", - [], - [], - [], - [], - [ - "ACK", - "INVITE", - "403:INVITE", - "407:INVITE" - ], - [ - 1, - 2, - 4, - 1 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1418, - 0, - 216703, - 0 - ], - [ - "104.149.157.54", - "136.243.16.181" - ], - 2, - [] - ], - [ - "f6bb5e89-62b1-11ec-9e89-000019432987", - "1640127735198499", - 2, - "1138452110-950363797-1165149794", - "", - "00018027711025", - "1010", - "00018027711025", - "1640127702985076", - "0", - "0", - "0", - "0", - 1, - "", - "", - "1010", - "", - "", - "", - "141.94.100.199", - 56230, - "136.243.16.181", - 5060, - 0, - "axzxccbvcnbxcbzxvssmnnsbscbs", - "GB", - "US", - "", - "", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - "{\"rf\":0.000000, \"mos\":0.000000, \"pl\":0.000000, \"jt\":0.000000}", - 0, - 771, - 0, - 0, - 0, - 0, - 0, - 0, - "", - "", - "", - "", - "", - "", - "", - 407, - 0, - "", - "", - "default", - "botauro", - "default", - "freeswitch", - 0, - 2222, - "", - "{\"pty\":1, \"pid\":17, \"queue\":1,\"fd\":\"136.243.16.181\",\"td\":\"136.243.16.181\",\"did\":\"1138452110-950363797-1165149794\",\"codia\":0,\"sdpsid\":16264,\"sdpsver\":18299,\"sdpap\":25282,\"sdpvp\":0,\"sdpip\":0,\"sdpap_b\":0,\"sdpvp_b\":0,\"sdpip_b\":0,\"sdpmedhost\":\"192.168.1.83\",\"sdpmedpr\":\"ipv4\",\"geocc\":\"GB\", \"geolat\": 50.796700, \"geolan\": -1.083300,\"destcc\":\"US\", \"destlat\": -37.833332, \"destlan\": 145.199997,\"sourcecc\":\"US\", \"sourcelat\": 37.090240, \"sourcelan\": -95.712891,\"termdir\":0, \"termcode\": 407, \"reason\": 0}", - [], - [], - [], - [], - [ - "INVITE", - "407:INVITE" - ], - [ - 1, - 11 - ], - [], - [ - "RF_G", - "RF_A", - "RF_B", - "MOS_G", - "MOS_MIN", - "MOS_MAX", - "MOS_A", - "MOS_B", - "PL_A", - "PL_G", - "PL_B", - "PKTPL_A", - "PKTPL_G", - "PKTPL_B", - "PKTEXP_A", - "PKTEXP_G", - "PKTEXP_B", - "JT_G", - "JT_A", - "JT_B", - "PTT_G", - "PTT_A", - "PTT_B", - "SRD", - "SSS", - "FSS", - "SDD" - ], - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 771, - 0, - 0, - 0 - ], - [ - "141.94.100.199", - "136.243.16.181" - ], - 4, - [] - ] - ], - "rows": 10, - "rows_before_limit_at_least": 6651, - "statistics": { - "elapsed": 0.037600619, - "rows_read": 6651, - "bytes_read": 12205478 - } -}; From 8005c92d1b3b1f9ffed72b55bf05e30978b8280f Mon Sep 17 00:00:00 2001 From: Eduard Klimenko Date: Fri, 9 Sep 2022 14:53:59 +0300 Subject: [PATCH 2/4] fix: if SQL-query is empty, show alert --- src/app/helper/error.interceptor.ts | 3 ++- src/app/pages/home.page/home.page.component.ts | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/helper/error.interceptor.ts b/src/app/helper/error.interceptor.ts index 0113f1b..3be1217 100644 --- a/src/app/helper/error.interceptor.ts +++ b/src/app/helper/error.interceptor.ts @@ -6,7 +6,8 @@ import { catchError } from 'rxjs/operators'; // import { AlertService } from '../services/alert.service'; import { Router } from '@angular/router'; -import { AlertService } from '@app/components/controls/alert/alert.service'; +import { AlertService } from '@app/services/alert.service'; +// import { AlertService } from '@app/components/controls/alert/alert.service'; @Injectable() export class ErrorInterceptor implements HttpInterceptor { diff --git a/src/app/pages/home.page/home.page.component.ts b/src/app/pages/home.page/home.page.component.ts index 5da697a..2e38fcd 100644 --- a/src/app/pages/home.page/home.page.component.ts +++ b/src/app/pages/home.page/home.page.component.ts @@ -10,6 +10,7 @@ import { promiseWait, cloneObject } from '@app/helper/functions'; import { getParam } from '@app/app.component'; import { MatDialog } from '@angular/material/dialog'; import { DialogKioskComponent } from '../dialogs/dialog-kiosk/dialog-kiosk.component'; +import { AlertService } from '@app/services/alert.service'; @Component({ templateUrl: './home.page.component.html', @@ -96,7 +97,8 @@ export class HomePageComponent implements OnInit { private apiService: ApiService, private docsService: DocsService, private cdr: ChangeDetectorRef, - public dialog: MatDialog + public dialog: MatDialog, + private alertService: AlertService ) { if (getParam.kiosk) { this.isDarkMode = getParam.mode === 'dark'; @@ -301,6 +303,10 @@ export class HomePageComponent implements OnInit { async SQL(sqlStr: string, isAuthenticated: boolean = false) { await promiseWait(100); + if (!sqlStr) { + this.alertService.error('ERROR: SQL query is empty!') + return false; + } if (!isAuthenticated) { this.sqlRequest = sqlStr; } @@ -348,10 +354,9 @@ export class HomePageComponent implements OnInit { } onClickRun(event?: any): void { - if (event) { - console.log(event); - this.sqlRequest = event; - } + console.log(event); + this.sqlRequest = event; + this.SQL(this.sqlRequest); } async connectToDB(event?: any, isTestConnection = false) { From 111ac27f919926403a7024eb127e1edbf25e6a7b Mon Sep 17 00:00:00 2001 From: Eduard Klimenko Date: Fri, 9 Sep 2022 15:01:57 +0300 Subject: [PATCH 3/4] fix: 'No Data' label don't shows in process to load data --- .../pages/home.page/home.page.component.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/pages/home.page/home.page.component.ts b/src/app/pages/home.page/home.page.component.ts index 2e38fcd..ee3941d 100644 --- a/src/app/pages/home.page/home.page.component.ts +++ b/src/app/pages/home.page/home.page.component.ts @@ -57,7 +57,7 @@ export class HomePageComponent implements OnInit { dictionary: Dictionary[] = []; dataForFile: any = null; - isLoadingDetails = false; + isLoadingDetails = true; details: any = []; columns: any[] = []; errorMessage: string = ''; @@ -69,6 +69,7 @@ export class HomePageComponent implements OnInit { ]; _SqlArchive: any = []; + set SqlArchive(value: any) { this._SqlArchive[this.checkSqlHistory()] = value; @@ -309,8 +310,9 @@ export class HomePageComponent implements OnInit { } if (!isAuthenticated) { this.sqlRequest = sqlStr; + this.isLoadingDetails = true; } - this.isLoadingDetails = true; + this.cdr.detectChanges(); this.details = []; @@ -329,7 +331,9 @@ export class HomePageComponent implements OnInit { this.dataForFile = response; this.formatData(response); this.errorMessage = ''; - this.isLoadingDetails = false; + if (!isAuthenticated) { + this.isLoadingDetails = false; + } this.cdr.detectChanges(); return true; @@ -346,7 +350,9 @@ export class HomePageComponent implements OnInit { this.cdr.detectChanges(); }) } - this.isLoadingDetails = false; + if (!isAuthenticated) { + this.isLoadingDetails = false; + } this.cdr.detectChanges(); return false; @@ -360,6 +366,7 @@ export class HomePageComponent implements OnInit { this.SQL(this.sqlRequest); } async connectToDB(event?: any, isTestConnection = false) { + this.isLoadingDetails = true; if (event) { this.dbLink = event.dbLink; this.dbLogin = event.dbLogin; @@ -382,7 +389,7 @@ export class HomePageComponent implements OnInit { this.isAccess = true; this.getHash(); - this.isLoadingDetails = true; + this.cdr.detectChanges(); await promiseWait(100); @@ -391,7 +398,7 @@ export class HomePageComponent implements OnInit { await this.initDbTree(); this.cdr.detectChanges(); - this.isLoadingDetails = false; + // this.isLoadingDetails = false; } else { this.authSuccessMessage = 'Connection is successfully established.'; setTimeout(() => { From 0ed828e797091211483a057f50879a92f492156b Mon Sep 17 00:00:00 2001 From: Eduard Klimenko Date: Fri, 9 Sep 2022 15:10:33 +0300 Subject: [PATCH 4/4] fix: turn OFF alert if sql is empty, only 'No Data' is shown --- src/app/pages/home.page/home.page.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/home.page/home.page.component.ts b/src/app/pages/home.page/home.page.component.ts index ee3941d..6c1c954 100644 --- a/src/app/pages/home.page/home.page.component.ts +++ b/src/app/pages/home.page/home.page.component.ts @@ -305,7 +305,7 @@ export class HomePageComponent implements OnInit { async SQL(sqlStr: string, isAuthenticated: boolean = false) { await promiseWait(100); if (!sqlStr) { - this.alertService.error('ERROR: SQL query is empty!') + // this.alertService.error('ERROR: SQL query is empty!') return false; } if (!isAuthenticated) {