-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Move model from one project to another
- Loading branch information
Showing
11 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ |
42 changes: 42 additions & 0 deletions
42
frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- | ||
~ SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
<mat-card> | ||
<h2>Move Model to Different Project</h2> | ||
<div>Select the project to which you want to move the model to.</div> | ||
<mat-form-field id="search" appearance="outline"> | ||
<mat-label>Search</mat-label> | ||
<input | ||
[(ngModel)]="search" | ||
autocomplete="off" | ||
matInput | ||
placeholder="Project Name" | ||
class="w-full" | ||
/> | ||
<mat-icon matSuffix>search</mat-icon> | ||
</mat-form-field> | ||
<mat-selection-list | ||
[multiple]="false" | ||
class="scrollable simple-scroll overflow-y-auto max-h-72" | ||
(selectionChange)="onProjectSelect($event.options[0].value)" | ||
> | ||
<mat-list-option | ||
*ngFor="let project of projectService.projects$ | async" | ||
[value]="project" | ||
> | ||
<div mat-line>{{ project.name }}</div> | ||
</mat-list-option> | ||
</mat-selection-list> | ||
<div *ngIf="selectedProject"> | ||
<button | ||
mat-flat-button | ||
color="primary" | ||
(click)="moveModelToProject(selectedProject)" | ||
> | ||
<mat-icon>drive_file_move</mat-icon> | ||
Move model {{ data.model.name }} to project {{ selectedProject.name }} | ||
</button> | ||
</div> | ||
</mat-card> |
58 changes: 58 additions & 0 deletions
58
frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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, MatDialogRef } from '@angular/material/dialog'; | ||
import { Router } from '@angular/router'; | ||
import { ToastService } from 'src/app/helpers/toast/toast.service'; | ||
import { | ||
Model, | ||
ModelService, | ||
} from 'src/app/projects/models/service/model.service'; | ||
import { | ||
Project, | ||
ProjectService, | ||
} from 'src/app/projects/service/project.service'; | ||
|
||
@Component({ | ||
selector: 'app-move-model', | ||
templateUrl: './move-model.component.html', | ||
styleUrls: ['./move-model.component.css'], | ||
}) | ||
export class MoveModelComponent { | ||
selectedProject?: Project; | ||
search = ''; | ||
constructor( | ||
private modelService: ModelService, | ||
private router: Router, | ||
private dialogRef: MatDialogRef<MoveModelComponent>, | ||
private toastService: ToastService, | ||
public projectService: ProjectService, | ||
@Inject(MAT_DIALOG_DATA) | ||
public data: { project_slug: string; model: Model } | ||
) { | ||
this.projectService.loadProjectsForRole('manager'); | ||
} | ||
|
||
onProjectSelect(project: Project) { | ||
this.selectedProject = project; | ||
} | ||
|
||
async moveModelToProject(project: Project) { | ||
this.modelService | ||
.moveModelToProject( | ||
this.data.project_slug, | ||
this.data.model.slug, | ||
project.slug | ||
) | ||
.subscribe(() => { | ||
this.toastService.showSuccess( | ||
'Model moved', | ||
`The model “${this.data.model.name}” was successfuly moved to project "${this.data.project_slug}".` | ||
); | ||
this.dialogRef.close(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters