fixed issue in usage page where local shell was not used at all.

This commit is contained in:
Erik Brakkee 2024-08-03 21:18:44 +02:00
parent b41317c598
commit 2df296d3c3

View File

@ -3,7 +3,7 @@ package templates
import "converge/pkg/models"
templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInputs UsageInputs) {
templ AgentUsage(access models.ConvergeAccess, usageInputs UsageInputs) {
<div>
<h2>Downloading and running the agent</h2>
@ -11,7 +11,7 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
This is what you run on a remote server, typically in your continuous integration job.
</p>
if shells[BASH] {
if usageInputs.RemoteShells[BASH] {
<pre>{addSshKeys(BASH, usageInputs.SshKeys)}
curl --fail-with-body http{access.Secure}://{access.HostPort}/downloads/agent > agent{`
chmod 755 agent
@ -19,14 +19,14 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
rm -f agent
`}</pre>
}
if shells[CMD] {
if usageInputs.RemoteShells[CMD] {
<pre>{addSshKeys(CMD, usageInputs.SshKeys)}
curl --fail-with-body http{access.Secure}://{access.HostPort}/downloads/agent.exe > agent.exe{`
`}agent --id {usageInputs.Id} ws{access.Secure}://{access.HostPort}{`
del agent.exe
`}</pre>
}
if shells[POWERSHELL] {
if usageInputs.RemoteShells[POWERSHELL] {
<pre>{addSshKeys(POWERSHELL, usageInputs.SshKeys)}
curl --fail-with-body http{access.Secure}://{access.HostPort}/downloads/agent.exe > agent.exe{`
`}agent --id {usageInputs.Id} ws{access.Secure}://{access.HostPort}{`
@ -85,7 +85,7 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
<h2>Working with the agent</h2>
if shells[BASH] {
if usageInputs.RemoteShells[BASH] {
<pre>{`
# cd back to the agent directory
cd $agentdir
@ -95,7 +95,7 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
`}</pre>
}
if shells[CMD] {
if usageInputs.RemoteShells[CMD] {
<pre>{`
# cd back to the agent directory
cd %agentdir%
@ -104,7 +104,7 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
echo > %agentdir%\.hold
`}</pre>
}
if shells[POWERSHELL] {
if usageInputs.RemoteShells[POWERSHELL] {
<pre>{`
# cd back to the agent directory
cd $env:agentdir
@ -113,8 +113,7 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
$null > $env:agentdir\.hold
`}</pre>
}
if shells[CMD] || shells[POWERSHELL] {
<p>windows</p>
if usageInputs.RemoteShells[CMD] || usageInputs.RemoteShells[POWERSHELL] {
<p>
NOTE: When running the agent on windows, an exit of the remote session using
exit in powershell or command prompt does not terminate the shell completely.
@ -130,7 +129,7 @@ templ AgentUsage(access models.ConvergeAccess, shells map[string]bool, usageInpu
templ ShellUsage(access models.ConvergeAccess, usageInputs UsageInputs) {
<div>
@AgentUsage(access, usageInputs.RemoteShells, usageInputs)
@AgentUsage(access, usageInputs)
</div>
}
@ -173,14 +172,14 @@ templ Usage(access models.ConvergeAccess) {
<input id="remote-shell-2" name="remote-shell" type="radio" value={POWERSHELL}> <label for="remote-shell-2">power shell</label>
</td>
</tr>
<tr>
<!--tr>
<td class="minimal-width"><label for="local-shell">local environment</label></td>
<td>
<input id="checked local-shell-0" name="local-shell" type="radio" value={BASH}> <label for="local-shell-0">*.sh</label>
<input id="local-shell-1" name="local-shell" type="radio" value={CMD}> <label for="local-shell-1">command prompt</label>
<input id="local-shell-2" name="local-shell" type="radio" value={POWERSHELL}> <label for="local-shell-2">powershell</label>
</td>
</tr>
</tr -->
</table>
</form>