Skip to content

Commit

Permalink
Merge pull request #1648 from solita-sabinaf/TIS-905/disable_dry_run_…
Browse files Browse the repository at this point in the history
…for_fintraffic

Add a way to hide a dry run export possibility
  • Loading branch information
testower authored Nov 7, 2024
2 parents fa64f0f + 52b3c1a commit d91a42a
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 41 deletions.
2 changes: 2 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ export interface Config {
* overriding translations (case appTitle)
*/
extPath?: string;

hideExportDryRun?: boolean;
}
7 changes: 5 additions & 2 deletions src/ext/Fintraffic/CustomStyle/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ body {

.page .page-content {
margin: 1.5rem 1rem;
padding: 0rem;
padding-right: 2rem;
padding: 0rem 2rem 0rem 1px;
}

// Navigation menu:
Expand Down Expand Up @@ -62,6 +61,10 @@ body {
line-height: unset;
}

.eds-side-navigation__item:focus-visible {
outline: none;
}

.eds-side-navigation {
--padding-vertical: 10px !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ const JourneyPatternStopPointMap = memo(
cluster.properties as ClusterProperties;
const stopPlace = (cluster.properties as AnyProps).stopPlace;

console.log(pointCount, typeof pointCount);

if (isCluster) {
return (
<ClusterMarker
Expand Down
48 changes: 27 additions & 21 deletions src/scenes/Exports/Creator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useDispatch } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import './styles.scss';
import { exportIsValid } from './validateForm';
import { useConfig } from '../../../config/ConfigContext';

const ExportsCreator = () => {
const navigate = useNavigate();
Expand All @@ -26,6 +27,7 @@ const ExportsCreator = () => {
const [saveClicked, setSaveClicked] = useState<boolean>(false);
const [isSaving, setSaving] = useState<boolean>(false);
const [theExport, setTheExport] = useState<Export>(newExport());
const { hideExportDryRun } = useConfig();

const dispatch = useDispatch<any>();

Expand Down Expand Up @@ -87,27 +89,31 @@ const ExportsCreator = () => {
}}
/>
</div>
<div className="export-dry-run">
<Checkbox
value="1"
checked={theExport.dryRun}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
onFieldChange('dryRun', e.target.checked)
}
>
{formatMessage({ id: 'exportCreatorDryRunFormLabel' })}
</Checkbox>
<Tooltip
placement="right"
content={formatMessage({
id: 'exportCreatorDryRunFormLabelTooltip',
})}
>
<span className="question-icon">
<QuestionIcon />
</span>
</Tooltip>
</div>
{!hideExportDryRun ? (
<div className="export-dry-run">
<Checkbox
value="1"
checked={theExport.dryRun}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
onFieldChange('dryRun', e.target.checked)
}
>
{formatMessage({ id: 'exportCreatorDryRunFormLabel' })}
</Checkbox>
<Tooltip
placement="right"
content={formatMessage({
id: 'exportCreatorDryRunFormLabelTooltip',
})}
>
<span className="question-icon">
<QuestionIcon />
</span>
</Tooltip>
</div>
) : (
<></>
)}
<SuccessButton className="export-save" onClick={handleOnSaveClick}>
{formatMessage({ id: 'exportCreatorSaveButtonLabelText' })}
</SuccessButton>
Expand Down
19 changes: 11 additions & 8 deletions src/scenes/Exports/Viewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const ExportsViewer = () => {
const currentExport = useAppSelector(getCurrentExportSelector(params));
const [theExport, setTheExport] = useState(currentExport);
const dispatch = useDispatch<any>();
const { hideExportDryRun } = useConfig();

const dispatchLoadExport = useCallback(() => {
if (params.id) {
Expand Down Expand Up @@ -83,14 +84,16 @@ const ExportsViewer = () => {
label={formatMessage({ id: 'viewerNameLabel' })}
value={theExport!.name}
/>
<ExportItem
label={formatMessage({ id: 'viewerDryRunLabel' })}
value={
theExport!.dryRun
? formatMessage({ id: 'viewerDryRunYes' })
: formatMessage({ id: 'viewerDryRunNo' })
}
/>
{!hideExportDryRun && (
<ExportItem
label={formatMessage({ id: 'viewerDryRunLabel' })}
value={
theExport!.dryRun
? formatMessage({ id: 'viewerDryRunYes' })
: formatMessage({ id: 'viewerDryRunNo' })
}
/>
)}
<ExportItem
label={formatMessage({ id: 'viewerStatusLabel' })}
value={
Expand Down
21 changes: 13 additions & 8 deletions src/scenes/Exports/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Exports = () => {
const exports: ExportsState = useAppSelector((state) => state.exports);
const intl = useIntl();
const { formatMessage, locale } = intl;
const { hideExportDryRun } = useConfig();

const dispatch = useAppDispatch();

Expand Down Expand Up @@ -63,11 +64,13 @@ const Exports = () => {
</SecondarySquareButton>
)}
</DataCell>
<DataCell>
{e.dryRun
? formatMessage({ id: 'exportsDryRunYes' })
: formatMessage({ id: 'exportsDryRunNo' })}
</DataCell>
{!hideExportDryRun && (
<DataCell>
{e.dryRun
? formatMessage({ id: 'exportsDryRunYes' })
: formatMessage({ id: 'exportsDryRunNo' })}
</DataCell>
)}
</TableRow>
))
) : (
Expand Down Expand Up @@ -117,9 +120,11 @@ const Exports = () => {
<HeaderCell>
{formatMessage({ id: 'exportsTableHeaderLabelDownload' })}
</HeaderCell>
<HeaderCell>
{formatMessage({ id: 'exportsTableHeaderLabelDryrun' })}
</HeaderCell>
{!hideExportDryRun && (
<HeaderCell>
{formatMessage({ id: 'exportsTableHeaderLabelDryrun' })}
</HeaderCell>
)}
</TableRow>
</TableHead>
<TableBody>{renderTableRows()}</TableBody>
Expand Down

0 comments on commit d91a42a

Please sign in to comment.