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

[backend/frontend] Add missing sortable #1401

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const inlineStyles: Record<string, CSSProperties> = {
},
asset_group_assets: {
width: '35%',
cursor: 'default',
},
asset_group_tags: {
width: '25%',
Expand Down
6 changes: 4 additions & 2 deletions openbas-front/src/admin/components/components/teams/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ const inlineStyles: Record<string, CSSProperties> = {
},
team_users_number: {
width: '10%',
cursor: 'default',
},
team_tags: {
width: '25%',
cursor: 'default',
},
team_updated_at: {
width: '20%',
Expand Down Expand Up @@ -94,8 +96,8 @@ const Teams = () => {
const headers = [
{ field: 'team_name', label: 'Name', isSortable: true },
{ field: 'team_description', label: 'Description', isSortable: true },
savacano28 marked this conversation as resolved.
Show resolved Hide resolved
{ field: 'team_users_number', label: 'Players', isSortable: true },
{ field: 'team_tags', label: 'Tags', isSortable: true },
{ field: 'team_users_number', label: 'Players', isSortable: false },
{ field: 'team_tags', label: 'Tags', isSortable: false },
{ field: 'team_updated_at', label: 'Updated', isSortable: true },
];

Expand Down
2 changes: 1 addition & 1 deletion openbas-front/src/admin/components/scenarios/Scenarios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const Scenarios = () => {
{
field: 'scenario_recurrence',
label: 'Status',
isSortable: true,
isSortable: false,
value: (scenario: ScenarioStore) => <ScenarioStatus scenario={scenario} variant="list" />,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const useStyles = makeStyles(() => ({
const inlineStyles = {
kill_chain_phase: {
width: '20%',
cursor: 'default',
},
attack_pattern_external_id: {
width: '15%',
Expand Down
15 changes: 10 additions & 5 deletions openbas-front/src/admin/components/settings/groups/Groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,23 @@ const inlineStyles = {
},
group_default_scenario_observer: {
width: '15%',
cursor: 'default',
},
group_default_scenario_planner: {
width: '15%',
cursor: 'default',
},
group_default_exercise_observer: {
width: '15%',
cursor: 'default',
},
group_default_exercise_planner: {
width: '15%',
cursor: 'default',
},
group_users_number: {
width: '10%',
cursor: 'default',
},
};

Expand All @@ -88,11 +93,11 @@ const Groups = () => {
const headers = [
{ field: 'group_name', label: 'Name', isSortable: true },
{ field: 'group_default_user_assign', label: 'Auto assign', isSortable: true },
{ field: 'group_default_scenario_observer', label: 'Auto observer on scenarios', isSortable: true },
{ field: 'group_default_scenario_planner', label: 'Auto planner on scenarios', isSortable: true },
{ field: 'group_default_exercise_observer', label: 'Auto observer on exercises', isSortable: true },
{ field: 'group_default_exercise_planner', label: 'Auto planner on exercises', isSortable: true },
{ field: 'group_users_number', label: 'Users', isSortable: true },
{ field: 'group_default_scenario_observer', label: 'Auto observer on scenarios', isSortable: false },
{ field: 'group_default_scenario_planner', label: 'Auto planner on scenarios', isSortable: false },
{ field: 'group_default_exercise_observer', label: 'Auto observer on exercises', isSortable: false },
{ field: 'group_default_exercise_planner', label: 'Auto planner on exercises', isSortable: false },
{ field: 'group_users_number', label: 'Users', isSortable: false },
];

const [groups, setGroups] = useState([]);
Expand Down
3 changes: 2 additions & 1 deletion openbas-front/src/admin/components/settings/users/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const inlineStyles = {
},
user_organization: {
width: '15%',
cursor: 'default',
},
user_admin: {
width: '10%',
Expand Down Expand Up @@ -85,7 +86,7 @@ const Users = () => {
{ field: 'user_email', label: 'Email address', isSortable: true },
{ field: 'user_firstname', label: 'Firstname', isSortable: true },
{ field: 'user_lastname', label: 'Lastname', isSortable: true },
{ field: 'user_organization', label: 'Organization', isSortable: true },
{ field: 'user_organization', label: 'Organization', isSortable: false },
{ field: 'user_admin', label: 'Administrator', isSortable: true },
{ field: 'user_tags', label: 'Tags', isSortable: true },
];
Expand Down
1 change: 0 additions & 1 deletion openbas-front/src/admin/components/teams/Organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const inlineStylesHeaders: Record<string, CSSProperties> = {
width: '40%',
fontSize: 12,
fontWeight: '700',
cursor: 'default',
},
organization_tags: {
width: '30%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Asset implements Base {
@NotBlank
private String name;

@Queryable(sortable = true)
@Column(name = "asset_description")
@JsonProperty("asset_description")
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.openbas.annotation.Queryable;
import io.openbas.database.audit.ModelBaseListener;
import io.openbas.helper.MultiIdListDeserializer;
import io.openbas.helper.MultiModelDeserializer;
Expand Down Expand Up @@ -32,6 +33,7 @@ public class Group implements Base {
@NotBlank
private String id;

@Queryable(sortable = true)
@Column(name = "group_name")
@JsonProperty("group_name")
@NotBlank
Expand All @@ -41,6 +43,7 @@ public class Group implements Base {
@JsonProperty("group_description")
private String description;

@Queryable(sortable = true)
@Column(name = "group_default_user_assign")
@JsonProperty("group_default_user_assign")
private boolean defaultUserAssignation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.openbas.database.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.openbas.annotation.Queryable;
import io.openbas.database.audit.ModelBaseListener;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
Expand Down Expand Up @@ -30,6 +31,7 @@ public class ImportMapper implements Base {
@NotNull
private UUID id;

@Queryable(sortable = true)
@Column(name = "mapper_name")
@JsonProperty("import_mapper_name")
@NotBlank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.openbas.annotation.Queryable;
import io.openbas.database.audit.ModelBaseListener;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
Expand Down Expand Up @@ -39,11 +40,13 @@ public class LessonsTemplate implements Base {
@NotNull
private Instant updated = now();

@Queryable(sortable = true)
@Column(name = "lessons_template_name")
@JsonProperty("lessons_template_name")
@NotBlank
private String name;

@Queryable(sortable = true)
@Column(name = "lessons_template_description")
@JsonProperty("lessons_template_description")
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class Mitigation implements Base {
@NotBlank
private String name;

@Queryable(searchable = true)
@Queryable(searchable = true, sortable = true)
@Column(name = "mitigation_description")
@JsonProperty("mitigation_description")
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class Team implements Base {
@NotBlank
private String name;

@Queryable(sortable = true)
@Column(name = "team_description")
@JsonProperty("team_description")
private String description;
Expand All @@ -58,6 +59,7 @@ public class Team implements Base {
@NotNull
private Instant createdAt = now();

@Queryable(sortable = true)
@Column(name = "team_updated_at")
@JsonProperty("team_updated_at")
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class User implements Base {
@Setter
@Column(name = "user_admin")
@JsonProperty("user_admin")
@Queryable(filterable = true)
@Queryable(filterable = true, sortable = true)
private boolean admin = false;

@Setter
Expand Down