Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPLOY 2024.09.24 #1743

Merged
merged 7 commits into from
Sep 24, 2024
Merged
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
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.0",
"version": "1.22.2",
"private": false,
"type": "module",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/real-time-metrics/constants/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ const REPORTS = [
classifiedIn: ['bad bot', 'good bot']
},
limit: 5000,
groupBy: ['geoipCountry'],
fields: ['geoipCountry'],
groupBy: ['geolocCountryName'],
fields: ['geolocCountryName'],
orderDirection: 'ASC',
dashboardId: '371360344901061482',
variationType: 'regular',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,15 @@ const formatCatAbsoluteChartData = ({ report, data }) => {
const seriesName = report.groupBy[0]
const fieldName = report.aggregationType || report.fields[0]

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

if (botCaptchaIds.includes(report.id)) {
return data[dataset].map((item) => {
const captchaSeriesName = item[seriesName] == 'true' ? 'Solved' : 'Not Solved'
return [camelToTitle(captchaSeriesName), item[fieldName]]
})
}

return data[dataset].map((item) => {
return [camelToTitle(item[seriesName]), item[fieldName]]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ function getFeedbackDifference(currentAggregation, previousAggregation) {
const currentValue = Object.values(currentAggregation)[0]
const previousValue = Object.values(previousAggregation)[0]

if (previousValue === 0 && currentValue === 0) return 0
if (previousValue === 0 && currentValue > 0) return 100
if (previousValue === 0 && currentValue < 0) return -100
if (previousValue === 0) return 0
return ((currentValue - previousValue) / previousValue) * 100
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const makeRealTimePurgeBaseUrl = () => {
const version = 'v4'
return `${version}/edge/purge`
return `${version}/workspace/purge`
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@
'no-variation': {
severity: 'info'
},
neutral: {
severity: 'info'
'positive-neutral': {
severity: 'info',
icon: 'pi pi-arrow-up-right'
},
'negative-neutral': {
severity: 'info',
icon: 'pi pi-arrow-down-left'
}
}
return variations[variation]
Expand All @@ -84,12 +89,6 @@
}

let variationState = props.variationValue > upperLimit ? 'positive' : 'negative'
if (variationType === 'neutral') {
return {
...getTagPropsByVariation(variationType),
value: `${props.variationValue.toFixed(precision)}%`
}
}

return {
...getTagPropsByVariation(`${variationState}-${variationType}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,8 @@ describe('RealTimeMetricsModule', () => {
classifiedIn: ['bad bot', 'good bot']
},
limit: 5000,
groupBy: ['geoipCountry'],
fields: ['geoipCountry'],
groupBy: ['geolocCountryName'],
fields: ['geolocCountryName'],
orderDirection: 'ASC',
dashboardId: '371360344901061482',
variationType: 'regular',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ botCategory
limit: 5000
aggregate: {sum: requests
}
groupBy: [geoipCountry]
groupBy: [geolocCountryName]
orderBy: [sum_ASC]
filter: {
tsRange: {
Expand All @@ -1338,9 +1338,9 @@ classifiedIn: ["bad bot","good bot"]

}
) {
geoipCountry
geolocCountryName
sum
geoipCountry
geolocCountryName
}
}`,
variables: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('RealTimePurgeServices', () => {
await sut(fixtures.realTimePurgeMock)

expect(requestSpy).toHaveBeenCalledWith({
url: `${version}/edge/purge/cachekey`,
url: `${version}/workspace/purge/cachekey`,
method: 'POST',
body: {
items: ['www.example.com', 'www.test.com.br'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('RealTimePurgeServices', () => {
it('should return the API base url to real-time purge', () => {
const { sut } = makeSut()
const version = 'v4'
const correctApiUrl = `${version}/edge/purge`
const correctApiUrl = `${version}/workspace/purge`

const baseUrl = sut()

Expand Down
26 changes: 26 additions & 0 deletions src/views/AccountSettings/AccountSettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
import ContentBlock from '@/templates/content-block'
import EditFormBlock from '@/templates/edit-form-block'
import PageHeadingBlock from '@/templates/page-heading-block'
import { handleTrackerError } from '@/utils/errorHandlingTracker'
import * as yup from 'yup'
import FormFieldsAccountSettings from './FormFields/FormFieldsAccountSettings'
import { inject } from 'vue'

/**@type {import('@/plugins/analytics/AnalyticsTrackerAdapter').AnalyticsTrackerAdapter} */
const tracker = inject('tracker')

defineProps({
getAccountSettingsService: {
Expand All @@ -29,6 +34,25 @@
}
})

const handleTrackSuccessEdit = () => {
tracker.product
.productEdited({
productName: 'Account Settings'
})
.track()
}
const handleTrackFailEdit = (error) => {
const { fieldName, message } = handleTrackerError(error)
tracker.product
.failedToEdit({
productName: 'Account Settings',
errorType: 'api',
fieldName: fieldName.trim(),
errorMessage: message
})
.track()
}

const validationSchema = yup.object({
accountName: yup.string().required().label('Account Name'),
clientId: yup.string(),
Expand All @@ -55,6 +79,8 @@
<EditFormBlock
:editService="updateAccountSettingsService"
:loadService="getAccountSettingsService"
@on-edit-success="handleTrackSuccessEdit"
@on-edit-fail="handleTrackFailEdit"
updatedRedirect="home"
:schema="validationSchema"
>
Expand Down
19 changes: 16 additions & 3 deletions src/views/RealTimePurge/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
dialogRef.value.close()
}

const handleRealTimePurge = () => {
dialogRef.value.data.repurge()
loading.value = true
const handleRealTimePurge = async () => {
try {
loading.value = true
await dialogRef.value.data.repurge(dialogRef.value.data.item)
} finally {
loading.value = false
closeDialog()
}
}

watch(
Expand Down Expand Up @@ -70,6 +75,14 @@
to propagate to all edge nodes.
</div>
</div>
<template #closeicon>
<PrimeButton
outlined
type="button"
icon="pi pi-times"
@click="closeDialog"
/>
</template>
<template #footer>
<PrimeButton
severity="primary"
Expand Down
3 changes: 2 additions & 1 deletion src/views/RealTimePurge/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
body: (item) => ({
data: {
isLoading,
repurge: repurgeEvent(item)
item,
repurge: repurgeEvent
}
})
}
Expand Down
68 changes: 65 additions & 3 deletions src/views/WafRules/ListWafRulesAllowed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
:createService="handleCreateWafRulesAllowedService"
:schema="validationSchemaAllowed"
:initialValues="initialValues"
@onSuccess="reloadWafRulesAllowedList"
@onError="handleFailedToCreate"
@onSuccess="handleSucessCreation"
title="Create Allowed Rule"
>
<template #formFields>
Expand All @@ -72,7 +73,8 @@
:loadService="handleLoadWafRulesAllowedService"
:editService="handleEditWafRulesAllowedService"
:schema="validationSchemaAllowed"
@onSuccess="reloadWafRulesAllowedList"
@onSuccess="handleSuccessEdit"
@onError="handleFailedToEdit"
title="Edit Allowed Rule"
>
<template #formFields>
Expand All @@ -88,14 +90,18 @@
import EmptyResultsBlock from '@/templates/empty-results-block'
import { columnBuilder } from '@/templates/list-table-block/columns/column-builder'
import CreateDrawerBlock from '@templates/create-drawer-block'
import { handleTrackerError } from '@/utils/errorHandlingTracker'
import EditDrawerBlock from '@templates/edit-drawer-block'
import ListTableBlock from '@templates/list-table-block'
import PrimeButton from 'primevue/button'
import { ref } from 'vue'
import { ref, inject } from 'vue'
import { useRoute } from 'vue-router'
import * as yup from 'yup'
import FormFieldsAllowed from './FormFields/FormFieldsAllowed.vue'

/**@type {import('@/plugins/analytics/AnalyticsTrackerAdapter').AnalyticsTrackerAdapter} */
const tracker = inject('tracker')

const route = useRoute()
const hasContentToList = ref(true)
const selectedWafRulesAllowedToEdit = ref(0)
Expand Down Expand Up @@ -157,6 +163,48 @@

const wafRuleId = ref(route.params.id)

const handleSuccessEdit = () => {
reloadWafRulesAllowedList()
tracker.product
.productEdited({
productName: 'Allowed Rules'
})
.track()
}

const handleSucessCreation = () => {
reloadWafRulesAllowedList()
tracker.product
.productCreated({
productName: 'Allowed Rules'
})
.track()
}

const handleFailedToCreate = (error) => {
const { fieldName, message } = handleTrackerError(error)
tracker.product
.failedToCreate({
productName: 'Allowed Rules',
errorType: 'api',
fieldName: fieldName.trim(),
errorMessage: message
})
.track()
}

const handleFailedToEdit = (error) => {
const { fieldName, message } = handleTrackerError(error)
tracker.product
.failedToEdit({
productName: 'Allowed Rules',
errorMessage: message,
fieldName: fieldName,
errorType: 'api'
})
.track()
}

const wafRulesAllowedColumns = ref([
{
field: 'ruleId',
Expand Down Expand Up @@ -212,6 +260,18 @@
hasContentToList.value = event
}

const handleTrackEditEvent = () => {
tracker.product.clickToEdit({
productName: 'Allowed Rules'
})
}

const handleCreateTrackEvent = () => {
tracker.product.clickToCreate({
productName: 'Allowed Rules'
})
}

const goToWafRulesTuning = () => {
emit('handle-go-to-tuning', { index: 1 })
}
Expand Down Expand Up @@ -245,10 +305,12 @@
const openEditDrawerWafRulesAllowed = (event) => {
selectedWafRulesAllowedToEdit.value = parseInt(event.id)
showEditWafRulesAllowedDrawer.value = true
handleTrackEditEvent()
}

const openCreateDrawerWafAllowed = () => {
showCreateWafRulesAllowedDrawer.value = true
handleCreateTrackEvent()
}

const actions = [
Expand Down
Loading