Skip to content

Commit

Permalink
feat(resource explorer): allow dashboard to only show asset name
Browse files Browse the repository at this point in the history
  • Loading branch information
square-li committed Mar 24, 2023
1 parent ea2b875 commit 5df2c5c
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ResourceExplorer } from '@iot-app-kit/react-components';
import { ResourceExplorerPanel } from '../components/panel';
import { DefaultDashboardMessages } from '../../../messages';
import type { SiteWiseQuery } from '@iot-app-kit/source-iotsitewise';
import type { DescribeAssetResponse } from '@aws-sdk/client-iotsitewise';
import type { AssetSummary, DescribeAssetResponse } from '@aws-sdk/client-iotsitewise';
import type { TableProps, NonCancelableCustomEvent } from '@cloudscape-design/components';

import './style.css';
Expand All @@ -14,6 +14,14 @@ interface StencilResourceExplorerProps {
treeQuery: SiteWiseQuery['assetTree']['fromRoot'];
}

const DEFAULT_COLUMNS = [
{
sortingField: 'name',
id: 'name',
header: 'Asset Name',
cell: ({ name }: AssetSummary) => name,
},
];
export const StencilResourceExplorer: React.FC<StencilResourceExplorerProps> = ({ treeQuery }) => {
const [currentBranchId, setCurrentBranchId] = useState<string | undefined>(undefined);

Expand All @@ -28,7 +36,11 @@ export const StencilResourceExplorer: React.FC<StencilResourceExplorerProps> = (
return (
<div className='stencil-resource-explorer'>
<div className='stencil-resource-explorer-tree'>
<ResourceExplorer query={treeQuery()} onSelectionChange={onSelectionChange} />
<ResourceExplorer
query={treeQuery()}
onSelectionChange={onSelectionChange}
columnDefinitions={DEFAULT_COLUMNS}
/>
</div>

<div className='stencil-resource-explorer-assets'>
Expand Down

0 comments on commit 5df2c5c

Please sign in to comment.