-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core/public/chrome] migrate controls, theme, and visibility apis #22987
[core/public/chrome] migrate controls, theme, and visibility apis #22987
Conversation
This comment has been minimized.
This comment has been minimized.
03e2601
to
7c3a2d7
Compare
This comment has been minimized.
This comment has been minimized.
8d2299b
to
3486219
Compare
This comment has been minimized.
This comment has been minimized.
3486219
to
1e41a93
Compare
This comment has been minimized.
This comment has been minimized.
1e41a93
to
5e0cf9f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cb78009
to
ed3a9a1
Compare
This comment has been minimized.
This comment has been minimized.
dcf21aa
to
b143fbb
Compare
3b6912a
to
730ecdb
Compare
This comment has been minimized.
This comment has been minimized.
730ecdb
to
6349a9a
Compare
This comment has been minimized.
This comment has been minimized.
6349a9a
to
d6ecd65
Compare
This comment has been minimized.
This comment has been minimized.
d6ecd65
to
dd151d6
Compare
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
ack: will get to this PR tomorrow morning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, thanks for adding tests! Testing locally at the moment.
/** | ||
* Get an observable of the current visiblity state of the chrome. | ||
*/ | ||
getIsVisible$: () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: mostly to widen my RxJS horizons :) What issues we'd have if we use something like this instead?
FORCE_HIDDEN ? of(false) : isVisible$.pipe(takeUntil(this.stop$))
With the current implementation if FORCE_HIDDEN === true
then next
on getIsVisible$
will always be called with false
whenever setIsVisible
is called and hence any external code that relies on this observable will be called as well .
Kind of related question, should we next
in setIsVisible
and setIsCollapsed
if value hasn't changed or it should be responsibility of the consumer to use or not distinct*
?
Not a big deal, just curious what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something like FORCE_HIDDEN ? of(false) : ...
would be fine, but I'm kind of concerned about the difference in lifecycle between the two return values, it probably wouldn't be a big deal, and since it really can't change it is "complete", but I'd have to think through how that might impact consumers. As for deduping here rather than in consumers, I originally had more dedupe logic in here, but felt like it didn't really add anything to do the extra work of deduping notifications. It might turn out that it's a lot nicer to consume an API that properly dedupes notifications, but I'm not sure about that... So I left it out for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested Kibana in embedded and full screen modes, generated PDF, etc. - everything looked good!
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
}); | ||
service.stop(); | ||
|
||
await expect(promise).resolves.toMatchInlineSnapshot(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an advantage to using toMatchInlineSnapshot
over toEqual
? Personally I would find the latter more readable:
await expect(promise).resolves.toEqual([
{},
{
logo: "big logo",
smallLogo: "not so big logo",
},
{
logo: "big logo without small logo",
smallLogo: undefined,
},
]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly maintenance, being able to update the snapshots with -u
and automatically update them with --watch
are pretty huge benefits to me
…latform/chrome-apis
💚 Build Succeeded |
…latform/chrome-apis
💚 Build Succeeded |
…astic#22987) * [core/public/chrome] migrate controls, theme, and visibility apis * [core/public] stop uiSettings service * [core/public/chrome] test that observables stop immedaiately after stop() * fix typos * [core/public/legacyPlatform] test globalNavState init * [ui/chrome] don't pass extra params * [core/public/chrome] test for dedupe-handling * [ui/chrome/theme] test with different values for logo and smallLogo
…2987) (#24308) * [core/public/chrome] migrate controls, theme, and visibility apis * [core/public] stop uiSettings service * [core/public/chrome] test that observables stop immedaiately after stop() * fix typos * [core/public/legacyPlatform] test globalNavState init * [ui/chrome] don't pass extra params * [core/public/chrome] test for dedupe-handling * [ui/chrome/theme] test with different values for logo and smallLogo
6.5/6.x: e33cba3 |
Another part of #19992, moved over the
ui/chrome
apis that control the theme (dark mode, custom home logo), visibility (embed mode), and controls (collapsed state) to acore.chrome
service. All of the original APIs are unchanged. This primary things to test are the collapse/expand button in the navigation, full screen mode in dashboard, the format of PDFs, and dashboard light/dark mode switching.