mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 13:07:58 +00:00
Fixed some hosttree bugs
This commit is contained in:
parent
2ecc664e48
commit
7eb41630db
@ -25,6 +25,7 @@ function enterText(title = '', description = '', value = '') {
|
||||
instance.$close();
|
||||
resolve(event.detail.value);
|
||||
});
|
||||
instance.$on('close', () => resolve(undefined));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -59,14 +59,17 @@ async function refresh() {
|
||||
}
|
||||
|
||||
for (const [ dbKey, database ] of Object.entries(host.databases)) {
|
||||
if (!dbNames.includes(dbKey)) {
|
||||
if (!database.new && !dbNames.includes(dbKey)) {
|
||||
delete host.databases[dbKey];
|
||||
continue;
|
||||
}
|
||||
|
||||
database.key = dbKey;
|
||||
database.hostKey = hostKey;
|
||||
database.collections = database.collections || {};
|
||||
|
||||
delete database.new;
|
||||
|
||||
database.open = async function() {
|
||||
const progress = startProgress(`Opening database "${dbKey}"…`);
|
||||
const { collections: collNames, stats } = await OpenDatabase(hostKey, dbKey);
|
||||
@ -81,8 +84,9 @@ async function refresh() {
|
||||
}
|
||||
|
||||
for (const [ collKey, collection ] of Object.entries(database.collections)) {
|
||||
if (!collNames.includes(collKey)) {
|
||||
if (!collection.new && !collNames.includes(collKey)) {
|
||||
delete database.collections[collKey];
|
||||
continue;
|
||||
}
|
||||
|
||||
collection.key = collKey;
|
||||
@ -90,6 +94,8 @@ async function refresh() {
|
||||
collection.hostKey = hostKey;
|
||||
collection.indexes = collection.indexes || [];
|
||||
|
||||
delete collection.new;
|
||||
|
||||
collection.open = async function() {
|
||||
const progress = startProgress(`Opening database "${dbKey}"…`);
|
||||
const stats = await OpenCollection(hostKey, dbKey, collKey);
|
||||
@ -262,8 +268,8 @@ async function refresh() {
|
||||
database.newCollection = async function() {
|
||||
const name = await dialogs.enterText('Create a collection', 'Note: collections in MongoDB do not exist until they have at least one item. Your new collection will not persist on the server; fill it to have it created.', '');
|
||||
if (name) {
|
||||
database.collections[name] = {};
|
||||
await refresh();
|
||||
database.collections[name] = { key: name, new: true };
|
||||
await database.open();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -271,8 +277,8 @@ async function refresh() {
|
||||
host.newDatabase = async function() {
|
||||
const name = await dialogs.enterText('Create a database', 'Enter the database name. Note: databases in MongoDB do not exist until they have a collection and an item. Your new database will not persist on the server; fill it to have it created.', '');
|
||||
if (name) {
|
||||
host.databases[name] = {};
|
||||
await refresh();
|
||||
host.databases[name] = { key: name, new: true };
|
||||
await host.open();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user