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

Hide button to create form groups when no EE token is present. Further avoid that the existing groups can be renamed or re-configured..

Henriette Darge4a70e0853a41
diff --git a/frontend/src/app/features/admin/types/group-edit-in-place.component.ts b/frontend/src/app/features/admin/types/group-edit-in-place.component.ts
index 0840bf33c0c..3adcc43c9ae 100644
--- a/frontend/src/app/features/admin/types/group-edit-in-place.component.ts
+++ b/frontend/src/app/features/admin/types/group-edit-in-place.component.ts
@@ -66,7 +66,7 @@ export class GroupEditInPlaceComponent implements OnInit {
}
}
- startEditing() {
+ startEditing():void {
this.bannerService.conditional(
() => this.bannerService.showEEOnlyHint(),
() => {
@@ -75,7 +75,7 @@ export class GroupEditInPlaceComponent implements OnInit {
);
}
- saveEdition(event:FocusEvent) {
+ saveEdition(event:FocusEvent):boolean {
this.leaveEditingMode();
this.name = this.editedName.trim();
@@ -91,12 +91,12 @@ export class GroupEditInPlaceComponent implements OnInit {
return false;
}
- reset() {
+ reset():void {
this.editing = false;
this.editedName = this.name;
}
- leaveEditingMode() {
+ leaveEditingMode():void {
// Only leave Editing mode if name not empty.
if (this.editedName != null && this.editedName.trim().length > 0) {
this.editing = false;
diff --git a/frontend/src/app/features/admin/types/query-group.component.ts b/frontend/src/app/features/admin/types/query-group.component.ts
index 402a3c01924..7648460101a 100644
--- a/frontend/src/app/features/admin/types/query-group.component.ts
+++ b/frontend/src/app/features/admin/types/query-group.component.ts
@@ -2,6 +2,7 @@ import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { TypeGroup } from 'core-app/features/admin/types/type-form-configuration.component';
@Component({
selector: 'op-type-form-query-group',
@@ -13,7 +14,7 @@ export class TypeFormQueryGroupComponent {
edit_query: this.I18n.t('js.admin.type_form.edit_query'),
};
- @Input() public group:any;
+ @Input() public group:TypeGroup;
@Output() public editQuery = new EventEmitter<void>();
@@ -23,7 +24,7 @@ export class TypeFormQueryGroupComponent {
private cdRef:ChangeDetectorRef) {
}
- rename(newValue:string) {
+ rename(newValue:string):void {
this.group.name = newValue;
this.cdRef.detectChanges();
}
diff --git a/frontend/src/app/features/admin/types/type-form-configuration.component.ts b/frontend/src/app/features/admin/types/type-form-configuration.component.ts
index b0a7366de8b..c7772f01d40 100644
--- a/frontend/src/app/features/admin/types/type-form-configuration.component.ts
+++ b/frontend/src/app/features/admin/types/type-form-configuration.component.ts
@@ -70,13 +70,16 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
private no_filter_query:string;
- constructor(private elementRef:ElementRef,
+ constructor(
+ private elementRef:ElementRef,
private I18n:I18nService,
private Gon:GonService,
private dragula:DragulaService,
private confirmDialog:ConfirmDialogService,
private toastService:ToastService,
- private externalRelationQuery:ExternalRelationQueryConfigurationService) {
+ private externalRelationQuery:ExternalRelationQueryConfigurationService,
+ readonly typeBanner:TypeBannerService,
+ ) {
super();
}
@@ -154,45 +157,55 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
);
}
- ngAfterViewInit() {
+ ngAfterViewInit():void {
const menu = jQuery(this.elementRef.nativeElement).find('.toolbar-items');
installMenuLogic(menu);
}
- public deactivateAttribute(attribute:TypeFormAttribute) {
+ deactivateAttribute(attribute:TypeFormAttribute):void {
this.updateInactives(this.inactives.concat(attribute));
}
- public addGroupAndOpenQuery():void {
+ addGroupAndOpenQuery():void {
const newGroup = this.createGroup('query');
this.editQuery(newGroup);
}
- public editQuery(group:TypeGroup) {
- // Disable display mode and timeline for now since we don't want users to enable it
- const disabledTabs = {
- 'display-settings': I18n.t('js.work_packages.table_configuration.embedded_tab_disabled'),
- timelines: I18n.t('js.work_packages.table_configuration.embedded_tab_disabled'),
- };
-
- this.externalRelationQuery.show({
- currentQuery: JSON.parse(group.query),
- callback: (queryProps:any) => (group.query = JSON.stringify(queryProps)),
- disabledTabs,
- });
+ editQuery(group:TypeGroup):void {
+ this.typeBanner.conditional(
+ () => this.typeBanner.showEEOnlyHint(),
+ () => {
+ // Disable display mode and timeline for now since we don't want users to enable it
+ const disabledTabs = {
+ 'display-settings': I18n.t('js.work_packages.table_configuration.embedded_tab_disabled'),
+ timelines: I18n.t('js.work_packages.table_configuration.embedded_tab_disabled'),
+ };
+
+ this.externalRelationQuery.show({
+ currentQuery: JSON.parse(group.query),
+ callback: (queryProps:any) => (group.query = JSON.stringify(queryProps)),
+ disabledTabs,
+ });
+ },
+ );
}
- public deleteGroup(group:TypeGroup) {
- if (group.type === 'attribute') {
- this.updateInactives(this.inactives.concat(group.attributes));
- }
+ deleteGroup(group:TypeGroup):void {
+ this.typeBanner.conditional(
+ () => this.typeBanner.showEEOnlyHint(),
+ () => {
+ if (group.type === 'attribute') {
+ this.updateInactives(this.inactives.concat(group.attributes));
+ }
- this.groups = this.groups.filter((el) => el !== group);
+ this.groups = this.groups.filter((el) => el !== group);
- return group;
+ return group;
+ },
+ );
}
- public createGroup(type:TypeGroupType, groupName = '') {
+ createGroup(type:TypeGroupType, groupName = ''):TypeGroup {
const group:TypeGroup = {
type,
name: groupName,
@@ -205,7 +218,7 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
return group;
}
- public resetToDefault($event:Event):boolean {
+ resetToDefault($event:Event):boolean {
this.confirmDialog
.confirm({
text: {
@@ -227,7 +240,7 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
return false;
}
- private updateInactives(newValue:TypeFormAttribute[]) {
+ private updateInactives(newValue:TypeFormAttribute[]):void {
this.inactives = [...newValue].sort((a, b) => a.translation.localeCompare(b.translation));
}
@@ -241,7 +254,7 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
};
}
- private updateHiddenFields() {
+ private updateHiddenFields():void {
const hiddenField = this.form.find('.admin-type-form--hidden-field');
if (this.groups.length === 0) {
// Ensure we're adding an empty group if deliberately removing
diff --git a/frontend/src/app/features/admin/types/type-form-configuration.html b/frontend/src/app/features/admin/types/type-form-configuration.html
index 846f8cfdbfb..b81afd11d77 100644
--- a/frontend/src/app/features/admin/types/type-form-configuration.html
+++ b/frontend/src/app/features/admin/types/type-form-configuration.html
@@ -9,7 +9,9 @@
<span class="button--text" [textContent]="text.reset"></span>
</button>
</li>
- <li class="toolbar-item drop-down">
+ <li
+ *ngIf="!typeBanner.eeShowBanners"
+ class="toolbar-item drop-down">
<a class="form-configuration--add-group button -alt-highlight" aria-haspopup="true">
<op-icon icon-classes="button--icon icon-add"></op-icon>
<span class="button--text" [textContent]="text.label_group"></span>