-
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.
[8.x] [Observability] fix slo observability compressed styles to be n…
…ot compressed (#193081) (#194650) # Backport This will backport the following commits from `main` to `8.x`: - [[Observability] fix slo observability compressed styles to be not compressed (#193081)](#193081) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Rachel Shen","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-01T23:01:20Z","message":"[Observability] fix slo observability compressed styles to be not compressed (#193081)\n\n## Summary\r\n\r\nBuilding off of PR #192993 to\r\nrevert the compressed styles for SLOs\r\n\r\nCompressed styles PR\r\n[here](https://github.com/elastic/kibana/pull/190636)\r\n\r\n\r\n### Before\r\nIn the SLO page in Observability, the status and tags fields are uneven\r\nwith the unified search bar.\r\n\r\n\r\n### After\r\n","sha":"7a9a5194d7acf8a9e507ae6b6acc9d22f56cf2ea","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:all-open","ci:project-deploy-observability","Team:obs-ux-management"],"title":"[Observability] fix slo observability compressed styles to be not compressed","number":193081,"url":"https://github.com/elastic/kibana/pull/193081","mergeCommit":{"message":"[Observability] fix slo observability compressed styles to be not compressed (#193081)\n\n## Summary\r\n\r\nBuilding off of PR #192993 to\r\nrevert the compressed styles for SLOs\r\n\r\nCompressed styles PR\r\n[here](https://github.com/elastic/kibana/pull/190636)\r\n\r\n\r\n### Before\r\nIn the SLO page in Observability, the status and tags fields are uneven\r\nwith the unified search bar.\r\n\r\n\r\n### After\r\n","sha":"7a9a5194d7acf8a9e507ae6b6acc9d22f56cf2ea"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193081","number":193081,"mergeCommit":{"message":"[Observability] fix slo observability compressed styles to be not compressed (#193081)\n\n## Summary\r\n\r\nBuilding off of PR #192993 to\r\nrevert the compressed styles for SLOs\r\n\r\nCompressed styles PR\r\n[here](https://github.com/elastic/kibana/pull/190636)\r\n\r\n\r\n### Before\r\nIn the SLO page in Observability, the status and tags fields are uneven\r\nwith the unified search bar.\r\n\r\n\r\n### After\r\n","sha":"7a9a5194d7acf8a9e507ae6b6acc9d22f56cf2ea"}}]}] BACKPORT--> Co-authored-by: Rachel Shen <[email protected]>
- Loading branch information
1 parent
bb1e61e
commit 176a19b
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