MangoAutomation / ma-modules-public

Open source Mango Automation modules
Other
19 stars 33 forks source link

SeroJson Export Functionality from UI #88

Open terrypacker opened 4 years ago

terrypacker commented 4 years ago

We need the ability to export various types of VOs via RQL queries in a format that is easily downloadable and formatted exactly how a Mango import expects. The endpoints are all at GET ../export

REST Endpoints Needed

The UI should have a button on any list/table that will then use the RQL filter on the table to get the export file for download. Also any edit view should have a button that makes an RQL query xid=for_export to get the single item for download.

As a general rule use the export icon and place in top right edit view for single download or top right of table header in download all view.

UI Needed

When testing please export and import the files to ensure they are formatted correctly before checking off a box.

terrypacker commented 4 years ago

@jazdw I was looking at how you export the SeroJson for the data points via the UI but don’t actually see the requests in the dev console? Basically I have endpoints that returns SeroJson MimeType but I wanted to see how to supply a filename for the downloaded file (or if that is even necessary).

Can you enlighten me so I can finish these endpoints?

jazdw commented 4 years ago

They are just <a href="/rest/v2/data-sources/export/internal_mango_monitoring_ds"> links so you wont see it in the dev console. I set the file name via the download attribute on the link.

pierpuccini commented 4 years ago

Hey @jazdw I was wondering how can I form the RQL for the data source export when the table is filtered on the page?

terrypacker commented 4 years ago

@pierpuccini can you change the class on the icon to be class="md-icon-button ma-small-button" for all the icons.

pierpuccini commented 4 years ago

@terrypacker when added the export functionality in the Maintenance events module I noticed the following error in the attached image. In order to replicate just click on the toogle event switch

{
    "data": {
        "cause": "NotFoundException: Not found",
        "mangoStatusCode": -1,
        "mangoStatusName": null,
        "localizedMessage": "Not found"
    },
    "status": 404,
    "config": {
        "method": "PUT",
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "jsonpCallbackParam": "callback",
        "url": "/rest/v2/maintenance-events/toggle/undefined",
        "timeout": 30000,
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "X-Requested-With": "XMLHttpRequest",
            "X-XSRF-TOKEN": "84a6dda5-13af-4bb7-8c4a-9772c5c38623"
        },
        "cached": false
    },
    "statusText": "Not Found",
    "xhrStatus": "complete",
    "mangoStatusText": "Not found",
    "mangoStatusTextShort": "Not found"
}

eval @ angular.js:15572
logAndSendStackTrace @ exceptionHandler.js:28
maExceptionHandler @ exceptionHandler.js:84
processChecks @ angular.js:17982
$digest @ angular.js:19117
$apply @ angular.js:19505
eval @ angular.js:19809
completeTask @ angular.js:21236
eval @ angular.js:6817
setTimeout (async)
Browser.self.defer @ angular.js:6815
scheduleApplyAsync @ angular.js:19808
$applyAsync @ angular.js:19537
done @ angular.js:13345
completeRequest @ angular.js:13605
requestLoaded @ angular.js:13510
load (async)
eval @ angular.js:13493
sendReq @ angular.js:13293
serverRequest @ angular.js:13034
processQueue @ angular.js:17950
eval @ angular.js:17998
$digest @ angular.js:19117
$apply @ angular.js:19505
listener @ angular-material.js:11343
dispatch @ jquery.js:5183
elemData.handle @ jquery.js:4991
Screen Shot 2020-05-01 at 9 42 18 PM