mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Improve e2e stability (#949)
This commit is contained in:
@@ -19,6 +19,8 @@ interface DatabasesState {
|
||||
loadDatabaseOffers: () => Promise<void>;
|
||||
isFirstResourceCreated: () => boolean;
|
||||
findSelectedDatabase: () => ViewModels.Database;
|
||||
validateDatabaseId: (id: string) => boolean;
|
||||
validateCollectionId: (databaseId: string, collectionId: string) => Promise<boolean>;
|
||||
}
|
||||
|
||||
export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
||||
@@ -129,4 +131,12 @@ export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
||||
|
||||
return selectedNode.collection?.database;
|
||||
},
|
||||
validateDatabaseId: (id: string): boolean => {
|
||||
return !get().databases.some((database) => database.id() === id);
|
||||
},
|
||||
validateCollectionId: async (databaseId: string, collectionId: string): Promise<boolean> => {
|
||||
const database = get().databases.find((db) => db.id() === databaseId);
|
||||
await database.loadCollections();
|
||||
return !database.collections().some((collection) => collection.id() === collectionId);
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user