Skip to content

Commit

Permalink
Merge branch 'bcgov:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
nimya-aot authored Sep 24, 2024
2 parents 70201f1 + 70c6915 commit 8eb43aa
Show file tree
Hide file tree
Showing 105 changed files with 17,297 additions and 9,390 deletions.
11 changes: 6 additions & 5 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
version: "2"
exclude_patterns:
- components/
- config/
- "**/db/"
- dist/
- features/
- "**/node_modules/"
- script/
- Tests/
- "**/*.d.ts"
- "**/*_test.go"
- "**/db/"
- "**/node_modules/"
- "**/spec/"
- "**/test/"
- "**/tests/"
- Tests/
- "**/vendor/"
- "**/*_test.go"
- "**/*.d.ts"
plugins:
csslint:
enabled: true
Expand Down
36 changes: 27 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<!-- Provide a general summary of your changes in the Title above -->
<!--
The above Title for the Pull Request should use the format:
type: FORMS-ABCD your change description
For example:
feat: FORMS-1234 add Assigned To column to submission table
-->

# Description

<!-- Describe your changes in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->
<!--
Describe your changes in detail.
- Why is this change required?
- What problem does it solve?
-->

## Types of changes
## Type of Change

<!-- Uncomment the main reason for the change (for example, all feat PRs should include docs and test, but only uncomment feat): -->
<!--
Uncomment the main reason for the change. For example: all "feat" PRs should
include documentation ("docs") and tests ("test"), but only uncomment "feat".
-->

<!-- feat (a new feature) -->
<!-- fix (a bug fix) -->
Expand All @@ -18,6 +29,7 @@
<!-- docs (change to documentation) -->
<!-- perf (change to improve performance) -->
<!-- refactor (change to improve code quality) -->
<!-- revert (reverts changes in a previous commit) -->
<!-- style (change to code style/formatting) -->
<!-- test (add missing tests or correct existing tests) -->

Expand All @@ -27,8 +39,10 @@ This is a breaking change because ...

## Checklist

<!-- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
<!--
Go over all the following points, and put an `x` in all the boxes that apply. If
you're unsure about any of these, don't hesitate to ask. We're here to help!
-->

- [ ] I have read the [CONTRIBUTING](/bcgov/common-hosted-form-service/blob/main/CONTRIBUTING.md) doc
- [ ] I have checked that unit tests pass locally with my changes
Expand All @@ -39,4 +53,8 @@ This is a breaking change because ...

## Further comments

<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
<!--
If this is a relatively large or complex change, kick off the discussion by
explaining why you chose the solution you did and what alternatives you
considered, etc...
-->
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ jobs:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{ github.workspace }}/**/lcov.info:lcov
${{ github.workspace }}/**/clover.xml:clover
prefix: ${{ github.workplace }}
8 changes: 4 additions & 4 deletions app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

224 changes: 66 additions & 158 deletions app/frontend/src/components/admin/FormComponentsProactiveHelp.vue
Original file line number Diff line number Diff line change
@@ -1,172 +1,80 @@
<script>
import { mapActions, mapState } from 'pinia';
<script setup>
import { storeToRefs } from 'pinia';
import { computed, onMounted, ref, watch } from 'vue';
import GeneralLayout from '~/components/infolinks/GeneralLayout.vue';
import { useAdminStore } from '~/store/admin';
import { FormComponentProactiveHelpValues } from '~/utils/constants';
export default {
components: {
GeneralLayout,
},
data() {
return {
layout: {
'Basic Layout': [
'Text/Images',
'Columns - 2',
'Columns - 3',
'Columns - 4',
'Tabs',
'Panel',
],
'Basic Fields': [
'Text Field',
'Multi-line Text',
'Select List',
'Checkbox',
'Checkbox Group',
'Radio Group',
'Number',
'Phone Number',
'Email',
'Date / Time',
'Day',
],
'Advanced Layout': [
'HTML Element',
'Content',
'Columns',
'Field Set',
'Panel',
'Table',
'Tabs',
'Well',
],
'Advanced Fields': [
'Text Field',
'Email',
'Text Area',
'Url',
'Number',
'Phone Number',
'Tags',
'Address',
'Password',
'Date / Time',
'Checkbox',
'Day',
'Time',
'Select Boxes',
'Select',
'Currency',
'Radio',
'Survey',
'Signature',
],
'Advanced Data': [
'Hidden',
'Container',
'Data Map',
'Data Grid',
'Edit Grid',
'Tree',
],
'BC Government': ['File Upload', 'Business Name Search', 'BC Address'],
},
isPanelOpened: new Map(),
groupComponentsList: [],
};
},
computed: {
...mapState(useAdminStore, ['fcProactiveHelp', 'fcProactiveHelpGroupList']),
groupList() {
return this.extractGroups();
},
},
watch: {
fcProactiveHelp() {
this.listFCProactiveHelp();
},
},
mounted() {
this.listFCProactiveHelp();
},
methods: {
...mapActions(useAdminStore, ['listFCProactiveHelp']),
onExpansionPanelClick(groupName) {
if (
this.isPanelOpened.get(groupName) === undefined ||
!this.isPanelOpened.get(groupName)
) {
this.isPanelOpened.set(groupName, true);
this.groupComponentsList = this.extractGroupComponents(groupName);
} else {
this.isPanelOpened.set(groupName, false);
}
const loading = ref(false);
for (let key of this.isPanelOpened.keys()) {
if (key !== groupName) {
this.isPanelOpened.set(key, false);
}
}
},
//extract form builder layout groups.
extractGroups() {
let allgroups = [];
for (let [title] of Object.entries(this.layout)) {
if (title) {
allgroups.push(title);
}
}
return allgroups;
},
//extract all components in the select group in form builder
extractGroupComponents(groupName) {
let groupComponents = [];
for (let [title, components] of Object.entries(this.layout)) {
if (title && title === groupName && components) {
for (let componentName of components) {
groupComponents.push({ componentName: componentName });
}
}
const adminStore = useAdminStore();
const { fcProactiveHelp, fcProactiveHelpGroupList } = storeToRefs(adminStore);
const formComponentGroupNames = computed(() =>
Object.keys(FormComponentProactiveHelpValues).filter((name) => name !== '')
);
watch(fcProactiveHelp, async () => {
await refreshData();
});
onMounted(async () => {
await refreshData();
});
async function refreshData() {
loading.value = true;
await adminStore.listFCProactiveHelp();
loading.value = false;
}
//extract all components in the select group in form builder
function extractGroupComponents(groupName) {
let groupComponents = [];
for (let [title, components] of Object.entries(
FormComponentProactiveHelpValues
)) {
if (title && title === groupName && components) {
for (let componentName of components) {
groupComponents.push({ componentName: componentName });
}
return groupComponents;
},
},
};
}
}
return groupComponents;
}
</script>

<template>
<div class="mt-5">
<v-expansion-panels
class="nrmc-expand-collapse"
data-cy="info_link_expansion_panels"
>
<v-expansion-panel
v-for="(groupName, index) in groupList"
:key="index"
@click="onExpansionPanelClick(groupName)"
<v-skeleton-loader :loading="loading">
<v-expansion-panels
class="nrmc-expand-collapse"
data-cy="info_link_expansion_panels"
>
<v-expansion-panel-title>
<div class="header">
<strong>{{ groupName }}</strong>
</div>
</v-expansion-panel-title>
<v-expansion-panel-text>
<GeneralLayout
:group-name="groupName"
:layout-list="groupComponentsList"
:components-list="
fcProactiveHelpGroupList && fcProactiveHelpGroupList[groupName]
? fcProactiveHelpGroupList[groupName]
: []
"
/>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
<v-expansion-panel
v-for="(groupName, index) in formComponentGroupNames"
:key="index"
>
<v-expansion-panel-title>
<div class="header">
<strong>{{ groupName }}</strong>
</div>
</v-expansion-panel-title>
<v-expansion-panel-text>
<GeneralLayout
:group-name="groupName"
:form-component-names="extractGroupComponents(groupName)"
:form-component-data="
fcProactiveHelpGroupList && fcProactiveHelpGroupList[groupName]
? fcProactiveHelpGroupList[groupName]
: []
"
/>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</v-skeleton-loader>
</div>
</template>

Expand Down
Loading

0 comments on commit 8eb43aa

Please sign in to comment.