Browse Source

swagger improvements

pull/14929/head
dashevchenko 7 months ago
parent
commit
5ad9eae7d5
  1. 6
      application/src/main/java/org/thingsboard/server/controller/DashboardController.java
  2. 2
      common/data/src/main/java/org/thingsboard/server/common/data/Dashboard.java

6
application/src/main/java/org/thingsboard/server/controller/DashboardController.java

@ -120,7 +120,7 @@ public class DashboardController extends BaseController {
"Used to adjust view of the dashboards according to the difference between browser and server time.") "Used to adjust view of the dashboards according to the difference between browser and server time.")
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@GetMapping(value = "/dashboard/serverTime") @GetMapping(value = "/dashboard/serverTime")
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "1636023857137"))) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(type = "integer", format = "int64", example = "1636023857137")))
public long getServerTime() { public long getServerTime() {
return System.currentTimeMillis(); return System.currentTimeMillis();
} }
@ -132,7 +132,7 @@ public class DashboardController extends BaseController {
"The actual value of the limit is configurable in the system configuration file.") "The actual value of the limit is configurable in the system configuration file.")
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@GetMapping(value = "/dashboard/maxDatapointsLimit") @GetMapping(value = "/dashboard/maxDatapointsLimit")
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "5000"))) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(type = "integer", format = "int64", example = "1636023857137")))
public long getMaxDatapointsLimit() { public long getMaxDatapointsLimit() {
return maxDatapointsLimit; return maxDatapointsLimit;
} }
@ -177,6 +177,8 @@ public class DashboardController extends BaseController {
"Referencing non-existing dashboard Id will cause 'Not Found' error. " + "Referencing non-existing dashboard Id will cause 'Not Found' error. " +
"Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. " + "Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. " +
TENANT_AUTHORITY_PARAGRAPH) TENANT_AUTHORITY_PARAGRAPH)
@ApiResponse(responseCode = "200", description = "OK",
content = @Content(schema = @Schema(implementation = Dashboard.class)))
@PreAuthorize("hasAuthority('TENANT_ADMIN')") @PreAuthorize("hasAuthority('TENANT_ADMIN')")
@PostMapping(value = "/dashboard") @PostMapping(value = "/dashboard")
public void saveDashboard(@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "A JSON value representing the dashboard.") public void saveDashboard(@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "A JSON value representing the dashboard.")

2
common/data/src/main/java/org/thingsboard/server/common/data/Dashboard.java

@ -70,7 +70,7 @@ public class Dashboard extends DashboardInfo implements ExportableEntity<Dashboa
@Schema(description = "JSON object with main configuration of the dashboard: layouts, widgets, aliases, etc. " + @Schema(description = "JSON object with main configuration of the dashboard: layouts, widgets, aliases, etc. " +
"The JSON structure of the dashboard configuration is quite complex. " + "The JSON structure of the dashboard configuration is quite complex. " +
"The easiest way to learn it is to export existing dashboard to JSON." "The easiest way to learn it is to export existing dashboard to JSON."
, implementation = com.fasterxml.jackson.databind.JsonNode.class) , implementation = JsonNode.class)
public JsonNode getConfiguration() { public JsonNode getConfiguration() {
return configuration; return configuration;
} }

Loading…
Cancel
Save