mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 10:51:30 +00:00
Compare commits
5 Commits
index-arch
...
sampledb_e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cf0eb511a | ||
|
|
f7b7d135df | ||
|
|
1ab6bf3d81 | ||
|
|
ac8dbbc0d2 | ||
|
|
edfd6cfc30 |
@@ -1158,7 +1158,7 @@ export default class Explorer {
|
|||||||
|
|
||||||
public async refreshSampleData(): Promise<void> {
|
public async refreshSampleData(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (!userContext.sampleDataConnectionInfo) {
|
if (!userContext.sampleDataConnectionInfo || useDatabases.getState().sampleDataResourceTokenCollection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const collection: DataModels.Collection = await readSampleCollection();
|
const collection: DataModels.Collection = await readSampleCollection();
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
this.prevHeaderStatus = undefined;
|
this.prevHeaderStatus = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
this.componentDidUpdate(this.props, this.state);
|
||||||
|
}
|
||||||
|
|
||||||
public componentDidUpdate(
|
public componentDidUpdate(
|
||||||
prevProps: NotificationConsoleComponentProps,
|
prevProps: NotificationConsoleComponentProps,
|
||||||
prevState: NotificationConsoleComponentState,
|
prevState: NotificationConsoleComponentState,
|
||||||
@@ -265,20 +269,29 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
};
|
};
|
||||||
|
|
||||||
private updateConsoleData = (prevProps: NotificationConsoleComponentProps): void => {
|
private updateConsoleData = (prevProps: NotificationConsoleComponentProps): void => {
|
||||||
|
let updatedConsoleData: ConsoleData[] = [...this.state.allConsoleData];
|
||||||
|
let refresh = false;
|
||||||
|
|
||||||
if (!this.areConsoleDataEqual(this.props.consoleData, prevProps.consoleData)) {
|
if (!this.areConsoleDataEqual(this.props.consoleData, prevProps.consoleData)) {
|
||||||
this.setState({ allConsoleData: [this.props.consoleData, ...this.state.allConsoleData] });
|
updatedConsoleData = [this.props.consoleData, ...updatedConsoleData];
|
||||||
|
refresh = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (this.props.inProgressConsoleDataIdToBeDeleted) {
|
||||||
this.props.inProgressConsoleDataIdToBeDeleted &&
|
const hasMatchingItem = updatedConsoleData.some(
|
||||||
prevProps.inProgressConsoleDataIdToBeDeleted !== this.props.inProgressConsoleDataIdToBeDeleted
|
|
||||||
) {
|
|
||||||
const allConsoleData = this.state.allConsoleData.filter(
|
|
||||||
(data: ConsoleData) =>
|
(data: ConsoleData) =>
|
||||||
!(data.type === ConsoleDataType.InProgress && data.id === this.props.inProgressConsoleDataIdToBeDeleted),
|
data.type === ConsoleDataType.InProgress && data.id === this.props.inProgressConsoleDataIdToBeDeleted,
|
||||||
);
|
);
|
||||||
this.setState({ allConsoleData });
|
|
||||||
|
if (hasMatchingItem) {
|
||||||
|
updatedConsoleData = updatedConsoleData.filter(
|
||||||
|
(data: ConsoleData) =>
|
||||||
|
!(data.type === ConsoleDataType.InProgress && data.id === this.props.inProgressConsoleDataIdToBeDeleted),
|
||||||
|
);
|
||||||
|
refresh = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
refresh && this.setState({ allConsoleData: updatedConsoleData });
|
||||||
};
|
};
|
||||||
|
|
||||||
private areConsoleDataEqual = (currentData: ConsoleData, prevData: ConsoleData): boolean => {
|
private areConsoleDataEqual = (currentData: ConsoleData, prevData: ConsoleData): boolean => {
|
||||||
|
|||||||
Reference in New Issue
Block a user