forked from openshift/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
327b13c
commit 4d3b230
Showing
21 changed files
with
189 additions
and
127 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
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
76 changes: 27 additions & 49 deletions
76
frontend/packages/topology/src/components/page/TopologyDataRenderer.tsx
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 |
---|---|---|
@@ -1,64 +1,42 @@ | ||
import * as React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { observer } from '@patternfly/react-topology'; | ||
import { HintBlock, StatusBox } from '@console/internal/components/utils'; | ||
import EmptyState from '@console/dev-console/src/components/EmptyState'; | ||
import { StatusBox } from '@console/internal/components/utils'; | ||
import { ModelContext, ExtensibleModel } from '../../data-transforms/ModelContext'; | ||
import TopologyView from './TopologyView'; | ||
import { TopologyViewType } from '../../topology-types'; | ||
import { FilterProvider } from '../../filters/FilterProvider'; | ||
|
||
interface TopologyDataRendererProps { | ||
viewType: TopologyViewType; | ||
title: string; | ||
} | ||
|
||
const TopologyDataRenderer: React.FC<TopologyDataRendererProps> = observer( | ||
({ viewType, title }) => { | ||
const { t } = useTranslation(); | ||
const { namespace, model, loaded, loadError } = React.useContext<ExtensibleModel>(ModelContext); | ||
const EmptyMsg = React.useCallback( | ||
() => ( | ||
<EmptyState | ||
title={title} | ||
hintBlock={ | ||
<HintBlock title={t('topology~No resources found')}> | ||
<p> | ||
{t( | ||
'topology~To add content to your Project, create an Application, component or service using one of these options.', | ||
)} | ||
</p> | ||
</HintBlock> | ||
} | ||
/> | ||
), | ||
[t, title], | ||
); | ||
const TopologyDataRenderer: React.FC<TopologyDataRendererProps> = observer(({ viewType }) => { | ||
const { t } = useTranslation(); | ||
const { namespace, model, loaded, loadError } = React.useContext<ExtensibleModel>(ModelContext); | ||
|
||
return ( | ||
<StatusBox | ||
skeleton={ | ||
viewType === TopologyViewType.list && ( | ||
<div className="co-m-pane__body skeleton-overview"> | ||
<div className="skeleton-overview--head" /> | ||
<div className="skeleton-overview--tile" /> | ||
<div className="skeleton-overview--tile" /> | ||
<div className="skeleton-overview--tile" /> | ||
</div> | ||
) | ||
} | ||
data={model ? model.nodes : null} | ||
label={t('topology~Topology')} | ||
loaded={loaded} | ||
loadError={loadError} | ||
EmptyMsg={EmptyMsg} | ||
> | ||
<FilterProvider> | ||
<TopologyView viewType={viewType} model={model} namespace={namespace} /> | ||
</FilterProvider> | ||
</StatusBox> | ||
); | ||
}, | ||
); | ||
return ( | ||
<StatusBox | ||
skeleton={ | ||
viewType === TopologyViewType.list && ( | ||
<div className="co-m-pane__body skeleton-overview"> | ||
<div className="skeleton-overview--head" /> | ||
<div className="skeleton-overview--tile" /> | ||
<div className="skeleton-overview--tile" /> | ||
<div className="skeleton-overview--tile" /> | ||
</div> | ||
) | ||
} | ||
data={model} | ||
label={t('topology~Topology')} | ||
loaded={loaded} | ||
loadError={loadError} | ||
> | ||
<FilterProvider> | ||
<TopologyView viewType={viewType} model={model} namespace={namespace} /> | ||
</FilterProvider> | ||
</StatusBox> | ||
); | ||
}); | ||
|
||
export default TopologyDataRenderer; |
45 changes: 45 additions & 0 deletions
45
frontend/packages/topology/src/components/page/TopologyEmptyState.tsx
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,45 @@ | ||
import * as React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { Trans, useTranslation } from 'react-i18next'; | ||
import { | ||
Button, | ||
EmptyState, | ||
EmptyStateIcon, | ||
EmptyStateSecondaryActions, | ||
EmptyStateVariant, | ||
Title, | ||
} from '@patternfly/react-core'; | ||
import { TopologyIcon } from '@patternfly/react-icons'; | ||
|
||
type TopologyEmptyStateProps = { | ||
setIsQuickSearchOpen: (isOpen: boolean) => void; | ||
}; | ||
|
||
const TopologyEmptyState: React.FC<TopologyEmptyStateProps> = ({ setIsQuickSearchOpen }) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<EmptyState className="odc-topology__empty-state" variant={EmptyStateVariant.full}> | ||
<EmptyStateIcon variant="container" component={TopologyIcon} /> | ||
<Title headingLevel="h3" size="lg"> | ||
{t('topology~No resources found')} | ||
</Title> | ||
<EmptyStateSecondaryActions> | ||
<Trans t={t} ns="topology"> | ||
<Button | ||
isInline | ||
variant="link" | ||
onClick={() => { | ||
setIsQuickSearchOpen(true); | ||
}} | ||
> | ||
Start building your application | ||
</Button>{' '} | ||
or visit the <Link to="/add">Add page</Link> for more details. | ||
</Trans> | ||
</EmptyStateSecondaryActions> | ||
</EmptyState> | ||
); | ||
}; | ||
|
||
export default React.memo(TopologyEmptyState); |
Oops, something went wrong.