-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: dev
Are you sure you want to change the base?
[GT-187] Add feature selecting multiple sites #475
Conversation
cfb67ca
to
a87a37c
Compare
This PR is ready for review. |
$type = strpos($idType, 's') !== false ? 'services' : 'endpoints'; | ||
$id = str_replace(['s', 'e'], '', $idType); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
1983632
to
b3dd024
Compare
@@ -294,6 +305,22 @@ function updateStartEndTimesInUtc(){ | |||
} | |||
} | |||
|
|||
function hasSitesWithSingleTimezones() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasMultipleSitesWithSiteTimezones()
$downtimeInfo['SITE_LEVEL_DETAILS'] = $siteLevelDetails; | ||
$downtimeInfo['SERVICE_WITH_ENDPOINTS'] = $serviceWithEndpoints; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
47a372c
to
876e490
Compare
There was a problem hiding this 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
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'; |
There was a problem hiding this comment.
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:
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'; |
@gregcorbett , I have updated the code (some what large parts). |
[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
...