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