Skip to content

Commit

Permalink
register genericGlobals as global variable, switch ServiceUnavailable…
Browse files Browse the repository at this point in the history
… component to use Composition API, and update CVE Services base URL
  • Loading branch information
athu-tran committed Oct 1, 2024
1 parent 8ca5269 commit b18c1fa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
11 changes: 6 additions & 5 deletions src/components/ServiceUnavailable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@
</template>

<script>
import { useGenericGlobalsStore } from '@/stores/genericGlobals.ts';
import { getCurrentInstance } from 'vue';
export default {
name: 'ServiceUnavailable',
data() {
setup() {
const legacyCveWebsiteLink = getCurrentInstance().appContext.config.globalProperties.GenericGlobalsStore.legacyCveWebsiteLink;
return {
legacyCveWebsiteLink: useGenericGlobalsStore().legacyCveWebsiteLink
legacyCveWebsiteLink
}
}
};
}
</script>

<style lang="scss">
Expand Down
5 changes: 1 addition & 4 deletions src/components/cveRecordSearchModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ watch(
() => {
if (route.query?.query){
queryString.value = route.query.query.trim();
validateQueryString();
if (!cveListSearchStore.isSeachButtonDisabled) {
startSearch();
}
validate();
} else {
queryString.value = cveListSearchStore.query = '';
errorMessage.value = '';
Expand Down
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import App from './App.vue';
import router from './router/index.js';
import ExternalLinkMessage from './components/ExternalLinkMessage.vue';
import { usePartnerStore } from '@/stores/partners';
import { useGenericGlobalsStore } from '@/stores/genericGlobals.ts';


// Import and add icons to library
Expand Down Expand Up @@ -43,11 +44,11 @@ app.use(VueGtag, {
config: { id: import.meta.env.VITE_GOOGLE_ANALYTICS_PROPERTY_ID },
appName: 'CVE Website',
}, router);

app.use(LoadScript);

app.use(router);

app.config.globalProperties.GenericGlobalsStore = useGenericGlobalsStore();

app.component('font-awesome-icon', FontAwesomeIcon);
app.component('ExternalLinkMessage', ExternalLinkMessage);
app.mount('#app');
9 changes: 5 additions & 4 deletions src/views/CVERecord/CVERecord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import RejectedRecordOrId from './RejectedRecordOrId.vue';
import ReservedId from './ReservedId.vue';
import { usecveRecordStore } from '@/stores/cveRecord.ts';
import ServiceUnavailable from '@/components/ServiceUnavailable.vue';
import { useGenericGlobalsStore } from '@/stores/genericGlobals.ts';
import axios from 'axios';
export default {
Expand All @@ -84,7 +83,7 @@ export default {
errorMessage: [],
disabled: true,
getIdStatusCode: undefined,
legacyCveWebsiteLink: useGenericGlobalsStore().legacyCveWebsiteLink
legacyCveWebsiteLink: this.GenericGlobalsStore.legacyCveWebsiteLink
};
},
computed: {
Expand Down Expand Up @@ -208,7 +207,8 @@ export default {
const getIdUrl = `/api/cve-id/${usecveRecordStore().cveId}`;
try {
axios.defaults.baseURL = `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}`;
// axios.defaults.baseURL = `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}`;
axios.defaults.baseURL = "https://cveawg.mitre.org";
const idData = await axios.get(getIdUrl);
this.getIdStatusCode = 200;
if (idData.status === 200 && idData?.data?.error === undefined) {
Expand Down Expand Up @@ -244,7 +244,8 @@ export default {
}
},
async getRecordData() {
const getRecordUrl = `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}/api/cve/${usecveRecordStore().cveId}`;
// const getRecordUrl = `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}/api/cve/${usecveRecordStore().cveId}`;
const getRecordUrl = `https://cveawg.mitre.org/api/cve/${usecveRecordStore().cveId}`;
const recordData = await axios.get(getRecordUrl);
if (!(typeof (recordData.data) === 'object')) {
Expand Down
3 changes: 1 addition & 2 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

<script>
import HomeModule from '@/components/HomeModule.vue';
import { useGenericGlobalsStore } from '@/stores/genericGlobals.ts';
import axios from 'axios';
export default {
Expand All @@ -70,7 +69,7 @@ export default {
cveRecordsTotal: 0,
cveRecordsLoading: true,
cveRecordsRequestErrored: false,
legacyCveWebsiteLink: useGenericGlobalsStore().legacyCveWebsiteLink
legacyCveWebsiteLink: this.GenericGlobalsStore.legacyCveWebsiteLink
}
},
created() {
Expand Down
5 changes: 3 additions & 2 deletions src/views/ReportRequest/ReportRequestForNonCNAs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@
<script>
import NavigationSidebar from '@/components/NavigationSidebar.vue';
import SurveyLinkComponent from '@/components/SurveyLinkComponent.vue';
import { useGenericGlobalsStore } from '@/stores/genericGlobals.ts';
import data from '@/assets/data/CNAsList.json';
import ServiceUnavailable from '@/components/ServiceUnavailable.vue';
export default {
name: 'ReportRequestForNonCNAs',
Expand All @@ -176,6 +176,7 @@ export default {
components: {
NavigationSidebar,
SurveyLinkComponent,
ServiceUnavailable
},
data() {
return {
Expand All @@ -186,7 +187,7 @@ export default {
clearable: false,
showTip: true,
pagePath: this.cvenavs['Right Menu']['Report/Request'].submenu['Non-CNAs'],
legacyCveWebsiteLink: useGenericGlobalsStore().legacyCveWebsiteLink
legacyCveWebsiteLink: this.GenericGlobalsStore.legacyCveWebsiteLink
};
},
computed: {
Expand Down

0 comments on commit b18c1fa

Please sign in to comment.