mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-06 01:49:12 +00:00
cleaning
This commit is contained in:
parent
82ea06e3d0
commit
bde32664bd
@ -8,11 +8,7 @@ export interface MaterializedViewComponentProps {
|
||||
}
|
||||
|
||||
export const MaterializedViewComponent: React.FC<MaterializedViewComponentProps> = ({ collection }) => {
|
||||
// If this container itself defines a materialized view, skip rendering this component.
|
||||
const isTargetContainer = !!collection?.materializedViewDefinition();
|
||||
if (isTargetContainer) {
|
||||
return null;
|
||||
}
|
||||
const isSourceContainer = !!collection?.materializedViews();
|
||||
|
||||
return (
|
||||
<Stack tokens={{ childrenGap: 8 }} styles={{ root: { maxWidth: 600 } }}>
|
||||
@ -26,7 +22,7 @@ export const MaterializedViewComponent: React.FC<MaterializedViewComponentProps>
|
||||
about how to define materialized views and how to use them.
|
||||
</Text>
|
||||
</Stack>
|
||||
<MaterializedViewSourceComponent collection={collection} />
|
||||
{isSourceContainer && <MaterializedViewSourceComponent collection={collection} />}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
@ -20,11 +20,11 @@ export const MaterializedViewSourceComponent: React.FC<MaterializedViewSourceCom
|
||||
let definition = "";
|
||||
let partitionKey: string[] = [];
|
||||
useDatabases.getState().databases.forEach((database) => {
|
||||
database.collections().forEach((coll) => {
|
||||
if (coll.id() === viewId) {
|
||||
const materializedViewDefinition = coll.materializedViewDefinition();
|
||||
database.collections().forEach((collection) => {
|
||||
if (collection.id() === viewId) {
|
||||
const materializedViewDefinition = collection.materializedViewDefinition();
|
||||
materializedViewDefinition && (definition = materializedViewDefinition.definition);
|
||||
coll.partitionKey?.paths && (partitionKey = coll.partitionKey.paths);
|
||||
collection.partitionKey?.paths && (partitionKey = collection.partitionKey.paths);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user