Skip to content

Commit

Permalink
Merge pull request #2205 from aziontech/dev
Browse files Browse the repository at this point in the history
DEPLOY 2025-02-20
  • Loading branch information
HerbertJulio authored Feb 20, 2025
2 parents aa16be3 + c583ebc commit 11463f8
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 74 deletions.
33 changes: 31 additions & 2 deletions azion/production/azion.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "console_kit_31-07-2024",
"bucket": "consolekit31-07-2024",
"preset": "vue",
"mode": "deliver",
"env": "production",
"prefix": "20240731102422",
"not-first-run": true,
Expand Down Expand Up @@ -162,6 +161,36 @@
"id": 318350,
"name": "Route GraphQL Accounting Queries to Manager Origin",
"phase": "request"
},
{
"id": 368275,
"name": "Rewrite azrt Cookie in azion.com",
"phase": "response"
},
{
"id": 368276,
"name": "Rewrite azrt Cookie in azionedge.net",
"phase": "response"
},
{
"id": 368277,
"name": "Rewrite azsid Cookie in azion.com",
"phase": "response"
},
{
"id": 368278,
"name": "Rewrite azsid Cookie in azionedge.net",
"phase": "response"
},
{
"id": 368279,
"name": "Rewrite azat Cookie in azion.com",
"phase": "response"
},
{
"id": 368280,
"name": "Rewrite azat Cookie in azionedge.net",
"phase": "response"
}
]
},
Expand All @@ -175,4 +204,4 @@
"name": "Cities - Cache"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
showMore: '[data-testid="table-column-expand-text-column__show-more__toggle"]',
filteredRow: {
column: (columnName) => `[data-testid="list-table-block__column__${columnName}__row"]`,
statusColumn: '[data-testid="list-table-block__column__status__row"] > .p-tag-value',
statusColumn: '.p-tag-value',
empty: '[data-testid="list-table-block__empty-message__text"]',
lastEditorColumn: '[data-testid="list-table-block__column__lastEditor__row"]',
lastModifiedColumn: '[data-testid="list-table-block__column__lastModified__row"]'
Expand Down
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.31.6",
"version": "1.31.7",
"private": false,
"type": "module",
"repository": {
Expand Down
20 changes: 17 additions & 3 deletions src/helpers/convert-gql.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ const convertGQL = (filter, table) => {
if (!table) throw new Error('Table parameter is required')

let variables = {}
const fields = filter?.fields || []
const filterQuery = buildFilterQuery(filter, variables)
const fieldsFormat = table.fields.map((field) => `\t\t${field}`).join('\n')
const filterParameter = formatFilterParameter(variables)
const filterParameter = formatFilterParameter(variables, fields)
variables = formatValueContainOperator(variables)

const queryConfig = {
Expand Down Expand Up @@ -216,8 +217,21 @@ const buildFilterQueriesWithPrefix = (filter, variables, prefix) => {
* @param {Object} variables
* @returns {String} formattedFilterParameter
*/
const formatFilterParameter = (variables) => {
return Object.keys(variables).map((key) => `\t$${key}: ${getGraphQLType(variables[key])}!`)
const formatFilterParameter = (variables, fields) => {
return Object.keys(variables).map((key) => {
let type
if (key.startsWith('and_')) {
const fieldKey = key.replace('and_', '')
const field = fields.find(
({ valueField, operator }) => `${valueField}${operator}` === fieldKey
)
type = field && field?.type ? field.type : getGraphQLType(variables[key])
} else {
type = getGraphQLType(variables[key])
}

return `\t$${key}: ${type}!`
})
}

export default convertGQL
51 changes: 25 additions & 26 deletions src/modules/real-time-metrics/chart/format-c3-graph-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,46 +130,45 @@ function formatPercentageDataUnit(data) {
}).format(data / 100)
}

function calculateValueAndUnit(data, unit) {
if (data > CHART_RULES.DATA_VOLUME.tera) {
return { value: data / CHART_RULES.DATA_VOLUME.tera, formattedUnit: `tera${unit}` }
}
if (data > CHART_RULES.DATA_VOLUME.giga) {
return { value: data / CHART_RULES.DATA_VOLUME.giga, formattedUnit: `giga${unit}` }
}
if (data > CHART_RULES.DATA_VOLUME.mega) {
return { value: data / CHART_RULES.DATA_VOLUME.mega, formattedUnit: `mega${unit}` }
}
if (data > CHART_RULES.DATA_VOLUME.kilo) {
return { value: data / CHART_RULES.DATA_VOLUME.kilo, formattedUnit: `kilo${unit}` }
}
return { value: data, formattedUnit: unit }
}

/**
* Format data for displaying byte unit
* @param {number} data - The data to be formatted
* @param {Object} chartData - The chart data
* @returns {string} - Returns the formatted data for byte unit display
*/
function formatBytesDataUnit(data, chartData) {
let value = data
let unit = 'byte'
const unit = chartData.dataUnit === 'bitsPerSecond' ? 'bit-per-second' : 'byte'

if (chartData.dataUnit === 'bitsPerSecond') {
unit = 'bit-per-second'
}
const { value, formattedUnit } = calculateValueAndUnit(Math.abs(data), unit)

if (data > CHART_RULES.DATA_VOLUME.tera) {
value = data / CHART_RULES.DATA_VOLUME.tera
unit = `tera${unit}`
} else if (data > CHART_RULES.DATA_VOLUME.giga) {
value = data / CHART_RULES.DATA_VOLUME.giga
unit = `giga${unit}`
} else if (data > CHART_RULES.DATA_VOLUME.mega) {
value = data / CHART_RULES.DATA_VOLUME.mega
unit = `mega${unit}`
} else if (data > CHART_RULES.DATA_VOLUME.kilo) {
value = data / CHART_RULES.DATA_VOLUME.kilo
unit = `kilo${unit}`
}

/**
* Formatter for byte display
*/
const byteValueNumberFormatter = Intl.NumberFormat('en', {
const formattedData = Intl.NumberFormat('en', {
notation: 'compact',
style: 'unit',
unit,
unit: formattedUnit,
unitDisplay: 'narrow',
minimumFractionDigits: CHART_RULES.TO_FIXED_DATA_VOLUME,
maximumFractionDigits: CHART_RULES.TO_FIXED_DATA_VOLUME
})
return byteValueNumberFormatter.format(value)
}).format(value)

const isNegativeData = data < 0

return isNegativeData ? `-${formattedData}` : formattedData
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AxiosHttpClientAdapter, parseHttpResponse } from '../axios/AxiosHttpClientAdapter'
import { AxiosHttpClientAdapter } from '../axios/AxiosHttpClientAdapter'
import { makeVersionControlSystemBaseUrl } from './make-version-control-system-base-url'

import * as Errors from '@/services/axios/errors'
import { extractApiError } from '@/helpers/extract-api-error'
export const postCallbackUrlService = async (path, body) => {
let httpResponse = await AxiosHttpClientAdapter.request({
url: `${makeVersionControlSystemBaseUrl()}${path}`,
Expand All @@ -10,3 +11,19 @@ export const postCallbackUrlService = async (path, body) => {

return parseHttpResponse(httpResponse)
}

/**
* @param {Object} httpResponse - The HTTP response object.
* @param {Object} httpResponse.body - The response body.
* @returns {string} The formatted error message.
*/
const parseHttpResponse = (httpResponse) => {
switch (httpResponse.statusCode) {
case 200:
return { feedback: 'Git Hub Installation successfully completed' }
case 500:
throw new Errors.InternalServerError().message
default:
throw new Error(extractApiError(httpResponse)).message
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
generateGraph()
})
const calculateYMin = () =>
Math.min(0, ...props.resultChart.flat().filter((value) => typeof value === 'number'))
const generateGraph = () => {
const c3Props = FormatC3GraphProps({
chartData: props.chartData,
Expand All @@ -22,6 +25,8 @@
hasMeanLineSeries: props.hasMeanLineSeries
})
c3Props.axis.y.min = calculateYMin()
c3.generate({
bindto: `#line-chart-${props.chartData?.id}`,
...c3Props
Expand Down
14 changes: 12 additions & 2 deletions src/templates/template-engine-block/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,18 @@
const saveIntegration = async (integration) => {
isIntegrationsLoading.value = true
await props.postCallbackUrlService(callbackUrl.value, integration.data)
await listIntegrations()
try {
await props.postCallbackUrlService(callbackUrl.value, integration.data)
} catch (error) {
toast.add({
closable: true,
severity: 'error',
summary: 'error',
detail: error
})
} finally {
await listIntegrations()
}
}
const createSchemaObject = async () => {
Expand Down
6 changes: 4 additions & 2 deletions src/tests/helpers/convert-gql.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe('convertGQL', () => {
{ value: 'value3', label: 'test1' },
{ value: 'value4', label: 'test2' }
]
}
},
fields: [{ valueField: 'value2', operator: 'Eq', value: 'value2' }]
}

const { sut } = makeSut()
Expand All @@ -40,7 +41,8 @@ describe('convertGQL', () => {
and_field2: 'value2',
in_field3: ['value3', 'value4'],
tsRange_begin: '2022-01-01',
tsRange_end: '2022-01-31'
tsRange_end: '2022-01-31',
and_value2Eq: 'value2'
}
})
})
Expand Down
30 changes: 1 addition & 29 deletions src/views/Home/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import DialogOnboardingScheduling from '@/templates/dialogs-block/dialog-onboarding-scheduling.vue'
import CreateFormBlock from '@/templates/create-form-block'
import { useLayout } from '@/composables/use-layout'
import InlineMessage from 'primevue/inlinemessage'
import { getStaticUrlsByEnvironment } from '@/helpers'
/**@type {import('@/plugins/analytics/AnalyticsTrackerAdapter').AnalyticsTrackerAdapter} */
const tracker = inject('tracker')
Expand Down Expand Up @@ -42,7 +39,7 @@
const router = useRouter()
const route = useRoute()
const dialog = useDialog()
const { accountData, isBannerVisible } = useAccountStore()
const { accountData } = useAccountStore()
const user = accountData
const teams = ref([])
Expand Down Expand Up @@ -116,12 +113,6 @@
}
}
const openRTM = async () => {
const urlEOL = getStaticUrlsByEnvironment('managerEOL')
await tracker.product.clickedTo({ target: 'RTM' }).track()
window.location.href = `${urlEOL}?disableRedirect=true`
}
onMounted(async () => {
teams.value = await props.listTeamsService()
showOnboardingSchedulingDialog()
Expand All @@ -135,25 +126,6 @@
<ContentBlock>
<template #content>
<section class="w-full flex flex-col gap-6 lg:gap-8">
<InlineMessage
v-if="isBannerVisible"
class="p-3 gap-1"
severity="info"
data-testid="message-deprecation"
>
Azion Console is now the primary way to access Azion's platform.
<PrimeButton
label="Real-Time Manager (RTM)"
@click="openRTM"
iconPos="right"
class="p-0"
size="small"
link
/>
will be deprecated soon, and access will only be available for a limited time through this
link.
</InlineMessage>

<div
v-if="showExperimental"
class="w-full p-3 surface-border border rounded-md flex flex-col gap-4 justify-between items-center sm:flex-row sm:p-8 lg:gap-10"
Expand Down
6 changes: 0 additions & 6 deletions vulcan.config.js

This file was deleted.

0 comments on commit 11463f8

Please sign in to comment.