Compare commits

...

1 Commits

  1. 9
      frontend/src/app/core/apiv3/api-v3.service.ts
  2. 4
      frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.html
  3. 2
      frontend/src/app/features/work-packages/components/wp-card-view/services/wp-card-drag-and-drop.service.ts
  4. 5
      frontend/src/app/features/work-packages/components/wp-inline-create/wp-inline-create.component.ts
  5. 3
      frontend/src/app/features/work-packages/components/wp-new/wp-create.component.ts
  6. 39
      frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
  7. 2
      frontend/src/app/features/work-packages/components/wp-relations/embedded/wp-relation-query.html
  8. 8
      frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-base.component.ts
  9. 2
      frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.html
  10. 2
      frontend/src/app/features/work-packages/components/wp-table/wp-table-configuration.ts
  11. 3
      frontend/src/app/features/work-packages/components/wp-table/wp-table.component.ts
  12. 2
      frontend/src/app/features/work-packages/components/wp-table/wp-table.directive.html
  13. 4
      frontend/src/app/features/work-packages/routing/wp-list-view/wp-list-view.component.html

@ -61,6 +61,7 @@ import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { ApiV3NotificationsPaths } from 'core-app/core/apiv3/endpoints/notifications/apiv3-notifications-paths';
import { ApiV3ViewsPaths } from 'core-app/core/apiv3/endpoints/views/apiv3-views-paths';
import { Apiv3BackupsPath } from 'core-app/core/apiv3/endpoints/backups/apiv3-backups-path';
import { ID } from '@datorama/akita';
@Injectable({ providedIn: 'root' })
export class ApiV3Service {
@ -162,13 +163,13 @@ export class ApiV3Service {
*
* The available API endpoints are being restricted automatically by typescript.
*
* @param projectIdentifier
* @param projectID
*/
public withOptionalProject(projectIdentifier:string|number|null|undefined):ApiV3ProjectPaths|this {
if (_.isNil(projectIdentifier)) {
public withOptionalProject(projectID?:ID|null):ApiV3ProjectPaths|this {
if (_.isNil(projectID)) {
return this;
}
return this.projects.id(projectIdentifier);
return this.projects.id(projectID);
}
public collectionFromString(fullPath:string) {

@ -10,7 +10,7 @@
localStorageKey="openProject-splitViewFlexBasis">
</wp-resizer>
<wp-table [projectIdentifier]="CurrentProject.identifier"
<wp-table [projectID]="CurrentProject.id"
[configuration]="wpTableConfiguration"
(itemClicked)="handleWorkPackageClicked($event)"
(stateLinkClicked)="openStateLink($event)"
@ -35,4 +35,4 @@
<div class="work-packages-split-view--tabletimeline-footer hide-when-print"
*ngIf="tableInformationLoaded">
<wp-table-pagination></wp-table-pagination>
</div>
</div>

@ -159,7 +159,7 @@ export class WorkPackageCardDragAndDropService {
*/
public addNewCard() {
this.wpCreate
.createOrContinueWorkPackage(this.currentProject.identifier)
.createOrContinueWorkPackage()
.then((changeset:WorkPackageChangeset) => {
this.activeInlineCreateWp = changeset.projectedResource;
this.workPackages = this.workPackages;

@ -59,6 +59,7 @@ import {
import { WorkPackageCreateService } from '../wp-new/wp-create.service';
import { WorkPackageTable } from '../wp-fast-table/wp-fast-table';
import { onClickOrEnter } from '../wp-fast-table/handlers/click-or-enter-handler';
import { ID } from '@datorama/akita';
@Component({
selector: '[wpInlineCreate]',
@ -67,7 +68,7 @@ import { onClickOrEnter } from '../wp-fast-table/handlers/click-or-enter-handler
export class WorkPackageInlineCreateComponent extends UntilDestroyedMixin implements OnInit, AfterViewInit {
@Input('wp-inline-create--table') table:WorkPackageTable;
@Input('wp-inline-create--project-identifier') projectIdentifier:string;
@Input('wp-inline-create--project-id') projectID:ID;
@Output('wp-inline-create--showing') showing = new EventEmitter<boolean>();
@ -216,7 +217,7 @@ export class WorkPackageInlineCreateComponent extends UntilDestroyedMixin implem
public addWorkPackageRow() {
this.wpCreate
.createOrContinueWorkPackage(this.projectIdentifier)
.createOrContinueWorkPackage(this.projectID)
.then((change:WorkPackageChangeset) => {
const wp = this.currentWorkPackage = change.projectedResource;

@ -190,7 +190,6 @@ export class WorkPackageCreateComponent extends UntilDestroyedMixin implements O
const type = this.stateParams.type ? parseInt(this.stateParams.type) : undefined;
const parent = this.stateParams.parent_id ? parseInt(this.stateParams.parent_id) : undefined;
const project = this.stateParams.projectPath;
if (type) {
defaults._links.type = { href: this.apiV3Service.types.id(type).path };
@ -199,7 +198,7 @@ export class WorkPackageCreateComponent extends UntilDestroyedMixin implements O
defaults._links.parent = { href: this.apiV3Service.work_packages.id(parent).path };
}
return this.wpCreate.createOrContinueWorkPackage(project, type, defaults);
return this.wpCreate.createOrContinueWorkPackage(undefined, type, defaults);
}
private closeEditFormWhenNewWorkPackageSaved() {

@ -48,6 +48,8 @@ import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import { ID } from '@datorama/akita';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
export const newWorkPackageHref = '/api/v3/work_packages/new';
@ -58,7 +60,8 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
// Allow callbacks to happen on newly created work packages
protected newWorkPackageCreatedSubject = new Subject<WorkPackageResource>();
constructor(protected injector:Injector,
constructor(
protected injector:Injector,
protected hooks:HookService,
protected apiV3Service:ApiV3Service,
protected halResourceService:HalResourceService,
@ -66,7 +69,9 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
protected authorisationService:AuthorisationService,
protected halEditing:HalResourceEditingService,
protected schemaCache:SchemaCacheService,
protected halEvents:HalEventsService) {
protected halEvents:HalEventsService,
protected currentProject:CurrentProjectService,
) {
super();
this.halEditing
@ -99,10 +104,10 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
return this.newWorkPackageCreatedSubject.asObservable();
}
public createNewWorkPackage(projectIdentifier:string|undefined|null, payload:HalSource):Promise<WorkPackageChangeset> {
public createNewWorkPackage(payload:HalSource, projectID?:ID|null):Promise<WorkPackageChangeset> {
return this
.apiV3Service
.withOptionalProject(projectIdentifier)
.withOptionalProject(projectID)
.work_packages
.form
.forPayload(payload)
@ -176,11 +181,20 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
.values$();
}
public createOrContinueWorkPackage(projectIdentifier:string|null|undefined, type?:number, defaults?:HalSource) {
public createOrContinueWorkPackage(projectId?:ID|null, type?:number, defaults?:HalSource):Promise<WorkPackageChangeset> {
let changePromise = this.continueExistingEdit(type);
const extendedDefaults:HalSource = defaults || { _links: {} };
const projectID = projectId || this.currentProject.id;
// Special case due to the introduction of the project include dropdown
// If we are in a project, we want the create wp to be part of that project.
// Only on the global WP page, the filters should be applied.
if (projectID) {
extendedDefaults._links.project = { href: this.apiV3Service.projects.id(projectID).path };
}
if (!changePromise) {
changePromise = this.createNewWithDefaults(projectIdentifier, defaults);
changePromise = this.createNewWithDefaults(projectID === null ? undefined : projectID, extendedDefaults);
}
return changePromise.then((change:WorkPackageChangeset) => {
@ -231,16 +245,15 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
* The first can be employed to e.g. provide the type or the parent of the work package.
* The later can be employed to create a work package that adheres to the filter values.
*
* @params projectIdentifier The project the work package is to be created in.
* @param defaults Values the new work package should possess on creation.
* @param defaults? Values the new work package should possess on creation.
*/
protected createNewWithDefaults(projectIdentifier:string|null|undefined, defaults?:HalSource) {
protected createNewWithDefaults(projectID?:ID|null, defaults?: HalSource):Promise<WorkPackageChangeset> {
return this
.withFiltersPayload(projectIdentifier, defaults)
.withFiltersPayload(projectID, defaults)
.then((filterDefaults) => {
const mergedPayload = _.merge({ _links: {} }, filterDefaults, defaults);
return this.createNewWorkPackage(projectIdentifier, mergedPayload).then((change:WorkPackageChangeset) => {
return this.createNewWorkPackage(mergedPayload, projectID).then((change:WorkPackageChangeset) => {
if (!change) {
throw new Error('No new work package was created');
}
@ -286,7 +299,7 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
* HalResources are in the _links section and follow the { href: some_link } format while simple properties stay on the
* top level.
*/
private withFiltersPayload(projectIdentifier:string|null|undefined, defaults?:HalSource):Promise<HalSource> {
private withFiltersPayload(projectID?:ID|null, defaults?:HalSource):Promise<HalSource> {
const fromFilter = { _links: {} };
this.defaultsFromFilters(fromFilter, defaults);
@ -295,7 +308,7 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
if (filtersApplied) {
return this
.apiV3Service
.withOptionalProject(projectIdentifier)
.withOptionalProject(projectID)
.work_packages
.form
.forTypePayload(defaults || { _links: {} })

@ -17,7 +17,7 @@
compactTableStyle: true,
columnMenuEnabled: false,
contextMenuEnabled: false,
projectIdentifier: idFromLink(workPackage.project.href),
projectID: idFromLink(workPackage.project.href),
projectContext: false }" >
</wp-embedded-table>
</ng-container>

@ -70,11 +70,11 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
}
}
public get projectIdentifier() {
public get projectID() {
if (this.configuration.projectContext) {
return this.currentProject.identifier || undefined;
return this.currentProject.id || undefined;
}
return this.configuration.projectIdentifier || undefined;
return this.configuration.projectID || undefined;
}
public buildQueryProps() {
@ -135,7 +135,7 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
if (!this.configuration.projectContext) {
return undefined;
}
return this.projectIdentifier;
return this.projectID;
}
protected initializeStates(query:QueryResource) {

@ -15,7 +15,7 @@
<!-- TABLE + TIMELINE horizontal split -->
<wp-table *ngIf="!configuration.isCardView"
[projectIdentifier]="projectIdentifier"
[projectID]="projectID"
[configuration]="configuration"
(itemClicked)="handleWorkPackageClicked($event)"
(stateLinkClicked)="openStateLink($event)"

@ -48,7 +48,7 @@ export class WorkPackageTableConfiguration {
public projectContext = true;
/** Whether the embedded table should live within a specific project context (e.g., given by its parent) */
public projectIdentifier:string|null = null;
public projectID:string|null = null;
/** Whether inline create is enabled */
public inlineCreateEnabled = true;

@ -61,6 +61,7 @@ import {
} from 'core-app/features/work-packages/components/wp-table/wp-table-configuration';
import { States } from 'core-app/core/states/states.service';
import { QueryGroupByResource } from 'core-app/features/hal/resources/query-group-by-resource';
import { ID } from '@datorama/akita';
export interface WorkPackageFocusContext {
/** Work package that was focused */
@ -77,7 +78,7 @@ export interface WorkPackageFocusContext {
selector: 'wp-table',
})
export class WorkPackagesTableComponent extends UntilDestroyedMixin implements OnInit, TableEventComponent {
@Input() projectIdentifier:string;
@Input() projectID:ID;
@Input('configuration') configurationObject:WorkPackageTableConfigurationObject;

@ -68,7 +68,7 @@
<tbody *ngIf="tableElement && configuration.inlineCreateEnabled"
wpInlineCreate
[wp-inline-create--table]="workPackageTable"
[wp-inline-create--project-identifier]="projectIdentifier"
[wp-inline-create--project-id]="projectID"
(wp-inline-create--showing)="inlineCreateVisible = $event"
>
</tbody>

@ -3,7 +3,7 @@
<!-- TABLE + TIMELINE horizontal split -->
<wp-table *ngIf="tableInformationLoaded && showTableView"
[projectIdentifier]="CurrentProject.identifier"
[projectID]="CurrentProject.id"
[configuration]="wpTableConfiguration"
(itemClicked)="handleWorkPackageClicked($event)"
(stateLinkClicked)="openStateLink($event)"
@ -27,4 +27,4 @@
<div class="work-packages-split-view--tabletimeline-footer hide-when-print"
*ngIf="tableInformationLoaded">
<wp-table-pagination></wp-table-pagination>
</div>
</div>

Loading…
Cancel
Save