Skip to content

Commit

Permalink
Merge pull request #1696 from aziontech/dev
Browse files Browse the repository at this point in the history
DEPLOY 2024.09.10
  • Loading branch information
HerbertJulio authored Sep 10, 2024
2 parents 7a03751 + 42f44ac commit 8466805
Show file tree
Hide file tree
Showing 52 changed files with 1,494 additions and 408 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: deploy-console
cancel-in-progress: false
container:
image: node:18-alpine3.18
steps:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/dev-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
group: [2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -47,26 +47,27 @@ jobs:

- name: Upload Cypress Screenshots
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: cypress_screenshots_${{ matrix.group }}
path: cypress/screenshots
retention-days: 4

- name: Upload Cypress Videos
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: cypress_videos_${{ matrix.group }}
path: cypress/videos
retention-days: 1

- name: Upload Coverage Files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage_reportx
name: coverage_report_${{ matrix.group }}
path: .nyc_output/*
retention-days: 1
include-hidden-files: true

download_and_merge:
name: Download and Merge Coverage Reports
Expand All @@ -86,12 +87,14 @@ jobs:
run: npm install --global nyc

- name: Download Coverage Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: coverage_report
pattern: coverage_report_*
merge-multiple: true

- name: Merge Coverage Reports
run: npx nyc merge ./coverage_report/coverage_reportx .nyc_output/out.json
run: npx nyc merge ./coverage_report .nyc_output/out.json

- name: Generate Text Coverage Report
run: npx nyc report --reporter=text-summary
Expand All @@ -112,7 +115,7 @@ jobs:

- name: Upload Coverage Report Artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage_e2e_report
path: coverage.zip
Expand Down
87 changes: 54 additions & 33 deletions azion.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -242,47 +242,68 @@ const backRules = [
},
rewrite: '/billing/graphql'
}
},
{
name: 'Route List Client Ids to Github',
description: 'this route will get the client ids of the accounts released to the console',
match: '^/api/allowed-accounts',
behavior: {
forwardCookies: true,
setOrigin: {
name: 'origin-github-allowed-accounts',
type: 'single_origin'
},
rewrite: '/aziontech/console-client-list/main/clids.json'
}
}
]

const AzionConfig = {
cache: [...cacheConfig],
origin: addStagePrefix([
{
name: 'origin-storage-default',
type: 'object_storage'
},
{
name: 'origin-manager',
type: 'single_origin',
hostHeader: `manager.azion.com`,
addresses: [`manager.azion.com`]
},
{
name: 'origin-marketplace',
type: 'single_origin',
hostHeader: `marketplace.azion.com`,
addresses: [`marketplace.azion.com`]
},
{
name: 'origin-cities',
type: 'single_origin',
hostHeader: `cities.azion.com`,
addresses: [`cities.azion.com`]
},
origin: [
...addStagePrefix([
{
name: 'origin-storage-default',
type: 'object_storage'
},
{
name: 'origin-manager',
type: 'single_origin',
hostHeader: `manager.azion.com`,
addresses: [`manager.azion.com`]
},
{
name: 'origin-marketplace',
type: 'single_origin',
hostHeader: `marketplace.azion.com`,
addresses: [`marketplace.azion.com`]
},
{
name: 'origin-cities',
type: 'single_origin',
hostHeader: `cities.azion.com`,
addresses: [`cities.azion.com`]
},
{
name: 'origin-sso',
type: 'single_origin',
hostHeader: `sso.azion.com`,
addresses: [`sso.azion.com`]
},
{
name: 'origin-api',
type: 'single_origin',
hostHeader: `api.azion.com`,
addresses: [`api.azion.com`]
},
]),
{
name: 'origin-sso',
name: 'origin-github-allowed-accounts',
type: 'single_origin',
hostHeader: `sso.azion.com`,
addresses: [`sso.azion.com`]
hostHeader: `raw.githubusercontent.com`,
addresses: [`raw.githubusercontent.com`]
},
{
name: 'origin-api',
type: 'single_origin',
hostHeader: `api.azion.com`,
addresses: [`api.azion.com`]
}
]),
],
rules: {
request: [...commonRules, ...frontRules, ...backRules],
response: [
Expand Down
10 changes: 10 additions & 0 deletions azion/stage/azion.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
"origin-id": 146195,
"origin-key": "c92f57e1-79d6-4bcc-9493-2af4ad9f4dd5",
"name": "origin-cities"
},
{
"origin-id": 153113,
"origin-key": "ab771dc5-8ee9-4f9f-bb5d-3fa6fe9483c5",
"name": "origin-github-allowed-accounts"
}
],
"rules-engine": {
Expand Down Expand Up @@ -142,6 +147,11 @@
"id": 277563,
"name": "Secure Headers",
"phase": "response"
},
{
"id": 294965,
"name": "Route List Client Ids to Github",
"phase": "request"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ describe('Edge Firewall spec', { tags: ['@dev5'] }, () => {
cy.get(selectors.edgeFirewall.ruleDescriptionInput).type('My Rule Description')

// Act - Set Criteria
cy.intercept('GET', '/api/v3/network_lists?page=1&page_size=200').as('networkList')
cy.get(selectors.edgeFirewall.ruleCriteriaVariableDropdown).click()
cy.get(selectors.edgeFirewall.ruleCriteriaVariableDropdownNetworkLists).click()
cy.get(selectors.edgeFirewall.ruleCriteriaOperatorDropdown).click()
cy.get(selectors.edgeFirewall.ruleCriteriaOperatorFirstOption).click()
cy.wait(1000)
cy.wait('@networkList')
cy.get(selectors.edgeFirewall.ruleCriteriaNetworkListDropdown).click()
cy.get(selectors.edgeFirewall.ruleCriteriaNetworkListFilter).clear()
cy.get(selectors.edgeFirewall.ruleCriteriaNetworkListFilter).type(networkListName)
Expand Down Expand Up @@ -98,4 +99,4 @@ describe('Edge Firewall spec', { tags: ['@dev5'] }, () => {
cy.verifyToast('Edge Firewall successfully deleted')
})
})
})
})
5 changes: 3 additions & 2 deletions cypress/e2e/edge-firewall/create-edge-firewall-waf.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const createWAFCase = () => {

// Act
cy.get(selectors.wafs.nameInput).type(wafName)
cy.intercept('GET', '/api/v3/waf/rulesets/*').as('wafRules')
cy.get(selectors.form.actionsSubmitButton).click()
cy.verifyToast('success', 'Your waf rule has been created')
}
Expand All @@ -27,7 +28,7 @@ describe('Edge Firewall spec', { tags: ['@dev5'] }, () => {

it('should create an Edge Firewall with a rules engine using a WAF', () => {
createWAFCase()
cy.wait(2000)
cy.wait('@wafRules')
cy.openProduct('Edge Firewall')

// Act - create Edge Firewall
Expand Down Expand Up @@ -96,4 +97,4 @@ describe('Edge Firewall spec', { tags: ['@dev5'] }, () => {
cy.verifyToast('Edge Firewall successfully deleted')
})
})
})
})
2 changes: 1 addition & 1 deletion src/helpers/metrics-playground-opener.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getStaticUrlsByEnvironment } from './get-static-urls-by-environment'

export const metricsPlaygroundOpener = () => {
const playgroundUrl = getStaticUrlsByEnvironment('playground')
const playgroundUrl = getStaticUrlsByEnvironment('playgroundMetrics')
window.open(playgroundUrl, '_blank')
}
33 changes: 23 additions & 10 deletions src/modules/real-time-metrics/chart/format-c3-graph-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CHART_RULES } from '@modules/real-time-metrics/constants'
* @param {any} date - The input to be checked
* @returns {boolean} - Returns true if the input is a valid date, otherwise returns false
*/
function isDate(date) {
export function isDate(date) {
const series = date
// eslint-disable-next-line eqeqeq
return new Date(series) != 'Invalid Date'
Expand Down Expand Up @@ -42,7 +42,7 @@ function formatC3DataProp(chartData, resultChart) {
const field = resultChart[1][0]

data.types = { [field]: 'bar' }
data.labels = true
data.labels = { format: (value) => formatYAxisLabels(value, chartData) }
data.color = (_, data) => CHART_RULES.BASE_COLOR_PATTERNS[data.index]

return data
Expand All @@ -63,7 +63,7 @@ function formatC3DataProp(chartData, resultChart) {
* @param {Array} resultChart - The result chart
* @returns {Object} - Returns the formatted C3 X Axis
*/
function formatC3XAxis(chartData, resultChart) {
export function formatC3XAxis(chartData, resultChart) {
const isSeriesDate = isDate(resultChart[0][1])
const isSeriesNumeric = isNumeric(resultChart)
const isTimeSeries = chartData.xAxis === 'ts'
Expand Down Expand Up @@ -166,7 +166,7 @@ function formatDataUnit(data) {
* @param {Object} chartData - The chart data
* @returns {string} - Returns the formatted Y axis labels for the C3 chart
*/
function formatYAxisLabels(data, chartData) {
export function formatYAxisLabels(data, chartData) {
if (chartData.dataUnit === 'bytes' || chartData.dataUnit === 'bitsPerSecond') {
return formatBytesDataUnit(data, chartData)
}
Expand All @@ -187,7 +187,7 @@ function formatYAxisLabels(data, chartData) {
* @param {Object} chartData - The chart data
* @returns {Object} - Returns the formatted Y axis of the C3 chart
*/
function formatC3YAxis(chartData) {
export function formatC3YAxis(chartData, hasCount = true) {
const hiddenTypes = ['ordered-bar']

if (hiddenTypes.includes(chartData.type)) {
Expand All @@ -199,12 +199,15 @@ function formatC3YAxis(chartData) {
* Configuration of the Y axis tick
*/
tick: {
count: CHART_RULES.MAX_COUNT,
format: (d) => formatYAxisLabels(d, chartData)
},
min: !isRotated ? CHART_RULES.RESET_COUNT : undefined,
padding: { bottom: 0 }
}

if (hasCount) {
yAxis.tick.count = CHART_RULES.MAX_COUNT
}
if (chartData.maxYAxis) {
yAxis.max = chartData.maxYAxis
yAxis.padding.top = 0
Expand Down Expand Up @@ -249,7 +252,7 @@ function generateMeanLineValues(resultChart, mean) {
* @param {string} text - The camelCase string to convert
* @returns {string} - The title case string
*/
function camelToTitle(text) {
export function camelToTitle(text) {
const title = text.replace(/([A-Z])/g, ' $1').replace(/([a-zA-Z])(\d+)/g, '$1 $2')
return title.charAt(0).toUpperCase() + title.slice(1)
}
Expand Down Expand Up @@ -284,7 +287,7 @@ function setMeanSeriesValues(serie, seriesTotal, chartData) {
* @param {boolean} hasMeanLineTotal - Indicates if the chart has mean line total
* @returns {Object} - Returns the series names, mean line total, and mean line series for the C3 chart
*/
function getSeriesInfos(resultChart, chartData, hasMeanLineSeries, hasMeanLineTotal) {
export function getSeriesInfos(resultChart, chartData, hasMeanLineSeries, hasMeanLineTotal) {
const sliced = resultChart.slice(1)

let seriesNames = {}
Expand Down Expand Up @@ -387,7 +390,7 @@ function displayLegend(chartData) {
* @param {boolean} options.hasMeanLineTotal - Flag indicating if the chart has mean line total
* @returns {Object} The formatted C3 graph properties
*/
export default function FormatC3GraphProps({
export function FormatC3GraphProps({
chartData,
resultChart,
hasMeanLineSeries = false,
Expand Down Expand Up @@ -423,6 +426,10 @@ export default function FormatC3GraphProps({
data.columns = [...data.columns, ...meanLineSeries]
}

const showFocus = (chartData) => {
return chartData.type !== 'ordered-bar'
}

const c3Props = {
data,
axis: {
Expand All @@ -436,6 +443,9 @@ export default function FormatC3GraphProps({
grid: {
y: {
show: displayGrid(chartData)
},
focus: {
show: showFocus(chartData)
}
},
point: {
Expand All @@ -452,7 +462,10 @@ export default function FormatC3GraphProps({
)
},
format: {
title: (d) => (isDate(d) ? new Date(d).toLocaleString('en-US') : d)
title: (d) => (isDate(d) ? new Date(d).toLocaleString('en-US') : d),
value: function (value) {
return formatYAxisLabels(value, chartData)
}
}
},
zoom: {
Expand Down
Loading

0 comments on commit 8466805

Please sign in to comment.