mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-08 16:33:16 +00:00
Some checks are pending
CI / build (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
169 lines
5.1 KiB
TypeScript
169 lines
5.1 KiB
TypeScript
//
|
|
// Copyright © 2024 Hardcore Engineering Inc.
|
|
//
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License. You may
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
//
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
|
|
import activity from '@hcengineering/activity'
|
|
import { AccountRole } from '@hcengineering/core'
|
|
import { type Builder } from '@hcengineering/model'
|
|
import core from '@hcengineering/model-core'
|
|
import chunter from '@hcengineering/model-chunter'
|
|
import view, { createAction, type Viewlet } from '@hcengineering/model-view'
|
|
import workbench from '@hcengineering/model-workbench'
|
|
import { surveyId } from '@hcengineering/survey'
|
|
import { TPoll, TSurvey } from './types'
|
|
import survey from './plugin'
|
|
|
|
export { surveyId } from '@hcengineering/survey'
|
|
export { surveyOperation } from './migration'
|
|
export default survey
|
|
export * from './types'
|
|
|
|
export function createModel (builder: Builder): void {
|
|
builder.createModel(TPoll, TSurvey)
|
|
|
|
builder.createDoc(
|
|
workbench.class.Application,
|
|
core.space.Model,
|
|
{
|
|
label: survey.string.Application,
|
|
icon: survey.icon.Application,
|
|
alias: surveyId,
|
|
accessLevel: AccountRole.User,
|
|
hidden: false,
|
|
locationResolver: survey.resolver.Location,
|
|
navigatorModel: {
|
|
spaces: [],
|
|
specials: [
|
|
{
|
|
id: 'surveys',
|
|
label: survey.string.Surveys,
|
|
icon: survey.icon.Survey,
|
|
component: workbench.component.SpecialView,
|
|
componentProps: {
|
|
_class: survey.class.Survey,
|
|
icon: survey.icon.Survey,
|
|
label: survey.string.Surveys,
|
|
createLabel: survey.string.CreateSurvey,
|
|
createComponent: survey.component.CreateSurvey
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
survey.app.Survey
|
|
)
|
|
|
|
builder.createDoc<Viewlet>(
|
|
view.class.Viewlet,
|
|
core.space.Model,
|
|
{
|
|
attachTo: survey.class.Survey,
|
|
descriptor: view.viewlet.Table,
|
|
config: ['', 'modifiedOn'],
|
|
configOptions: {
|
|
hiddenKeys: ['name', 'questions'],
|
|
sortable: true
|
|
}
|
|
},
|
|
survey.viewlet.TableSurvey
|
|
)
|
|
|
|
builder.mixin(survey.class.Survey, core.class.Class, view.mixin.ObjectTitle, {
|
|
titleProvider: survey.function.SurveyTitleProvider
|
|
})
|
|
|
|
builder.mixin(survey.class.Survey, core.class.Class, view.mixin.LinkProvider, {
|
|
encode: survey.function.GetSurveyLink
|
|
})
|
|
|
|
builder.mixin(survey.class.Survey, core.class.Class, view.mixin.ObjectPanel, {
|
|
component: survey.component.EditSurveyPanel
|
|
})
|
|
|
|
builder.mixin(survey.class.Survey, core.class.Class, view.mixin.ObjectPresenter, {
|
|
presenter: survey.component.SurveyPresenter
|
|
})
|
|
|
|
builder.mixin(survey.class.Survey, core.class.Class, activity.mixin.ActivityDoc, {})
|
|
|
|
builder.createDoc(activity.class.ActivityExtension, core.space.Model, {
|
|
ofClass: survey.class.Survey,
|
|
components: { input: { component: chunter.component.ChatMessageInput } }
|
|
})
|
|
|
|
builder.createDoc<Viewlet>(
|
|
view.class.Viewlet,
|
|
core.space.Model,
|
|
{
|
|
attachTo: survey.class.Poll,
|
|
descriptor: view.viewlet.Table,
|
|
config: ['', 'isCompleted', 'modifiedOn'],
|
|
options: {
|
|
showArchived: true
|
|
},
|
|
configOptions: {
|
|
hiddenKeys: ['name', 'survey', 'questions'],
|
|
sortable: true
|
|
}
|
|
},
|
|
survey.viewlet.TablePoll
|
|
)
|
|
|
|
builder.mixin(survey.class.Poll, core.class.Class, view.mixin.ObjectTitle, {
|
|
titleProvider: survey.function.PollTitleProvider
|
|
})
|
|
|
|
builder.mixin(survey.class.Poll, core.class.Class, view.mixin.LinkProvider, {
|
|
encode: survey.function.GetPollLink
|
|
})
|
|
|
|
builder.mixin(survey.class.Poll, core.class.Class, view.mixin.ObjectPanel, {
|
|
component: survey.component.EditPollPanel
|
|
})
|
|
|
|
builder.mixin(survey.class.Poll, core.class.Class, view.mixin.ObjectPresenter, {
|
|
presenter: survey.component.PollPresenter
|
|
})
|
|
|
|
builder.mixin(survey.class.Poll, core.class.Class, activity.mixin.ActivityDoc, {})
|
|
|
|
builder.createDoc(activity.class.ActivityExtension, core.space.Model, {
|
|
ofClass: survey.class.Poll,
|
|
components: { input: { component: chunter.component.ChatMessageInput } }
|
|
})
|
|
|
|
builder.mixin(survey.class.Poll, core.class.Class, view.mixin.CollectionEditor, {
|
|
editor: survey.component.PollCollection
|
|
})
|
|
|
|
createAction(
|
|
builder,
|
|
{
|
|
action: survey.actionImpl.DeletePoll,
|
|
label: workbench.string.Delete,
|
|
icon: view.icon.Delete,
|
|
input: 'any',
|
|
category: survey.category.Survey,
|
|
target: survey.class.Poll,
|
|
context: {
|
|
mode: ['context', 'browser'],
|
|
group: 'remove'
|
|
},
|
|
visibilityTester: view.function.CanDeleteObject,
|
|
override: [view.action.Delete]
|
|
},
|
|
survey.action.DeletePoll
|
|
)
|
|
}
|