diff --git a/src/leases/components/leaseSections/leaseArea/PlanUnitItem.tsx b/src/leases/components/leaseSections/leaseArea/PlanUnitItem.tsx index bc421c785..6d4a17a61 100644 --- a/src/leases/components/leaseSections/leaseArea/PlanUnitItem.tsx +++ b/src/leases/components/leaseSections/leaseArea/PlanUnitItem.tsx @@ -15,7 +15,7 @@ import { LeasePlanUnitsFieldPaths, LeasePlanUnitsFieldTitles, LeaseAreaUsageDist import { getUiDataLeaseKey } from "uiData/helpers"; import { formatDate, formatNumber, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, isEmptyValue, isFieldAllowedToRead } from "util/helpers"; import { getAttributes } from "leases/selectors"; -import { createPaikkatietovipunenUrl } from "util/helpers"; +import { createPTPPlanReportUrl, createPTPPlotDivisionUrl } from "util/helpers"; import type { Attributes } from "types"; import SubTitle from "components/content/SubTitle"; type OwnProps = { @@ -99,7 +99,7 @@ const PlanUnitItem = ({ {LeasePlanUnitsFieldTitles.DETAILED_PLAN_IDENTIFIER} - {planUnit.detailed_plan_identifier ? : -} + {planUnit.detailed_plan_identifier ? : -} @@ -127,7 +127,7 @@ const PlanUnitItem = ({ {LeasePlanUnitsFieldTitles.PLOT_DIVISION_IDENTIFIER} - {planUnit.plot_division_identifier ? : -} + {planUnit.plot_division_identifier ? : -} diff --git a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteCustomDetailedPlan.tsx b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteCustomDetailedPlan.tsx index ba7d6e70f..72fcc2302 100644 --- a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteCustomDetailedPlan.tsx +++ b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteCustomDetailedPlan.tsx @@ -11,7 +11,7 @@ import Collapse from "components/collapse/Collapse"; import FormText from "components/form/FormText"; import FormTextTitle from "components/form/FormTextTitle"; import ExternalLink from "components/links/ExternalLink"; -import { createPaikkatietovipunenUrl } from "util/helpers"; +import { createPTPPlanReportUrl } from "util/helpers"; import { formatDate, getFieldOptions, getLabelOfOption } from "util/helpers"; import { getAttributes, getCollapseStateByKey, getIsFetchingCustomDetailedPlanAttributes, getRelatedApplications } from "plotSearch/selectors"; import type { Attributes } from "types"; @@ -125,7 +125,7 @@ class PlotSearchSiteCustomDetailedPlan extends PureComponent { {PlotSearchFieldTitles.DETAILED_PLAN} - {get(currentCustomDetailedPlan, 'detailed_plan') ? : -} + {get(currentCustomDetailedPlan, 'detailed_plan') ? : -} diff --git a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEdit.tsx b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEdit.tsx index 7a115de9f..f6c630bab 100644 --- a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEdit.tsx +++ b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEdit.tsx @@ -21,7 +21,7 @@ import FormTextTitle from "components/form/FormTextTitle"; import { getUsersPermissions } from "usersPermissions/selectors"; import WarningContainer from "components/content/WarningContainer"; import WarningField from "components/form/WarningField"; -import { createPaikkatietovipunenUrl } from "util/helpers"; +import { createPTPPlanReportUrl } from "util/helpers"; import { receiveCollapseStates, receiveIsSaveClicked, fetchPlanUnit, fetchCustomDetailedPlan } from "plotSearch/actions"; import { PlotSearchFieldTitles } from "plotSearch/enums"; import { formatDate, getFieldOptions, getLabelOfOption } from "util/helpers"; @@ -571,7 +571,7 @@ class PlotSearchSiteEdit extends Component { {PlotSearchFieldTitles.DETAILED_PLAN} - {planUnitByValue ? : -} + {planUnitByValue ? : -} diff --git a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEditCustomDetailedPlan.tsx b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEditCustomDetailedPlan.tsx index 336d22e46..31e8e6e63 100644 --- a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEditCustomDetailedPlan.tsx +++ b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSiteEditCustomDetailedPlan.tsx @@ -10,7 +10,7 @@ import LoaderWrapper from "components/loader/LoaderWrapper"; import ExternalLink from "components/links/ExternalLink"; import Loader from "components/loader/Loader"; import PlanUnitSelectInput from "components/inputs/PlanUnitSelectInput"; -import { createPaikkatietovipunenUrl } from "util/helpers"; +import { createPTPPlanReportUrl } from "util/helpers"; import { PlotSearchFieldTitles } from "plotSearch/enums"; import { formatDate, getFieldOptions, getLabelOfOption } from "util/helpers"; import { getInfoLinkLanguageDisplayText } from "plotSearch/helpers"; @@ -105,7 +105,7 @@ class PlotSearchSiteEditCustomDetailedPlan extends Component { {PlotSearchFieldTitles.DETAILED_PLAN} - {get(currentCustomDetailedPlan, 'detailed_plan') ? : -} + {get(currentCustomDetailedPlan, 'detailed_plan') ? : -} diff --git a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSitePlanUnit.tsx b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSitePlanUnit.tsx index 2cd92a404..17c2c8830 100644 --- a/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSitePlanUnit.tsx +++ b/src/plotSearch/components/plotSearchSections/basicInfo/PlotSearchSitePlanUnit.tsx @@ -12,7 +12,7 @@ import FormTextTitle from "components/form/FormTextTitle"; import ExternalLink from "components/links/ExternalLink"; import WarningContainer from "components/content/WarningContainer"; import WarningField from "components/form/WarningField"; -import { createPaikkatietovipunenUrl } from "util/helpers"; +import { createPTPPlanReportUrl } from "util/helpers"; import { Routes, getRouteById } from "root/routes"; import { formatDate, getFieldOptions, getLabelOfOption } from "util/helpers"; import { getAttributes, getCollapseStateByKey, getIsFetchingPlanUnitAttributes, getRelatedApplications } from "plotSearch/selectors"; @@ -214,7 +214,7 @@ class PlotSearchSitePlanUnit extends PureComponent { {PlotSearchFieldTitles.DETAILED_PLAN} - {get(currentPlanUnit, 'detailed_plan_identifier') ? : -} + {get(currentPlanUnit, 'detailed_plan_identifier') ? : -} diff --git a/src/util/constants.ts b/src/util/constants.ts index a16bd64d8..9408de72c 100644 --- a/src/util/constants.ts +++ b/src/util/constants.ts @@ -37,11 +37,11 @@ export const MAX_ZOOM = 12; export const MAP_COLORS = ['#0078C0', '#FF9800', '#1976D2', '#D32F2F', '#E040FB', '#FF4081', '#512DA8', '#536DFE', '#F57C00', '#E64A19', '#8BC34A', '#689F38', '#FFC107', '#CDDC39']; /** - * Url of the paikkatietovipunen + * Url of the ptp.hel.fi API * @readonly * @const {string} */ -export const PAIKKATIETOVIPUNEN_URL = 'http://paikkatietovipunen.hel.fi:10058'; +export const PTP_URL = 'https://ptp.hel.fi/'; /** * Delete modal button text diff --git a/src/util/helpers.tsx b/src/util/helpers.tsx index 448ca3c39..eb050388a 100644 --- a/src/util/helpers.tsx +++ b/src/util/helpers.tsx @@ -9,7 +9,7 @@ import isEmpty from "lodash/isEmpty"; import isNumber from "lodash/isNumber"; import { toastr } from "react-redux-toastr"; import ToastrIcons from "components/toastr/ToastrIcons"; -import { PAIKKATIETOVIPUNEN_URL } from "util/constants"; +import { PTP_URL } from "util/constants"; import { Breakpoints } from "foundation/enums"; import type { ApiResponse, Attributes, Methods } from "types"; import type { UsersPermissions } from "usersPermissions/types"; @@ -633,11 +633,18 @@ export const findFromOcdString = (ocd: string, key: string): string | null | und }; /** - * Create url to paikkatietovipunen - * @param {string} url + * Create url to ptp.hel.fi + * @param {string} reportId * @returns {string} */ -export const createPaikkatietovipunenUrl = (url: string): string => `${PAIKKATIETOVIPUNEN_URL}/${url}`; +export const createPTPPlanReportUrl = (reportId: string): string => `${PTP_URL}/DataForms/planreport/?id=${reportId}`; + +/** + * Create url to ptp.hel.fi + * @param {string} plotDivisionId + * @returns {string} + */ +export const createPTPPlotDivisionUrl = (plotDivisionId: string): string => `${PTP_URL}/DataHandlers/Tonttijaot/?q=${plotDivisionId}`; /** * Get count of results from api response diff --git a/src/util/spec.ts b/src/util/spec.ts index e38280c38..02023e645 100644 --- a/src/util/spec.ts +++ b/src/util/spec.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { isValidDate, getDayMonth, getCurrentYear, sortByStartAndEndDateAsc, sortByStartAndEndDateDesc, isDateRangesCollapsing, splitDateRanges, getSplittedDateRanges, getSplittedDateRangesWithItems } from "./date"; -import { composePageTitle, getSearchQuery, getUrlParams, fixedLengthNumber, getEpochTime, isEmptyValue, formatNumberWithThousandSeparator, formatDecimalNumber, formatNumber, isDecimalNumberStr, convertStrToDecimalNumber, formatDate, formatDateRange, getReferenceNumberLink, findItemById, getLabelOfOption, sortNumberByKeyAsc, sortNumberByKeyDesc, sortStringAsc, sortStringDesc, sortStringByKeyAsc, sortStringByKeyDesc, sortByOptionsAsc, sortByOptionsDesc, addEmptyOption, isFieldRequired, isFieldAllowedToEdit, isFieldAllowedToRead, isMethodAllowed, hasPermissions, getFieldAttributeOptions, getFieldOptions, humanReadableByteCount, hasNumber, findFromOcdString, createPaikkatietovipunenUrl, getApiResponseCount, getApiResponseMaxPage, getApiResponseResults, isActive, isActiveOrFuture, isArchived } from "./helpers"; +import { composePageTitle, getSearchQuery, getUrlParams, fixedLengthNumber, getEpochTime, isEmptyValue, formatNumberWithThousandSeparator, formatDecimalNumber, formatNumber, isDecimalNumberStr, convertStrToDecimalNumber, formatDate, formatDateRange, getReferenceNumberLink, findItemById, getLabelOfOption, sortNumberByKeyAsc, sortNumberByKeyDesc, sortStringAsc, sortStringDesc, sortStringByKeyAsc, sortStringByKeyDesc, sortByOptionsAsc, sortByOptionsDesc, addEmptyOption, isFieldRequired, isFieldAllowedToEdit, isFieldAllowedToRead, isMethodAllowed, hasPermissions, getFieldAttributeOptions, getFieldOptions, humanReadableByteCount, hasNumber, findFromOcdString, createPTPPlanReportUrl, createPTPPlotDivisionUrl, getApiResponseCount, getApiResponseMaxPage, getApiResponseResults, isActive, isActiveOrFuture, isArchived } from "./helpers"; import { getCoordinatesOfGeometry, getCenterFromCoordinates } from "./map"; describe('utils', () => { @@ -1133,8 +1133,11 @@ describe('utils', () => { it('should not find property from ocd string', () => { expect(findFromOcdString('property1:test/property2:test2', 'property3')).to.deep.equal(null); }); - it('should return paikkatietovipunen url', () => { - expect(createPaikkatietovipunenUrl('123')).to.deep.equal('http://paikkatietovipunen.hel.fi:10058/123'); + it('should return PTP plan report url', () => { + expect(createPTPPlanReportUrl('123')).to.deep.equal('https://ptp.hel.fi/DataForms/planreport/?id=123'); + }); + it('should return PTP plot division url', () => { + expect(createPTPPlotDivisionUrl('123')).to.deep.equal('https://ptp.hel.fi/DataHandlers/Tonttijaot/?q=123'); }); it('should return api response count', () => { const apiResponse = {