mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
29 lines
1 KiB
PowerShell
29 lines
1 KiB
PowerShell
|
|
function Complete-IcingaProgressStatus()
|
||
|
|
{
|
||
|
|
param (
|
||
|
|
[string]$Name = ''
|
||
|
|
);
|
||
|
|
|
||
|
|
if ([string]::IsNullOrEmpty($Name)) {
|
||
|
|
Write-IcingaConsoleError -Message 'Failed to complete progress status. You have to specify a name.';
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($Global:Icinga.Private.ProgressStatus.ContainsKey($Name) -eq $FALSE) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($Global:Icinga.Private.ProgressStatus[$Name].Details) {
|
||
|
|
$Message = [string]::Format('{0}: {1}/{2}', $Global:Icinga.Private.ProgressStatus[$Name].Message, $Global:Icinga.Private.ProgressStatus[$Name].MaxValue, $Global:Icinga.Private.ProgressStatus[$Name].MaxValue);
|
||
|
|
} else {
|
||
|
|
$Message = $Global:Icinga.Private.ProgressStatus[$Name].Message;
|
||
|
|
}
|
||
|
|
|
||
|
|
$ProgressPreference = 'Continue';
|
||
|
|
Write-Progress -Activity $Message -Status ([string]::Format($Global:Icinga.Private.ProgressStatus[$Name].Status, 100)) -PercentComplete 100 -Completed;
|
||
|
|
|
||
|
|
$Global:Icinga.Private.ProgressStatus.Remove($Name);
|
||
|
|
|
||
|
|
$ProgressPreference = 'SilentlyContinue';
|
||
|
|
}
|