Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab 523 spaces module #208

Merged
merged 6 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TAB-523 refactor spaces into module - wip
  • Loading branch information
evandor committed Apr 22, 2024
commit 3746eecbdc97bb2a6244d6234417691de1d0aa5b
22 changes: 0 additions & 22 deletions src/services/IndexedDbPersistenceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,6 @@ class IndexedDbPersistenceService implements PersistenceService {
}
}

async loadSpaces(): Promise<void> {
console.debug(" loading spaces...")
const spacesStore = useSpacesStore()
const keys: IDBValidKey[] = await this.db.getAllKeys('spaces')
_.forEach(keys, key => {
this.db.get('spaces', key)
.then((space: Space) => {
spacesStore.putSpace(space)
})
.catch(err => console.log("err", err))
})
}

async saveTabset(tabset: Tabset): Promise<IDBValidKey> {
return await this.db.put('tabsets', JSON.parse(JSON.stringify(tabset)), tabset.id);
}
Expand Down Expand Up @@ -386,15 +373,6 @@ class IndexedDbPersistenceService implements PersistenceService {
await this.db.put('blobs', blobsForTab, tabId)
}

async addSpace(space: Space): Promise<void> {
return await this.db.put('spaces', space, space.id)
.then(() => Promise.resolve())
}

deleteSpace(spaceId: string): Promise<void> {
return this.db.delete('spaces', spaceId)
}

addGroup(group: chrome.tabGroups.TabGroup): Promise<any> {
console.debug("adding group", group)
return this.db.add('groups', group, group.title)
Expand Down
8 changes: 3 additions & 5 deletions src/services/PersistenceService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Tabset} from "src/models/Tabset";
import {Space} from "src/spaces/models/Space";
import {Tab} from "src/models/Tab";
import {Notification} from "src/models/Notification";
import {SearchDoc} from "src/models/SearchDoc";
Expand Down Expand Up @@ -50,10 +49,9 @@ interface PersistenceService {

saveRequest(url: string, requestInfo: RequestInfo): Promise<void>

loadSpaces(): Promise<any>

addSpace(space: Space): Promise<any>
deleteSpace(spaceId: string): void;
// loadSpaces(): Promise<any>
// addSpace(space: Space): Promise<any>
// deleteSpace(spaceId: string): void;

//loadCategories(): Promise<any>

Expand Down
2 changes: 1 addition & 1 deletion src/spaces/pages/SidePanelSpacesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ async function getTabsetsForSpaces() {
}
],['desc','asc'] ))
});
console.log("res", res)
// console.log("res", res)
return res;
}

Expand Down
8 changes: 5 additions & 3 deletions src/spaces/persistence/IndexedDbSpacesStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ class IndexedDbSpacesStorage implements SpacesPersistence {
});
}

addSpace(space: Space): Promise<any> {
return Promise.resolve(undefined);
async addSpace(space: Space): Promise<any> {
return await this.db.put(this.STORE_IDENT, space, space.id)
.then(() => Promise.resolve())
}

compactDb(): Promise<any> {
return Promise.resolve(undefined);
}

deleteSpace(spaceId: string): void {
async deleteSpace(spaceId: string) {
return this.db.delete(this.STORE_IDENT, spaceId)
}

async loadSpaces(): Promise<any> {
Expand Down
2 changes: 1 addition & 1 deletion src/windows
Loading