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

Move global namespaces filter dropdown to the application header #2468

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions packages/components/src/components/Header/Header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2021 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -29,10 +29,10 @@ function skipToContentClick(event) {
}

function Header({
children,
headerNameProps,
intl,
isSideNavExpanded,
logoutButton,
onHeaderMenuButtonClick
}) {
return (
Expand Down Expand Up @@ -63,7 +63,7 @@ function Header({
<HeaderName prefix="Tekton" {...headerNameProps}>
Dashboard
</HeaderName>
<HeaderGlobalBar>{logoutButton}</HeaderGlobalBar>
<HeaderGlobalBar>{children}</HeaderGlobalBar>
</CarbonHeader>
);
}
Expand Down
11 changes: 10 additions & 1 deletion packages/components/src/components/Header/Header.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2020 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -12,6 +12,15 @@ limitations under the License.
*/

header.bx--header.tkn--header {
.bx--list-box__wrapper {
margin-top: 0.5rem;
margin-right: 1rem;

&:last-child {
margin-right: 2rem;
}
}

.tkn--logout-btn {
padding-right: 2px;
}
Expand Down
10 changes: 4 additions & 6 deletions packages/components/src/components/Header/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2020 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -24,9 +24,7 @@ export default {
export const Base = () => <Header />;

export const WithLogout = () => (
<Header
logoutButton={
<LogoutButton getLogoutURL={() => Promise.resolve('/something')} />
}
/>
<Header>
<LogoutButton getLogoutURL={() => Promise.resolve('/something')} />
</Header>
);
6 changes: 2 additions & 4 deletions packages/components/src/components/Header/Header.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2020 The Tekton Authors
Copyright 2019-2022 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -25,9 +25,7 @@ describe('Header', () => {

it('renders the logout button', () => {
const logoutButton = 'log out';
const { getByText } = renderWithRouter(
<Header logoutButton={logoutButton} />
);
const { getByText } = renderWithRouter(<Header>{logoutButton}</Header>);
expect(getByText(/log out/i)).toBeTruthy();
});

Expand Down
3 changes: 3 additions & 0 deletions packages/utils/src/utils/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ export const paths = {
}
},
rawCRD: {
all() {
return '/:type';
},
byNamespace() {
return byNamespace({ path: '/:type/:name' });
},
Expand Down
7 changes: 7 additions & 0 deletions packages/utils/src/utils/router.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ describe('pipelines', () => {
});

describe('rawCRD', () => {
it('all', () => {
const type = 'tasks';
expect(urls.rawCRD.all({ type })).toEqual(
generatePath(paths.rawCRD.all(), { type })
);
});

it('byNamespace', () => {
const type = 'tasks';
const name = taskName;
Expand Down
Loading