feat: add config flag to configure default project view #2154
|
@ -62,6 +62,9 @@ service:
|
|||
allowiconchanges: true
|
||||
# Allow using a custom logo via external URL.
|
||||
customlogourl: ''
|
||||
# Specify default view when opening a project the first time
|
||||
# Possible options are: 'project.list', 'project.gantt', 'project.table' or 'project.kanban'
|
||||
defaultprojectview: 'project.list'
|
||||
|
||||
sentry:
|
||||
# If set to true, enables anonymous error tracking of api errors via Sentry. This allows us to gather more
|
||||
|
|
|
@ -346,6 +346,18 @@ Full path: `service.customlogourl`
|
|||
Environment path: `VIKUNJA_SERVICE_CUSTOMLOGOURL`
|
||||
|
||||
|
||||
### defaultprojectview
|
||||
|
||||
Specify default view when opening a project the first time
|
||||
Possible options are: 'project.list', 'project.gantt', 'project.table' or 'project.kanban'
|
||||
|
||||
Default: `project.list`
|
||||
|
||||
Full path: `service.defaultprojectview`
|
||||
|
||||
Environment path: `VIKUNJA_SERVICE_DEFAULTPROJECTVIEW`
|
||||
|
||||
|
||||
---
|
||||
|
||||
## sentry
|
||||
|
|
|
@ -9,6 +9,7 @@ import {setTitle} from '@/helpers/setTitle'
|
|||
import {LINK_SHARE_HASH_PREFIX} from '@/constants/linkShareHash'
|
||||
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {useBaseStore} from '@/stores/base'
|
||||
|
||||
|
@ -348,13 +349,16 @@ const router = createRouter({
|
|||
redirect(to) {
|
||||
// Redirect the user to list view by default
|
||||
const savedProjectView = getProjectView(Number(to.params.projectId as string))
|
||||
|
||||
// Project default view
|
||||
const configStore = useConfigStore()
|
||||
|
||||
if (savedProjectView) {
|
||||
console.log('Replaced list view with', savedProjectView)
|
||||
}
|
||||
|
||||
return {
|
||||
name: savedProjectView || 'project.list',
|
||||
name: savedProjectView || configStore.defaultProjectView,
|
||||
params: {projectId: to.params.projectId},
|
||||
}
|
||||
},
|
||||
|
|
|
@ -37,6 +37,7 @@ export interface ConfigState {
|
|||
providers: IProvider[],
|
||||
},
|
||||
},
|
||||
defaultProjectView: string,
|
||||
}
|
||||
|
||||
export const useConfigStore = defineStore('config', () => {
|
||||
|
@ -70,6 +71,7 @@ export const useConfigStore = defineStore('config', () => {
|
|||
providers: [],
|
||||
},
|
||||
},
|
||||
defaultProjectView: 'project.list',
|
||||
})
|
||||
|
||||
const migratorsEnabled = computed(() => state.availableMigrators?.length > 0)
|
||||
|
|
|
@ -64,6 +64,7 @@ const (
|
|||
ServiceMaxAvatarSize Key = `service.maxavatarsize`
|
||||
ServiceAllowIconChanges Key = `service.allowiconchanges`
|
||||
ServiceCustomLogoURL Key = `service.customlogourl`
|
||||
ServiceDefaultProjectView Key = `service.defaultprojectview`
|
||||
|
||||
SentryEnabled Key = `sentry.enabled`
|
||||
SentryDsn Key = `sentry.dsn`
|
||||
|
@ -312,6 +313,7 @@ func InitDefaultConfig() {
|
|||
ServiceMaxAvatarSize.setDefault(1024)
|
||||
ServiceDemoMode.setDefault(false)
|
||||
ServiceAllowIconChanges.setDefault(true)
|
||||
ServiceDefaultProjectView.setDefault("project.list")
|
||||
|
||||
// Sentry
|
||||
SentryDsn.setDefault("https://440eedc957d545a795c17bbaf477497c@o1047380.ingest.sentry.io/4504254983634944")
|
||||
|
|
|
@ -51,6 +51,7 @@ type vikunjaInfos struct {
|
|||
TaskCommentsEnabled bool `json:"task_comments_enabled"`
|
||||
DemoModeEnabled bool `json:"demo_mode_enabled"`
|
||||
WebhooksEnabled bool `json:"webhooks_enabled"`
|
||||
DefaultProjectView string `json:"default_project_view"`
|
||||
}
|
||||
|
||||
type authInfo struct {
|
||||
|
@ -95,6 +96,7 @@ func Info(c echo.Context) error {
|
|||
TaskCommentsEnabled: config.ServiceEnableTaskComments.GetBool(),
|
||||
DemoModeEnabled: config.ServiceDemoMode.GetBool(),
|
||||
WebhooksEnabled: config.WebhooksEnabled.GetBool(),
|
||||
DefaultProjectView: config.ServiceDefaultProjectView.GetString(),
|
||||
AvailableMigrators: []string{
|
||||
(&vikunja_file.FileMigrator{}).Name(),
|
||||
(&ticktick.Migrator{}).Name(),
|
||||
|
|
|
@ -8917,6 +8917,9 @@ const docTemplate = `{
|
|||
"caldav_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"default_project_view": {
|
||||
"type": "string"
|
||||
},
|
||||
"demo_mode_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
|
@ -8909,6 +8909,9 @@
|
|||
"caldav_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"default_project_view": {
|
||||
"type": "string"
|
||||
},
|
||||
"demo_mode_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
|
@ -1368,6 +1368,8 @@ definitions:
|
|||
type: array
|
||||
caldav_enabled:
|
||||
type: boolean
|
||||
default_project_view:
|
||||
type: string
|
||||
demo_mode_enabled:
|
||||
type: boolean
|
||||
email_reminders_enabled:
|
||||
|
|
Loading…
Reference in New Issue