-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Items: Implement copy button inside the details view
- Loading branch information
Showing
20 changed files
with
607 additions
and
111 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
projects/cobbler-frontend/src/app/common/dialog-item-copy/dialog-item-copy.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,21 @@ | ||
<h1 mat-dialog-title>Copy {{ data.itemType }}</h1> | ||
<mat-dialog-content> | ||
<mat-form-field class="form-field-full-width"> | ||
<mat-label>Old name</mat-label> | ||
<input matInput readonly value="{{ data.itemName }}" /> | ||
</mat-form-field> | ||
|
||
<mat-form-field class="form-field-full-width"> | ||
<mat-label>New name</mat-label> | ||
<input | ||
matInput | ||
[(ngModel)]="dialogCloseSignal" | ||
cdkFocusInitial | ||
placeholder="New name" | ||
/> | ||
</mat-form-field> | ||
</mat-dialog-content> | ||
<mat-dialog-actions> | ||
<button mat-button (click)="onNoClick()">Close</button> | ||
<button mat-button [mat-dialog-close]="dialogCloseSignal()">Copy</button> | ||
</mat-dialog-actions> |
3 changes: 3 additions & 0 deletions
3
projects/cobbler-frontend/src/app/common/dialog-item-copy/dialog-item-copy.component.scss
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,3 @@ | ||
.form-field-full-width { | ||
width: 100%; | ||
} |
39 changes: 39 additions & 0 deletions
39
projects/cobbler-frontend/src/app/common/dialog-item-copy/dialog-item-copy.component.spec.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,39 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { | ||
MAT_DIALOG_DATA, | ||
MatDialogModule, | ||
MatDialogRef, | ||
} from '@angular/material/dialog'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { provideRouter } from '@angular/router'; | ||
|
||
import { DialogItemCopyComponent } from './dialog-item-copy.component'; | ||
|
||
describe('DialogItemRenameComponent', () => { | ||
let component: DialogItemCopyComponent; | ||
let fixture: ComponentFixture<DialogItemCopyComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [DialogItemCopyComponent, MatDialogModule, NoopAnimationsModule], | ||
providers: [ | ||
{ | ||
provide: MatDialogRef, | ||
useValue: {}, | ||
}, | ||
{ | ||
provide: MAT_DIALOG_DATA, | ||
useValue: { itemType: 'Test', itemName: 'test', itemUid: '' }, | ||
}, | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(DialogItemCopyComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
48 changes: 48 additions & 0 deletions
48
projects/cobbler-frontend/src/app/common/dialog-item-copy/dialog-item-copy.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,48 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
inject, | ||
Inject, | ||
model, | ||
} from '@angular/core'; | ||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||
import { MatButton, MatButtonModule } from '@angular/material/button'; | ||
import { | ||
MAT_DIALOG_DATA, | ||
MatDialogModule, | ||
MatDialogRef, | ||
} from '@angular/material/dialog'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
|
||
export interface DialogItemCopyData { | ||
itemType: string; | ||
itemName: string; | ||
itemUid: string; | ||
} | ||
|
||
@Component({ | ||
selector: 'cobbler-dialog-item-copy', | ||
standalone: true, | ||
imports: [ | ||
MatDialogModule, | ||
MatButtonModule, | ||
ReactiveFormsModule, | ||
MatFormFieldModule, | ||
MatInputModule, | ||
FormsModule, | ||
], | ||
templateUrl: './dialog-item-copy.component.html', | ||
styleUrl: './dialog-item-copy.component.scss', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DialogItemCopyComponent { | ||
readonly dialogRef = inject(MatDialogRef<DialogItemCopyComponent>); | ||
readonly dialogCloseSignal = model(''); | ||
|
||
constructor(@Inject(MAT_DIALOG_DATA) public data: DialogItemCopyData) {} | ||
|
||
onNoClick(): void { | ||
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
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
Oops, something went wrong.