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

Apply the right sorting depending on the list #721

Closed
adri9valle opened this issue May 27, 2019 · 2 comments
Closed

Apply the right sorting depending on the list #721

adri9valle opened this issue May 27, 2019 · 2 comments
Assignees
Labels
type/enhancement Enhancement issue UI/UX Generic label for things related to the font-end side

Comments

@adri9valle
Copy link
Contributor

Wazuh Splunk Rev
3.x 7.2.6 --

Description

Some tables and lists have a default value for the initial sorting that not always makes sense.

Steps to reproduce

Open a section with a table, use the agents search bar, there are a lot of examples in the app.

Screenshots

Agents search bar:

image

Checks list from an SCA policy:

image

@adri9valle adri9valle added type/enhancement Enhancement issue frontend UI/UX Generic label for things related to the font-end side labels May 27, 2019
@adri9valle adri9valle added this to the 22th week sprint milestone May 27, 2019
@adri9valle adri9valle self-assigned this May 27, 2019
@adri9valle
Copy link
Contributor Author

Update

PR: #722

To fix the related problems in the issue I've made these changes:

Fix wz-tag-filters

In the wz-tag-filters directive I applied the sort method:

this.scope.searchBarModel = {
name: [],
status: ['Active', 'Disconnected', 'Never connected'],
group: groups ? groups.sort() : [],
version: versions ? versions : [],
'os.platform': os ? os.map(x => x.platform).sort() : [],
'os.version': os ? os.map(x => x.version).sort() : [],
'os.name': os ? os.map(x => x.name).sort() : []
}

In the versions field the sort method has not been applied because is an alphanumeric field, this provokes that the values won't be sorted properly always.

Fix Agents > SCA tables

I've applied an implicit sort by id.

<wazuh-table flex path="wzTablePath" row-sizes="[13,11,9]" extra-limit="100"
keys="['id', 'title','file','result']" implicit-sort="'id'">
</wazuh-table>

@adri9valle
Copy link
Contributor Author

Update

Improved the sort method in the agent controller, now it takes into account letters and numbers.

this.scope.searchBarModel = {
name: [],
status: ['Active', 'Disconnected', 'Never connected'],
group: groups ? groups.sort((a, b) => { return a.toString().localeCompare(b.toString()) }) : [],
version: versions ? versions.sort((a, b) => { return a.toString().localeCompare(b.toString(), undefined, { numeric: true, sensitivity: 'base' }) }) : [],
'os.platform': os ? os.map(x => x.platform).sort((a, b) => { return a.toString().localeCompare(b.toString()) }) : [],
'os.version': os ? os.map(x => x.version).sort((a, b) => { return a.toString().localeCompare(b.toString(), undefined, { numeric: true, sensitivity: 'base' }) }) : [],
'os.name': os ? os.map(x => x.name).sort((a, b) => { return a.toString().localeCompare(b.toString()) }) : []
}

image

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Enhancement issue UI/UX Generic label for things related to the font-end side
Projects
None yet
Development

No branches or pull requests

2 participants