Skip to content

Commit

Permalink
Merge branch 'master' into feat/revert-removing-accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
neSpecc committed Nov 22, 2024
2 parents f0e9ada + e0f5b6f commit d96be46
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 21 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build-and-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ jobs:
envkey_VUE_APP_CLOUDPAYMENTS_PUBLIC_ID: ${{ secrets.CP_PUBLIC_ID_PROD }}
envkey_VUE_APP_API_ENDPOINT: "https://api.hawk.so"

- name: Make prod envfile
if: endsWith(github.ref, '/prod-ru')
uses: SpicyPizza/create-envfile@v1
with:
envkey_VUE_APP_HAWK_TOKEN: ${{ secrets.HAWK_TOKEN_PROD }}
envkey_VUE_APP_AMPLITUDE_TOKEN: ${{ secrets.AMPLITUDE_TOKEN_PROD }}
envkey_VUE_APP_CLOUDPAYMENTS_PUBLIC_ID: ${{ secrets.CP_PUBLIC_ID_PROD }}
envkey_VUE_APP_API_ENDPOINT: "https://api.hawk-tracker.ru"

- name: Build and push docker image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ env.DOCKER_REPO }}
tag_with_ref: true
push: ${{ endsWith(github.ref, '/stage') || endsWith(github.ref, '/prod') }}
push: ${{ endsWith(github.ref, '/stage') || endsWith(github.ref, '/prod') || endsWith(github.ref, '/prod-ru') }}
64 changes: 63 additions & 1 deletion cypress/integration/repetitionAssembler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,68 @@ describe('Merging of the repetition and the original event payloads at the overv
expect(result).to.deep.equal(assembledRepetition);
});

it('(array of objects) should replace null in original if the repetition event has value', () => {
originalEvent = {
...originalEvent,
backtrace: [
{
...baseEvent.backtrace[0],
sourceCode: null
}
],
};

repetitionEvent = {
...repetitionEvent,
backtrace: [
{
...baseEvent.backtrace[0],
sourceCode: [
{
content: '111',
line: 4
},
{
content: '222',
line: 5
},
{
content: '333',
line: 6
}
]
}
],
};

assembledRepetition = {
...baseEvent,
backtrace: [
{
...baseEvent.backtrace[0],
sourceCode: [
{
content: '111',
line: 4
},
{
content: '222',
line: 5
},
{
content: '333',
line: 6
}
]
}
],
};

const result = repetitionAssembler(originalEvent, repetitionEvent);

expect(result).to.deep.equal(assembledRepetition);
});

it('should take the repetition field value instead of the original event value in the array of objects', () => {
originalEvent = {
...originalEvent,
Expand Down Expand Up @@ -229,4 +291,4 @@ describe('Merging of the repetition and the original event payloads at the overv

expect(result).to.deep.equal(assembledRepetition);
});
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawk.so",
"version": "0.4.1",
"version": "0.4.2",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
1 change: 1 addition & 0 deletions src/assets/sprite-icons/flask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/sprite-icons/nuxt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions src/assets/sprite-icons/vue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion src/components/event/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,23 @@
v-if="getIntegrationAddons('vue')"
class="event-overview__section"
:addons="getIntegrationAddons('vue')"
icon="vue"
title="Vue"
/>
<DetailsAddons
v-if="getIntegrationAddons('nuxt')"
class="event-overview__section"
:addons="getIntegrationAddons('nuxt')"
icon="nuxt"
title="Nuxt"
/>
<DetailsAddons
v-if="getIntegrationAddons('flask')"
class="event-overview__section"
:addons="getIntegrationAddons('flask')"
icon="flask"
title="Flask"
/>
<DetailsAddons
v-if="hasContext"
class="event-overview__section"
Expand Down Expand Up @@ -112,7 +127,7 @@ export default Vue.extend({
return null;
}
const integrationToFilter = [ 'vue' ];
const integrationToFilter = [ 'vue', 'nuxt', 'flask' ];
const filteredAddons = {};
Object.entries(this.event.payload.addons).forEach(([name, value]) => {
Expand Down
16 changes: 12 additions & 4 deletions src/components/event/details/DetailsAddons.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<DetailsBase>
<template #header>
{{ title }}
<template v-if="title === 'Vue' ">
<Icon symbol="vue" />
<template v-if="icon">
<Icon :symbol="icon" />
</template>
{{ title }}
</template>
<template #content>
<div
Expand Down Expand Up @@ -90,6 +90,14 @@ export default Vue.extend({
type: Object as PropType<EventAddons>,
required: true,
},
/**
* Integration framework logo
*/
icon: {
type: String,
default: '',
}
},
computed: {
},
Expand All @@ -101,7 +109,7 @@ export default Vue.extend({
* @param key - addon key
*/
isHTML(key: string): boolean {
return key === 'component' && this.title === 'Vue';
return key.toLowerCase() === 'component' && ['Vue', 'Nuxt'].includes(this.title);
},
},
});
Expand Down
9 changes: 5 additions & 4 deletions src/components/event/details/DetailsBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ export default {
font-size: 12px;
letter-spacing: 0.15px;
text-transform: uppercase;
display: flex;
align-items: center;
gap: 4px;
.icon {
width: 16px;
height: 13px;
margin-top: -2px;
margin-left: 5px;
width: 20px;
height: 20px;
vertical-align: middle;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export interface HawkEventBacktraceFrame {
/**
* Part of source code file near the called line
*/
sourceCode: BacktraceSourceCode[];
sourceCode: BacktraceSourceCode[] | null;

/**
* Function name extracted from current stack frame
Expand Down
15 changes: 13 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,19 @@ export function repetitionAssembler(originalEvent: HawkEventPayload, repetition:
return originalParam;
}

if (typeof repetitionParam === 'object' && typeof originalEvent === 'object') {
return repetitionAssembler(originalParam, repetitionParam);

if (typeof repetitionParam === 'object' && typeof originalParam === 'object') {
/**
* If original event has null but repetition has some value, we need to return repetition value
*/
if (originalParam === null) {
return repetitionParam;
/**
* Otherwise, we need to recursively merge original and repetition values
*/
} else {
return repetitionAssembler(originalParam, repetitionParam);
}
}

return repetitionParam;
Expand Down

0 comments on commit d96be46

Please sign in to comment.