Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Li <[email protected]>
  • Loading branch information
sejli committed Mar 25, 2024
1 parent 8dd316f commit ade9057
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const AssociatedObjectsDetailsFlyout = ({
const { setToast } = useToast();

const DiscoverButton = () => {
// TODO: display button if can be sent to discover
return (
<EuiButtonEmpty
onClick={() => {
Expand Down Expand Up @@ -234,6 +233,7 @@ export const AssociatedObjectsDetailsFlyout = ({
).columns;
setTableColumns(columns);

Check warning on line 234 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx#L234

Added line #L234 was not covered by tests
} catch (error) {
console.error(error);
setToast('Your cache is outdated, refresh databases and tables', 'warning');

Check warning on line 237 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx#L236-L237

Added lines #L236 - L237 were not covered by tests
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
EuiSelectable,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { useToast } from 'public/components/common/toast';
import { useToast } from '../../../../../../public/components/common/toast';
import { ACCELERATION_INDEX_TYPES } from '../../../../../../common/constants/data_sources';
import {
AssociatedObject,
Expand Down Expand Up @@ -209,8 +209,9 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
if (datasource.name && selectedDatabase) {
let databaseCache;
try {
databaseCache = CatalogCacheManager.getOrCreateDataSource(datasource.name);
databaseCache = CatalogCacheManager.getDatabase(datasource.name, selectedDatabase);
} catch (error) {
console.error(error);
setToast('Your cache is outdated, refresh databases and tables', 'warning');
return;

Check warning on line 216 in public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx#L214-L216

Added lines #L214 - L216 were not covered by tests
}
Expand Down Expand Up @@ -249,6 +250,8 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
try {
databaseCache = CatalogCacheManager.getDatabase(datasource.name, selectedDatabase);
} catch (error) {
console.error(error);
setToast('Your cache is outdated, refresh databases and tables', 'warning');
return;

Check warning on line 255 in public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx#L253-L255

Added lines #L253 - L255 were not covered by tests
}
const accelerationsStatus = accelerationsLoadStatus.toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => {
if (clause.field !== ASSC_OBJ_TABLE_ACC_COLUMN_NAME) {
return associatedObject[clause.field] === clause.value;
} else if (clause.field === ASSC_OBJ_TABLE_ACC_COLUMN_NAME) {
console.log('in here');
console.log(associatedObject);
return associatedObject.type !== 'table' && associatedObject.name === clause.value;
}

Expand Down
14 changes: 6 additions & 8 deletions public/framework/catalog_cache/cache_loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,12 @@ export const updateTableColumnsToCache = (
ts.name === tableName ? { ...ts, columns: tableColumns } : { ...ts }
);

if (cachedDatabase.status === CachedDataSourceStatus.Updated) {
CatalogCacheManager.updateDatabase(dataSourceName, {
...cachedDatabase,
tables: newTables,
lastUpdated: currentTime,
status: CachedDataSourceStatus.Updated,
});
}
CatalogCacheManager.updateDatabase(dataSourceName, {
...cachedDatabase,
tables: newTables,
lastUpdated: currentTime,
status: CachedDataSourceStatus.Updated,
});
};

export const updateToCache = (
Expand Down

0 comments on commit ade9057

Please sign in to comment.