Skip to content
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

CB-5125 do not trigger logo in configuration stage #3096

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions webapp/packages/core-blocks/src/layout/AppLogo.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
display: flex;
align-items: center;
padding: 0 14px;
}

.active {
cursor: pointer;
}

Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/core-blocks/src/layout/AppLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface Props {
export const AppLogo: React.FC<Props> = function AppLogo({ title, onClick }) {
const style = useS(styles);
return (
<div tabIndex={0} className={s(style, { container: true })} onClick={onClick}>
<div tabIndex={0} className={s(style, { container: true, active: onClick !== undefined })} onClick={onClick}>
<IconOrImage title={title} className={s(style, { logo: true })} icon="/icons/logo_sm.svg" />
</div>
);
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-top-app-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-administration": "^0",
"@cloudbeaver/core-app": "^0",
"@cloudbeaver/core-authentication": "^0",
"@cloudbeaver/core-blocks": "^0",
Expand Down
4 changes: 3 additions & 1 deletion webapp/packages/plugin-top-app-bar/src/TopNavBar/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import { observer } from 'mobx-react-lite';

import { AdministrationScreenService } from '@cloudbeaver/core-administration';
import { AppLogo, useResource } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { ProductInfoResource } from '@cloudbeaver/core-root';
Expand All @@ -16,6 +17,7 @@ import { useAppVersion } from '@cloudbeaver/core-version';
export const Logo = observer(function Logo() {
const productInfoResource = useResource(Logo, ProductInfoResource, undefined);
const screenService = useService(ScreenService);
const administrationScreenService = useService(AdministrationScreenService);
const { backendVersion, frontendVersion } = useAppVersion(true);

const isSameVersion = backendVersion === frontendVersion;
Expand All @@ -26,5 +28,5 @@ export const Logo = observer(function Logo() {

const title = isSameVersion ? backendVersionTitle : commonVersionTitle;

return <AppLogo title={title} onClick={() => screenService.navigateToRoot()} />;
return <AppLogo title={title} onClick={administrationScreenService.isConfigurationMode ? undefined : () => screenService.navigateToRoot()} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to fix somehow in ScreenService or in AppScreenBootstrap (so basically we need to block public screen activation in case we in configuration mode (we can check it from server config for not administration pages))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugins can use any core* packages.
I am not sure about adding this logic to the screen service. It should not check itself whether it can be navigate or not, it should be checked outside of this service. Cause screen service has single responsibility, we want to keep it this way

});
Loading