Skip to content

Commit

Permalink
Changed toast text for uir.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Jun 5, 2024
1 parent a68b3e9 commit f8af914
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions Server/Components/Pages/Deploy.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<div class="input-group">
<input type="text" class="form-control" readonly value="@_windowsScript" />
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyToClipboard(_windowsScript)">
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyScriptToClipboard(_windowsScript)">
<i class="oi oi-clipboard"></i>
</button>
</div>
Expand All @@ -44,7 +44,7 @@

<div class="input-group">
<input type="text" class="form-control" readonly value="@_ubuntuScript" />
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyToClipboard(_ubuntuScript)">
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyScriptToClipboard(_ubuntuScript)">
<i class="oi oi-clipboard"></i>
</button>
</div>
Expand All @@ -57,7 +57,7 @@

<div class="input-group">
<input type="text" class="form-control" readonly value="@_manjaroScript" />
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyToClipboard(_manjaroScript)">
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyScriptToClipboard(_manjaroScript)">
<i class="oi oi-clipboard"></i>
</button>
</div>
Expand Down Expand Up @@ -116,7 +116,7 @@

<div class="input-group">
<input type="text" class="form-control" readonly value="@_winX64Uri" />
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyToClipboard(_winX64Uri)">
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyUriToClipboard(_winX64Uri)">
<i class="oi oi-clipboard"></i>
</button>
</div>
Expand Down Expand Up @@ -161,7 +161,7 @@

<div class="input-group">
<input type="text" class="form-control" readonly value="@_winX86Uri" />
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyToClipboard(_winX86Uri)">
<button class="btn btn-primary" type="button" id="button-addon2" @onclick="() => CopyUriToClipboard(_winX86Uri)">
<i class="oi oi-clipboard"></i>
</button>
</div>
Expand Down Expand Up @@ -207,11 +207,11 @@
await base.OnInitializedAsync();
}

private async Task CopyToClipboard(string text)
private async Task CopyScriptToClipboard(string script)
{
try
{
var result = await JsInterop.SetClipboardText(text);
var result = await JsInterop.SetClipboardText(script);
if (result)
{
Toasts.ShowToast2("Script copied to clipboard", ToastType.Success);
Expand All @@ -225,6 +225,23 @@
Toasts.ShowToast2("Failed to set clipboard content", ToastType.Error);
}

private async Task CopyUriToClipboard(string uri)
{
try
{
var result = await JsInterop.SetClipboardText(uri);
if (result)
{
Toasts.ShowToast2("URI copied to clipboard", ToastType.Success);
return;
}
}
catch (Exception ex)
{
Logger.LogError(ex, "Error while copying URI to clipboard.");
}
Toasts.ShowToast2("Failed to set clipboard content", ToastType.Error);
}

private string GetLinuxScript(string platformId)
{
Expand Down

0 comments on commit f8af914

Please sign in to comment.