Skip to content

Commit

Permalink
preparing release, import release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
evandor committed Jan 6, 2024
1 parent 388cfea commit 213425c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/domain/tabs/CreateGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UndoCommand implements Command<any> {
}

execute(): Promise<ExecutionResult<any>> {
this.tabset.columns = _.filter(this.tabset.columns, (g: Group) => g.id !== this.groupId)
this.tabset.columns = _.filter(this.tabset.columns, (g: TabsetColumn) => g.id !== this.groupId)
return useTabsetService().saveTabset(this.tabset)
.then((res) =>
Promise.resolve(new ExecutionResult("done", `Group was deleted again`)))
Expand Down
26 changes: 2 additions & 24 deletions src/services/TabsetService2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,37 +618,15 @@ export function useTabsetService() {
return false;
}

// const handleAnnotationMessage = (msg: object) => {
// console.log("yyy", msg)
// switch (msg['name' as keyof object]) {
// case "recogito-annotation-created":
// const url = msg['url' as keyof object]
// console.log("url", url)
// const tab = useTabsStore().tabForUrlInSelectedTabset(url)
// if (tab) {
// // if (!tab.annotations) {
// // tab.annotations = new Map()
// // }
// console.log("tab.annotations", tab.annotations)
// //tab.annotations.set(msg['annotation' as keyof object]['id'], msg['annotation' as keyof object])
// tab.annotations.push(msg['annotation' as keyof object])
// }
// console.log("got tab", tab)
// saveCurrentTabset()
// break
// default:
// console.log("unhandled massage", msg)
// }
// }

const tabsToShow = (tabset: Tabset): Tab[] => {
if (tabset.type === TabsetType.DYNAMIC &&
tabset.dynamicTabs && tabset.dynamicTabs.type === DynamicTabSourceType.TAG) {
const results: Tab[] = []
//console.log("checking", tabset.dynamicTabs)
const tag = tabset.dynamicTabs?.config['tags' as keyof object][0]
//console.log("using tag", tag)
_.forEach([...useTabsStore().tabsets.values()], (tabset: Tabset) => {
const tabsets:Tabset[] = [...useTabsStore().tabsets.values()] as Tabset[]
_.forEach(tabsets, (tabset: Tabset) => {
_.forEach(tabset.tabs, (tab: Tab) => {
if (tab.tags?.indexOf(tag) >= 0) {
results.push(tab)
Expand Down
32 changes: 16 additions & 16 deletions src/stores/tabsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const useTabsStore = defineStore('tabs', {
_.filter(
_.flatMap(
_.filter(
_.map([...this.tabsets.values()], (ts: Tabset) => ts),
_.map([...this.tabsets.values()] as Tabset[], (ts: Tabset) => ts),
(ts: Tabset) => ts.status === TabsetStatus.DEFAULT || ts.status === TabsetStatus.FAVORITE),
(ts: Tabset) => ts.tabs), (t: Tab) => t.activatedCount > 1),
(t: Tab) => t.activatedCount, ['desc'])
Expand All @@ -126,15 +126,15 @@ export const useTabsStore = defineStore('tabs', {
return tabset?.name || 'unknown'
}),
getCurrentTabs: (state): Tab[] => {
return state.tabsets.get(state.currentTabsetId)?.tabs || []
return state.tabsets.get(state.currentTabsetId)?.tabs as Tab[] || []
},
getCurrentTabset: (state): Tabset | undefined => {
//console.log("calling getcurrenttabset", state.currentTabsetId)
return state.tabsets.get(state.currentTabsetId)
return state.tabsets.get(state.currentTabsetId) as Tabset
},
getTabset: (state) => {
return (tabsetId: string): Tabset | undefined => {
return state.tabsets.get(tabsetId)
return state.tabsets.get(tabsetId) as Tabset
}
},
currentTabsetName: (state): string | undefined => {
Expand All @@ -146,14 +146,14 @@ export const useTabsStore = defineStore('tabs', {
},

tabForUrlInSelectedTabset: (state): (url: string) => Tab | undefined => {
const tabs: Tab[] = state.tabsets.get(state.currentTabsetId)?.tabs || []
const tabs: Tab[] = state.tabsets.get(state.currentTabsetId)?.tabs as Tab[] || []
return (url: string) => _.find(tabs, t => t.url === url)
},

tabsForUrl: (state): (url: string) => Tab[] => {
return (url: string) => {
const tabs: Tab[] = []
forEach([...state.tabsets.values()], (ts: Tabset) => {
forEach([...state.tabsets.values()] as Tabset[], (ts: Tabset) => {
forEach(ts.tabs, (t: Tab) => {
if (t.url === url) {
tabs.push(t)
Expand All @@ -174,7 +174,7 @@ export const useTabsStore = defineStore('tabs', {
existingInTabset: (state) => {
return (searchName: string, space: Space = null as unknown as Space): Tabset | undefined => {
const trustedName = searchName.replace(STRIP_CHARS_IN_USER_INPUT, '')
return _.find([...state.tabsets.values()], (ts: Tabset) => {
return _.find([...state.tabsets.values()] as Tabset[], (ts: Tabset) => {
if (space === null) {
return ts.name === trustedName?.trim()
} else {
Expand All @@ -188,7 +188,7 @@ export const useTabsStore = defineStore('tabs', {
return (tabId: string): TabAndTabsetId | undefined => {
console.log("call to getTab1", tabId)
for (const [key, value] of state.tabsets) {
const found = useTabsetService().findTabInFolder([value], tabId)
const found = useTabsetService().findTabInFolder([value as Tabset], tabId)
// const found: Tab | undefined = _.find(value.tabs, t => {
// return t.id === tabId
// })
Expand All @@ -204,7 +204,7 @@ export const useTabsStore = defineStore('tabs', {
return (tabId: string): Tabset | undefined => {
for (const [key, value] of state.tabsets) {
if (_.find(value.tabs, t => t.id === tabId)) {
return value
return value as Tabset
}
}
return undefined
Expand All @@ -228,7 +228,7 @@ export const useTabsStore = defineStore('tabs', {
},
rssTabs: (state) => {
const res: Tab[] = []
_.forEach([...state.tabsets.values()], (ts: Tabset) => {
_.forEach([...state.tabsets.values()] as Tabset[], (ts: Tabset) => {
if (ts.status === TabsetStatus.DEFAULT || ts.status === TabsetStatus.FAVORITE) {
_.forEach(ts.tabs, (t: Tab) => {
if (t.extension === UrlExtension.RSS) {
Expand All @@ -241,7 +241,7 @@ export const useTabsStore = defineStore('tabs', {
},
scheduledTabs: (state) => {
const res: Tab[] = []
_.forEach([...state.tabsets.values()], (ts: Tabset) => {
_.forEach([...state.tabsets.values()] as Tabset[], (ts: Tabset) => {
//if (ts.status === TabsetStatus.DEFAULT || ts.status === TabsetStatus.FAVORITE) {
_.forEach(ts.tabs, (t: Tab) => {
if (t.scheduledFor) {
Expand Down Expand Up @@ -342,7 +342,7 @@ export const useTabsStore = defineStore('tabs', {
},

selectCurrentTabset(tabsetId: string): Tabset | undefined {
const found = _.find([...this.tabsets.values()], k => {
const found = _.find([...this.tabsets.values()] as Tabset[], k => {
const ts = k || new Tabset("", "", [])
return ts.id === tabsetId
})
Expand All @@ -359,10 +359,10 @@ export const useTabsStore = defineStore('tabs', {
removeTab(tabset: Tabset, tabId: string) {

//const currentTabset: Tabset = this.tabsets.get(this.currentTabsetId) || new Tabset("", "", [])
tabset.tabs = _.filter(tabset.tabs, (t: Tab) => t.id !== tabId)
tabset.tabs = _.filter(tabset.tabs as Tab[], (t: Tab) => t.id !== tabId)
markDuplicates(tabset)
if (this.pendingTabset) {
this.pendingTabset.tabs = _.filter(this.pendingTabset.tabs, (t: Tab) => t.id !== tabId)
this.pendingTabset.tabs = _.filter(this.pendingTabset.tabs as Tab[], (t: Tab) => t.id !== tabId)
}
},

Expand All @@ -375,7 +375,7 @@ export const useTabsStore = defineStore('tabs', {
color: string | undefined = undefined
): Promise<NewOrReplacedTabset> {

const foundTS: Tabset | undefined = _.find([...this.tabsets.values()], ts => ts.name === tabsetName)
const foundTS: Tabset | undefined = _.find([...this.tabsets.values()] as Tabset[], ts => ts.name === tabsetName)
let ts: Tabset = null as unknown as Tabset
//const tabsetExtensionTab = await ChromeApi.getCurrentTab()
const currentSpace = useSpacesStore().space
Expand Down Expand Up @@ -417,7 +417,7 @@ export const useTabsStore = defineStore('tabs', {

getOrCreateSpecialTabset(ident: SpecialTabsetIdent, type: TabsetType): Tabset {
console.log("creating special tabset", ident, type)
const foundTS: Tabset | undefined = _.find([...this.tabsets.values()], ts => ts.id === ident.toString())
const foundTS: Tabset | undefined = _.find([...this.tabsets.values()] as Tabset[], ts => ts.id === ident.toString())
let ts: Tabset = null as unknown as Tabset
if (foundTS) {
ts = foundTS
Expand Down

0 comments on commit 213425c

Please sign in to comment.