diff --git a/.gitignore b/.gitignore index 8c8dc0c..efd5504 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ structurizr-*.json .env.local .env.*.local +/site/public/assets/locales-dev.json diff --git a/site/nginx.conf.template b/site/nginx.conf.template index b991a0d..647d407 100644 --- a/site/nginx.conf.template +++ b/site/nginx.conf.template @@ -146,6 +146,13 @@ server { proxy_set_header X-Robots-Tag "noindex, nofollow"; } + location /changelogs/road-registry { + proxy_redirect off; + proxy_ssl_server_name on; + proxy_pass https://raw.githubusercontent.com/Informatievlaanderen/road-registry/main/CHANGELOG.md; + proxy_set_header X-Robots-Tag "noindex, nofollow"; + } + location /wiki { proxy_redirect off; proxy_ssl_server_name on; diff --git a/site/package.json b/site/package.json index a53580a..77e8cbc 100644 --- a/site/package.json +++ b/site/package.json @@ -9,7 +9,8 @@ }, "private": true, "scripts": { - "serve": "NODE_ENV=development vue-cli-service serve --mode development", + "serve": "vue-cli-service serve --mode development", + "serve-dev": "NODE_ENV=development vue-cli-service serve --mode development", "serve-tst": "NODE_ENV=test vue-cli-service serve --mode test", "serve-stg": "NODE_ENV=staging vue-cli-service serve --mode staging", "serve-prd": "NODE_ENV=production vue-cli-service serve --mode production", diff --git a/site/src/modules/release-notes/index.ts b/site/src/modules/release-notes/index.ts index 45afb67..d434227 100644 --- a/site/src/modules/release-notes/index.ts +++ b/site/src/modules/release-notes/index.ts @@ -1,6 +1,7 @@ import Root from "./views/Root.vue"; import ReleaseNotes from "./views/ReleaseNotes.vue"; import ReleaseNotesTechnicalGrar from "./views/ReleaseNotesTechnicalGrar.vue"; +import ReleaseNotesTechnicalWr from "./views/ReleaseNotesTechnicalWr.vue"; import ReleaseNotesBusinessGrar from "./views/ReleaseNotesBusinessGrar.vue"; import ReleaseNotesBusinessWr from "./views/ReleaseNotesBusinessWr.vue"; @@ -20,6 +21,11 @@ export const ReleaseNotesRoutes = [ component: ReleaseNotesTechnicalGrar, name: "release-notes-technisch-grar" }, + { + path: "technischwr", + component: ReleaseNotesTechnicalWr, + name: "release-notes-technisch-wr" + }, { path: "functioneelgrar", component: ReleaseNotesBusinessGrar, diff --git a/site/src/modules/release-notes/views/ReleaseNotes.vue b/site/src/modules/release-notes/views/ReleaseNotes.vue index 8f66e50..44c33e3 100755 --- a/site/src/modules/release-notes/views/ReleaseNotes.vue +++ b/site/src/modules/release-notes/views/ReleaseNotes.vue @@ -48,20 +48,17 @@ \ No newline at end of file diff --git a/site/src/services/api-client.ts b/site/src/services/api-client.ts index 5286fb8..e54aba0 100644 --- a/site/src/services/api-client.ts +++ b/site/src/services/api-client.ts @@ -1,6 +1,5 @@ import Vue from "vue"; -import axios, { AxiosInstance, AxiosRequestConfig, Method } from "axios"; -import {API_KEY} from "../environment"; +import axios, { AxiosInstance, Method } from "axios"; export interface IApiClient { get( diff --git a/site/src/services/i18n.ts b/site/src/services/i18n.ts index bd028ad..316dfe4 100644 --- a/site/src/services/i18n.ts +++ b/site/src/services/i18n.ts @@ -2,85 +2,94 @@ import Vue from "vue"; import VueI18n from "vue-i18n"; import TranslationClient, { Faq, ErrorDetail, ImplementationModelType } from "./translations-client"; import { DirectiveBinding } from "vue/types/options"; -import Util from "./util"; +import Util from "./util"; Vue.use(VueI18n); const translations = Vue.observable({ - nl: {} as any, - faqTableOfContents: {} as Faq.TableOfContents, - faqAccordionItems: {} as Faq.Accordion, - errorDetailTableOfContents: {} as ErrorDetail.TableOfContents + nl: {} as any, + faqTableOfContents: {} as Faq.TableOfContents, + faqAccordionItems: {} as Faq.Accordion, + errorDetailTableOfContents: {} as ErrorDetail.TableOfContents, }); const i18n = { - translate: (key: string, args?: any): any => { - //type check - const value = Util.GetPropByName(translations.nl, key); - if (typeof value === "boolean") { - return value; - } - if(!value) return key; - if (args){ - const onMissingParam = (paramName: string) => console.warn(`No parameter '${paramName}' passed for key '${key}'`); - return Util.interpolateString(value, args, onMissingParam); - } - return value; - }, - directive: (el: HTMLElement, binding: DirectiveBinding) => { - let key = binding.value || el.innerText; - let translation: string; - if (typeof binding.value === "string") { - translation = i18n.translate(key); - } else { - key = binding.value.key; - delete binding.value.key; - translation = i18n.translate(key, binding.value); - } - el.innerHTML = translation; - }, - async init() { - await i18n.refresh(); - }, - async refresh() { - const result = await TranslationClient.getTranslations("nl"); - translations.nl = { ...result } as any; - const path = window.location.pathname; - if (path.startsWith("/foutmeldingen/")) { - const data = await TranslationClient.getErrorDetailTableOfContents("nl"); - translations.errorDetailTableOfContents = { ...data }; - } - if (path.startsWith("/veelgestelde-vragen")){ - const data = await TranslationClient.getAccordion("nl", "faq"); - translations.faqAccordionItems = { ...data }; - } + translate: (key: string, args?: any): any => { + //type check + const value = Util.GetPropByName(translations.nl, key); + if (typeof value === "boolean") { + return value; } -} + if (!value) return key; + if (args) { + const onMissingParam = (paramName: string) => console.warn(`No parameter '${paramName}' passed for key '${key}'`); + return Util.interpolateString(value, args, onMissingParam); + } + return value; + }, + directive: (el: HTMLElement, binding: DirectiveBinding) => { + let key = binding.value || el.innerText; + let translation: string; + if (typeof binding.value === "string") { + translation = i18n.translate(key); + } else { + key = binding.value.key; + delete binding.value.key; + translation = i18n.translate(key, binding.value); + } + el.innerHTML = translation; + }, + async init() { + await i18n.refresh(); + }, + async refresh() { + const result = await TranslationClient.getTranslations("nl"); + translations.nl = { ...result } as any; + + if (process.env.NODE_ENV === "development") { + try { + const devTranslations = await TranslationClient.getDevTranslations(); + translations.nl = { ...translations.nl, ...devTranslations } as any; + } catch (err) { + console.error('Failed to load dev locales json', err); + } + } + + const path = window.location.pathname; + if (path.startsWith("/foutmeldingen/")) { + const data = await TranslationClient.getErrorDetailTableOfContents("nl"); + translations.errorDetailTableOfContents = { ...data }; + } + if (path.startsWith("/veelgestelde-vragen")) { + const data = await TranslationClient.getAccordion("nl", "faq"); + translations.faqAccordionItems = { ...data }; + } + }, +}; const { init, refresh, directive, translate } = i18n; -Vue.directive("l", { - bind: (el, binding) => directive(el, binding), - update: (el, binding) => directive(el, binding) +Vue.directive("l", { + bind: (el, binding) => directive(el, binding), + update: (el, binding) => directive(el, binding), }); Vue.prototype.$l = translate; Vue.prototype.localeName = undefined as string | undefined; Vue.prototype.hasMarkdown = false; declare module "vue/types/vue" { - interface Vue { - $l: (key: string, args?: any) => any; - - } + interface Vue { + $l: (key: string, args?: any) => any; + } } -declare module 'vue/types/options' { - interface ComponentOptions { - localeName?: string; - hasMarkdown?: boolean; - implementationModelRegistry?: ImplementationModelType; - } +declare module "vue/types/options" { + interface ComponentOptions { + localeName?: string; + hasMarkdown?: boolean; + implementationModelRegistry?: ImplementationModelType; } +} export default { - init, - refresh, - translations -} \ No newline at end of file + init, + refresh, + translations, +}; diff --git a/site/src/services/translations-client.ts b/site/src/services/translations-client.ts index 06710c8..41d77b8 100644 --- a/site/src/services/translations-client.ts +++ b/site/src/services/translations-client.ts @@ -7,6 +7,10 @@ export const TranslationClient = { const path = `/assets/locales/${lang}.json`; return (await apiClient.get(path, undefined, { 'Cache-Control': 'no-store' })).data; }, + getDevTranslations: async (): Promise => { + const path = `/assets/locales-dev.json`; + return (await apiClient.get(path, undefined, { 'Cache-Control': 'no-store' })).data; + }, getPageMarkdownContent: async (lang: string, page: string): Promise => { const path = `/assets/locales/${lang}/${page}/content.md`; return (await apiClient.get(path, undefined, { 'Cache-Control': 'no-store' })).data; @@ -19,6 +23,10 @@ export const TranslationClient = { const path = `/wiki/Informatievlaanderen/registry-documentation/Release-Notes.md`; return (await apiClient.get(path, undefined, { 'Cache-Control': 'no-store' })).data; }, + getRoadRegistryChangeLog: async (): Promise => { + const path = `/changelogs/road-registry`; + return (await apiClient.get(path, undefined, { 'Cache-Control': 'no-store' })).data; + }, getFaqTableOfContents: async (lang: string): Promise => { const path = `/assets/locales/${lang}/faq/table-of-contents.json`; return (await apiClient.get(path, undefined, { 'Cache-Control': 'no-store' })).data;