Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSP-638 Value Deletion Comment #198

Merged
merged 7 commits into from
Oct 6, 2020
Merged

Conversation

mdelez
Copy link
Contributor

@mdelez mdelez commented Sep 30, 2020

@mdelez mdelez self-assigned this Sep 30, 2020
@mdelez mdelez added the enhancement New feature or request label Sep 30, 2020
@mdelez
Copy link
Contributor Author

mdelez commented Oct 1, 2020

Screen Shot 2020-10-01 at 09 27 31

@flavens what do you think about this design? Should the label and input be side-by-side or is this okay?

@flavens
Copy link
Collaborator

flavens commented Oct 1, 2020

@flavens what do you think about this design? Should the label and input be side-by-side or is this okay?

I would rather use a textarea (you can configure the size to keep it small) because an input may be too short. The label can be the placeholder, instead of being outside of the field. It saves some space. The label could be more straight forward, e.g. "Comment about the deletion" or something like this..

@mdelez mdelez mentioned this pull request Oct 1, 2020
Copy link
Collaborator

@flavens flavens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -9,7 +9,12 @@ import { ReadValue } from '@dasch-swiss/dsp-js';
export class ConfirmationMessageComponent {

@Input() value: ReadValue;
comment: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the comment by made optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made optional in 050a4cd


export class ConfirmationDialogData {
value: ReadValue;
buttonTextOk: string;
buttonTextCancel: string;
}

export class ConfirmationDialogPayload {
confirmed: boolean;
deletionComment: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the deletionComment be made optional (instead of setting it to null when there is no deletion comment)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made optional in 050a4cd

this._dialogRef.close(true);
const payload = new ConfirmationDialogPayload();
payload.confirmed = true;
payload.deletionComment = this.confirmationMessageComponent.comment ? this.confirmationMessageComponent.comment : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to undefined if a comment is not provided in 050a4cd

confirmed: boolean;
deletionComment: string;
}

@Component({
selector: 'dsp-confirmation-dialog',
templateUrl: './confirmation-dialog.component.html',
styleUrls: ['./confirmation-dialog.component.scss']
})
export class ConfirmationDialogComponent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this component specific for value deletion? If so, could its name say so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed in 050a4cd

@@ -937,6 +938,7 @@ describe('DisplayEditComponent', () => {
const deleteVal = new DeleteValue();
deleteVal.id = 'http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/dJ1ES8QTQNepFKF5-EAqdg';
deleteVal.type = 'http://api.knora.org/ontology/knora-api/v2#IntValue';
deleteVal.deleteComment = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment about optional comments :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made optional in 050a4cd

this.deleteValue();
dialogRef.afterClosed().subscribe((payload: ConfirmationDialogPayload) => {
if (payload && payload.confirmed) {
this.deleteValue(payload.deletionComment);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if null is passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made optional in 050a4cd

@@ -160,3 +160,30 @@ button.save .mat-icon,
button.cancel .mat-icon {
font-size: 18px;
}

.deletion-dialog .title {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this more general than value deletion? Wouldn't it make more sense to keep it in the component's CSS file?

Copy link
Contributor Author

@mdelez mdelez Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some thinking, I should refactor this a little. The current ConfirmationMessage component should be renamed and made more specific to a deletion message. This way the ConfirmationDialog component can be reused and you can just supply it with the Message component of your choosing.

Ideally the ConfirmationDialog component is just a shell with a button to confirm and a button to cancel and its contents is defined by the type of message component you give it. We should handle this in another PR though.

Task created https://dasch.myjetbrains.com/youtrack/issue/DSP-781

@mdelez
Copy link
Contributor Author

mdelez commented Oct 5, 2020

Should this be unsubscribed from? dialogRef.afterClosed().subscribe

Edit: The answer is no. I appreciate how simple this guy made it to understand https://stackoverflow.com/a/58199099

 - renamed ConfirmationDialogPayload to ConfirmationDialogValueDeletionPayload
 - refactored the deletion comment to be optional so that it will be undefined instead of null if a comment is not provided
Copy link
Contributor

@tobiasschweizer tobiasschweizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the adaptions.

@mdelez mdelez merged commit 29f259d into master Oct 6, 2020
@mdelez mdelez deleted the wip/dsp-638-value-deletion-comment branch October 6, 2020 11:18
@kilchenmann kilchenmann changed the title Value Deletion Comment DSP-638 Value Deletion Comment Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants