Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-mng committed Oct 16, 2024
1 parent 109bba5 commit c7b3f4b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/gmp/commands/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ export class UserCommand extends EntityCommand {
return this.httpPost({
cmd: 'save_my_settings',
text: data.timezone,
[PARAM_KEYS.DATE]: data.dateFormat,
[PARAM_KEYS.TIME]: data.timeFormat,
[PARAM_KEYS.DATE]: data.userInterfaceDateFormat,
[PARAM_KEYS.TIME]: data.userInterfaceTimeFormat,

Check warning on line 264 in src/gmp/commands/users.js

View check run for this annotation

Codecov / codecov/patch

src/gmp/commands/users.js#L263-L264

Added lines #L263 - L264 were not covered by tests
old_password: data.oldPassword,
password: data.newPassword,
lang: data.userInterfaceLanguage,
Expand Down
8 changes: 3 additions & 5 deletions src/web/pages/overrides/detailspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,9 @@ ToolBarIcons.propTypes = {
onOverrideEditClick: PropTypes.func.isRequired,
};

const Details = connect(rootState => {
return {
timezone: getTimezone(rootState),
};
})(({entity, timezone, ...props}) => {
const Details = connect(rootState => ({
timezone: getTimezone(rootState),
}))(({entity, timezone, ...props}) => {
const {nvt} = entity;
return (
<Layout flex="column">
Expand Down
9 changes: 4 additions & 5 deletions src/web/pages/usersettings/generalpart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ const GeneralPart = ({
onChange,
}) => {
const [_] = useTranslation();
const [prevUserInterfaceTimeFormat, setPrevUserInterfaceTimeFormat] =
useState(undefined);
const [prevUserInterfaceDateFormat, setPrevUserInterfaceDateFormat] =
useState(undefined);

Check warning on line 91 in src/web/pages/usersettings/generalpart.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/usersettings/generalpart.jsx#L88-L91

Added lines #L88 - L91 were not covered by tests

const getSelectItems = category => {
return Object.entries(dateTimeFormatOptions[category].options).map(
Expand All @@ -95,11 +99,6 @@ const GeneralPart = ({
);
};

Check warning on line 100 in src/web/pages/usersettings/generalpart.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/usersettings/generalpart.jsx#L93-L100

Added lines #L93 - L100 were not covered by tests

const [prevUserInterfaceTimeFormat, setPrevUserInterfaceTimeFormat] =
useState(undefined);
const [prevUserInterfaceDateFormat, setPrevUserInterfaceDateFormat] =
useState(undefined);

const handleSysDefaultChange = event => {
const isSystemDefault = parseYesNo(event);

Check warning on line 103 in src/web/pages/usersettings/generalpart.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/usersettings/generalpart.jsx#L102-L103

Added lines #L102 - L103 were not covered by tests

Expand Down
10 changes: 0 additions & 10 deletions src/web/pages/usersettings/usersettingspage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,6 @@ class UserSettings extends React.Component {

const {userInterfaceLanguage = BROWSER_LANGUAGE, timezone} = data;

Check warning on line 244 in src/web/pages/usersettings/usersettingspage.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/usersettings/usersettingspage.jsx#L244

Added line #L244 was not covered by tests

this.handleInteraction();
await gmp.user.saveSetting(
'd9857b7c-1159-4193-9bc0-18fae5473a69',
data.userInterfaceDateFormat,
);
await gmp.user.saveSetting(
'11deb7ff-550b-4950-aacf-06faeb7c61b9',
data.userInterfaceTimeFormat,
);

await gmp.user.saveSettings(data).then(() => {
this.closeDialog();
this.props.setLocale(
Expand Down

0 comments on commit c7b3f4b

Please sign in to comment.