Skip to content

Commit

Permalink
fix(about): add missing buildInfo in mocked health response (#1345)
Browse files Browse the repository at this point in the history
* chore(pf5): add missing buildInfo in mocked health response

Signed-off-by: Thuan Vo <[email protected]>

* fix(mirageJS): testing target def should not create target

* chore: fix type check issues

---------

Signed-off-by: Thuan Vo <[email protected]>
  • Loading branch information
tthvo authored Sep 9, 2024
1 parent 8a2cbb9 commit 3582233
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/Recordings/Filters/DatetimeFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface DateTimeRange {
to?: Date;
}

export const filterRecordingByDatetime = (recordings?: ActiveRecording[], filters?: DateTimeRange[]) => {
export const filterRecordingByDatetime = (recordings: ActiveRecording[], filters?: DateTimeRange[]) => {
if (!recordings?.length || !filters?.length) {
return recordings;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/Recordings/Filters/DurationFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { DURATION_INPUT_MAXLENGTH } from './const';

export const CONTINUOUS_INDICATOR = 'continuous';

export const filterRecordingByDuration = (recordings?: ActiveRecording[], filters?: DurationRange[]) => {
export const filterRecordingByDuration = (recordings: ActiveRecording[], filters?: DurationRange[]) => {
if (!recordings?.length || !filters?.length) {
return recordings;
}
Expand Down
10 changes: 10 additions & 0 deletions src/mirage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export const startMirage = ({ environment = 'development' } = {}) => {
this.logging = environment === 'development';

this.get('health', () => ({
build: {
git: {
hash: '775aee4cdd61f5b8d91aa38f4601933c9750d54e',
},
},
cryostatVersion: `${build.version.replace(/(-\w+)*$/g, '')}-0-preview`,
dashboardAvailable: false,
dashboardConfigured: false,
Expand Down Expand Up @@ -97,6 +102,11 @@ export const startMirage = ({ environment = 'development' } = {}) => {
() => new Response(400, {}, 'Resource downloads are not supported in this demo'),
);
this.post('api/v2/targets', (schema, request) => {
const params = request.queryParams;
if (params['dryrun']) {
return new Response(200);
}

const attrs = request.requestBody as any;
const target = schema.create(Resource.TARGET, {
jvmId: `${Date.now().toString(16)}`,
Expand Down

0 comments on commit 3582233

Please sign in to comment.