Repository navigation
feat(software): device lists sort and filter, type, installedBy and a real up-to-date status CU-17tkuw61fh5 #2909
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
Changes from 2 commits
7808893
daab8f7
74fa57e
b73e34b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.openframe.api.dto.rmm.software; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Data | ||
| public class SoftwareVulnerabilityFilterInput { | ||
| private List<SoftwareCveSeverity> severities; | ||
| } |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.openframe.api.util; | ||
|
|
||
| import lombok.experimental.UtilityClass; | ||
|
|
||
| import java.util.regex.Matcher; | ||
| import java.util.regex.Pattern; | ||
|
|
||
| @UtilityClass | ||
| public class SoftwareVersions { | ||
|
|
||
| private static final Pattern LEADING_DIGITS = Pattern.compile("^\\d{1,18}"); | ||
|
|
||
| // Numeric, segment-wise version order so "9.0" precedes "10.0" (plain String sort would not). | ||
| public static int compare(String a, String b) { | ||
| String[] pa = a.split("\\."); | ||
| String[] pb = b.split("\\."); | ||
| for (int i = 0; i < Math.max(pa.length, pb.length); i++) { | ||
|
Check warning on line 17 in openframe-api-lib/src/main/java/com/openframe/api/util/SoftwareVersions.java
|
||
| long va = i < pa.length ? parseSegment(pa[i]) : 0; | ||
| long vb = i < pb.length ? parseSegment(pb[i]) : 0; | ||
| if (va != vb) { | ||
| return Long.compare(va, vb); | ||
| } | ||
| } | ||
| return a.compareTo(b); | ||
| } | ||
|
Check warning on line 25 in openframe-api-lib/src/main/java/com/openframe/api/util/SoftwareVersions.java
|
||
|
andrii-flamingo marked this conversation as resolved.
Resolved
|
||
|
|
||
| // the leading number of a segment, so "3-beta" and "0_2" still count as 3 and 0 | ||
| private static long parseSegment(String segment) { | ||
| Matcher digits = LEADING_DIGITS.matcher(segment.trim()); | ||
| return digits.find() ? Long.parseLong(digits.group()) : 0; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.