Skip to content

Commit

Permalink
Add reorder button and skeletal dialog to model overview
Browse files Browse the repository at this point in the history
  • Loading branch information
romeonicholas committed Nov 2, 2023
1 parent 7e7c7c9 commit 7c454ae
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ <h2>Models</h2>
>
<mat-icon id="add-icon">add</mat-icon>
</a>
<a
mat-stroked-button
class="!ml-4"
(click)="openReorderModelsDialog()"
*ngIf="projectUserService.verifyRole('manager')"
[matTooltip]="
project?.is_archived
? 'You cannot reorder models for an archived project'
: 'Reorder models'
"
[disabled]="project?.is_archived"
>
<mat-icon>reorder</mat-icon>
</a>
</div>
<div class="flex flex-wrap">
<div class="flex" *ngIf="(modelService.models$ | async) === undefined">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ModelService,
} from 'src/app/projects/models/service/model.service';
import { MoveModelComponent } from 'src/app/projects/project-detail/model-overview/move-model/move-model.component';
import { ReorderModelsComponent } from 'src/app/projects/project-detail/model-overview/reorder-models/reorder-models.component';
import { ProjectUserService } from 'src/app/projects/project-detail/project-users/service/project-user.service';
import { UserService } from 'src/app/services/user/user.service';
import { SessionService } from 'src/app/sessions/service/session.service';
Expand Down Expand Up @@ -88,4 +89,11 @@ export class ModelOverviewComponent implements OnInit {
data: { projectSlug: this.project?.slug, model: model },
});
}

openReorderModelsDialog(): void {
this.dialog.open(ReorderModelsComponent, {
maxWidth: '100vw',
maxHeight: '200vw',
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
~ SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors
~ SPDX-License-Identifier: Apache-2.0
-->

<div class="dialog">
<h2>Reorder models</h2>
<div>
Drag and drop models in the order you would like, then press save. All
members of a team will see the updated order.
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';

import { ProjectService } from 'src/app/projects/service/project.service';

@Component({
selector: 'app-reorder-models',
templateUrl: './reorder-models.component.html',
styleUrls: ['./reorder-models.component.css'],
})
export class ReorderModelsComponent {
constructor(
public projectService: ProjectService,
@Inject(MAT_DIALOG_DATA)
public data: { data: 1 },
) {}
}

0 comments on commit 7c454ae

Please sign in to comment.