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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Removed wrong chages coming from dev
Aleix Suau7dc34a9f7ba0
diff --git a/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.tsindex c756dcf4ab2..11205f85405 100644--- a/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts+++ b/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts@@ -26,20 +26,19 @@// See docs/COPYRIGHT.rdoc for more details.//++-import { Component, OnInit } from '@angular/core';-import { HalResourceSortingService } from 'core-app/modules/hal/services/hal-resource-sorting.service';-import { CollectionResource } from 'core-app/modules/hal/resources/collection-resource';-import { HalResource } from 'core-app/modules/hal/resources/hal-resource';-import { EditFieldComponent } from '../edit-field.component';-import { SelectAutocompleterRegisterService } from 'app/modules/fields/edit/field-types/select-autocompleter-register.service';-import { from } from 'rxjs';-import { map, tap } from 'rxjs/operators';-import { HalResourceNotificationService } from 'core-app/modules/hal/services/hal-resource-notification.service';-import { InjectField } from 'core-app/helpers/angular/inject-field.decorator';-import { PermissionsService } from 'core-app/core/services/permissions/permissions.service';-import { CreateAutocompleterComponent } from "core-app/modules/autocompleter/create-autocompleter/create-autocompleter.component";-import { EditFormComponent } from "core-app/modules/fields/edit/edit-form/edit-form.component";-import { StateService } from "@uirouter/core";+import {Component, OnInit} from "@angular/core";+import {HalResourceSortingService} from "core-app/modules/hal/services/hal-resource-sorting.service";+import {CollectionResource} from "core-app/modules/hal/resources/collection-resource";+import {HalResource} from "core-app/modules/hal/resources/hal-resource";+import {EditFieldComponent} from "../edit-field.component";+import {CreateAutocompleterComponent} from "core-app/modules/common/autocomplete/create-autocompleter.component";+import {SelectAutocompleterRegisterService} from "app/modules/fields/edit/field-types/select-autocompleter-register.service";+import {from} from 'rxjs';+import {map, tap} from 'rxjs/operators';+import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";+import {EditFormComponent} from "core-app/modules/fields/edit/edit-form/edit-form.component";+import {StateService} from "@uirouter/core";export interface ValueOption {name:string;@@ -47,21 +46,31 @@ export interface ValueOption {}@Component({- templateUrl: './select-edit-field.component.html',+ templateUrl: './select-edit-field.component.html'})export class SelectEditFieldComponent extends EditFieldComponent implements OnInit {@InjectField() selectAutocompleterRegister:SelectAutocompleterRegisterService;@InjectField() halNotification:HalResourceNotificationService;@InjectField() halSorting:HalResourceSortingService;- @InjectField() permissionsService:PermissionsService;@InjectField() editFormComponent:EditFormComponent;- @InjectField() $state:StateService-+ @InjectField() $state:StateService;public availableOptions:any[];public valueOptions:ValueOption[];+ protected valuesLoaded = false;+public text:{ [key:string]:string };+public appendTo:any = null;+ private hiddenOverflowContainer = '.__hidden_overflow_container';++ /** Remember the values loading promise which changes as soon as the changeset is updated+ * (e.g., project or type is changed).+ */+ private valuesLoadingPromise:Promise<unknown>;++ protected _autocompleterComponent:CreateAutocompleterComponent;+public referenceOutputs:{ [key:string]:Function } = {onCreate: (newElement:HalResource) => this.onCreate(newElement),onChange: (value:HalResource) => this.onChange(value),@@ -70,31 +79,27 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnInonClose: () => this.onClose(),onAfterViewInit: (component:CreateAutocompleterComponent) => this._autocompleterComponent = component};- public get selectedOption() {- const href = this.value ? this.value.$href : null;- return _.find(this.valueOptions, o => o.$href === href)!;- }- public set selectedOption(val:ValueOption) {- const option = _.find(this.availableOptions, o => o.$href === val.$href);- // Special case 'null' value, which angular- // only understands in ng-options as an empty string.- if (option && option.$href === '') {- option.$href = null;- }+ protected initialize() {+ this.text = {+ requiredPlaceholder: this.I18n.t('js.placeholders.selection'),+ placeholder: this.I18n.t('js.placeholders.default')+ };- this.value = option;+ this.valuesLoadingPromise = this.change.getForm().then(() => {+ return this.initialValueLoading();+ });}- public showAddNewButton:boolean;- protected valuesLoaded = false;- protected _autocompleterComponent:CreateAutocompleterComponent;+ protected initialValueLoading() {+ this.valuesLoaded = false;+ return this.loadValues().toPromise();+ }- private hiddenOverflowContainer = '.__hidden_overflow_container';- /** Remember the values loading promise which changes as soon as the changeset is updated- * (e.g., project or type is changed).- */- private valuesLoadingPromise:Promise<unknown>;+ public autocompleterComponent() {+ let type = this.schema.type;+ return this.selectAutocompleterRegister.getAutocompleterOfAttribute(type) || CreateAutocompleterComponent;+ }public ngOnInit() {super.ngOnInit();@@ -114,35 +119,21 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnInthis._syncUrlParamsOnChangeIfNeeded(this.handler.fieldName, this.editFormComponent.editMode);}- protected initialize() {- this.text = {- requiredPlaceholder: this.I18n.t('js.placeholders.selection'),- placeholder: this.I18n.t('js.placeholders.default')- };-- this.valuesLoadingPromise = this.change.getForm().then(() => {- return this.initialValueLoading();- });-- this.initializeShowAddButton();+ public get selectedOption() {+ const href = this.value ? this.value.$href : null;+ return _.find(this.valueOptions, o => o.$href === href)!;}- initializeShowAddButton() {- if (this.schema.type === 'User') {- this.permissionsService- .canInviteUsersToProject()- .subscribe(canInviteUsersToProject => this.showAddNewButton = canInviteUsersToProject);- }- }+ public set selectedOption(val:ValueOption) {+ let option = _.find(this.availableOptions, o => o.$href === val.$href);- protected initialValueLoading() {- this.valuesLoaded = false;- return this.loadValues().toPromise();- }+ // Special case 'null' value, which angular+ // only understands in ng-options as an empty string.+ if (option && option.$href === '') {+ option.$href = null;+ }- public autocompleterComponent() {- const type = this.schema.type;- return this.selectAutocompleterRegister.getAutocompleterOfAttribute(type) || CreateAutocompleterComponent;+ this.value = option;}private setValues(availableValues:HalResource[]) {@@ -152,7 +143,7 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnIn}protected loadValues(query?:string) {- const allowedValues = this.schema.allowedValues;+ let allowedValues = this.schema.allowedValues;if (Array.isArray(allowedValues)) {this.setValues(allowedValues);