Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is improvement for QE report data (GTL) API, which allows more easily query data on screen and control GTLs more programmatically.
New methods:
sendDataWithRx({controller: 'reportDataController', action: 'get_current_page'})
Will store current page number.
sendDataWithRx({controller: 'reportDataController', action: 'get_pages_amount'})
Will store number of all items.
sendDataWithRx({controller: 'reportDataController', action: 'get_items_per_page'})
Will store number of shown items per page.
sendDataWithRx({controller: 'reportDataController', action: 'set_items_per_page', data: [5]})
Will change number of records per page, data is array with number of records per page.
sendDataWithRx({controller: 'reportDataController', action: 'set_sorting', data: [{sortBy: 2, isAscending: true}]})
Will change sort based on given data.
sortBy
ID of column to sort by,isAscending
true|false direction.(stores) sendDataWithRx({controller: 'reportDataController', action: 'get_sorting'})
Will store sorting object.
sortBy
column which is sorted by,sortDir
is eitherASC
orDESC
sendDataWithRx({controller: 'reportDataController', action: 'get_all_items'})
Will store all items on screen in given format including helpful methods.
sendDataWithRx({controller: 'reportDataController', action: 'get_item', data: ['name_or_id']})
dataname_or_id
can be number or string, since simple comparison (==
) is used.Will query for item based on name or it's ID property. If record doesn't have name column set it will try to look up based on ID. This item will be stored in given format including helpful methods.
Store result in global scope
If we want to get some information from screen we can call method which will store this result (methods marked as stores) in global scope. We can then access it by calling
ManageIQ.qe.gtl.result
. Example:endDataWithRx({controller: 'reportDataController', action: 'get_item', data: ['name_of_record']})
will store found item inManageIQ.qe.gtl.result
and callingManageIQ.qe.gtl.result.click()
will click on such item.New callback function
If we want to check or play around with stored data we can now pass callback function. Example:
sendDataWithRx({controller: 'reportDataController', action: 'get_item', data: ['name_of_record'], eventCallback: function(data) {data.click();}})
this will query GTL to find item with namename_of_record
and once data are returned it will click on such item.Item querying
It is possible to query for all items or to select one item (shown in 7) and 8) point), result will contain not only item, but couple of helpful methods, the result is: