Skip to content

Commit

Permalink
Merge pull request #217 from cityofaustin/3668_ecapris_integration
Browse files Browse the repository at this point in the history
hyperlinked eCapris id
  • Loading branch information
mateoclarke authored Mar 9, 2021
2 parents c0e4d27 + 1f7cdd6 commit b6f900c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion moped-editor/src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ const DataTable = ({ fieldConfiguration, data, loading, error, refetch }) => {
fieldConfiguration.fields[field]?.labelStyle ?? null
}
>
{formatValue(field)}
{fieldConfiguration.fields[field].format
? fieldConfiguration.fields[field].format(
getValue(field)
)
: formatValue(field)}
{fieldConfiguration.fields[field].editable &&
!isEditing && (
<Icon
Expand Down
20 changes: 20 additions & 0 deletions moped-editor/src/components/ExternalLink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import Link from "@material-ui/core/Link";
import OpenInNewIcon from "@material-ui/icons/OpenInNew";

const ExternalLink = ({ url, text }) => {
return (
<span>
{!!text ? (
<Link href={url} target="_blank" rel="noopener noreferrer">
{text}
<OpenInNewIcon style={{ fontSize: 16 }} />
</Link>
) : (
<span>-</span>
)}
</span>
);
};

export default ExternalLink;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React from "react";
import DataTable from "../../../components/DataTable/DataTable";
import makeStyles from "@material-ui/core/styles/makeStyles";

import ExternalLink from "../../../components/ExternalLink";

const useStyles = makeStyles(theme => ({
fieldSelectCapitalize: {
textTransform: "capitalize",
Expand Down Expand Up @@ -91,6 +93,11 @@ const ProjectSummaryTable = ({ data, loading, error, refetch }) => {
placeholder: "Enter eCapris ID",
emptyValue: "None",
editable: true,
format: value =>
<ExternalLink
text={value}
url={`https://ecapris.austintexas.gov/index.cfm?fuseaction=subprojects.subprojectData&SUBPROJECT_ID=${value}`}
/>
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from "react";
import { ProjectsListViewFiltersConf } from "./ProjectsListViewFiltersConf";
import { ProjectsListViewExportConf } from "./ProjectsListViewExportConf";
import ExternalLink from "../../../components/ExternalLink";

/**
* The Query configuration (now also including filters)
Expand Down Expand Up @@ -98,6 +100,12 @@ export const ProjectsListViewQueryConf = {
searchable: true,
sortable: false,
label: "eCapris Subp.",
filter: value =>
<ExternalLink
text={value}
url={`https://ecapris.austintexas.gov/index.cfm?fuseaction=subprojects.subprojectData&SUBPROJECT_ID=${value}`}
/>
,
type: "string",
search: {
label: "Search by eCapris subproject id",
Expand Down

0 comments on commit b6f900c

Please sign in to comment.