Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading range rejection #1392

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
693 changes: 8 additions & 685 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"bootstrap": "~5.3.3",
"csv": "~5.3.2",
"csv-stringify": "~5.6.5",
"d3": "~7.8.5",
"dotenv": "~16.4.5",
"escape-html": "~1.0.3",
"express": "~4.19.2",
Expand Down Expand Up @@ -105,7 +104,6 @@
},
"devDependencies": {
"@redux-devtools/extension": "~3.2.5",
"@types/d3": "~7.4.3",
"@types/lodash": "~4.17.4",
"@types/node": "~20.14.10",
"@types/plotly.js": "~2.29.2",
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/DashboardComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function DashboardComponent() {
<UIOptionsComponent />
</div>
<div className={`${optionsVisibility ? 'col-12 col-lg-10' : 'col-12'} align-self-auto text-center`} style={{ height: '100%' }}>
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', height: '100%' }}>
<PlotNavComponent />
{chartToRender === ChartTypes.line && <LineChartComponent />}
{chartToRender === ChartTypes.bar && <BarChartComponent />}
Expand Down
15 changes: 3 additions & 12 deletions src/client/app/components/HeaderButtonsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function HeaderButtonsComponent() {
const version = useAppSelector(selectOEDVersion);
const helpUrl = useAppSelector(selectHelpUrl);
// options help
const optionsHelp = helpUrl + '/optionsMenu/';
const optionsHelp = helpUrl + '/optionsMenu.html';

const loggedInAsAdmin = useAppSelector(selectIsAdmin);
const loggedIn = useAppSelector(selectIsLoggedIn);
Expand Down Expand Up @@ -64,7 +64,6 @@ export default function HeaderButtonsComponent() {
shouldCSVReadingsButtonDisabled: true,
shouldUnitsButtonDisabled: true,
shouldConversionsButtonDisabled: true,
shouldVisualUnitMapButtonDisabled: true,
// Translated menu title that depend on whether logged in.
menuTitle: '',
// link to help page for page choices. Should not see default but use general help URL.
Expand Down Expand Up @@ -100,8 +99,7 @@ export default function HeaderButtonsComponent() {
shouldCSVMetersButtonDisabled: pathname === '/csvMeters',
shouldCSVReadingsButtonDisabled: pathname === '/csvReadings',
shouldUnitsButtonDisabled: pathname === '/units',
shouldConversionsButtonDisabled: pathname === '/conversions',
shouldVisualUnitMapButtonDisabled: pathname === '/visual-unit'
shouldConversionsButtonDisabled: pathname === '/conversions'
}));
}, [pathname]);

Expand Down Expand Up @@ -129,7 +127,7 @@ export default function HeaderButtonsComponent() {
display: pathname === '/' ? 'block' : 'none'
};
// Admin help or regular user page
const neededPage = loggedInAsAdmin ? '/adminPageChoices/' : '/pageChoices/';
const neededPage = loggedInAsAdmin ? '/adminPageChoices.html' : '/pageChoices.html';
const currentPageChoicesHelp = helpUrl + neededPage;

setState(prevState => ({
Expand Down Expand Up @@ -229,13 +227,6 @@ export default function HeaderButtonsComponent() {
to="/units">
<FormattedMessage id='units' />
</DropdownItem>
<DropdownItem
style={state.adminViewableLinkStyle}
disabled={state.shouldVisualUnitMapButtonDisabled}
tag={Link}
to="/visual-unit">
<FormattedMessage id='visual.unit' />
</DropdownItem>
<DropdownItem divider style={state.adminViewableLinkStyle} />
<DropdownItem
style={state.adminViewableLinkStyle}
Expand Down
10 changes: 7 additions & 3 deletions src/client/app/components/LanguageSelectorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';
import { selectSelectedLanguage, updateSelectedLanguage } from '../redux/slices/appStateSlice';
import { selectOEDVersion } from '../redux/api/versionApi';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
import { LanguageTypes } from '../types/redux/i18n';
import { selectHelpUrl } from '../redux/slices/adminSlice';
import { selectBaseHelpUrl } from '../redux/slices/adminSlice';

/**
* A component that allows users to select which language the page should be displayed in.
Expand All @@ -18,7 +19,10 @@ export default function LanguageSelectorComponent() {
const dispatch = useAppDispatch();

const selectedLanguage = useAppSelector(selectSelectedLanguage);
const helpUrl = useAppSelector(selectHelpUrl);
const version = useAppSelector(selectOEDVersion);
const baseHelpUrl = useAppSelector(selectBaseHelpUrl);

const helpUrl = baseHelpUrl + version;

return (
<>
Expand All @@ -44,7 +48,7 @@ export default function LanguageSelectorComponent() {
</DropdownItem>
<DropdownItem divider />
<DropdownItem
href={helpUrl + '/language/'}>
href={helpUrl + '/language.html'}>
<FormattedMessage id="help" />
</DropdownItem>
</DropdownMenu>
Expand Down
4 changes: 1 addition & 3 deletions src/client/app/components/RouteComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import RoleOutlet from './router/RoleOutlet';
import UnitsDetailComponent from './unit/UnitsDetailComponent';
import ErrorComponent from './router/ErrorComponent';
import { selectSelectedLanguage } from '../redux/slices/appStateSlice';
import VisualUnitDetailComponent from './visual-unit/VisualUnitDetailComponent';

/**
* @returns the router component Responsible for client side routing.
Expand Down Expand Up @@ -59,8 +58,7 @@ const router = createBrowserRouter([
{ path: 'csvMeters', element: <MetersCSVUploadComponent /> },
{ path: 'maps', element: <MapsDetailContainer /> },
{ path: 'units', element: <UnitsDetailComponent /> },
{ path: 'users', element: <UsersDetailComponent /> },
{ path: 'visual-unit', element: <VisualUnitDetailComponent/> }
{ path: 'users', element: <UsersDetailComponent /> }
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions src/client/app/components/TooltipHelpComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export default function TooltipHelpComponent(props: TooltipHelpProps) {
'help.home.toggle.chart.link': { link: `${helpUrl}/chartLink/` },
'help.groups.groupdetails': { link: `${helpUrl}/groupViewing/#groupDetails` },
'help.groups.groupview': { link: `${helpUrl}/groupViewing/` },
'help.meters.meterview': { link: `${helpUrl}/meterViewing/` },
'help.admin.unitconversionvisuals': { link: `${helpUrl}/adminUnitVisual/` }
'help.meters.meterview': { link: `${helpUrl}/meterViewing/` }
};

return (
Expand Down
2 changes: 2 additions & 0 deletions src/client/app/components/UnsavedWarningComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ export function UnsavedWarningComponent(props: UnsavedWarningProps) {
submitChanges(changes)
.unwrap()
.then(() => {
//TODO translate me
showSuccessNotification(translate('unsaved.success'));
if (blocker.state === 'blocked') {
blocker.proceed();
}
})
.catch(() => {
//TODO translate me
showErrorNotification(translate('unsaved.failure'));
if (blocker.state === 'blocked') {
blocker.proceed();
Expand Down
Loading
Loading