generated from bcgov/bcrs-template-ui
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixed some getLegalType types - added generic Technical Error Dialog (per Yui) - added amalgamation enums - refactored Legal Service function for better result and error handling - added dialog to Amalgamation Selection component - refactored Amalgamation Selection for error handling and to pre-populate TING business - added test suite for new dialog
- Loading branch information
Severin Beauvais
committed
Jan 16, 2024
1 parent
66f651e
commit 0ca3dac
Showing
12 changed files
with
196 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<v-dialog | ||
v-model="dialog" | ||
width="45rem" | ||
persistent | ||
:attach="attach" | ||
content-class="technical-error-dialog" | ||
> | ||
<v-card> | ||
<v-card-title>Error</v-card-title> | ||
|
||
<v-card-text> | ||
<p class="font-15"> | ||
We could not process your action due to a technical issue. Try again in a few minutes. | ||
</p> | ||
|
||
<template v-if="!isRoleStaff"> | ||
<p class="font-15"> | ||
If this error persists, please contact BC Registries staff: | ||
</p> | ||
<ContactInfo class="mt-5" /> | ||
</template> | ||
</v-card-text> | ||
|
||
<v-divider class="my-0" /> | ||
|
||
<v-card-actions> | ||
<v-spacer /> | ||
<v-btn | ||
id="dialog-close-button" | ||
color="primary" | ||
text | ||
@click="close()" | ||
> | ||
Close | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Prop, Emit, Vue } from 'vue-property-decorator' | ||
import { Getter } from 'pinia-class' | ||
import { ContactInfo } from '@/components/common' | ||
import { useRootStore } from '@/stores' | ||
@Component({ | ||
components: { ContactInfo } | ||
}) | ||
export default class TechnicalErrorDialog extends Vue { | ||
// Getter to check if logged in user is Staff. | ||
@Getter(useRootStore) isRoleStaff!: boolean | ||
/** Prop to display the dialog. */ | ||
@Prop({ default: false }) readonly dialog!: boolean | ||
/** Prop to provide attachment selector. */ | ||
@Prop({ default: '' }) readonly attach!: string | ||
// Pass click event to parent. | ||
@Emit() close () {} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export enum AmlRoles { | ||
AMALGAMATING = 'amalgamating', | ||
HOLDING = 'holding' | ||
} | ||
|
||
export enum AmlTypes { | ||
LEAR = 'lear', | ||
FOREIGN = 'foreign' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Vue from 'vue' | ||
import Vuetify from 'vuetify' | ||
import { mount } from '@vue/test-utils' | ||
import { createPinia, setActivePinia } from 'pinia' | ||
import { useRootStore } from '@/stores' | ||
import TechnicalErrorDialog from '@/components/dialogs/TechnicalErrorDialog.vue' | ||
import { ContactInfo } from '@/components/common' | ||
|
||
Vue.use(Vuetify) | ||
|
||
const vuetify = new Vuetify({}) | ||
setActivePinia(createPinia()) | ||
const rootStore = useRootStore() | ||
|
||
describe('TechnicalErrorDialog', () => { | ||
it('displays everything for normal users', () => { | ||
// init store | ||
rootStore.keycloakRoles = [''] | ||
|
||
const wrapper = mount(TechnicalErrorDialog, { propsData: { dialog: true }, vuetify }) | ||
|
||
expect(wrapper.find('.v-card__title').text()).toBe('Error') | ||
expect(wrapper.find('.v-card__text').text()) | ||
.toContain('We could not process your action due to a technical issue.') | ||
expect(wrapper.find('.v-card__text').text()) | ||
.toContain('If this error persists, please contact BC Registries staff:') | ||
expect(wrapper.findComponent(ContactInfo).exists()).toBe(true) | ||
expect(wrapper.find('.v-card__actions').text()).toBe('Close') | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
it('does not display contact info for staff users', () => { | ||
// init store | ||
rootStore.keycloakRoles = ['staff'] | ||
|
||
const wrapper = mount(TechnicalErrorDialog, { propsData: { dialog: true }, vuetify }) | ||
|
||
expect(wrapper.findComponent(ContactInfo).exists()).toBe(false) | ||
|
||
wrapper.destroy() | ||
}) | ||
}) |