mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-06 09:58:25 +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 }) => {
|
export const MaterializedViewComponent: React.FC<MaterializedViewComponentProps> = ({ collection }) => {
|
||||||
// If this container itself defines a materialized view, skip rendering this component.
|
const isSourceContainer = !!collection?.materializedViews();
|
||||||
const isTargetContainer = !!collection?.materializedViewDefinition();
|
|
||||||
if (isTargetContainer) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack tokens={{ childrenGap: 8 }} styles={{ root: { maxWidth: 600 } }}>
|
<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.
|
about how to define materialized views and how to use them.
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
<MaterializedViewSourceComponent collection={collection} />
|
{isSourceContainer && <MaterializedViewSourceComponent collection={collection} />}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -20,11 +20,11 @@ export const MaterializedViewSourceComponent: React.FC<MaterializedViewSourceCom
|
|||||||
let definition = "";
|
let definition = "";
|
||||||
let partitionKey: string[] = [];
|
let partitionKey: string[] = [];
|
||||||
useDatabases.getState().databases.forEach((database) => {
|
useDatabases.getState().databases.forEach((database) => {
|
||||||
database.collections().forEach((coll) => {
|
database.collections().forEach((collection) => {
|
||||||
if (coll.id() === viewId) {
|
if (collection.id() === viewId) {
|
||||||
const materializedViewDefinition = coll.materializedViewDefinition();
|
const materializedViewDefinition = collection.materializedViewDefinition();
|
||||||
materializedViewDefinition && (definition = materializedViewDefinition.definition);
|
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