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

[O2B-1056] bookkeeping error page #1820

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hattinf
Copy link
Collaborator

@hattinf hattinf commented Dec 17, 2024

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:
-redirects to error page when page parameter is unknown

Notable changes for developers:

Changes made to the database:

@hattinf hattinf self-assigned this Dec 17, 2024
@hattinf hattinf changed the title Hattinf/o2 b 1056/bookkeeping error page [O2B-1056] bookkeeping error page Dec 17, 2024
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 27 lines in your changes missing coverage. Please review.

Project coverage is 43.81%. Comparing base (6f4cedf) to head (5573407).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
lib/public/Model.js 0.00% 12 Missing ⚠️
lib/public/views/Error/ErrorModel.js 0.00% 10 Missing ⚠️
lib/public/views/Error/index.js 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1820      +/-   ##
==========================================
+ Coverage   43.78%   43.81%   +0.03%     
==========================================
  Files         893      891       -2     
  Lines       15954    15887      -67     
  Branches     3003     2994       -9     
==========================================
- Hits         6985     6961      -24     
+ Misses       8969     8926      -43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


/**
* Sets the error object for the model
* @param {Object} error The error object to set, must contain a code, codeDescription and message
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a precise object description instead of simply suggesting it in comment. Because you use it in different places, I suppose you should create a typedef.

Comment on lines +16 to +40
import { registerFrontLinkListener } from './components/common/navigation/frontLinkListener.js';
import { ModalModel } from './components/modal/ModalModel.js';
import { BkpRoles } from './domain/enums/BkpRoles.js';
import { UserRoleSelectionModel } from './models/UserRoleSelectionModel.js';
import { detectorsProvider } from './services/detectors/detectorsProvider.js';
import { ObservableData } from './utilities/ObservableData.js';
import { debounce, INPUT_DEBOUNCE_TIME } from './utilities/debounce.js';
import { getRoleForDetector } from './utilities/getRoleForDetector.js';
import { userPreferencesStore } from './utilities/userPreferencesStore.js';
import { registerFrontLinkListener } from './components/common/navigation/frontLinkListener.js';
import { EosReportModel } from './views/EosReport/EosReportModel.js';
import { AboutModel } from './views/About/About.js';
import { StatisticsPageModel } from './views/Statistics/StatisticsPageModel.js';
import { LhcPeriodsModel } from './views/lhcPeriods/LhcPeriodsModel.js';
import { HomePageModel } from './views/Home/Overview/HomePageModel.js';
import { DataPassesModel } from './views/DataPasses/DataPassesModel.js';
import { SimulationPassesModel } from './views/SimulationPasses/SimulationPassesModel.js';
import { EnvironmentModel } from './views/Environments/EnvironmentModel.js';
import { EosReportModel } from './views/EosReport/EosReportModel.js';
import { ErrorModel } from './views/Error/ErrorModel.js';
import Flps from './views/Flps/Flps.js';
import { HomePageModel } from './views/Home/Overview/HomePageModel.js';
import LhcFills from './views/LhcFills/LhcFills.js';
import { LogsModel } from './views/Logs/LogsModel.js';
import { QcFlagTypesModel } from './views/QcFlagTypes/QcFlagTypesModel.js';
import { QcFlagsModel } from './views/QcFlags/QcFlagsModel.js';
import { UserRoleSelectionModel } from './models/UserRoleSelectionModel.js';
import { ObservableData } from './utilities/ObservableData.js';
import { BkpRoles } from './domain/enums/BkpRoles.js';
import { getRoleForDetector } from './utilities/getRoleForDetector.js';
import { detectorsProvider } from './services/detectors/detectorsProvider.js';
import RunTypeModel from './views/RunTypes/RunTypeModel.js';
import { RunsModel } from './views/Runs/RunsModel.js';
import { SimulationPassesModel } from './views/SimulationPasses/SimulationPassesModel.js';
import { StatisticsPageModel } from './views/Statistics/StatisticsPageModel.js';
import Tags from './views/Tags/Tags.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should try to avoid as much as possible this kind of huge changes, for example reordering imports. It adds a lot of noise for review, and someone might do the other way around in a future commit, and this is an endless cycle of changes.

h('.f5', message),
h('button.btn.btn-primary', {
onclick: () => {
model.router.go('?page=home');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, we should avoid as much as possible dependencies inside components. The ideal would be for it to depend only on a very specific submodel, in this case only on model.errorModel. Using router is an external dependency that should be avoided outside of models.
Instead, you should try to have a look at "frontLink" component, that hides this dependency for you (and puts it in one single place). You might style it as a button if you like, but in my personal opinion, a link should look like a link (I am fine with the button if you prefer it).

model.router.go('?page=home');
} }, [
iconHome(),
' Go to Home Page',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use flex container and flex-gap instead of putting a space in your text

Comment on lines +26 to +30
await page.setViewport({
width: 700,
height: 720,
deviceScaleFactor: 1,
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to set this?

});

it('shows the error message', async () => {
await goToPage(page, 'error');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can consider that one suite of frontend test is a continuous test, basically you can make them dependent one of the other. In this test for example you can suppose that you are already in the right page, and simply do your tests. Same for the next ones, and this way we avoid navigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants