Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check requirement fulfillment and show it on ShowContentPacksPage (#4966
) * Check requirement fulfillment and show it on ShowContentPacksPage We want to display if a requirement of a content pack is met by the server, for that the server checkes if every constraint is met and adds the information to the json result. The frontend can now use the so send fulfilled flag to check if the requirement is met Also: - fix naming of ContentPackResource function - add download API endpoint Fixes #4950
- Loading branch information
Showing
21 changed files
with
231 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...rver/src/main/java/org/graylog2/contentpacks/model/constraints/ConstraintCheckResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
/** | |||
* This file is part of Graylog. | |||
* | |||
* Graylog is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* Graylog is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with Graylog. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.graylog2.contentpacks.model.constraints; | |||
|
|||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | |||
import com.fasterxml.jackson.annotation.JsonCreator; | |||
import com.fasterxml.jackson.annotation.JsonProperty; | |||
import com.google.auto.value.AutoValue; | |||
import org.graylog.autovalue.WithBeanGetter; | |||
|
|||
@JsonAutoDetect | |||
|
|||
@AutoValue | |||
@WithBeanGetter | |||
public abstract class ConstraintCheckResult { | |||
@JsonProperty | |||
public abstract Constraint constraint(); | |||
|
|||
@JsonProperty | |||
public abstract boolean fulfilled(); | |||
|
|||
@JsonCreator | |||
public static ConstraintCheckResult create(@JsonProperty("constraint") Constraint constraint, @JsonProperty("fulfilled") boolean fulfilled) { | |||
return new AutoValue_ConstraintCheckResult(constraint, fulfilled); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.../main/java/org/graylog2/rest/models/system/contenpacks/responses/ContentPackResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
/** | |||
* This file is part of Graylog. | |||
* | |||
* Graylog is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* Graylog is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with Graylog. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.graylog2.rest.models.system.contenpacks.responses; | |||
|
|||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | |||
import com.fasterxml.jackson.annotation.JsonCreator; | |||
import com.fasterxml.jackson.annotation.JsonProperty; | |||
import com.google.auto.value.AutoValue; | |||
import org.graylog2.contentpacks.model.ContentPack; | |||
import org.graylog2.contentpacks.model.constraints.ConstraintCheckResult; | |||
|
|||
import java.util.Set; | |||
|
|||
@JsonAutoDetect | |||
@AutoValue | |||
public abstract class ContentPackResponse { | |||
@JsonProperty("content_pack") | |||
public abstract ContentPack contentPack(); | |||
|
|||
@JsonProperty("constraints_result") | |||
public abstract Set<ConstraintCheckResult> constraints(); | |||
|
|||
@JsonCreator | |||
public static ContentPackResponse create(@JsonProperty("content_pack") ContentPack contentPack, @JsonProperty("constraints_result") Set<ConstraintCheckResult> constraints) { | |||
return new AutoValue_ContentPackResponse(contentPack, constraints); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.