From 52b4fea311a37df3cd81db94ce7ce6330dae2d18 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Mon, 28 Aug 2023 16:24:49 -0300 Subject: [PATCH 1/2] Add github templates --- .github/ISSUE_TEMPLATE/bug.yml | 67 ++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature.yml | 36 ++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/ISSUE_TEMPLATE/feature.yml diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..a9bc3b1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,67 @@ +name: Bug +description: Open a new issue to describe a bug. +title: "[Bug]: " +labels: ["bug"] +body: +- type: markdown + attributes: + value: > + Please describe the details of any bug you have found. Developers need to know specific details of what you found, where, and how this different from what you expect. _Need help filling this out? Once you have your feature details in hand, contact us and we'll help step you through filling out this issue._ +- type: markdown + attributes: + value: | + # Describe the bug + _Please provide a summary about the bug in the following form._ +- type: textarea + id: repro + attributes: + label: Steps to reproduce the bug + description: "How do you trigger this bug? Please walk us through it step by step. Try something like, When I do x, then I do y, and do z, I see this error" + value: | + 1. + 2. + 3. + ... + render: bash + validations: + required: true +- type: textarea + id: bug_screenshot + attributes: + label: Screenshot + description: Drag/drop your image/s here + validations: + required: false +- type: textarea + id: expected_behavior + attributes: + label: Expected behavior + description: Describe briefly what you expect to happen. + placeholder: When I do a, I expect b, c, d + validations: + required: false +- type: textarea + id: extra_screenshots + attributes: + label: Additional Screenshots + description: If applicable, add screenshots to help explain your problem. Drag/drop your image/s here + validations: + required: false +- type: input + id: taxonpages_site + attributes: + label: TaxonPages Site URL + description: Which website has this bug, please put the URL here, use "local for development environments + placeholder: https://orthoptera.speciesfile.org/, local +- type: input + id: taxonpages_panel + attributes: + label: TaxonPages Panel + description: (optional) Provide which TaxonPages Panel has this bug + placeholder: Nomenclature, Map, Literature +- type: input + id: browser_used + attributes: + label: Browser Used + description: Please share the browser and its version you were using. + placeholder: (e.g. chrome, firefox) diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 0000000..552352b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,36 @@ +name: Feature request or enhancement +description: Open a new issue to describe and request a new feature or enhancement. These will be auto-labeled with _enhancement_. Be sure to provide an informative title. +labels: ["enhancement"] +body: +- type: textarea + id: summary + attributes: + label: Feature or enhancement + description: Please describe what you would like to be able to do or see. Consider telling a story, e.g. first I do x, then y, then I see z. + placeholder: E.g. When I am at X, then I need Y, and when I click, then I will see Z. + validations: + required: true +- type: input + id: summary_target + attributes: + label: Location + description: Stepping back, where should this feature be found? Providing a URL path can help (e.g. /taxon_names/123). + placeholder: Nomenclature Panel + validations: + required: true +- type: textarea + id: figures + attributes: + label: Screenshot, napkin sketch of interface, or conceptual description + description: Provide drawings or screenshots mocking-up (illustrating) your feature, or feature progression. + placeholder: Drag/drop your image(s) here + validations: + required: false +- type: input + id: summary_x + attributes: + label: Your role + description: Who are you, i.e. in what role are you making this feature request? + placeholder: Graduate student biologist + validations: + required: false From b3816f7c96f00c26758b3c9bc68e9c4f04a4d050 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Mon, 28 Aug 2023 21:25:51 -0300 Subject: [PATCH 2/2] Add error 500 view, handle redirect for SSR --- server.js | 27 ++++----- src/entry-server.js | 5 +- src/modules/404/router/index.js | 7 --- src/modules/httpErrorPages/router/index.js | 15 +++++ .../index.vue => httpErrorPages/view/404.vue} | 0 src/modules/httpErrorPages/view/500.vue | 11 ++++ .../otus/store/actions/loadCachedMap.js | 9 --- src/modules/otus/store/actions/loadCatalog.js | 20 ------- .../otus/store/actions/loadTaxonomy.js | 18 ------ src/modules/otus/store/store.js | 55 ++++++++++++------- src/modules/otus/views/Index.vue | 13 ++++- 11 files changed, 92 insertions(+), 88 deletions(-) delete mode 100644 src/modules/404/router/index.js create mode 100644 src/modules/httpErrorPages/router/index.js rename src/modules/{404/view/index.vue => httpErrorPages/view/404.vue} (100%) create mode 100644 src/modules/httpErrorPages/view/500.vue delete mode 100644 src/modules/otus/store/actions/loadCachedMap.js delete mode 100644 src/modules/otus/store/actions/loadCatalog.js delete mode 100644 src/modules/otus/store/actions/loadTaxonomy.js diff --git a/server.js b/server.js index 6b8cc10..b467e00 100644 --- a/server.js +++ b/server.js @@ -76,21 +76,22 @@ export async function createServer( render = (await import('./dist/server/entry-server.js')).render } - const [appHtml, appState, preloadLinks, tagMeta] = await render( - url, - manifest, - origin - ) + const [appHtml, appState, preloadLinks, tagMeta, redirectRoute] = + await render(url, manifest, origin) - const html = template - .replace(``, preloadLinks) - .replace(``, appState) - .replace(``, tagMeta.headTags) - .replace(``, tagMeta.bodyTagsOpen) - .replace(``, tagMeta.bodyTags) - .replace(makeAppContainer(), makeAppContainer(appHtml)) + if (redirectRoute) { + res.redirect(redirectRoute) + } else { + const html = template + .replace(``, preloadLinks) + .replace(``, appState) + .replace(``, tagMeta.headTags) + .replace(``, tagMeta.bodyTagsOpen) + .replace(``, tagMeta.bodyTags) + .replace(makeAppContainer(), makeAppContainer(appHtml)) - res.status(200).set({ 'Content-Type': 'text/html' }).end(html) + res.status(200).set({ 'Content-Type': 'text/html' }).end(html) + } } catch (e) { vite && vite.ssrFixStacktrace(e) console.log(e.stack) diff --git a/src/entry-server.js b/src/entry-server.js index f2e99b9..f545e0c 100644 --- a/src/entry-server.js +++ b/src/entry-server.js @@ -23,7 +23,10 @@ export async function render(url, manifest, originUrl) { // itself on ctx.modules. After the render, ctx.modules would contain all the // components that have been instantiated during this render call. const ctx = {} + const initialRoute = router.currentRoute.value.path const html = await renderToString(app, ctx) + const latestRoute = router.currentRoute.value.path + const redirectRoute = initialRoute !== latestRoute && latestRoute const headPayload = await renderSSRHead(getActiveHead()) const renderState = `