mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Copilot user db (#1672)
* Implement copilot for user database * Fix minor bugs * fix bugs * Add user database copilot * Add placeholder text on copilot * Add AFEC adn killswitch * Add new v2 sampledatabase endpoint * Add telemetry * fix telemetry bug * Add query edited telemetry * add authorization header * Add back to the staging env for phoenix * point to stage for phoenix * Preview commit for test env * Preview link for staging * change the staging url * fix lint, unit tests * fix lint, unit tests * fix formatting
This commit is contained in:
@@ -14,7 +14,7 @@ interface DatabasesState {
|
||||
deleteDatabase: (database: ViewModels.Database) => void;
|
||||
clearDatabases: () => void;
|
||||
isSaveQueryEnabled: () => boolean;
|
||||
findDatabaseWithId: (databaseId: string) => ViewModels.Database;
|
||||
findDatabaseWithId: (databaseId: string, isSampleDatabase?: boolean) => ViewModels.Database;
|
||||
isLastNonEmptyDatabase: () => boolean;
|
||||
findCollection: (databaseId: string, collectionId: string) => ViewModels.Collection;
|
||||
isLastCollection: () => boolean;
|
||||
@@ -33,7 +33,7 @@ export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
||||
updateDatabase: (updatedDatabase: ViewModels.Database) =>
|
||||
set((state) => {
|
||||
const updatedDatabases = state.databases.map((database: ViewModels.Database) => {
|
||||
if (database.id() === updatedDatabase.id()) {
|
||||
if (database?.id() === updatedDatabase?.id()) {
|
||||
return updatedDatabase;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@ export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
||||
}
|
||||
return true;
|
||||
},
|
||||
findDatabaseWithId: (databaseId: string) => get().databases.find((db) => databaseId === db.id()),
|
||||
findDatabaseWithId: (databaseId: string, isSampleDatabase?: boolean) => {
|
||||
return get().databases.find((db) => databaseId === db.id() && db.isSampleDB === isSampleDatabase);
|
||||
},
|
||||
isLastNonEmptyDatabase: () => {
|
||||
const databases = get().databases;
|
||||
return databases.length === 1 && (databases[0].collections()?.length > 0 || !!databases[0].offer());
|
||||
|
||||
Reference in New Issue
Block a user