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

Fix scheduled task tooltip time format #1382

Merged
merged 3 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Cleanup get_report function in gsad [#1263](https://github.com/greenbone/gsa/pull/1263)

### Fixed
- Fix scheduled task tooltip time format [#1382](https://github.com/greenbone/gsa/pull/1382)
- Use German manual for *DE* locale [#1372](https://github.com/greenbone/gsa/pull/1372)
- Load all container tasks for report import dialog from redux store [#1370](https://github.com/greenbone/gsa/pull/1370)
- Don't render *Invalid Date* [#1368](https://github.com/greenbone/gsa/pull/1368)
Expand Down
20 changes: 15 additions & 5 deletions gsa/src/web/pages/tasks/icons/scheduleicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
import React from 'react';

import {connect} from 'react-redux';

import _ from 'gmp/locale';

import {isDefined} from 'gmp/utils/identity';
Expand All @@ -28,7 +30,10 @@ import ScheduleIcon from 'web/components/icon/scheduleicon';

import DetailsLink from 'web/components/link/detailslink';

const TaskScheduleIcon = ({size, links = true, schedule}) => {
import {dateTimeWithTimeZone} from 'gmp/locale/date';
import {getTimezone} from 'web/store/usersettings/selectors';

const TaskScheduleIcon = ({size, links = true, schedule, timezone}) => {
if (
schedule.userCapabilities.areDefined() &&
schedule.userCapabilities.length === 0
Expand All @@ -55,22 +60,22 @@ const TaskScheduleIcon = ({size, links = true, schedule}) => {
} else if (count === 1) {
title = _('View Details of Schedule {{name}} (Next due: {{time}} Once)', {
name,
time: nextDate,
time: dateTimeWithTimeZone(nextDate, timezone),
});
} else if (count > 1) {
title = _(
'View Details of Schedule {{name}} (Next due: ' +
'{{time}}, {{periods}} more times )',
{
name,
time: nextDate,
time: dateTimeWithTimeZone(nextDate, timezone),
periods: count,
},
);
} else {
title = _('View Details of Schedule {{name}} (Next due: {{time}})', {
name,
time: nextDate,
time: dateTimeWithTimeZone(nextDate, timezone),
});
}

Expand All @@ -91,8 +96,13 @@ TaskScheduleIcon.propTypes = {
schedule: PropTypes.model.isRequired,
schedulePeriods: PropTypes.number,
size: PropTypes.iconSize,
timezone: PropTypes.string,
};

export default TaskScheduleIcon;
const mapStateToProps = rootState => ({
timezone: getTimezone(rootState),
});

export default connect(mapStateToProps)(TaskScheduleIcon);

// vim: set ts=2 sw=2 tw=80: