Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add "create new" link in the sidemenu for team planner

Henriette Dargebfb0d9167acc
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 4801c851474..93591f5c2fc 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -499,6 +499,7 @@ en:
label_starred_queries: "Favorite views"
label_global_queries: "Public views"
label_custom_queries: "Private views"
+ label_create_new_query: "Create new"
label_columns: "Columns"
label_attachments: Files
label_drop_files: Drop files here
diff --git a/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts b/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
index 66fb9a54a8a..f46d58dcbc2 100644
--- a/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
+++ b/frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
@@ -158,15 +158,6 @@ export class StaticQueriesService {
},
view: 'BCF',
},
- /* TODO {
- title: this.text.create_new_team_planner,
- uiSref: 'team_planner.page.show',
- uiParams: {
- query_id: '',
- query_props: '{"c":["id","subject","type","status","assignee","createdAt"],"hi":false,"g":"","t":"createdAt:desc","f":[{"n":"status","o":"o","v":[]}]}',
- },
- view: 'TeamPlanner',
- },*/
];
const projectIdentifier = this.CurrentProject.identifier;
@@ -192,6 +183,23 @@ export class StaticQueriesService {
.filter((query) => query.view === view);
}
+ public getCreateNewQueryForView(view:ViewType):IOpSidemenuItem[] {
+ return this.buildCreateNewQuery()
+ .filter((query) => query.view === view);
+ }
+
+ private buildCreateNewQuery():IStaticQuery[] {
+ return [{
+ title: this.text.create_new_team_planner,
+ uiSref: 'team_planner.page.show',
+ uiParams: {
+ query_id: '',
+ query_props: '',
+ },
+ view: 'TeamPlanner',
+ }];
+ }
+
private projectDependentQueries(projectIdentifier:string):IStaticQuery[] {
return [
{
diff --git a/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts b/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
index 6a8fa2ed8eb..304054db43f 100644
--- a/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
+++ b/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
@@ -71,6 +71,7 @@ export class ViewSelectComponent extends UntilDestroyedMixin implements OnInit {
scope_starred: this.I18n.t('js.label_starred_queries'),
scope_global: this.I18n.t('js.label_global_queries'),
scope_private: this.I18n.t('js.label_custom_queries'),
+ scope_new: this.I18n.t('js.label_create_new_query'),
no_results: this.I18n.t('js.work_packages.query.text_no_results'),
};
@@ -167,6 +168,7 @@ export class ViewSelectComponent extends UntilDestroyedMixin implements OnInit {
default: [],
public: [],
private: [],
+ createNew: [],
};
const params:Apiv3ListParameters = {
@@ -198,11 +200,13 @@ export class ViewSelectComponent extends UntilDestroyedMixin implements OnInit {
});
const staticQueries = this.opStaticQueries.getStaticQueriesForView(this.viewType);
+ const newQueryLink = this.opStaticQueries.getCreateNewQueryForView(this.viewType);
this.$viewCategories.next([
{ title: this.text.scope_starred, children: categories.starred, collapsible: true },
{ title: this.text.scope_default, children: staticQueries, collapsible: true },
{ title: this.text.scope_global, children: categories.public, collapsible: true },
{ title: this.text.scope_private, children: categories.private, collapsible: true },
+ { title: this.text.scope_new, children: newQueryLink, collapsible: true },
]);
});
}