Skip to content

Commit

Permalink
Merge pull request #1769 from aziontech/dev
Browse files Browse the repository at this point in the history
DEPLOY 2024.09.30
  • Loading branch information
vinigfer authored Sep 30, 2024
2 parents 1695439 + 33f2e90 commit a58e2d3
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 58 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azion-console-kit",
"version": "1.22.4",
"version": "1.23.0",
"private": false,
"type": "module",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const HELP_CENTER_URLS = {
},
botManagerBreakdown: {
impactedUrls: '/real-time-metrics/bot-manager-advanced/breakdown/impacted-urls',
topIps: '/real-time-metrics/bot-manager-advanced/breakdown/top-ips',
topBadBotIps: '/real-time-metrics/bot-manager-advanced/breakdown/top-bad-bot-ips',
topImpactedUrls: '/real-time-metrics/bot-manager-advanced/breakdown/top-impacted-urls'
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/real-time-metrics/constants/reports-texts.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ const REPORTS_TEXTS = {
impactedUrls: {
description: 'Sum of the detected bot actions, broken down by the affected URLs.'
},
topIps: {
topBadBotIps: {
description:
'Sum of the detected bot actions, broken down by the highest-ranking IP addresses.'
'Sum of requests detected as bad bots, broken down by the highest-ranking IP addresses.'
},
topImpactedUrls: {
description: 'Sum of the detected bot actions, broken down by the most affected URLs.'
Expand Down
8 changes: 4 additions & 4 deletions src/modules/real-time-metrics/constants/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,8 @@ const REPORTS = [
{
id: '978435123222265554',
chartOwner: 'azion',
label: 'Top IPs',
description: REPORTS_TEXTS.botManager.botManagerBreakdown.topIps.description,
label: 'Top Bad Bot IPs',
description: REPORTS_TEXTS.botManager.botManagerBreakdown.topBadBotIps.description,
aggregationType: 'sum',
columns: 6,
type: 'ordered-bar',
Expand All @@ -1182,15 +1182,15 @@ const REPORTS = [
],
filters: {
datasetEq: 'bot_manager',
metricEq: 'top_remote_addr'
metricEq: 'top_bad_remote_addr'
},
limit: 10,
groupBy: ['dimension1'],
fields: ['dimension1'],
orderDirection: 'DESC',
dashboardId: '659868342290523846',
variationType: 'regular',
helpCenterPath: HELP_CENTER_URLS.botManager.botManagerBreakdown.topIps
helpCenterPath: HELP_CENTER_URLS.botManager.botManagerBreakdown.topBadBotIps
},
{
id: '1030427483148242',
Expand Down
24 changes: 12 additions & 12 deletions src/modules/real-time-metrics/reports/convert-beholder-to-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,10 @@ const formatTsChartData = ({

const seriesArray = fillSeriesWithZeroes(series, countValues)

if (report.id === '071851224118431167') {
const BOT_CAPTCHA_CHART = '071851224118431167'
if (report.id === BOT_CAPTCHA_CHART) {
seriesArray.forEach((serie) => {
// linter complains about ternary
if (serie[0] === 'false') {
serie[0] = 'Not Solved'
}
if (serie[0] === 'true') {
serie[0] = 'Solved'
}
serie[0] = serie[0] === 'true' ? 'Solved' : 'Not Solved'
})
}
// ensures that the X-axis is the first set of data.
Expand All @@ -358,9 +353,9 @@ const formatCatAbsoluteChartData = ({ report, data }) => {
const seriesName = report.groupBy[0]
const fieldName = report.aggregationType || report.fields[0]

const botCaptchaIds = ['455330743572401794', '071851224118431167']
const BOT_CAPTCHA_IDS = ['455330743572401794', '071851224118431167']

if (botCaptchaIds.includes(report.id)) {
if (BOT_CAPTCHA_IDS.includes(report.id)) {
return data[dataset].map((item) => {
const captchaSeriesName = item[seriesName] == 'true' ? 'Solved' : 'Not Solved'
return [camelToTitle(captchaSeriesName), item[fieldName]]
Expand Down Expand Up @@ -420,8 +415,12 @@ const formatRotatedBarChartData = ({ report, data }) => {
const series = [seriesName]
const values = [dataUnit]

const TOP_IMPACTED_URLS_CHART = '1030427483148242'

data[dataset].forEach((item) => {
series.push(camelToTitle(item[seriesName]))
report.id !== TOP_IMPACTED_URLS_CHART
? series.push(camelToTitle(item[seriesName]))
: series.push(item[seriesName])
values.push(item[aggregation] || item[fieldName])
})

Expand All @@ -443,7 +442,8 @@ const formatBigNumbers = ({ report, data }) => {
const total = data[dataset].reduce((acc, current) => acc + current[aggregation || fieldName], 0)
let { unit, value } = formatDataUnit(total, report)

if (report.id === '847143804009563421') {
const IMPACTED_URLS_CHART = '847143804009563421'
if (report.id === IMPACTED_URLS_CHART) {
unit = 'URLs'
}

Expand Down
8 changes: 4 additions & 4 deletions src/plugins/analytics/trackers/RealTimeMetricsTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export class RealTimeMetricsTracker {
}

/**
* @param {Object} payload
* @param {AzionProductsNames} payload.productName
* @returns {AnalyticsTrackerAdapter}
*/
* @param {Object} payload
* @param {AzionProductsNames} payload.productName
* @returns {AnalyticsTrackerAdapter}
*/
clickedToRealTimeMetrics({ eventName, payload }) {
this.#trackerAdapter.addEvent({
eventName,
Expand Down
9 changes: 8 additions & 1 deletion src/plugins/analytics/trackers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ import { ProductTracker } from './ProductTracker'
import { WafRulesTracker } from './WafRulesTracker'
import { RealTimeMetricsTracker } from './RealTimeMetricsTracker'

export { SignUpTracker, SignInTracker, CreateTracker, ProductTracker, WafRulesTracker, RealTimeMetricsTracker }
export {
SignUpTracker,
SignInTracker,
CreateTracker,
ProductTracker,
WafRulesTracker,
RealTimeMetricsTracker
}
3 changes: 2 additions & 1 deletion src/services/edge-node-services/edit-edge-node-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const adapt = (payload) => {
name: payload.name,
hashId: payload.hashId,
groups,
status: payload.status
status: payload.status,
has_services: payload.hasServices
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/services/edge-node-services/load-edge-node-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const adapt = (httpResponse, id) => {
name: httpResponse.body.name,
id: id,
hashId: httpResponse.body.hash_id,
groups: httpResponse.body.groups
groups: httpResponse.body.groups,
hasServices: httpResponse.body.has_services
}

return {
Expand Down
2 changes: 1 addition & 1 deletion src/services/real-time-metrics-services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export {
searchEdgeDnsService,
searchEdgeFunctionsService,
loadRealTimeMetricsData,
searchBotCategoryService
searchBotCategoryService
}
4 changes: 4 additions & 0 deletions src/templates/form-fields-inputs/fieldSwitchBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:nameId="props.name"
@change="changeState"
:inputClass="props.selectorClass"
:rootClass="rootClass"
:data-testid="customTestId.selector"
>
<template #selector>
Expand Down Expand Up @@ -79,6 +80,9 @@
},
selectorClass: {
type: String
},
rootClass: {
type: String
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const COMMON_LAYERS_COLOR_LAKES = {
color: '#b5b5b5',
width: 1
},
fill: { color: '#eeeeee' }
fill: { color: '#f9fafb' }
}
}
}
Expand All @@ -122,7 +122,7 @@ const COMMON_LAYERS_COLOR_OCEANS = {
color: 'transparent',
width: 0
},
fill: { color: '#eeeeee' }
fill: { color: '#f9fafb' }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,11 @@ const LIMITS = {
const BUBBLE_SIZE = 15

const rangeVariations = (value, rangeVariation) => {
switch (true) {
case value > LIMITS.limit5:
return `${rangeVariation}-limit5`
case value >= LIMITS.limit4:
return `${rangeVariation}-limit4`
case value >= LIMITS.limit3:
return `${rangeVariation}-limit3`
case value >= LIMITS.limit2:
return `${rangeVariation}-limit2`
default:
return `${rangeVariation}-limit1`
}
if (value > LIMITS.limit5) return `${rangeVariation}-limit5`
if (value >= LIMITS.limit4) return `${rangeVariation}-limit4`
if (value >= LIMITS.limit3) return `${rangeVariation}-limit3`
if (value >= LIMITS.limit2) return `${rangeVariation}-limit2`
return `${rangeVariation}-limit1`
}

export const bubblesHandler = (name, data) => {
Expand Down
5 changes: 4 additions & 1 deletion src/templates/selector-block/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<Card
:pt="{
root: { class: ['select-none', classStateRoot] }
root: { class: ['select-none', classStateRoot, rootClass] }
}"
>
<template #content>
Expand Down Expand Up @@ -92,6 +92,9 @@
},
inputClass: {
type: String
},
rootClass: {
type: String
}
})
const slots = useSlots()
Expand Down
8 changes: 4 additions & 4 deletions src/tests/modules/real-time-metrics/constants/reports.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,9 +1141,9 @@ describe('RealTimeMetricsModule', () => {
{
id: '978435123222265554',
chartOwner: 'azion',
label: 'Top IPs',
label: 'Top Bad Bot IPs',
description:
'Sum of the detected bot actions, broken down by the highest-ranking IP addresses.',
'Sum of requests detected as bad bots, broken down by the highest-ranking IP addresses.',
aggregationType: 'sum',
columns: 6,
type: 'ordered-bar',
Expand All @@ -1160,15 +1160,15 @@ describe('RealTimeMetricsModule', () => {
],
filters: {
datasetEq: 'bot_manager',
metricEq: 'top_remote_addr'
metricEq: 'top_bad_remote_addr'
},
limit: 10,
groupBy: ['dimension1'],
fields: ['dimension1'],
orderDirection: 'DESC',
dashboardId: '659868342290523846',
variationType: 'regular',
helpCenterPath: '/real-time-metrics/bot-manager-advanced/breakdown/top-ips'
helpCenterPath: '/real-time-metrics/bot-manager-advanced/breakdown/top-bad-bot-ips'
},
{
id: '1030427483148242',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ ts
},
{
id: '978435123222265554',
label: 'Top IPs',
label: 'Top Bad Bot IPs',
gqlQuery: {
query: `query ($tsRange_begin:DateTime!, $tsRange_end:DateTime!) {
securityMetrics (
Expand All @@ -1453,7 +1453,7 @@ end: $tsRange_end
}
datasetEq: "bot_manager"
metricEq: "top_remote_addr"
metricEq: "top_bad_remote_addr"
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const fixtures = {
name: 'Az-dns',
hashId: 'a1b2c3d4e5f6g7h8i9j0',
groups: [],
status: true
status: true,
hasServices: false
}
}

Expand Down Expand Up @@ -39,7 +40,8 @@ describe('EdgeNodeServices', () => {
groups: [],
hashId: 'a1b2c3d4e5f6g7h8i9j0',
name: 'Az-dns',
status: true
status: true,
has_services: false
}
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const fixtures = {
id: 76789,
active: true,
groups: [],
name: 'My Edge Service'
name: 'My Edge Service',
has_services: true
}
}

Expand Down Expand Up @@ -49,7 +50,8 @@ describe('EdgeNodeServices', () => {
name: fixtures.mock.name,
groups: fixtures.mock.groups,
hashId: fixtures.mock.hashId,
id: fixtures.mock.id
id: fixtures.mock.id,
hasServices: fixtures.mock.has_services
})
})
})
6 changes: 3 additions & 3 deletions src/views/CompareWithAzion/blocks/retry-message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { onMounted, ref } from 'vue'
import Message from 'primevue/message'
import Button from 'primevue/button'
const emit = defineEmits(['onRetry'])
const props = defineProps({
data: ref({
Expand All @@ -56,7 +56,7 @@
default: 'error'
}
})
const counter = ref(props.timer)
const retryButton = ref({
disabled: false,
Expand Down
3 changes: 2 additions & 1 deletion src/views/EdgeNode/EditView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
const validationSchema = yup.object({
name: yup.string().required().label('Name'),
hashId: yup.string().required().label('Hash ID'),
groups: yup.array().label('Groups')
groups: yup.array().label('Groups'),
hasServices: yup.boolean().label('Service')
})
const formSubmit = async (onSubmit, values, formValid) => {
Expand Down
20 changes: 20 additions & 0 deletions src/views/EdgeNode/FormFields/FormFieldsEdgeNode.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import FormHorizontal from '@/templates/create-form-block/form-horizontal'
import FieldText from '@/templates/form-fields-inputs/fieldText'
import FieldSwitchBlock from '@/templates/form-fields-inputs/fieldSwitchBlock'
import MultiSelect from 'primevue/multiselect'
import { useField } from 'vee-validate'
Expand Down Expand Up @@ -86,4 +87,23 @@
</div>
</template>
</FormHorizontal>

<FormHorizontal
title="Orchestration Modules"
description="Choose orchestration modules to install on your Edge Node."
>
<template #inputs>
<div class="flex flex-col gap-2">
<FieldSwitchBlock
nameField="hasServices"
name="hasServices"
rootClass="w-full"
auto
isCard
title="Add-On Services"
subtitle="Enables you to instantiate add-on services from your own Services Library."
/>
</div>
</template>
</FormHorizontal>
</template>
Loading

0 comments on commit a58e2d3

Please sign in to comment.