Merge branch 'master' of github.com:spotify/backstage into ndudnik/use-catalog-backend

This commit is contained in:
Nikita Nek Dudnik
2020-05-28 18:28:33 +02:00
47 changed files with 158 additions and 105 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ import privateExports, {
defaultSystemIcons,
} from '@backstage/core-api';
import ErrorPage from '../layout/ErrorPage';
import { ErrorPage } from '../layout/ErrorPage';
import { lightTheme, darkTheme } from '@backstage/theme';
const { PrivateAppImpl } = privateExports;
@@ -16,7 +16,7 @@
import React from 'react';
import CodeSnippet from './CodeSnippet';
import InfoCard from '../../layout/InfoCard';
import { InfoCard } from '../../layout/InfoCard';
export default {
title: 'CodeSnippet',
@@ -16,8 +16,8 @@
import React, { FC } from 'react';
import { makeStyles } from '@material-ui/core';
import InfoCard from '../../layout/InfoCard';
import { Props as BottomLinkProps } from '../../layout/BottomLink';
import { InfoCard } from '../../layout/InfoCard';
import { BottomLinkProps } from '../../layout/BottomLink';
import CircleProgress from './CircleProgress';
type Props = {
@@ -36,7 +36,7 @@ const useStyles = makeStyles({
},
});
const ProgressCard: FC<Props> = (props) => {
const ProgressCard: FC<Props> = props => {
const classes = useStyles(props);
const { title, subheader, progress, deepLink, variant } = props;
@@ -24,7 +24,7 @@ import {
StatusWarning,
} from './Status';
import Table from '../Table';
import InfoCard from '../../layout/InfoCard';
import { InfoCard } from '../../layout/InfoCard';
export default {
title: 'Status',
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { FC } from 'react';
import InfoCard from '../../layout/InfoCard';
import { InfoCard } from '../../layout/InfoCard';
import { Grid } from '@material-ui/core';
import StructuredMetadataTable from '.';
@@ -17,7 +17,7 @@
import React from 'react';
import TrendLine from '.';
import Table from '../Table';
import InfoCard from '../../layout/InfoCard';
import { InfoCard } from '../../layout/InfoCard';
export default {
title: 'TrendLine',
+2 -13
View File
@@ -17,21 +17,10 @@
export * from '@backstage/core-api';
export * from './api';
export { default as Page } from './layout/Page';
export { gradients, pageTheme } from './layout/Page';
export type { PageTheme } from './layout/Page';
export * from './layout';
export { default as CodeSnippet } from './components/CodeSnippet';
export { default as Content } from './layout/Content/Content';
export { default as ContentHeader } from './layout/ContentHeader/ContentHeader';
export { default as DismissableBanner } from './components/DismissableBanner';
export { default as Header } from './layout/Header/Header';
export { default as HeaderLabel } from './layout/HeaderLabel';
export { default as HomepageTimer } from './layout/HomepageTimer';
export { default as InfoCard } from './layout/InfoCard';
export { CardTab, TabbedCard } from './layout/TabbedCard';
export { default as ErrorBoundary } from './layout/ErrorBoundary';
export * from './layout/Sidebar';
export * from './layout/LoginPage';
export { AlertDisplay } from './components/AlertDisplay';
export { default as HorizontalScrollGrid } from './components/HorizontalScrollGrid';
export { default as ProgressCard } from './components/ProgressBars/ProgressCard';
@@ -17,7 +17,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { wrapInTestApp } from '@backstage/test-utils';
import BottomLink from './BottomLink';
import { BottomLink } from './BottomLink';
const minProps = {
title: 'A deepLink title',
@@ -41,13 +41,13 @@ const useStyles = makeStyles<BackstageTheme>(theme => ({
},
}));
export type Props = {
export type BottomLinkProps = {
link: string;
title: string;
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
};
const BottomLink: FC<Props> = ({ link, title, onClick }) => {
export const BottomLink: FC<BottomLinkProps> = ({ link, title, onClick }) => {
const classes = useStyles();
return (
@@ -68,5 +68,3 @@ const BottomLink: FC<Props> = ({ link, title, onClick }) => {
</div>
);
};
export default BottomLink;
+2 -2
View File
@@ -14,5 +14,5 @@
* limitations under the License.
*/
export { default } from './BottomLink';
export type { Props } from './BottomLink';
export { BottomLink } from './BottomLink';
export type { BottomLinkProps } from './BottomLink';
+1 -3
View File
@@ -42,7 +42,7 @@ type Props = {
className?: string;
};
const Content: FC<Props> = ({
export const Content: FC<Props> = ({
className,
stretch,
noPadding,
@@ -62,5 +62,3 @@ const Content: FC<Props> = ({
</article>
);
};
export default Content;
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright 2020 Spotify AB
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { Content } from './Content';
@@ -16,7 +16,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import ContentHeader from './ContentHeader';
import { ContentHeader } from './ContentHeader';
import { wrapInThemedTestApp } from '@backstage/test-utils';
jest.mock('react-helmet', () => {
@@ -75,7 +75,7 @@ type ContentHeaderProps = {
description?: string;
};
const ContentHeader: FC<ContentHeaderProps> = ({
export const ContentHeader: FC<ContentHeaderProps> = ({
description,
title,
titleComponent: TitleComponent = undefined,
@@ -105,5 +105,3 @@ const ContentHeader: FC<ContentHeaderProps> = ({
</Fragment>
);
};
export default ContentHeader;
@@ -0,0 +1,17 @@
/*
* Copyright 2020 Spotify AB
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { ContentHeader } from './ContentHeader';
@@ -26,7 +26,7 @@ type State = {
errorInfo?: ErrorInfo;
};
const ErrorBoundary: ComponentClass<
export const ErrorBoundary: ComponentClass<
Props,
State
> = class ErrorBoundary extends Component<Props, State> {
@@ -57,8 +57,6 @@ const ErrorBoundary: ComponentClass<
}
};
export default ErrorBoundary;
type EProps = {
error?: Error;
slackChannel?: string;
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default } from './ErrorBoundary';
export { ErrorBoundary } from './ErrorBoundary';
@@ -16,7 +16,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import ErrorPage from './ErrorPage';
import { ErrorPage } from './ErrorPage';
import { wrapInThemedTestApp } from '@backstage/test-utils';
describe('<ErrorPage/>', () => {
@@ -18,7 +18,7 @@ import React from 'react';
import { Typography, Link, Grid } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { BackstageTheme } from '@backstage/theme';
import MicDrop from './MicDrop';
import { MicDrop } from './MicDrop';
import { useHistory } from 'react-router';
interface IErrorPageProps {
@@ -38,7 +38,7 @@ const useStyles = makeStyles<BackstageTheme>(theme => ({
},
}));
const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => {
export const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => {
const classes = useStyles();
const history = useHistory();
@@ -63,5 +63,3 @@ const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => {
</Grid>
);
};
export default ErrorPage;
@@ -26,7 +26,7 @@ const useStyles = makeStyles({
},
});
const MicDrop = () => {
export const MicDrop = () => {
const classes = useStyles();
return (
<svg
@@ -158,5 +158,3 @@ const MicDrop = () => {
</svg>
);
};
export default MicDrop;
+1 -1
View File
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default } from './ErrorPage';
export { ErrorPage } from './ErrorPage';
@@ -14,9 +14,9 @@
* limitations under the License.
*/
import React from 'react';
import Header from '.';
import HeaderLabel from '../HeaderLabel';
import Page, { pageTheme } from '../Page';
import { Header } from '.';
import { HeaderLabel } from '../HeaderLabel';
import { Page, pageTheme } from '../Page';
export default {
title: 'Header',
@@ -17,7 +17,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { wrapInThemedTestApp } from '@backstage/test-utils';
import Header from './Header';
import { Header } from './Header';
jest.mock('react-helmet', () => {
return {
+1 -3
View File
@@ -20,7 +20,7 @@ import { Typography, Tooltip, makeStyles } from '@material-ui/core';
import { BackstageTheme } from '@backstage/theme';
import { Theme } from '../Page/Page';
import Waves from './Waves';
import { Waves } from './Waves';
const useStyles = makeStyles<BackstageTheme>(theme => ({
header: {
@@ -193,5 +193,3 @@ export const Header: FC<Props> = ({
</Fragment>
);
};
export default Header;
@@ -17,7 +17,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { pageTheme } from '../Page/PageThemeProvider';
import Waves from './Waves';
import { Waves } from './Waves';
describe('<Waves/>', () => {
it('should render svg', () => {
+1 -3
View File
@@ -35,7 +35,7 @@ type Props = {
theme: PageTheme;
};
const Waves: FC<Props> = ({ theme }) => {
export const Waves: FC<Props> = ({ theme }) => {
const classes = useStyles();
const [color1, color2] = theme.gradient.colors;
@@ -139,5 +139,3 @@ const Waves: FC<Props> = ({ theme }) => {
</svg>
);
};
export default Waves;
+1 -1
View File
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default } from './Header';
export { Header } from './Header';
@@ -17,7 +17,7 @@
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { wrapInThemedTestApp, Keyboard } from '@backstage/test-utils';
import HeaderActionMenu from './HeaderActionMenu';
import { HeaderActionMenu } from './HeaderActionMenu';
describe('<ComponentContextMenu />', () => {
it('renders without any items and without exploding', () => {
@@ -24,7 +24,7 @@ import {
Popover,
ListItemTextProps,
} from '@material-ui/core';
import { default as KebabMenuIcon } from './MenuVertical';
import { VerticalMenuIcon } from './VerticalMenuIcon';
type ActionItemProps = {
label?: ListItemTextProps['primary'];
@@ -66,7 +66,9 @@ export type HeaderActionMenuProps = {
actionItems: ActionItemProps[];
};
const HeaderActionMenu: FC<HeaderActionMenuProps> = ({ actionItems }) => {
export const HeaderActionMenu: FC<HeaderActionMenuProps> = ({
actionItems,
}) => {
const [open, setOpen] = React.useState(false);
const anchorElRef = React.useRef(null);
@@ -84,7 +86,7 @@ const HeaderActionMenu: FC<HeaderActionMenuProps> = ({ actionItems }) => {
padding: 0,
}}
>
<KebabMenuIcon titleAccess="menu" style={{ fontSize: 40 }} />
<VerticalMenuIcon titleAccess="menu" style={{ fontSize: 40 }} />
</IconButton>
<Popover
open={open}
@@ -104,5 +106,3 @@ const HeaderActionMenu: FC<HeaderActionMenuProps> = ({ actionItems }) => {
</Fragment>
);
};
export default HeaderActionMenu;
@@ -17,11 +17,9 @@
import React from 'react';
import SvgIcon, { SvgIconProps } from '@material-ui/core/SvgIcon';
const SvgMenuVertical = (props: SvgIconProps) =>
export const VerticalMenuIcon = (props: SvgIconProps) =>
React.createElement(
SvgIcon,
props,
<path d="M11 3a1 1 0 00-1 1v2a1 1 0 001 1h2a1 1 0 001-1V4a1 1 0 00-1-1h-2zm0 7a1 1 0 00-1 1v2a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 00-1-1h-2zm0 7a1 1 0 00-1 1v2a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 00-1-1h-2z" />,
);
export default SvgMenuVertical;
@@ -0,0 +1,17 @@
/*
* Copyright 2020 Spotify AB
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { HeaderActionMenu } from './HeaderActionMenu';
@@ -17,7 +17,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { wrapInThemedTestApp } from '@backstage/test-utils';
import HeaderLabel from './HeaderLabel';
import { HeaderLabel } from './HeaderLabel';
describe('<HeaderLabel />', () => {
it('should have a label', () => {
@@ -56,7 +56,7 @@ type HeaderLabelProps = {
url?: string;
};
const HeaderLabel: FC<HeaderLabelProps> = ({ label, value, url }) => {
export const HeaderLabel: FC<HeaderLabelProps> = ({ label, value, url }) => {
const classes = useStyles();
const content = (
<HeaderLabelContent
@@ -71,5 +71,3 @@ const HeaderLabel: FC<HeaderLabelProps> = ({ label, value, url }) => {
</span>
);
};
export default HeaderLabel;
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default } from './HeaderLabel';
export { HeaderLabel } from './HeaderLabel';
@@ -15,7 +15,7 @@
*/
import React, { FC } from 'react';
import HeaderLabel from '../HeaderLabel';
import { HeaderLabel } from '../HeaderLabel';
const timeFormat = { hour: '2-digit', minute: '2-digit' };
const utcOptions = { timeZone: 'UTC', ...timeFormat };
@@ -44,7 +44,7 @@ function getTimes() {
return { timeNY, timeUTC, timeTYO, timeSTO };
}
const HomePageTimer: FC<{}> = () => {
export const HomepageTimer: FC<{}> = () => {
const [{ timeNY, timeUTC, timeTYO, timeSTO }, setTimes] = React.useState(
defaultTimes,
);
@@ -70,5 +70,3 @@ const HomePageTimer: FC<{}> = () => {
</>
);
};
export default HomePageTimer;
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default } from './HomepageTimer';
export { HomepageTimer } from './HomepageTimer';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import React, { FC } from 'react';
import InfoCard from '.';
import { InfoCard } from '.';
import { Grid } from '@material-ui/core';
const cardContentStyle = { height: 200, width: 500 };
@@ -17,7 +17,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { wrapInTestApp } from '@backstage/test-utils';
import InfoCard from './InfoCard';
import { InfoCard } from './InfoCard';
const minProps = {
title: 'Some title',
@@ -25,8 +25,8 @@ import {
makeStyles,
} from '@material-ui/core';
import classNames from 'classnames';
import ErrorBoundary from '../ErrorBoundary';
import BottomLink, { Props as BottomLinkProps } from '../BottomLink';
import { ErrorBoundary } from '../ErrorBoundary';
import { BottomLink, BottomLinkProps } from '../BottomLink';
const useStyles = makeStyles(theme => ({
header: {
@@ -137,7 +137,7 @@ type Props = {
noPadding?: boolean;
};
const InfoCard: FC<Props> = ({
export const InfoCard: FC<Props> = ({
title,
subheader,
divider,
@@ -214,5 +214,3 @@ const InfoCard: FC<Props> = ({
</Card>
);
};
export default InfoCard;
+1 -1
View File
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default } from './InfoCard';
export { InfoCard } from './InfoCard';
@@ -16,10 +16,11 @@
import React, { FC, useState } from 'react';
import GitHubIcon from '@material-ui/icons/GitHub';
import Page from '../Page';
import Header from '../Header';
import Content from '../Content/Content';
import ContentHeader from '../ContentHeader/ContentHeader';
import { Page } from '../Page';
import { Header } from '../Header';
import { Content } from '../Content';
import { ContentHeader } from '../ContentHeader';
import { InfoCard } from '../InfoCard/InfoCard';
import {
Grid,
Typography,
@@ -29,7 +30,6 @@ import {
ListItem,
Link,
} from '@material-ui/core';
import InfoCard from '../InfoCard/InfoCard';
enum AuthType {
GitHub,
+1 -3
View File
@@ -35,7 +35,7 @@ type Props = {
theme?: PageTheme;
};
const Page: FC<Props> = ({ theme = pageTheme.home, children }) => {
export const Page: FC<Props> = ({ theme = pageTheme.home, children }) => {
const classes = useStyles();
return (
<Theme.Provider value={theme}>
@@ -43,5 +43,3 @@ const Page: FC<Props> = ({ theme = pageTheme.home, children }) => {
</Theme.Provider>
);
};
export default Page;
+1 -1
View File
@@ -14,6 +14,6 @@
* limitations under the License.
*/
export { default } from './Page';
export { Page } from './Page';
export { gradients, pageTheme } from './PageThemeProvider';
export type { PageTheme } from './PageThemeProvider';
+18 -6
View File
@@ -14,10 +14,22 @@
* limitations under the License.
*/
export * from './Bar';
export * from './Page';
export * from './Items';
export * from './Intro';
export * from './UserBadge';
export * from './config';
export { Sidebar } from './Bar';
export { SidebarPage, SidebarPinStateContext } from './Page';
export type { SidebarPinStateContextType } from './Page';
export {
SidebarDivider,
SidebarItem,
SidebarSearchField,
SidebarSpace,
SidebarSpacer,
} from './Items';
export { IntroCard, SidebarIntro } from './Intro';
export { SidebarUserBadge } from './UserBadge';
export {
SIDEBAR_INTRO_LOCAL_STORAGE,
SidebarContext,
sidebarConfig,
} from './config';
export type { SidebarContextType } from './config';
export { SidebarThemeToggle } from './SidebarThemeToggle';
@@ -26,8 +26,8 @@ import {
Tab,
TabProps,
} from '@material-ui/core';
import BottomLink, { Props as BottomLinkProps } from '../BottomLink';
import ErrorBoundary from '../ErrorBoundary/ErrorBoundary';
import { BottomLink, BottomLinkProps } from '../BottomLink';
import { ErrorBoundary } from '../ErrorBoundary';
const useTabsStyles = makeStyles(theme => ({
root: {
+1 -1
View File
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export * from './TabbedCard';
export { CardTab, TabbedCard } from './TabbedCard';
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright 2020 Spotify AB
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './Content';
export * from './ContentHeader';
export * from './ErrorBoundary';
export * from './Header';
export * from './HeaderLabel';
export * from './HomepageTimer';
export * from './InfoCard';
export * from './LoginPage';
export * from './Page';
export * from './Sidebar';
export * from './TabbedCard';