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

adding update capabilities for classification nodes #470

Merged
merged 12 commits into from
Aug 5, 2022

Conversation

a11smiles
Copy link
Contributor

PR Summary

  • Added Update-VSTeamArea and Update-VSTeamIteration wrappers and their base function Update-VSTeamClassificationNodes to allow updates to classification nodes.
  • Updated StartTime and FinishTime to be nullable for iterations, which includes the base classification nodes functions.
  • Updated the ClassificationNode object to provide a direct reference to an iteration's start and finish date, if provided, rather than being required to access them through the InternalObject.
  • Small updates to typos in the documentation.

For the second bullet, consider the following scenario:

In a situation where I'm syncing two projects (e.g. copying iterations from one to another), the current implementation would require me to write the following if-else statement to check if dates are provided because it doesn't allow for a nullable DateTime.

    if ($null -eq $Node.InternalObject.Attributes.StartDate) {
         Add-VSTeamIteration -ProjectName $DestinationProject -Name $Node.Name -Path $Path
    } else {
         Add-VSTeamIteration -ProjectName $DestinationProject -Name $Node.Name -Path $Path -StartDate $Node.InternalObject.Attributes.StartDate -FinishDate $Node.InternalObject.Attributes.FinishDate
    }

Not allowing a nullable DateTime is okay if the node is net new. However, I have the write this if-else for pre-existing nodes when attempting to simply copy them.

[Add|Update]-VSTeamIteration

Params changed to the following:

[Parameter(Mandatory = $false)]
[Nullable[datetime]] $StartDate,

[Parameter(Mandatory = $false)]
[Nullable[datetime]] $FinishDate,

This also removes the need for these if statements. (Also, AzDO requires that if one date is set, the other MUST also be set. It won't allow a StartDate and not a FinishDate, and vice versa.)

if ($StartDate) {
    $params.StartDate = $StartDate
}

if ($FinishDate) {
    $params.FinishDate = $FinishDate
}

By making the above changes, I no longer need my original if-else statement. I can simply write the following one line and the null values are accepted.

Add-VSTeamIteration -ProjectName $DestinationProject -Name $Node.Name -Path $Path -StartDate $Node.InternalObject.Attributes.StartDate -FinishDate $Node.InternalObject.Attributes.FinishDate

PR Checklist

@a11smiles
Copy link
Contributor Author

@SebastianSchuetze can you run the workflows please? I had a mistype in my unit tests. Thanks!

@SebastianSchuetze
Copy link
Collaborator

looks like you have green lights. I will review in the next few days.

Copy link
Collaborator

@SebastianSchuetze SebastianSchuetze left a comment

Choose a reason for hiding this comment

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

Please check the comments. Nothing serious. Otherwise I will approve as soon as I understand or changes are made. :-)

Source/Classes/Provider/ClassificationNode.cs Show resolved Hide resolved
Copy link
Collaborator

@SebastianSchuetze SebastianSchuetze left a comment

Choose a reason for hiding this comment

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

Sorry forgot to save my other suggestions @a11smiles :-)

Tests/function/tests/Update-VSTeamIteration.Tests.ps1 Outdated Show resolved Hide resolved
Tests/function/tests/Update-VSTeamIteration.Tests.ps1 Outdated Show resolved Hide resolved
Tests/function/tests/Update-VSTeamArea.Tests.ps1 Outdated Show resolved Hide resolved
Tests/function/tests/Update-VSTeamArea.Tests.ps1 Outdated Show resolved Hide resolved
@SebastianSchuetze
Copy link
Collaborator

@a11smiles anything I can help with to get this PR finished?

a11smiles and others added 6 commits August 2, 2022 21:36
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
@a11smiles
Copy link
Contributor Author

I wasn't sure how particular you guys were with 'return' vs. 'update'. Thanks for making the changes.

@SebastianSchuetze SebastianSchuetze enabled auto-merge (squash) August 5, 2022 15:07
Copy link
Collaborator

@SebastianSchuetze SebastianSchuetze left a comment

Choose a reason for hiding this comment

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

All good now, thanks!

@SebastianSchuetze SebastianSchuetze merged commit 33c5f0c into MethodsAndPractices:trunk Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants