Merge pull request #296 from Mykhailo-Roit/master
feat: replace_with_assignments import type
This commit is contained in:
@@ -43,6 +43,10 @@ function Invoke-InitializeModule
|
||||
Name = "Replace (Preview)"
|
||||
Value = "replace"
|
||||
},
|
||||
[PSCustomObject]@{
|
||||
Name = "Replace with assignments (Preview)"
|
||||
Value = "replace_with_assignments"
|
||||
},
|
||||
[PSCustomObject]@{
|
||||
Name = "Update (Preview)"
|
||||
Value = "update"
|
||||
@@ -2353,7 +2357,10 @@ function Reset-GraphObject
|
||||
# Clone the object before removing properties
|
||||
$obj = $fileObj.Object | ConvertTo-Json -Depth 50 | ConvertFrom-Json
|
||||
Start-GraphPreImport $obj $objectType
|
||||
Remove-Property $obj "Assignments"
|
||||
if ($global:cbImportType.SelectedValue -ne "replace_with_assignments"){
|
||||
# will use the assignments from the file for "replace_with_assignments" type
|
||||
Remove-Property $obj "Assignments"
|
||||
}
|
||||
Remove-Property $obj "isAssigned"
|
||||
|
||||
if($global:cbImportType.SelectedValue -eq "update")
|
||||
@@ -2417,7 +2424,7 @@ function Reset-GraphObject
|
||||
}
|
||||
return $true
|
||||
}
|
||||
elseif($global:cbImportType.SelectedValue -eq "replace")
|
||||
elseif($global:cbImportType.SelectedValue -in @("replace","replace_with_assignments"))
|
||||
{
|
||||
$replace = $true
|
||||
$import = $true
|
||||
@@ -2466,8 +2473,13 @@ function Reset-GraphObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Import-GraphObjectAssignment $newObj $objectType $curObject.Object.Assignments $fileObj.FileInfo.FullName -CopyAssignments | Out-Null
|
||||
if ($global:cbImportType.SelectedValue -eq "replace")
|
||||
{
|
||||
Import-GraphObjectAssignment $newObj $objectType $curObject.Object.Assignments $fileObj.FileInfo.FullName -CopyAssignments | Out-Null
|
||||
}
|
||||
else {
|
||||
Import-GraphObjectAssignment $newObj $objectType $obj.Assignments $file.FileInfo.FullName | Out-Null
|
||||
}
|
||||
|
||||
if($delete)
|
||||
{
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<Bold>Always import</Bold>: Always try to import the object. No detction of existing object (Default)<LineBreak />
|
||||
<Bold>Skip if object exists</Bold>: Skip import if there is an existing object with the same name and type<LineBreak />
|
||||
<Bold>Replace</Bold>: If an object is detected, it will be deleted. The assignments will be copied to the new imported object<LineBreak />
|
||||
<Bold>Replace with assignments</Bold>: If an object is detected, it will be deleted. The assignments will be copied from the imported object<LineBreak />
|
||||
<Bold>Update</Bold>: If an object is detected, settings will be replaced from the import file
|
||||
</TextBlock>
|
||||
</Rectangle.ToolTip>
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<Bold>Always import</Bold>: Always try to import the object. No detction of existing object (Default)<LineBreak />
|
||||
<Bold>Skip if object exists</Bold>: Skip import if there is an existing object with the same name and type<LineBreak />
|
||||
<Bold>Replace</Bold>: If an object is detected, it will be deleted. The assignments will be copied to the new imported object<LineBreak />
|
||||
<Bold>Replace with assignments</Bold>: If an object is detected, it will be deleted. The assignments will be copied from the imported object<LineBreak />
|
||||
<Bold>Update</Bold>: If an object is detected, settings will be replaced from the import file
|
||||
</TextBlock>
|
||||
</Rectangle.ToolTip>
|
||||
|
||||
Reference in New Issue
Block a user