Skip to content

Commit

Permalink
updating empty state
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Li <[email protected]>
  • Loading branch information
sejli committed Mar 20, 2024
1 parent 15e043a commit be6f8bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5046,34 +5046,10 @@ exports[`AssociatedObjectsTab Component renders tab with no databases or objects
Add databases and tables to your data source or use Query Workbench
</p>
</EuiText>
<EuiLink
external={true}
onClick={[Function]}
>
Learn more
</EuiLink>
</React.Fragment>
}
button={
<EuiButton
iconSide="right"
iconType="popout"
onClick={[Function]}
>
Query Workbench
</EuiButton>
}
>
<div
button={
<EuiButton
iconSide="right"
iconType="popout"
onClick={[Function]}
>
Query Workbench
</EuiButton>
}
className="euiEmptyPrompt"
>
<EuiTextColor
Expand All @@ -5098,19 +5074,6 @@ exports[`AssociatedObjectsTab Component renders tab with no databases or objects
</p>
</div>
</EuiText>
<EuiLink
external={true}
onClick={[Function]}
>
<button
className="euiLink euiLink--primary"
disabled={false}
onClick={[Function]}
type="button"
>
Learn more
</button>
</EuiLink>
</div>
</EuiText>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
if (datasource.name) {
const datasourceCache = CatalogCacheManager.getOrCreateDataSource(datasource.name);
if (
datasourceCache.status === CachedDataSourceStatus.Empty &&
(datasourceCache.status === CachedDataSourceStatus.Empty ||
datasourceCache.status === CachedDataSourceStatus.Failed) &&
!isCatalogCacheFetching(databasesLoadStatus)
) {
startLoadingDatabases(datasource.name);
Expand Down Expand Up @@ -209,7 +210,8 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
datasource.name
);
if (
databaseCache.status === CachedDataSourceStatus.Empty &&
(databaseCache.status === CachedDataSourceStatus.Empty ||
databaseCache.status === CachedDataSourceStatus.Failed) &&
!isCatalogCacheFetching(tablesLoadStatus)
) {
startLoadingTables(datasource.name, selectedDatabase);
Expand All @@ -218,7 +220,9 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
setCachedTables(databaseCache.tables);
}
if (
(accelerationsCache.status === CachedDataSourceStatus.Empty || isRefreshing) &&
(accelerationsCache.status === CachedDataSourceStatus.Empty ||
accelerationsCache.status === CachedDataSourceStatus.Failed ||
isRefreshing) &&
!isCatalogCacheFetching(accelerationsLoadStatus)
) {
startLoadingAccelerations(datasource.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,16 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiButton, EuiEmptyPrompt, EuiLink, EuiText } from '@elastic/eui';
import { EuiEmptyPrompt, EuiText } from '@elastic/eui';
import React from 'react';
import { LoadCacheType } from '../../../../../../../common/types/data_connections';
import { coreRefs } from '../../../../../../framework/core_refs';

interface AssociatedObjectsTabEmptyProps {
cacheType: LoadCacheType;
}

export const AssociatedObjectsTabEmpty: React.FC<AssociatedObjectsTabEmptyProps> = (props) => {
const { cacheType } = props;
const { application } = coreRefs;

const QueryWorkbenchButton = (
<EuiButton
iconSide="right"
onClick={() => application!.navigateToApp('opensearch-query-workbench')}
iconType="popout"
>
Query Workbench
</EuiButton>
);

let titleText;
let bodyText;
Expand All @@ -51,12 +39,8 @@ export const AssociatedObjectsTabEmpty: React.FC<AssociatedObjectsTabEmptyProps>
<h4>{titleText}</h4>
<p>{bodyText}</p>
</EuiText>
<EuiLink onClick={() => console.log()} external>
Learn more
</EuiLink>
</>
}
button={QueryWorkbenchButton}
/>
);
};

0 comments on commit be6f8bc

Please sign in to comment.