diff --git a/components/frontend/src/dashboard/ExportCard.js b/components/frontend/src/dashboard/ExportCard.js index 3ff8f30416..b6eec93f08 100644 --- a/components/frontend/src/dashboard/ExportCard.js +++ b/components/frontend/src/dashboard/ExportCard.js @@ -4,6 +4,7 @@ import { bool, string } from "prop-types" import { Card, List } from "semantic-ui-react" import { childrenPropType, datePropType, reportPropType } from "../sharedPropTypes" +import { DOCUMENTATION_URL } from "../utils" function ExportCardItem({ children, url }) { const item = children @@ -43,9 +44,7 @@ export function ExportCard({ lastUpdate, report, reportDate, isOverview = false , - + Quality-time v{process.env.REACT_APP_VERSION} diff --git a/components/frontend/src/header_footer/Footer.js b/components/frontend/src/header_footer/Footer.js index a4a97eec6f..1cce21d25c 100644 --- a/components/frontend/src/header_footer/Footer.js +++ b/components/frontend/src/header_footer/Footer.js @@ -22,6 +22,7 @@ import { import { element, object, oneOfType, string } from "prop-types" import { alignmentPropType, childrenPropType, datePropType, reportPropType } from "../sharedPropTypes" +import { DOCUMENTATION_URL, REPOSITORY_URL } from "../utils" function FooterItem({ children, icon, url }) { const color = "silver" @@ -69,16 +70,13 @@ function AboutAppColumn() { } url="https://www.ictu.nl/about-us"> Created by ICTU - } url="https://github.com/ICTU/quality-time/blob/master/LICENSE"> + } url={`${REPOSITORY_URL}/blob/master/LICENSE`}> License - } - url={`https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/changelog.html`} - > + } url={`${DOCUMENTATION_URL}/changelog.html`}> Changelog - } url="https://github.com/ICTU/quality-time"> + } url={REPOSITORY_URL}> Source code @@ -88,22 +86,16 @@ function AboutAppColumn() { function SupportColumn() { return ( - } - url={`https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/`} - > + } url={DOCUMENTATION_URL}> Documentation - } - url={`https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/usage.html`} - > + } url={`${DOCUMENTATION_URL}/usage.html`}> User manual - } url="https://github.com/ICTU/quality-time/issues"> + } url={`${REPOSITORY_URL}/issues`}> Known issues - } url="https://github.com/ICTU/quality-time/issues/new"> + } url={`${REPOSITORY_URL}/issues/new`}> Report an issue diff --git a/components/frontend/src/metric/MetricTypeHeader.js b/components/frontend/src/metric/MetricTypeHeader.js index bc91a5c021..a03bc13273 100644 --- a/components/frontend/src/metric/MetricTypeHeader.js +++ b/components/frontend/src/metric/MetricTypeHeader.js @@ -1,10 +1,9 @@ import { Header } from "../semantic_ui_react_wrappers" import { metricTypePropType } from "../sharedPropTypes" -import { slugify } from "../utils" +import { referenceDocumentationURL } from "../utils" import { ReadTheDocsLink } from "../widgets/ReadTheDocsLink" export function MetricTypeHeader({ metricType }) { - const url = `https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/reference.html${slugify(metricType.name)}` const howToConfigure = metricType.documentation ? " for specific information on how to configure this metric type." : "" @@ -13,7 +12,7 @@ export function MetricTypeHeader({ metricType }) { {metricType.name} - {metricType.description} + {metricType.description} {howToConfigure} diff --git a/components/frontend/src/source/Source.js b/components/frontend/src/source/Source.js index 9bee36716a..b94f115789 100644 --- a/components/frontend/src/source/Source.js +++ b/components/frontend/src/source/Source.js @@ -16,7 +16,7 @@ import { sourcePropType, stringsPropType, } from "../sharedPropTypes" -import { getMetricName, getSourceName } from "../utils" +import { getMetricName, getSourceName, referenceDocumentationURL } from "../utils" import { ButtonRow } from "../widgets/ButtonRow" import { DeleteButton } from "../widgets/buttons/DeleteButton" import { ReorderButtonGroup } from "../widgets/buttons/ReorderButtonGroup" @@ -141,7 +141,6 @@ export function Source({ const metricName = getMetricName(metric, dataModel) const connectionError = measurement_source?.connection_error || "" const parseError = measurement_source?.parse_error || "" - const referenceManualURL = `https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/reference.html` const configErrorMessage = ( <>

@@ -152,11 +151,11 @@ export function Source({

  • Change the type of the metric (back) to a type that is supported by{" "} - {sourceName}. + {sourceName}.
  • Change the type of this source to a type that supports{" "} - {metricName}. + {metricName}.
  • Move this source to another metric.
  • Remove this source altogether.
  • diff --git a/components/frontend/src/source/SourceTypeHeader.js b/components/frontend/src/source/SourceTypeHeader.js index a874a54087..9387333b40 100644 --- a/components/frontend/src/source/SourceTypeHeader.js +++ b/components/frontend/src/source/SourceTypeHeader.js @@ -2,7 +2,7 @@ import { string } from "prop-types" import { Header, Label } from "../semantic_ui_react_wrappers" import { sourceTypePropType } from "../sharedPropTypes" -import { slugify } from "../utils" +import { referenceDocumentationURL } from "../utils" import { ReadTheDocsLink } from "../widgets/ReadTheDocsLink" import { Logo } from "./Logo" import { sourceTypeDescription } from "./SourceType" @@ -12,7 +12,6 @@ export function SourceTypeHeader({ metricTypeId, sourceTypeId, sourceType }) { if (sourceType?.documentation?.generic || sourceType?.documentation?.[metricTypeId]) { howToConfigure = " for specific information on how to configure this source type." } - const url = `https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/reference.html${slugify(sourceType.name)}` return (
    @@ -21,7 +20,7 @@ export function SourceTypeHeader({ metricTypeId, sourceTypeId, sourceType }) { {sourceType.deprecated && } {`${sourceTypeDescription(sourceType)} `} - + {howToConfigure} diff --git a/components/frontend/src/subject/SubjectTitle.js b/components/frontend/src/subject/SubjectTitle.js index a5370644cc..23bc9fcc2d 100644 --- a/components/frontend/src/subject/SubjectTitle.js +++ b/components/frontend/src/subject/SubjectTitle.js @@ -8,7 +8,7 @@ import { DataModel } from "../context/DataModel" import { EDIT_REPORT_PERMISSION, ReadOnlyOrEditable } from "../context/Permissions" import { Header, Tab } from "../semantic_ui_react_wrappers" import { reportPropType, settingsPropType } from "../sharedPropTypes" -import { getSubjectType, slugify } from "../utils" +import { getSubjectType, referenceDocumentationURL } from "../utils" import { ButtonRow } from "../widgets/ButtonRow" import { DeleteButton } from "../widgets/buttons/DeleteButton" import { PermLinkButton } from "../widgets/buttons/PermLinkButton" @@ -19,13 +19,12 @@ import { changelogTabPane, configurationTabPane } from "../widgets/TabPane" import { SubjectParameters } from "./SubjectParameters" function SubjectHeader({ subjectType }) { - const url = `https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}/reference.html${slugify(subjectType.name)}` return (
    {subjectType.name} - {subjectType.description} + {subjectType.description}
    diff --git a/components/frontend/src/utils.js b/components/frontend/src/utils.js index ef1cb76eb3..2970a3b521 100644 --- a/components/frontend/src/utils.js +++ b/components/frontend/src/utils.js @@ -15,6 +15,8 @@ import { subjectTypePropType, } from "./sharedPropTypes" +export const DOCUMENTATION_URL = `https://quality-time.readthedocs.io/en/v${process.env.REACT_APP_VERSION}` +export const REPOSITORY_URL = "https://github.com/ICTU/quality-time" export const MILLISECONDS_PER_HOUR = 60 * 60 * 1000 const MILLISECONDS_PER_DAY = 24 * MILLISECONDS_PER_HOUR @@ -420,9 +422,10 @@ export function dropdownOptions(options) { return options.map((option) => ({ key: option, text: option, value: option })) } -export function slugify(name) { - // The hash isn't really part of the slug, but to prevent duplication it is included anyway - return `#${name?.toLowerCase().replaceAll(" ", "-").replaceAll("(", "").replaceAll(")", "").replaceAll("/", "")}` +export function referenceDocumentationURL(name) { + // Return a URL to the documentation for the metric/subject/source name + const slug = `${name?.toLowerCase().replaceAll(" ", "-").replaceAll(/[()/]/g, "")}` + return `${DOCUMENTATION_URL}/reference.html#${slug}` } export function addCounts(object1, object2) {