From d17155e5fc12943aa3091af3e31ac0b63198dea5 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Thu, 30 Nov 2023 10:35:45 +0100 Subject: [PATCH 1/3] feat(dedicated.network-security): dashboard category rename ref: UXCT-511 Signed-off-by: Stephanie Moallic --- .../scrubbing-center/scrubbing-center.routing.js | 2 +- .../client/app/network-security/traffic/traffic.routing.js | 2 +- .../app/network-security/translations/Messages_fr_FR.json | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/manager/apps/dedicated/client/app/network-security/scrubbing-center/scrubbing-center.routing.js b/packages/manager/apps/dedicated/client/app/network-security/scrubbing-center/scrubbing-center.routing.js index 9beb3946023a..6c125eb84f21 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/scrubbing-center/scrubbing-center.routing.js +++ b/packages/manager/apps/dedicated/client/app/network-security/scrubbing-center/scrubbing-center.routing.js @@ -15,7 +15,7 @@ export default /* @ngInject */ ($stateProvider) => { }, resolve: { breadcrumb: /* @ngInject */ ($translate) => - $translate.instant('network_security_dashboard_title'), + $translate.instant('network_security_dashboard_breadcrumb'), cursors: /* @ngInject */ ($transition$) => $transition$.params().cursors, showStats: /* @ngInject */ (goTo) => (row) => goTo({ diff --git a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.routing.js b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.routing.js index b6a5f534f893..4d0ff972d85d 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.routing.js +++ b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.routing.js @@ -7,7 +7,7 @@ export default /* @ngInject */ ($stateProvider) => { }, resolve: { breadcrumb: /* @ngInject */ ($translate) => - $translate.instant('network_security_dashboard_title'), + $translate.instant('network_security_dashboard_breadcrumb'), getSubnet: /* @ngInject */ ($state) => () => $state.params.subnet, }, }); diff --git a/packages/manager/apps/dedicated/client/app/network-security/translations/Messages_fr_FR.json b/packages/manager/apps/dedicated/client/app/network-security/translations/Messages_fr_FR.json index 498a919ea71f..cfbf5e381180 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/translations/Messages_fr_FR.json +++ b/packages/manager/apps/dedicated/client/app/network-security/translations/Messages_fr_FR.json @@ -1,5 +1,6 @@ { - "network_security_title": "Sécurité réseau", + "network_security_title": "Network", + "network_security_dashboard_breadcrumb": "Network Security Dashboard", "network_security_dashboard_title": "Tableau de bord Anti-DDoS (bêta)", "network_security_dashboard_guides": "Guides", "network_security_dashboard_header_content_survey": "En surveillant constamment le trafic réseau, nous observons un certain nombre d’activités suspectes. Pour chacune d’entre elles, le trafic réseau entrant est redirigé de manière transparente via nos centres de nettoyage pour une analyse plus approfondie et un éventuel nettoyage des attaquants afin de fournir la meilleure expérience sans interruption.", From 791149c4efe91b7f1ef4bf3d818c97f1d668d302 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Wed, 29 Nov 2023 09:10:11 +0100 Subject: [PATCH 2/3] feat(dedicated.network-security): update call api for traffic ref: UXCT-510 - update call API using pagination to load all traffic data for graph displayed Signed-off-by: Stephanie Moallic --- .../network-security.service.js | 14 +++-- .../traffic/traffic.constant.js | 11 +++- .../traffic/traffic.controller.js | 55 +++++++++++++++---- .../app/network-security/traffic/traffic.html | 2 +- 4 files changed, 63 insertions(+), 19 deletions(-) diff --git a/packages/manager/apps/dedicated/client/app/network-security/network-security.service.js b/packages/manager/apps/dedicated/client/app/network-security/network-security.service.js index 4a6645409ef4..c91b3f66546b 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/network-security.service.js +++ b/packages/manager/apps/dedicated/client/app/network-security/network-security.service.js @@ -10,11 +10,15 @@ export default class NetworkSecurityService { this.PAGE_SIZE = PAGE_SIZE; } - getTraffic(params) { - return this.Apiv2Service.httpApiv2({ - method: 'get', - url: `/engine/api/v2${this.API_PATH}/traffic`, - params, + getAllTraffic({ cursor, params, pageSize }) { + return this.Apiv2Service.httpApiv2List( + { + url: `/engine/api/v2${this.API_PATH}/traffic`, + params, + }, + { cursor, size: pageSize }, + ).then((response) => { + return { ...response, data: response.data }; }); } diff --git a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.constant.js b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.constant.js index b006e2075a8b..a59b0cf63383 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.constant.js +++ b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.constant.js @@ -19,11 +19,11 @@ export const CHART = { colors: [ { borderColor: '#D2F2C2', - backgroundColor: 'rgba(210, 242, 194, 0.4)', + backgroundColor: '#D2F2C2', }, { borderColor: '#FFCCD9', - backgroundColor: 'rgba(255, 204, 217, 0.4)', + backgroundColor: '#FFCCD9', }, ], options: { @@ -43,6 +43,11 @@ export const CHART = { radius: 0, }, }, + interaction: { + intersect: false, + mode: 'nearest', + axis: 'x', + }, tooltips: { mode: 'label', intersect: false, @@ -76,6 +81,8 @@ export const CHART = { position: 'bottom', ticks: { display: true, + source: 'auto', + autoSkip: true, }, time: { displayFormats: { diff --git a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.controller.js b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.controller.js index 800300a0cf87..68304c00a802 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.controller.js +++ b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.controller.js @@ -95,6 +95,7 @@ export default class TrafficController { } this.isLoading = true; this.results = null; + this.displayGraph = false; const currentDate = new Date(); const after = new Date(); const before = currentDate.toISOString(); @@ -108,14 +109,23 @@ export default class TrafficController { default: after.setDate(after.getDate() - 1); } + this.getAllTraffic(null, after.toISOString(), before, this.subnet); + } + + getAllTraffic(cursor, after, before, subnet) { const params = { - after: after.toISOString(), + after, before, - subnet: this.subnet, + subnet, }; this.networkSecurityService - .getTraffic(params) - .then(({ data }) => { + .getAllTraffic({ + cursor, + params, + pageSize: this.PAGE_SIZE, + }) + .then((response) => { + const { data } = response; if (data.message) { this.Alerter.error( this.$translate.instant('network_security_dashboard_events_error'), @@ -123,13 +133,36 @@ export default class TrafficController { ); return data; } - this.results = data; - this.resume(after.toISOString(), before, this.subnet); - this.loadGraph(); - return data; - }) - .finally(() => { - this.isLoading = false; + if (data) { + if (!this.results) { + this.results = data; + } else { + this.results.timestamps = this.results.timestamps.concat( + data.timestamps, + ); + this.results.bps.dropped = this.results.bps.dropped.concat( + data.bps.dropped, + ); + this.results.bps.passed = this.results.bps.passed.concat( + data.bps.passed, + ); + this.results.pps.dropped = this.results.pps.dropped.concat( + data.pps.dropped, + ); + this.results.pps.passed = this.results.pps.passed.concat( + data.pps.passed, + ); + } + } + if (response.cursor.next) { + this.getAllTraffic(response.cursor.next, after, before, subnet); + } else { + this.isLoading = false; + this.displayGraph = true; + this.resume(after, before, subnet); + this.loadGraph(); + } + return this.results; }); } diff --git a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.html b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.html index c7cedd182494..bc237abb61b3 100644 --- a/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.html +++ b/packages/manager/apps/dedicated/client/app/network-security/traffic/traffic.html @@ -60,7 +60,7 @@
-
+

Date: Tue, 5 Dec 2023 16:26:23 +0100 Subject: [PATCH 3/3] feat(dedicated): add links for survey ref: UXCT-508 - Edge firewall: add link for survey - GAME firewall: add link for survey - Network security dashboard: add link for survey Signed-off-by: Stephanie Moallic --- .../list/firewall/firewall.constant.js | 12 +++++++ .../game/ip-ip-firewall-game.constants.js | 13 ++++++++ .../game/ip-ip-firewall-game.controller.js | 29 +++++++++++++++- .../firewall/game/ip-ip-firewall-game.html | 13 ++++++++ .../firewall/ip-ip-firewall.controller.js | 25 ++++++++++++++ .../list/firewall/ip-ip-firewall.html | 13 ++++++++ .../app/ip/translations/Messages_fr_FR.json | 4 +++ .../network-security.component.js | 2 ++ .../network-security.constant.js | 19 ++++++++++- .../network-security.controller.js | 33 +++++++++++++++++++ .../network-security/network-security.html | 15 +++++++++ .../network-security.module.js | 2 ++ .../translations/Messages_fr_FR.json | 8 ++++- 13 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 packages/manager/apps/dedicated/client/app/ip/components/list/firewall/firewall.constant.js create mode 100644 packages/manager/apps/dedicated/client/app/network-security/network-security.controller.js diff --git a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/firewall.constant.js b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/firewall.constant.js new file mode 100644 index 000000000000..51ca3b96c5ec --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/firewall.constant.js @@ -0,0 +1,12 @@ +export const ALLOWED_LANGUAGES = { + en: { + isDefault: true, + }, + fr: { + isDefault: false, + }, +}; + +export const BASE_URL_SURVEY = 'https://survey.ovh.com/index.php/116651?lang='; + +export default { ALLOWED_LANGUAGES, BASE_URL_SURVEY }; diff --git a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.constants.js b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.constants.js index d23763d867a7..289c52ceb9f5 100644 --- a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.constants.js +++ b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.constants.js @@ -10,6 +10,19 @@ export const IP_MITIGATION_RULE_PROTOCOL_PORT = { trackmaniaShootmania: { from: 2350, to: 2450 }, }; +export const ALLOWED_LANGUAGES = { + en: { + isDefault: true, + }, + fr: { + isDefault: false, + }, +}; + +export const BASE_URL_SURVEY = 'https://survey.ovh.com/index.php/187648?lang='; + export default { IP_MITIGATION_RULE_PROTOCOL_PORT, + ALLOWED_LANGUAGES, + BASE_URL_SURVEY, }; diff --git a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.controller.js b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.controller.js index c829c051fde3..7e05bbf42fbb 100644 --- a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.controller.js +++ b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.controller.js @@ -1,8 +1,13 @@ +import isObject from 'lodash/isObject'; import findIndex from 'lodash/findIndex'; import remove from 'lodash/remove'; import startCase from 'lodash/startCase'; -import { IP_MITIGATION_RULE_PROTOCOL_PORT } from './ip-ip-firewall-game.constants'; +import { + IP_MITIGATION_RULE_PROTOCOL_PORT, + ALLOWED_LANGUAGES, + BASE_URL_SURVEY, +} from './ip-ip-firewall-game.constants'; export default /* @ngInject */ function IpGameFirewallCtrl( $location, @@ -15,6 +20,7 @@ export default /* @ngInject */ function IpGameFirewallCtrl( IpGameFirewall, Alerter, $q, + coreConfig, ) { const self = this; const alert = 'ip_game_firewall_alert'; @@ -84,6 +90,25 @@ export default /* @ngInject */ function IpGameFirewallCtrl( self.loading = false; + function initializeUrlSurvey() { + // Get default language + const defaultLanguage = Object.keys(ALLOWED_LANGUAGES).find( + (key) => ALLOWED_LANGUAGES[key].isDefault, + ); + const userLanguage = coreConfig.getUserLanguage(); + + const languageToUse = isObject(ALLOWED_LANGUAGES[userLanguage]) + ? userLanguage + : defaultLanguage; + + // Get user + const user = coreConfig.getUser(); + + // Build url for survey link + const surveyUrl = `${BASE_URL_SURVEY}${languageToUse}&nic=${user.nichandle}`; + return surveyUrl; + } + self.getProtocoleText = function getProtocoleText(protocol) { return startCase(protocol); }; @@ -183,6 +208,8 @@ export default /* @ngInject */ function IpGameFirewallCtrl( } function init(params) { + self.surveyUrl = initializeUrlSurvey(); + if (params) { self.datas.selectedBlock = params.ipBlock.ipBlock; self.datas.selectedIp = params.ip.ip; diff --git a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.html b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.html index 3539b9302156..aac4ddd1efa5 100644 --- a/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.html +++ b/packages/manager/apps/dedicated/client/app/ip/components/list/firewall/game/ip-ip-firewall-game.html @@ -23,6 +23,19 @@
+ +