Search in sources :

Example 1 with GettingStartedState

use of org.graylog2.gettingstarted.GettingStartedState in project graylog2-server by Graylog2.

the class GettingStartedResource method displayGettingStarted.

@GET
@ApiOperation("Check whether to display the Getting started guide for this version")
public DisplayGettingStarted displayGettingStarted() {
    final GettingStartedState gettingStartedState = clusterConfigService.get(GettingStartedState.class);
    if (gettingStartedState == null) {
        return DisplayGettingStarted.create(true);
    }
    final boolean isDismissed = gettingStartedState.dismissedInVersions().contains(currentMinorVersionString());
    return DisplayGettingStarted.create(!isDismissed);
}
Also used : GettingStartedState(org.graylog2.gettingstarted.GettingStartedState) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with GettingStartedState

use of org.graylog2.gettingstarted.GettingStartedState in project graylog2-server by Graylog2.

the class GettingStartedResource method dismissGettingStarted.

@POST
@Path("dismiss")
@ApiOperation("Dismiss auto-showing getting started guide for this version")
@AuditEvent(type = AuditEventTypes.GETTING_STARTED_GUIDE_OPT_OUT_CREATE)
public void dismissGettingStarted() {
    final GettingStartedState gettingStartedState = clusterConfigService.getOrDefault(GettingStartedState.class, GettingStartedState.create(Sets.<String>newHashSet()));
    gettingStartedState.dismissedInVersions().add(currentMinorVersionString());
    clusterConfigService.write(gettingStartedState);
}
Also used : GettingStartedState(org.graylog2.gettingstarted.GettingStartedState) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) ApiOperation(io.swagger.annotations.ApiOperation) AuditEvent(org.graylog2.audit.jersey.AuditEvent)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)2 GettingStartedState (org.graylog2.gettingstarted.GettingStartedState)2 GET (javax.ws.rs.GET)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 AuditEvent (org.graylog2.audit.jersey.AuditEvent)1