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

Report load from store #923

Merged
merged 16 commits into from
Sep 11, 2018
Merged
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
15 changes: 12 additions & 3 deletions gsa/src/gmp/commands/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ class ReportCommand extends EntityCommand {
});
}

download({id}, {report_format_id, delta_report_id, filter}) {
download({id}, {reportFormatId, deltaReportId, filter}) {
return this.httpGet({
cmd: 'get_report',
delta_report_id,
delta_report_id: deltaReportId,
report_id: id,
report_format_id,
report_format_id: reportFormatId,
filter: isDefined(filter) ? filter.all() : ALL_FILTER,
}, {transform: DefaultTransform, responseType: 'arraybuffer'});
}
Expand Down Expand Up @@ -129,6 +129,15 @@ class ReportCommand extends EntityCommand {
id,
delta_report_id,
filter,
ignore_pagination: 1,
}, options).then(this.transformResponse);
}

get({id}, {filter, ...options} = {}) {
return this.httpGet({
id,
filter,
ignore_pagination: 1,
}, options).then(this.transformResponse);
}

Expand Down
3 changes: 1 addition & 2 deletions gsa/src/web/entities/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Filter, {RESET_FILTER} from 'gmp/models/filter';

import {YES_VALUE} from 'gmp/parser';

import {LOAD_TIME_FACTOR} from 'web/utils/constants';
import PropTypes from 'web/utils/proptypes';
import SelectionType from 'web/utils/selectiontype';

Expand All @@ -60,8 +61,6 @@ const exclude_props = [
'onDownload',
];

const LOAD_TIME_FACTOR = 1.2;

class EntitiesContainer extends React.Component {

constructor(...args) {
Expand Down
26 changes: 12 additions & 14 deletions gsa/src/web/pages/reports/detailscontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,12 @@ const PageContent = ({
entity,
filter,
filters,
loading = true,
report_formats,
report_format_id,
isLoading = true,
reportFormats,
reportFormatId,
showError,
showErrorMessage,
showSuccessMessage,
updating = false,
onActivateTab,
onAddToAssetsClick,
onTlsCertificateDownloadClick,
Expand Down Expand Up @@ -301,7 +300,6 @@ const PageContent = ({
} = report;

const hasReport = isDefined(entity);
loading = loading && (!hasReport || updating);

const delta = isDefined(report.isDeltaReport) ?
report.isDeltaReport() : undefined;
Expand All @@ -314,7 +312,7 @@ const PageContent = ({
<span>
{_('Report:')}
</span>
{loading ?
{isLoading ?
<span>
{_('Loading')}
</span> :
Expand Down Expand Up @@ -355,10 +353,10 @@ const PageContent = ({
<ToolBarIcons
delta={delta}
filter={filter}
loading={loading}
loading={isLoading}
report={report}
report_format_id={report_format_id}
report_formats={report_formats}
report_format_id={reportFormatId}
report_formats={reportFormats}
showError={showError}
showSuccessMessage={showSuccessMessage}
showErrorMessage={showErrorMessage}
Expand Down Expand Up @@ -386,7 +384,7 @@ const PageContent = ({
<Section
header={header}
>
{loading ?
{isLoading ?
<Loading/> :
<React.Fragment>
<TabLayout
Expand Down Expand Up @@ -501,7 +499,7 @@ const PageContent = ({
onFilterDecreaseMinQoDClick={onFilterDecreaseMinQoDClick}
onFilterRemoveSeverityClick={onFilterRemoveSeverityClick}
onFilterEditClick={onFilterEditClick}
onFilterResetClick={onFilterResetClick}
onFilterRemoveClick={onFilterRemoveClick}
onInteraction={onInteraction}
Copy link
Member

Choose a reason for hiding this comment

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

Why not keep both options? Removing the reset-option makes it impossible to easily apply the default filter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've only fixed the current behavior of the displayed box. If you think we should add another box when no results are available to actually reset the filter to the detauls a new PR is always welcome 😄

onTargetEditClick={onTargetEditClick}
/>
Expand Down Expand Up @@ -659,9 +657,9 @@ PageContent.propTypes = {
entity: PropTypes.model,
filter: PropTypes.filter,
filters: PropTypes.array,
loading: PropTypes.bool,
report_format_id: PropTypes.id,
report_formats: PropTypes.array,
isLoading: PropTypes.bool,
reportFormatId: PropTypes.id,
reportFormats: PropTypes.array,
showError: PropTypes.func.isRequired,
showErrorMessage: PropTypes.func.isRequired,
showSuccessMessage: PropTypes.func.isRequired,
Expand Down
Loading