mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 13:35:04 +02:00
Add workbench tabs (#6788)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -64,6 +64,7 @@ export function createModel (builder: Builder): void {
|
||||
core.space.Model,
|
||||
{
|
||||
label: chunter.string.ApplicationLabelChunter,
|
||||
locationDataResolver: chunter.function.LocationDataResolver,
|
||||
icon: chunter.icon.Chunter,
|
||||
alias: chunterId,
|
||||
hidden: false,
|
||||
@@ -87,6 +88,11 @@ export function createModel (builder: Builder): void {
|
||||
chunter.ids.ChatWidget
|
||||
)
|
||||
|
||||
builder.createDoc(presentation.class.ComponentPointExtension, core.space.Model, {
|
||||
extension: workbench.extensions.WorkbenchTabExtensions,
|
||||
component: chunter.component.WorkbenchTabExtension
|
||||
})
|
||||
|
||||
const spaceClasses = [chunter.class.Channel, chunter.class.DirectMessage]
|
||||
|
||||
spaceClasses.forEach((spaceClass) => {
|
||||
|
||||
@@ -22,7 +22,7 @@ import type { IntlString, Resource } from '@hcengineering/platform'
|
||||
import { mergeIds } from '@hcengineering/platform'
|
||||
import type { AnyComponent, Location } from '@hcengineering/ui/src/types'
|
||||
import type { Action, ActionCategory, ViewAction, Viewlet, ViewletDescriptor } from '@hcengineering/view'
|
||||
import { type WidgetTab } from '@hcengineering/workbench'
|
||||
import { type WidgetTab, type LocationData } from '@hcengineering/workbench'
|
||||
|
||||
export default mergeIds(chunterId, chunter, {
|
||||
component: {
|
||||
@@ -34,7 +34,8 @@ export default mergeIds(chunterId, chunter, {
|
||||
ChatWidgetTab: '' as AnyComponent,
|
||||
ChatMessageNotificationLabel: '' as AnyComponent,
|
||||
ThreadNotificationPresenter: '' as AnyComponent,
|
||||
JoinChannelNotificationPresenter: '' as AnyComponent
|
||||
JoinChannelNotificationPresenter: '' as AnyComponent,
|
||||
WorkbenchTabExtension: '' as AnyComponent
|
||||
},
|
||||
action: {
|
||||
MarkCommentUnread: '' as Ref<Action>,
|
||||
@@ -108,7 +109,8 @@ export default mergeIds(chunterId, chunter, {
|
||||
ReplyToThread: '' as Resource<(doc: ActivityMessage, event: MouseEvent) => Promise<void>>,
|
||||
CanReplyToThread: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
|
||||
GetMessageLink: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>,
|
||||
CloseChatWidgetTab: '' as Resource<(tab: WidgetTab) => Promise<void>>
|
||||
CloseChatWidgetTab: '' as Resource<(tab: WidgetTab) => Promise<void>>,
|
||||
LocationDataResolver: '' as Resource<(loc: Location) => Promise<LocationData>>
|
||||
},
|
||||
filter: {
|
||||
ChatMessagesFilter: '' as Resource<(message: ActivityMessage, _class?: Ref<Doc>) => boolean>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"@hcengineering/model-attachment": "^0.6.0",
|
||||
"@hcengineering/model-chunter": "^0.6.0",
|
||||
"@hcengineering/model-core": "^0.6.0",
|
||||
"@hcengineering/model-guest": "^0.6.0",
|
||||
"@hcengineering/model-notification": "^0.6.0",
|
||||
"@hcengineering/model-presentation": "^0.6.0",
|
||||
"@hcengineering/model-view": "^0.6.0",
|
||||
@@ -48,7 +49,7 @@
|
||||
"@hcengineering/templates": "^0.6.11",
|
||||
"@hcengineering/ui": "^0.6.15",
|
||||
"@hcengineering/view": "^0.6.13",
|
||||
"@hcengineering/model-guest": "^0.6.0",
|
||||
"@hcengineering/workbench": "^0.6.16",
|
||||
"cross-fetch": "^3.1.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,6 +324,7 @@ export function createModel (builder: Builder): void {
|
||||
hidden: false,
|
||||
// component: contact.component.ContactsTabs,
|
||||
locationResolver: contact.resolver.Location,
|
||||
locationDataResolver: contact.resolver.LocationData,
|
||||
navigatorModel: {
|
||||
spaces: [],
|
||||
specials: [
|
||||
|
||||
@@ -21,9 +21,10 @@ import { type ObjectSearchCategory, type ObjectSearchFactory } from '@hcengineer
|
||||
import { type NotificationGroup } from '@hcengineering/notification'
|
||||
import { type IntlString, mergeIds, type Resource } from '@hcengineering/platform'
|
||||
import { type TemplateFieldFunc } from '@hcengineering/templates'
|
||||
import type { AnyComponent } from '@hcengineering/ui/src/types'
|
||||
import { type AnyComponent, type Location } from '@hcengineering/ui/src/types'
|
||||
import { type Action, type ActionCategory, type ViewAction } from '@hcengineering/view'
|
||||
import { type ChatMessageViewlet } from '@hcengineering/chunter'
|
||||
import { type LocationData } from '@hcengineering/workbench'
|
||||
|
||||
export default mergeIds(contactId, contact, {
|
||||
activity: {
|
||||
@@ -63,7 +64,6 @@ export default mergeIds(contactId, contact, {
|
||||
ChannelIcon: '' as AnyComponent
|
||||
},
|
||||
string: {
|
||||
Persons: '' as IntlString,
|
||||
SearchEmployee: '' as IntlString,
|
||||
SearchPerson: '' as IntlString,
|
||||
SearchOrganization: '' as IntlString,
|
||||
@@ -97,7 +97,6 @@ export default mergeIds(contactId, contact, {
|
||||
|
||||
ConfigLabel: '' as IntlString,
|
||||
ConfigDescription: '' as IntlString,
|
||||
Employees: '' as IntlString,
|
||||
People: '' as IntlString
|
||||
},
|
||||
completion: {
|
||||
@@ -142,5 +141,8 @@ export default mergeIds(contactId, contact, {
|
||||
ChannelIdentifierProvider: '' as Resource<(client: Client, ref: Ref<Doc>, doc?: Doc) => Promise<string>>,
|
||||
SetPersonStore: '' as Resource<(manager: DocManager<any>) => void>,
|
||||
PersonFilterFunction: '' as Resource<(doc: Doc, target: Doc) => boolean>
|
||||
},
|
||||
resolver: {
|
||||
LocationData: '' as Resource<(loc: Location) => Promise<LocationData>>
|
||||
}
|
||||
})
|
||||
|
||||
@@ -30,13 +30,14 @@
|
||||
"dependencies": {
|
||||
"@hcengineering/core": "^0.6.32",
|
||||
"@hcengineering/model": "^0.6.11",
|
||||
"@hcengineering/platform": "^0.6.11",
|
||||
"@hcengineering/model-core": "^0.6.0",
|
||||
"@hcengineering/workbench": "^0.6.16",
|
||||
"@hcengineering/model-preference": "^0.6.0",
|
||||
"@hcengineering/model-presentation": "^0.6.0",
|
||||
"@hcengineering/model-view": "^0.6.0",
|
||||
"@hcengineering/platform": "^0.6.11",
|
||||
"@hcengineering/ui": "^0.6.15",
|
||||
"@hcengineering/view": "^0.6.13",
|
||||
"@hcengineering/model-view": "^0.6.0",
|
||||
"@hcengineering/workbench-resources": "^0.6.1",
|
||||
"@hcengineering/model-preference": "^0.6.0"
|
||||
"@hcengineering/workbench": "^0.6.16",
|
||||
"@hcengineering/workbench-resources": "^0.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,12 @@ import type {
|
||||
WidgetPreference,
|
||||
WidgetTab,
|
||||
WidgetType,
|
||||
SidebarEvent
|
||||
SidebarEvent,
|
||||
WorkbenchTab
|
||||
} from '@hcengineering/workbench'
|
||||
import { type AnyComponent } from '@hcengineering/ui'
|
||||
import core, { TClass, TDoc, TTx } from '@hcengineering/model-core'
|
||||
import presentation from '@hcengineering/model-presentation'
|
||||
|
||||
import workbench from './plugin'
|
||||
|
||||
@@ -98,6 +100,13 @@ export class TTxSidebarEvent extends TTx implements TxSidebarEvent {
|
||||
params!: Record<string, any>
|
||||
}
|
||||
|
||||
@Model(workbench.class.WorkbenchTab, preference.class.Preference)
|
||||
@UX(workbench.string.Tab)
|
||||
export class TWorkbenchTab extends TPreference implements WorkbenchTab {
|
||||
location!: string
|
||||
isPinned!: boolean
|
||||
}
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
builder.createModel(
|
||||
TApplication,
|
||||
@@ -106,7 +115,8 @@ export function createModel (builder: Builder): void {
|
||||
TApplicationNavModel,
|
||||
TWidget,
|
||||
TWidgetPreference,
|
||||
TTxSidebarEvent
|
||||
TTxSidebarEvent,
|
||||
TWorkbenchTab
|
||||
)
|
||||
|
||||
builder.mixin(workbench.class.Application, core.class.Class, view.mixin.ObjectPresenter, {
|
||||
@@ -133,6 +143,52 @@ export function createModel (builder: Builder): void {
|
||||
mode: ['workbench']
|
||||
}
|
||||
})
|
||||
|
||||
createAction(builder, {
|
||||
action: workbench.actionImpl.PinTab,
|
||||
label: view.string.Pin,
|
||||
icon: view.icon.Pin,
|
||||
input: 'focus',
|
||||
category: workbench.category.Workbench,
|
||||
target: workbench.class.WorkbenchTab,
|
||||
query: {
|
||||
isPinned: false
|
||||
},
|
||||
context: {
|
||||
mode: 'context',
|
||||
group: 'edit'
|
||||
}
|
||||
})
|
||||
|
||||
createAction(builder, {
|
||||
action: workbench.actionImpl.UnpinTab,
|
||||
label: view.string.Unpin,
|
||||
icon: view.icon.Pin,
|
||||
input: 'focus',
|
||||
category: workbench.category.Workbench,
|
||||
target: workbench.class.WorkbenchTab,
|
||||
query: {
|
||||
isPinned: true
|
||||
},
|
||||
context: {
|
||||
mode: 'context',
|
||||
group: 'edit'
|
||||
}
|
||||
})
|
||||
|
||||
createAction(builder, {
|
||||
action: workbench.actionImpl.CloseTab,
|
||||
label: presentation.string.Close,
|
||||
icon: view.icon.Delete,
|
||||
input: 'focus',
|
||||
category: workbench.category.Workbench,
|
||||
target: workbench.class.WorkbenchTab,
|
||||
visibilityTester: workbench.function.CanCloseTab,
|
||||
context: {
|
||||
mode: 'context',
|
||||
group: 'edit'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default workbench
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { type Doc, type Space } from '@hcengineering/core'
|
||||
import { type Doc, type Ref, type Space } from '@hcengineering/core'
|
||||
import { type IntlString, type Resource, mergeIds } from '@hcengineering/platform'
|
||||
import { type AnyComponent } from '@hcengineering/ui/src/types'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import workbench from '@hcengineering/workbench-resources/src/plugin'
|
||||
import type { ActionCategory, ViewActionAvailabilityFunction } from '@hcengineering/view'
|
||||
|
||||
export default mergeIds(workbenchId, workbench, {
|
||||
component: {
|
||||
@@ -30,6 +31,15 @@ export default mergeIds(workbenchId, workbench, {
|
||||
},
|
||||
function: {
|
||||
HasArchiveSpaces: '' as Resource<(spaces: Space[]) => Promise<boolean>>,
|
||||
IsOwner: '' as Resource<(docs: Doc[]) => Promise<boolean>>
|
||||
IsOwner: '' as Resource<(docs: Doc[]) => Promise<boolean>>,
|
||||
CanCloseTab: '' as Resource<ViewActionAvailabilityFunction<Doc>>
|
||||
},
|
||||
category: {
|
||||
Workbench: '' as Ref<ActionCategory>
|
||||
},
|
||||
actionImpl: {
|
||||
PinTab: '' as Resource<(doc?: Doc | Doc[]) => Promise<void>>,
|
||||
UnpinTab: '' as Resource<(doc?: Doc | Doc[]) => Promise<void>>,
|
||||
CloseTab: '' as Resource<(doc?: Doc | Doc[]) => Promise<void>>
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user