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

Replace AddPhoneNumber with AddDestination #492

Merged
merged 5 commits into from
Mar 17, 2023

Conversation

podliashanyk
Copy link
Contributor

Changes made:

  • Clicking on pluss-button in Notification Profiles will prompt a new add destination component (instead of the add phone number component)
  • All use of phone numbers is removed/replaced (tests, styles, components, types, api calls etc), except of phone numbers as a part of destinations

Closes #481

@podliashanyk podliashanyk added notifications Notification system + notification profiles APIv2 Compatibility with APIv2 is guaranteed, may or may not be compatible with other API versions labels Mar 15, 2023
@podliashanyk podliashanyk self-assigned this Mar 15, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2023

Codecov Report

Merging #492 (632625a) into master (607d295) will increase coverage by 3.18%.
The diff coverage is 48.48%.

@@            Coverage Diff             @@
##           master     #492      +/-   ##
==========================================
+ Coverage   53.89%   57.07%   +3.18%     
==========================================
  Files          85       85              
  Lines        3570     3553      -17     
  Branches      739      744       +5     
==========================================
+ Hits         1924     2028     +104     
+ Misses       1637     1516     -121     
  Partials        9        9              
Impacted Files Coverage Δ
src/api/client.ts 38.11% <ø> (+1.19%) ⬆️
src/api/hooks.tsx 85.10% <ø> (+1.43%) ⬆️
src/components/destinations/Destination.tsx 2.85% <ø> (ø)
...ts/notificationprofile/NotificationProfileList.tsx 43.26% <36.95%> (-2.74%) ⬇️
...ts/notificationprofile/NotificationProfileCard.tsx 90.14% <66.66%> (+0.14%) ⬆️
src/components/destinations/NewDestination.tsx 96.82% <83.33%> (+94.34%) ⬆️
...nents/notificationprofile/AddDestinationDialog.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

I will test it manually now, will approve later.

This PR was mostly noise from formatting changes. Please do not combine this many formatting changes (whitespace, indentation, quote-type, newlines, comma vs. semi-colon vs. nothing etc.) and actual functionality changes in the same commits again.

No need to split this PR up, just don't do it again.

CHANGELOG.md Outdated
Comment on lines 6 to 18
## [v1.8.1] - 2023-02-15

### Fixed

- Ensure that description is stored properly when acking, both in bulk and directly

## [v1.8.0] - 2023-02-02

### Added

- Use backend bulk endpoints to speed up updating incidents in bulk
- Visual feedback (table loading) when changing incident filter parameters, and when navigating incident table pages

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, changelog needs updating anyway.

NOTES.md Outdated
Comment on lines 7 to 11
## [v1.8.0] - 2023-02-15
### Changed

### Fixed

- Ensure that description is stored properly when acking, both in bulk and directly
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs merging in so it is not lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one (and other updates in CHANGELOG.md and NOTES.md) are not removed. They are just moved. This one is f.e moved to line 25.
When updating changelogs I noticed that some of the earlier updates were moved from unreleased to some random release version. So I moved them back to unreleasedin this PR. Should have done it in a separate commit though 😅

Comment on lines -14 to -17
PhoneNumberPK,
PhoneNumber,
PhoneNumberRequest,
PhoneNumberSuccessResponse,
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgive the snark but this is one reason it is handy to keep imports sorted! Easier to change things.

@@ -209,45 +205,6 @@ class ApiClient {
);
}

// Phone number
Copy link
Contributor

Choose a reason for hiding this comment

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

Big fan of "abusing" comments this way, again, makes it easier to change things/find things!

@@ -122,14 +112,14 @@ export type DestinationPK = number;
export type Media = {
slug: string;
name: string;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a new linter that demands ";"? Does make for noise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prettier config 😅 My bad, I have fixed it now so next PRs will not come with tons of code reformats! 🥲

Comment on lines +360 to +365
"server-version": string;
"api-version": {
stable: string;
unstable: string;
};
'jsonapi-schema': {
"jsonapi-schema": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This file-change is almost all noise. Beh.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prettier config 😅 My bad, I have fixed it now so next PRs will not come with tons of code reformats! 🥲


export type MediaProperty = {
title: string;
type: string; // value type
description?: string;
format?: string;
}
};

export enum KnownProperties {
PHONE_NUMBER = "phone_number",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is PHONE_NUMBER = "phone_number", still needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

.. and why does it end with "," and not ";"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is a list of what the properties of the known media is and for destinations of the medium sms it is phone_number.

And the comma is because it is an enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we still have phone numbers as a part of destinations (like in the type you highlighted f.e.), in the same fashion as emails etc. But the notion of freestanding phone number is removed from Argus completely now.

Comment on lines -6 to -11
import {
Destination,
Filter, Media,
NotificationProfile,
PhoneNumber,
Timeslot
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only change in this file that removes the old way to do phone numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, PhoneNumber import. It was used in apiMock to phone number endpoint call before. I changed it to apiMock call to destinations in one of the earlier PRs. So rogue import was the only thing that remained in this file.

Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

  1. Even when I zoom out to 50% the popup still has vertical and horizontal scroll bars.

image

  1. When creating a destination from the notification profile page I would expect it not to only be added to destinations, but also automatically added to the profile I'm creating it from or is that no ideal?

CHANGELOG.md Outdated Show resolved Hide resolved
NOTES.md Outdated Show resolved Hide resolved

export type MediaProperty = {
title: string;
type: string; // value type
description?: string;
format?: string;
}
};

export enum KnownProperties {
PHONE_NUMBER = "phone_number",
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is a list of what the properties of the known media is and for destinations of the medium sms it is phone_number.

And the comma is because it is an enum.

@podliashanyk
Copy link
Contributor Author

podliashanyk commented Mar 16, 2023

  1. Even when I zoom out to 50% the popup still has vertical and horizontal scroll bars.

Fixed

  1. When creating a destination from the notification profile page I would expect it not to only be added to destinations, but also automatically added to the profile I'm creating it from or is that no ideal?

I simply mirrored the add phone number functionality in this PR, and this wasn't a part of the feature with phone numbers. New destination is therefore only added to the dropdown in notifications and to destinations.
I suggest creating a separate issue for this. Such changes are out of scope of this PR anyway.
What you suggest feels a bit off for me personally, but user might think otherwise. 😄 So if we choose to work on the issue we should get feedback from the users who work a lot with the notification profiles

@podliashanyk
Copy link
Contributor Author

podliashanyk commented Mar 16, 2023

This PR was mostly noise from formatting changes. Please do not combine this many formatting changes (whitespace, indentation, quote-type, newlines, comma vs. semi-colon vs. nothing etc.) and actual functionality changes in the same commits again.

No need to split this PR up, just don't do it again.

Sorry, my bad! Will keep an eye on it 🤯 I have fixed the formatter config now.

Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

No more unnecessary scrollbars!

And I made an issue for automatically adding a created destination to a profile.

Very nice! 👍

CHANGELOG.md Outdated

- Ensure that description is stored properly when acking, both in bulk and directly

## [v1.8.0] - 2023-02-02

### Added

- Use backend bulk endpoints to speed up updating incidents in bulk
Copy link
Contributor

Choose a reason for hiding this comment

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

"Use backend bulk endpoints to speed up updating incidents in bulk" is released isn't it? In the notes, it is sorted under version 1.8.0, not unreleased.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

NOTES.md Outdated
Comment on lines 16 to 11
- Use backend bulk endpoints to speed up updating incidents in bulk
- Visual feedback (table loading) when changing incident filter parameters, and when navigating incident table pages
- Replaced _add phone number from notification profiles_ feature with _add destination from notification profiles_ feature.
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw wrong but: isn't the bulk stuff already in production?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@hmpf
Copy link
Contributor

hmpf commented Mar 17, 2023

Polish, do not change now: on the "Notification profiles"-page, on Vivaldi (which uses chrome), the lines under the fields does not line up.

@hmpf
Copy link
Contributor

hmpf commented Mar 17, 2023

@johannaengland's follow up issue: #493

@podliashanyk
Copy link
Contributor Author

@hmpf CHANGELOG and NOTES are fixed now. And I commented on the cause of the problem with line up in #494

@podliashanyk podliashanyk requested a review from hmpf March 17, 2023 08:40
Copy link
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

Ready for rebase and merge.

Disable scrollbars


Switch to using destinations only in notifications list
Remove use of phone numbers in styles

Pluss some formatting and styling fixes
Remove add phone number dialog component


Remove phone number from notification list tests


Remove tests for add phone number dialog 

Component no longer exists
Replace phone numbers with destinations in card tests
Test reset of input fields in new destination component


Test discard button
Update CHANGELOG.md

Co-authored-by: Johanna England <[email protected]>
Update NOTES.md

Co-authored-by: Johanna England <[email protected]>
Fix changelogs
@podliashanyk podliashanyk force-pushed the implement-add-new-destination-from-notifications branch from d15db43 to 7775f88 Compare March 17, 2023 08:54
@podliashanyk podliashanyk merged commit ec9a621 into master Mar 17, 2023
@podliashanyk podliashanyk deleted the implement-add-new-destination-from-notifications branch March 17, 2023 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIv2 Compatibility with APIv2 is guaranteed, may or may not be compatible with other API versions notifications Notification system + notification profiles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to creating new destination in notification profiles
4 participants