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 event_logs download functionality #2373

Merged
merged 12 commits into from
Dec 2, 2021

Conversation

heatonk
Copy link
Contributor

@heatonk heatonk commented Nov 26, 2021

Description

Functionality was previously listed but not working, as mentioned in issue @2329. This fixes @2329 by creating another function that calls the correct API endpoint.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Verified solution by running locally and downloading event logs and reports from test operations.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Functionality was previously listed but not working, as mentioned in issue @2329. This fix creates another function that calls the correct API endpoint.
@heatonk heatonk added the bug label Nov 26, 2021
@heatonk heatonk self-assigned this Nov 26, 2021
@heatonk heatonk linked an issue Nov 26, 2021 that may be closed by this pull request
@elegantmoose
Copy link
Contributor

Addresses #2329

elegantmoose
elegantmoose previously approved these changes Nov 30, 2021
Copy link
Contributor

@iguannalin iguannalin left a comment

Choose a reason for hiding this comment

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

Hi @heatonk, I think this file could be reduced a bit, if all that's changing is the API endpoint.

downloadInfo(formatType) {
    const endpoint = formatType === 'full-report' ? 'report' : formatType;
    apiV2('POST', `${this.ENDPOINT}/${this.selectedOperationID}/${endpoint}`, { enable_agent_output: this.isAgentOutputSelected })
        .then((res) => {
            this.createDownloadReport(res, `${this.selectedOperation.name}_${formatType}`);
        })
        .catch(() => toast(`Error generating operation ${formatType.replace('-', ' ')}`));
},

downloadCSV() {...},

handleDownload() {
    if (this.selectedReportType === 'full-report') this.downloadInfo('full-report');
    else if (this.selectedReportType === 'event-logs') this.downloadInfo('event-logs');
    else if (this.selectedReportType === 'csv') this.downloadCSV();
},

Copy link
Contributor

@iguannalin iguannalin left a comment

Choose a reason for hiding this comment

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

Looks good! I'll suggest making sure to pull the latest changes from the master operations.html (i.e. I see there's a console error for operation that has been fixed but is still popping up in this branch's ver.), and some linting to match the spacing with the rest of the functions.

@wbooth wbooth enabled auto-merge December 2, 2021 16:15
@sonarcloud
Copy link

sonarcloud bot commented Dec 2, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wbooth wbooth disabled auto-merge December 2, 2021 18:12
@wbooth wbooth merged commit b8b033d into mitre:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The full report and event logs for an operation are identical
5 participants