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

[GT-187] Add feature selecting multiple sites #475

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

Sae126V
Copy link
Contributor

@Sae126V Sae126V commented Aug 31, 2023

[MAIN Functionality]
Added support for selecting multiple sites in "ADD" downtime.
Changed the Confirm Downtime and Confirm Edit Downtime pages.
Changed Add_Downtime success page with relevant content.

Resolves: #261

Partially address: #85 and #66 .

Addressed @gregcorbett comments:

Suggestion 1:

Include the Site Name next to the downtime link on creation, i.e.:

New Downtimes successfully created. Please click the links below for more information.

Site A: Downtime 10
Site B: Downtime 11

Suggestion 1:

Only display the start and end time once on the "Confirm Downtime" page, i.e.:

Severity: WARNING
Description: foo bar
Starting (UTC): 08/09/2023 00:00
Ending (UTC): 18/09/2023 00:00
Site Name: Brunnen GS
...
Site Name: Torch
...

@Sae126V Sae126V requested a review from a team as a code owner August 31, 2023 11:21
@Sae126V Sae126V force-pushed the GT-187-(functionality)-Selecting-multiple-sites-in-a-downtime-view branch from cfb67ca to a87a37c Compare August 31, 2023 11:37
@Sae126V
Copy link
Contributor Author

Sae126V commented Aug 31, 2023

This PR is ready for review.

Comment on lines 49 to 50
$type = strpos($idType, 's') !== false ? 'services' : 'endpoints';
$id = str_replace(['s', 'e'], '', $idType);
Copy link
Member

Choose a reason for hiding this comment

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

can you add some comments here explaining the desired behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added


if (!isset($_REQUEST['site_id']) || !is_numeric($_REQUEST['site_id']) ){
throw new Exception("An id must be specified");
if (empty($siteIDs)) {
Copy link
Member

Choose a reason for hiding this comment

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

is this change equivalent to the old functionality? what if a non numeric string is passed in via site_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say Not an equivalent. We are now passing an array of Number. So I don't think it would be an issue.

Copy link
Member

Choose a reason for hiding this comment

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

when you loop through the siteIDs later, can you add an is_numeric check?

@gregcorbett
Copy link
Member

When editing a downtime, the start time gets unset. This isn't existing beaviour. Can you track down the cause and fix?

@Sae126V
Copy link
Contributor Author

Sae126V commented Aug 31, 2023

When editing a downtime, the start time gets unset. This isn't existing beaviour. Can you track down the cause and fix?

When editing a downtime, the start time gets unset. This isn't existing beaviour. Can you track down the cause and fix?

This would be fixed by #474 .

@gregcorbett gregcorbett self-assigned this Aug 31, 2023
@gregcorbett gregcorbett added this to the May 2023 milestone Aug 31, 2023
Copy link
Member

@gregcorbett gregcorbett left a comment

Choose a reason for hiding this comment

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

See comments

@Sae126V Sae126V force-pushed the GT-187-(functionality)-Selecting-multiple-sites-in-a-downtime-view branch from 1983632 to b3dd024 Compare August 31, 2023 14:39
@Sae126V Sae126V requested a review from gregcorbett August 31, 2023 15:03
@@ -294,6 +305,22 @@ function updateStartEndTimesInUtc(){
}
}

function hasSitesWithSingleTimezones()
Copy link
Member

Choose a reason for hiding this comment

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

this method should refer to selecting multiple sites, than sites being in the same timezone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to go with hasSitesWithSingleTimezones() because its about user selecting site time zone (Which we are not supporting) option along with multiple sites.

Copy link
Member

Choose a reason for hiding this comment

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

the check here is that multiple sites have been selected, not that wether those sites share a timezone.

Copy link
Member

Choose a reason for hiding this comment

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

hasMultipleSitesWithSiteTimezones()

Comment on lines 113 to 114
$downtimeInfo['SITE_LEVEL_DETAILS'] = $siteLevelDetails;
$downtimeInfo['SERVICE_WITH_ENDPOINTS'] = $serviceWithEndpoints;
Copy link
Member

Choose a reason for hiding this comment

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

is SERVICE_WITH_ENDPOINTS roughly the same as the previous Impacted_Services here? if so, what does SITE_LEVEL_DETAILS add?

Copy link
Contributor Author

@Sae126V Sae126V Sep 1, 2023

Choose a reason for hiding this comment

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

is SERVICE_WITH_ENDPOINTS roughly the same as the previous Impacted_Services here?
No, SERVICE_WITH_ENDPOINTS will have each service with endpoints. Whereas Impacted_Services will have all service INFO.

I have used one object(SERVICE_WITH_ENDPOINTS ) for Viewing and extract the other to submit(Just in case if user goes back to and not submitting).

In a single loop. I constructed two objects one for viewing and the other for submitting purpose.

@Sae126V Sae126V force-pushed the GT-187-(functionality)-Selecting-multiple-sites-in-a-downtime-view branch from 47a372c to 876e490 Compare September 1, 2023 09:06
Copy link
Member

@gregcorbett gregcorbett left a comment

Choose a reason for hiding this comment

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

I have left some additional comments

Comment on lines 45 to 54
foreach ($impactedIDs as $id) {
/**
* `$siteNumber` => It's about Site ID
* `$parentService` => It's about service ID endpoint belongs too
* `idType` => It's about to differentiate
* the endpoint vs service selection.
*/
list($siteNumber, $parentService, $idType) = explode(':', $id);

$type = strpos($idType, 's') !== false ? 'services' : 'endpoints';
Copy link
Member

Choose a reason for hiding this comment

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

I'd go for something like:

Suggested change
foreach ($impactedIDs as $id) {
/**
* `$siteNumber` => It's about Site ID
* `$parentService` => It's about service ID endpoint belongs too
* `idType` => It's about to differentiate
* the endpoint vs service selection.
*/
list($siteNumber, $parentService, $idType) = explode(':', $id);
$type = strpos($idType, 's') !== false ? 'services' : 'endpoints';
foreach ($impactedIDs as $id) {
list($siteId, $parentServiceId, $idType) = explode(':', $id);
// put typical input for $idType here.
$type = strpos($idType, 's') !== false ? 'services' : 'endpoints';

@Sae126V Sae126V marked this pull request as draft September 1, 2023 11:13
@Sae126V Sae126V marked this pull request as ready for review September 12, 2023 12:59
@Sae126V
Copy link
Contributor Author

Sae126V commented Sep 12, 2023

@gregcorbett , I have updated the code (some what large parts).

@gregcorbett gregcorbett modified the milestones: May 2023, September 2023 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selecting multiple sites in a single downtime.
2 participants