Add a separate endpoint for frontend time format (#2847)
This commit is contained in:
parent
a8ccbc96c8
commit
cb8049e769
4 changed files with 25 additions and 3 deletions
|
@ -17,9 +17,16 @@ public class InfoController extends AbstractController implements TimeStampForma
|
|||
|
||||
@Value("${timestamp.format:dd.MM.YYYY HH:mm:ss}")
|
||||
private String timeStampFormat;
|
||||
@Value("${timestamp.format:DD.MM.YYYY HH:mm:ss}")
|
||||
private String timeStampFormatIso;
|
||||
|
||||
@Override
|
||||
public Mono<ResponseEntity<TimeStampFormatDTO>> getTimeStampFormat(ServerWebExchange exchange) {
|
||||
return Mono.just(ResponseEntity.ok(new TimeStampFormatDTO().timeStampFormat(timeStampFormat)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<ResponseEntity<TimeStampFormatDTO>> getTimeStampFormatISO(ServerWebExchange exchange) {
|
||||
return Mono.just(ResponseEntity.ok(new TimeStampFormatDTO().timeStampFormat(timeStampFormatIso)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1733,7 +1733,7 @@ paths:
|
|||
get:
|
||||
tags:
|
||||
- TimeStampFormat
|
||||
summary: getTimeStampFormat
|
||||
summary: get system default datetime format
|
||||
operationId: getTimeStampFormat
|
||||
responses:
|
||||
200:
|
||||
|
@ -1742,6 +1742,21 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TimeStampFormat'
|
||||
|
||||
/api/info/timestampformat/iso:
|
||||
get:
|
||||
tags:
|
||||
- TimeStampFormat
|
||||
summary: get system default datetime format (in ISO format, for JS)
|
||||
operationId: getTimeStampFormatISO
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TimeStampFormat'
|
||||
|
||||
components:
|
||||
schemas:
|
||||
TopicSerdeSuggestion:
|
||||
|
|
|
@ -3,7 +3,7 @@ import { expectQueryWorks, renderQueryHook } from 'lib/testHelpers';
|
|||
import * as hooks from 'lib/hooks/api/timeFormat';
|
||||
import { timeFormatPayload } from 'lib/fixtures/timeFormat';
|
||||
|
||||
const timeFormatPath = '/api/info/timestampformat';
|
||||
const timeFormatPath = '/api/info/timestampformat/iso';
|
||||
|
||||
describe('Time format hooks', () => {
|
||||
beforeEach(() => fetchMock.restore());
|
||||
|
|
|
@ -5,7 +5,7 @@ import { QUERY_REFETCH_OFF_OPTIONS } from 'lib/constants';
|
|||
export function useTimeFormat() {
|
||||
return useQuery(
|
||||
['settings', 'timestampformat'],
|
||||
() => api.getTimeStampFormat(),
|
||||
() => api.getTimeStampFormatISO(),
|
||||
QUERY_REFETCH_OFF_OPTIONS
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue