Skip to content

Commit

Permalink
Virus scanner status on releases page (#2536)
Browse files Browse the repository at this point in the history
* virus scanner status on releases page

* working

* working

* text size

* Move file upload status calls into the store.

* Fixed typo after merge

---------

Co-authored-by: drieJac <jac.drie@digitalteam.uk>
  • Loading branch information
tomlovesgithub and drieJAC authored Sep 24, 2024
1 parent afa9305 commit 2317f28
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import bugReports from '@/store/bugReports/collection';
import bugReport from '@/store/bugReports/document';

import releases from '@/store/releases';
import candidateSettings from '@/store/candidateSettings';

//const store = new Vuex.Store({
const store = createStore({
Expand Down Expand Up @@ -94,6 +95,7 @@ const store = createStore({
vacancy,
bugReport,
bugReports,
candidateSettings,
},
state: {
packageVersion: import.meta.env.PACKAGE_VERSION || '0',
Expand Down
30 changes: 30 additions & 0 deletions src/store/candidateSettings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { doc } from '@firebase/firestore';
import { firestore } from '@/firebase';
import { firestoreAction } from '@/helpers/vuexfireJAC';
import vuexfireSerialize from '@jac-uk/jac-kit/helpers/vuexfireSerialize';

export default {
namespaced: true,
actions: {
bind: firestoreAction(({ bindFirestoreRef }) => {
const firestoreRef = doc(firestore, 'settings/candidateSettings');
return bindFirestoreRef('record', firestoreRef, { serialize: vuexfireSerialize });
}),
unbind: firestoreAction(({ unbindFirestoreRef }) => {
return unbindFirestoreRef('record');
}),
},
mutations: {
set(state, { name, value }) {
state[name] = value;
},
},
state: {
record: null,
},
getters: {
getUploadStatus: (state) => {
return state.record && state.record.fileUpload.enabled;
},
},
};
13 changes: 12 additions & 1 deletion src/views/ReleasesList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<template>
<div>
<!-- New section for file upload status -->
<div>
<h2 class="govuk-heading-m govuk-!-margin-bottom-2">
Virus Scanner functionality: {{ fileUploadStatus }}
</h2>
</div>

<h2 class="govuk-heading-m govuk-!-margin-bottom-2">
Latest Releases
</h2>
Expand Down Expand Up @@ -62,19 +69,23 @@ export default {
},
computed: {
...mapGetters({
fileUploadEnabled: 'candidateSettings/getUploadStatus',
lastFetchedDT: 'releases/getLastFetchedDT',
}),
...mapState('releases', [
'availability',
]),
tableData() {
return this.$store.state.releases.records;
},
fileUploadStatus() {
return this.fileUploadEnabled ? 'Online' : 'Offline';
},
},
created() {
// Can make the calls synchronously below
this.$store.dispatch('releases/getLatestReleases');
this.$store.dispatch('candidateSettings/bind');
},
methods: {
formatDate(dateStr) {
Expand Down

0 comments on commit 2317f28

Please sign in to comment.