-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): delete a record and its draft
- Loading branch information
1 parent
767ab89
commit de2f098
Showing
18 changed files
with
267 additions
and
14 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
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
Empty file.
8 changes: 8 additions & 0 deletions
8
libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.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,8 @@ | ||
<h1 mat-dialog-title>{{ data.title }}</h1> | ||
<div mat-dialog-content>{{ data.message }}</div> | ||
<div mat-dialog-actions> | ||
<gn-ui-button (buttonClick)="onCancel()">{{ data.cancelText }}</gn-ui-button> | ||
<gn-ui-button (buttonClick)="onConfirm()" cdkFocusInitial class="ml-2">{{ | ||
data.confirmText | ||
}}</gn-ui-button> | ||
</div> |
24 changes: 24 additions & 0 deletions
24
libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.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,24 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { ConfirmationDialogComponent } from './confirmation-dialog.component' | ||
|
||
describe('ConfirmationDialogComponent', () => { | ||
let component: ConfirmationDialogComponent | ||
let fixture: ComponentFixture<ConfirmationDialogComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ConfirmationDialogComponent], | ||
}).compileComponents() | ||
}) | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ConfirmationDialogComponent) | ||
component = fixture.componentInstance | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
fixture.detectChanges() | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
47 changes: 47 additions & 0 deletions
47
libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.stories.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,47 @@ | ||
import { Component, Input } from '@angular/core' | ||
import { MatDialog } from '@angular/material/dialog' | ||
import { ButtonComponent } from '@geonetwork-ui/ui/inputs' | ||
import { Meta, moduleMetadata, StoryObj } from '@storybook/angular' | ||
import { ConfirmationDialogComponent } from './confirmation-dialog.component' | ||
|
||
@Component({ | ||
selector: 'gn-ui-launcher', | ||
template: ` <gn-ui-button (buttonClick)="launch()">Open</gn-ui-button> `, | ||
}) | ||
class LaunchDialogComponent { | ||
@Input() title = '' | ||
@Input() message = '' | ||
@Input() confirmText = '' | ||
@Input() cancelText = '' | ||
constructor(private _dialog: MatDialog) {} | ||
|
||
launch(): void { | ||
this._dialog.open(ConfirmationDialogComponent, { | ||
data: { | ||
title: this.title, | ||
message: this.message, | ||
confirmText: this.confirmText, | ||
cancelText: this.cancelText, | ||
}, | ||
}) | ||
} | ||
} | ||
|
||
export default { | ||
title: 'Elements/ConfirmationDialogComponent', | ||
component: LaunchDialogComponent, | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [ButtonComponent, ConfirmationDialogComponent], | ||
}), | ||
], | ||
} as Meta | ||
|
||
export const Primary: StoryObj<LaunchDialogComponent> = { | ||
args: { | ||
title: 'Some title', | ||
message: 'Some message to confirm', | ||
confirmText: 'OK', | ||
cancelText: 'KO', | ||
}, | ||
} |
37 changes: 37 additions & 0 deletions
37
libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.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,37 @@ | ||
import { ChangeDetectionStrategy, Component, Inject } from '@angular/core' | ||
import { | ||
MAT_DIALOG_DATA, | ||
MatDialogModule, | ||
MatDialogRef, | ||
} from '@angular/material/dialog' | ||
import { ButtonComponent } from '@geonetwork-ui/ui/inputs' | ||
|
||
export interface ConfirmationDialogData { | ||
title: string | ||
message: string | ||
confirmText: string | ||
cancelText: string | ||
} | ||
|
||
@Component({ | ||
selector: 'gn-ui-confirmation-dialog', | ||
templateUrl: './confirmation-dialog.component.html', | ||
styleUrls: ['./confirmation-dialog.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [MatDialogModule, ButtonComponent], | ||
}) | ||
export class ConfirmationDialogComponent { | ||
constructor( | ||
public dialogRef: MatDialogRef<ConfirmationDialogComponent>, | ||
@Inject(MAT_DIALOG_DATA) public data: ConfirmationDialogData | ||
) {} | ||
|
||
onConfirm() { | ||
this.dialogRef.close(true) | ||
} | ||
|
||
onCancel() { | ||
this.dialogRef.close(false) | ||
} | ||
} |
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.