-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Observability] fix slo observability compressed styles to be not com…
…pressed (#193081) ## Summary Building off of PR #192993 to revert the compressed styles for SLOs Compressed styles PR [here](#190636) ### Before In the SLO page in Observability, the status and tags fields are uneven with the unified search bar. ![Screenshot 2024-09-30 at 2 10 17 PM](https://github.com/user-attachments/assets/63391aa2-ec7d-43f5-9803-8094e73b8a6c) ### After ![Screenshot 2024-09-30 at 2 52 37 PM](https://github.com/user-attachments/assets/fb70109d-15d1-4278-81c6-318da290594f)
- Loading branch information
Showing
12 changed files
with
78 additions
and
7 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
33 changes: 33 additions & 0 deletions
33
src/plugins/controls/public/control_group/utils/is_compressed.test.ts
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { isCompressed } from './is_compressed'; | ||
|
||
describe('isCompressed', () => { | ||
test('should return true by default', () => { | ||
const mockApi = {}; | ||
expect(isCompressed(mockApi)).toBe(true); | ||
}); | ||
test('should return false if compressed is false', () => { | ||
const mockApi = { compressed: false }; | ||
expect(isCompressed(mockApi)).toBe(false); | ||
}); | ||
test('should return false if parent api has compressed false', () => { | ||
const mockApi = { parentApi: { compressed: false } }; | ||
expect(isCompressed(mockApi)).toBe(false); | ||
}); | ||
test('should return false if nested api has compressed false', () => { | ||
const mockApi = { parentApi: { parentApi: { parentApi: { compressed: false } } } }; | ||
expect(isCompressed(mockApi)).toBe(false); | ||
}); | ||
test('should return true if parent api does not specify compressed', () => { | ||
const mockApi = { parentApi: { parentApi: {} } }; | ||
expect(isCompressed(mockApi)).toBe(true); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
src/plugins/controls/public/control_group/utils/is_compressed.ts
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { apiHasParentApi } from '@kbn/presentation-publishing'; | ||
|
||
interface HasCompressed { | ||
compressed: boolean; | ||
} | ||
|
||
const apiHasCompressed = (unknownApi: unknown): unknownApi is HasCompressed => { | ||
return Boolean(unknownApi) && typeof (unknownApi as HasCompressed).compressed === 'boolean'; | ||
}; | ||
|
||
export function isCompressed(api: unknown): boolean { | ||
if (apiHasCompressed(api)) return api.compressed; | ||
return apiHasParentApi(api) ? isCompressed(api.parentApi) : true; | ||
} |
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
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