Skip to content

Commit

Permalink
Add button/link to the retransmission from view documentation, shown …
Browse files Browse the repository at this point in the history
…in the retransmission popup
  • Loading branch information
faderskd committed Oct 18, 2024
1 parent 7aa1890 commit ec1d3e4
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 5 deletions.
3 changes: 2 additions & 1 deletion hermes-console/json-server/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,8 @@
}
],
"offlineRetransmissionEnabled": true,
"offlineRetransmissionDescription": "Offline retransmission"
"offlineRetransmissionDescription": "Offline retransmission",
"offlineRetransmissionFromViewDocsUrl": "https://hermes-pubsub.rtfd.org"
},
"subscription": {
"endpointAddressResolverMetadata": {
Expand Down
1 change: 1 addition & 0 deletions hermes-console/src/api/app-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface TopicViewConfiguration {
retentionUnits: RetentionUnit[];
offlineRetransmissionEnabled: boolean;
offlineRetransmissionDescription: string;
offlineRetransmissionFromViewDocsUrl: string;
}

export interface DefaultTopicViewConfiguration {
Expand Down
1 change: 1 addition & 0 deletions hermes-console/src/dummy/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const dummyAppConfig: AppConfiguration = {
offlineRetransmissionEnabled: true,
offlineRetransmissionDescription:
'Offline retransmission allows retransmitting events from GCP (BigQuery) to Hermes.',
offlineRetransmissionFromViewDocsUrl: 'https://hermes-pubsub.rtfd.org',
},
subscription: {
endpointAddressResolverMetadata: {
Expand Down
1 change: 1 addition & 0 deletions hermes-console/src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ const en_US = {
},
offlineRetransmission: {
title: 'Offline retransmission',
titleRetransmissionFromView: 'Docs for retransmission from View',
subtitle:
'Offline retransmission allows retransmitting events from GCP (BigQuery) to Hermes.',
targetTopic: 'Target topic',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { createTestingPinia } from '@pinia/testing';
import { describe } from 'vitest';
import { dummyAppConfig } from '@/dummy/app-config';
import { renderWithEmits } from '@/utils/test-utils';
import { waitFor } from '@testing-library/vue';
import OfflineRetransmissionForm from '@/views/topic/offline-retransmission/OfflineRetransmissionForm.vue';

describe('OfflineRetransmissionForm', () => {
it('should emit a cancel event when user clicks cancel button', async () => {
// given
const wrapper = renderWithEmits(OfflineRetransmissionForm, {});
const wrapper = renderWithEmits(
OfflineRetransmissionForm,
createInitialState(),
);

// when
await wrapper
Expand All @@ -22,7 +27,10 @@ describe('OfflineRetransmissionForm', () => {

it('should emit a retransmit event when user clicks retransmit button', async () => {
// given
const wrapper = renderWithEmits(OfflineRetransmissionForm, {});
const wrapper = renderWithEmits(
OfflineRetransmissionForm,
createInitialState(),
);

// when
await wrapper
Expand Down Expand Up @@ -55,3 +63,21 @@ describe('OfflineRetransmissionForm', () => {
});
});
});

function createInitialState() {
return {
testPinia: createTestingPinia({
initialState: {
appConfig: {
appConfig: {
...dummyAppConfig,
},
loading: false,
error: {
loadConfig: null,
},
},
},
}),
};
}

Check failure on line 83 in hermes-console/src/views/topic/offline-retransmission/OfflineRetransmissionForm.spec.ts

View workflow job for this annotation

GitHub Actions / ci-console

Insert `⏎`
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useAppConfigStore } from '@/store/app-config/useAppConfigStore';
const emit = defineEmits<{
retransmit: [targetTopic: string, from: string, to: string];
cancel: [];
}>();
const configStore = useAppConfigStore();
const targetTopic = ref('');
const startTimestamp = ref(new Date().toISOString().slice(0, -5));
const endTimestamp = ref(new Date().toISOString().slice(0, -5));
Expand All @@ -23,7 +25,21 @@
<template>
<v-form @submit.prevent>
<v-card>
<v-card-title> {{ $t('offlineRetransmission.title') }}</v-card-title>
<v-card-title>
{{ $t('offlineRetransmission.title') }}
<v-btn
density="compact"
variant="outlined"
prepend-icon="mdi-open-in-new"
target="_blank"
:href="
configStore.loadedConfig.topic.offlineRetransmissionFromViewDocsUrl
"
>
<v-icon></v-icon>
{{ $t('offlineRetransmission.titleRetransmissionFromView') }}</v-btn
>
</v-card-title>
<v-card-subtitle>{{
$t('offlineRetransmission.subtitle')
}}</v-card-subtitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,10 @@ public static final class TopicView {
private Set<String> allowedTopicLabels = Collections.emptySet();
private List<RetentionUnit> retentionUnits =
Lists.newArrayList(new RetentionUnit("DAYS", "DAYS"));
private boolean offlineRetransmissionEnabled = false;
private boolean offlineRetransmissionEnabled = true;
private String offlineRetransmissionDescription = "Offline retransmission";
private String offlineRetransmissionFromViewDocsUrl =
"https://appengine.allegrogroup.com/en/latest/communication_messaging/hermes/offline_retransmission/";

public boolean isMessagePreviewEnabled() {
return messagePreviewEnabled;
Expand Down Expand Up @@ -462,6 +464,15 @@ public String getOfflineRetransmissionDescription() {
public void setOfflineRetransmissionDescription(String offlineRetransmissionDescription) {
this.offlineRetransmissionDescription = offlineRetransmissionDescription;
}

public String getOfflineRetransmissionFromViewDocsUrl() {
return offlineRetransmissionFromViewDocsUrl;
}

public void setOfflineRetransmissionFromViewDocsUrl(
String offlineRetransmissionFromViewDocsUrl) {
this.offlineRetransmissionFromViewDocsUrl = offlineRetransmissionFromViewDocsUrl;
}
}

public static final class DefaultTopicView {
Expand Down

0 comments on commit ec1d3e4

Please sign in to comment.