Skip to content

Commit

Permalink
Merge branch 'main' into feat/FORMS-1563-extapi-preapprove
Browse files Browse the repository at this point in the history
  • Loading branch information
usingtechnology authored Dec 18, 2024
2 parents c2cfaa8 + 6fb6b64 commit d9fda93
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 6 deletions.
17 changes: 11 additions & 6 deletions app/frontend/src/components/designer/FormViewerActions.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { storeToRefs } from 'pinia';
import { computed, onMounted, inject, ref } from 'vue';
import { computed, inject, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import ManageSubmissionUsers from '~/components/forms/submission/ManageSubmissionUsers.vue';
Expand Down Expand Up @@ -61,7 +61,7 @@ const properties = defineProps({
},
});
const isWideLayout = ref(false);
const isWideLayout = ref(properties.wideFormLayout);
const formStore = useFormStore();
Expand All @@ -74,14 +74,19 @@ const showEditToggle = computed(
properties.permissions.includes(FormPermissions.SUBMISSION_UPDATE)
);
onMounted(() => {
setWideLayout(isWideLayout.value);
});
function toggleWideLayout() {
isWideLayout.value = !isWideLayout.value;
setWideLayout(isWideLayout.value);
}
// Sync the local copy with the prop when it changes
watch(
() => properties.wideFormLayout,
(newValue) => {
isWideLayout.value = newValue;
setWideLayout(newValue);
},
{ immediate: true }
);
</script>

<template>
Expand Down
1 change: 1 addition & 0 deletions app/frontend/src/components/forms/FormSubmission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ onMounted(async () => {
await formStore.getFormPermissionsForUser(form.value.id);
loading.value = false;
// set wide layout
isWideLayout.value = form.value.wideFormLayout;
setWideLayout(isWideLayout.value);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@ describe('FormDisclaimer.vue', () => {
expect(wrapper.vm.showEditToggle).toBeTruthy();
});

it('when props.wideFormLayout is set from parent call setWideLayout', async () => {
const setWideLayout = vi.fn();
setWideLayout.mockImplementation(() => {});
const wrapper = mount(FormViewerActions, {
props: {
wideFormLayout: true,
},
global: {
plugins: [pinia],
provide: {
setWideLayout: setWideLayout,
},
stubs: STUBS,
},
});

expect(wrapper.vm.isWideLayout).toBeTruthy();
expect(setWideLayout).toBeCalledTimes(1);
});

it('toggleWideLayout will toggle isWideLayout and call setWideLayout', async () => {
const setWideLayout = vi.fn();
setWideLayout.mockImplementation(() => {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('FormSubmission.vue', () => {
formStore.form = {
id: 0,
name: 'This is a form title',
wideFormLayout: true,
};
const fetchSubmissionSpy = vi.spyOn(formStore, 'fetchSubmission');
fetchSubmissionSpy.mockImplementation(() => {});
Expand Down Expand Up @@ -88,6 +89,8 @@ describe('FormSubmission.vue', () => {
expect(wrapper.text()).toContain('trans.formSubmission.submitted');
expect(wrapper.text()).toContain('trans.formSubmission.submission');
expect(wrapper.html()).toContain(formStore.form.name);
expect(setWideLayout).toHaveBeenCalledTimes(1);
expect(wrapper.vm.isWideLayout).toBeTruthy();
});

it('onDelete should push to the FormSubmissions page', async () => {
Expand Down
9 changes: 9 additions & 0 deletions openshift/redash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

CHEFS uses [Redash](https://redash.io) to visualize forms metadata and display it in dashboards.

## Database

Redash uses CrunchyDB for its highly available database.

```sh
helm -n a12c97-tools upgrade --install crunchy-tools-redash ../crunchydb/charts/tools -f crunchydb-tools-values.yaml
helm -n a12c97-tools upgrade --install crunchy-postgres-redash ../crunchydb/charts/crunchy-postgres -f crunchydb-postgres-values-no-limits.yaml -f crunchydb-postgres-values.yaml
```

## Install Pre-requisites

The Redash Helm Chart doesn't work well in OpenShift due to the accounts it is trying to use for PostgreSQL and Redis. Install our own versions of them:
Expand Down
24 changes: 24 additions & 0 deletions openshift/redash/crunchydb-postgres-values-no-limits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
instances:
limits:
cpu:
memory:
replicaCertCopy:
limits:
cpu:
memory:

pgBackRest:
repoHost:
limits:
cpu:
memory:
sidecars:
limits:
cpu:
memory:

proxy:
pgBouncer:
limits:
cpu:
memory:
18 changes: 18 additions & 0 deletions openshift/redash/crunchydb-postgres-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
fullnameOverride: crunchy-postgres-redash

postgresVersion: 16

instances:
replicas: 3
dataVolumeClaimSpec:
storage: 512Mi

pgBackRest:
repos:
schedules:
full: 0 12 * * *
incremental: 0 0,4,8,16,20 * * *

proxy:
pgBouncer:
replicas: 3
2 changes: 2 additions & 0 deletions openshift/redash/crunchydb-tools-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fullnameOverride: crunchy-postgres-tools-redash
deploymentName: crunchy-postgres-redash

0 comments on commit d9fda93

Please sign in to comment.