Skip to content

Commit

Permalink
hack: Allow "repair builder" to reset work status
Browse files Browse the repository at this point in the history
Signed-off-by: Ikey Doherty <[email protected]>
  • Loading branch information
ikeycode committed Aug 14, 2024
1 parent acb7383 commit 6af2c8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions source/summit/web/builders.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import moss.service.accounts;
import vibe.d;
import moss.service.models.endpoints;

/**
/**
* BuilderWeb management
*/
@requiresAuth @path("/builders") public final class BuilderWeb
Expand All @@ -29,7 +29,7 @@ import moss.service.models.endpoints;

mixin AppAuthenticatorContext;

/**
/**
* Construct new BuilderWeb
*
* Params:
Expand All @@ -40,15 +40,15 @@ import moss.service.models.endpoints;
this.context = context;
}

/**
/**
* Landing page for builders, rendered mostly with JS
*/
@noAuth void index() @safe
{
render!"builders/index.dt";
}

/**
/**
* View an avalanche endpoint.
*
* Params:
Expand All @@ -62,7 +62,7 @@ import moss.service.models.endpoints;
render!("builders/view.dt", endpoint);
}

/**
/**
* Delete a builder completely (account, endpoint + tokens)
*
* Params:
Expand Down Expand Up @@ -91,7 +91,7 @@ import moss.service.models.endpoints;
redirect("/builders");
}

/**
/**
* Try to repair the builder.
*
* At the moment this simply marks it operational again, and subsequent builds may
Expand All @@ -111,6 +111,7 @@ import moss.service.models.endpoints;

endpoint.status = EndpointStatus.Operational;
endpoint.statusText = "Fully operational";
endpoint.workStatus = WorkStatus.Idle;
immutable svErr = context.appDB.update((scope tx) => endpoint.save(tx));
enforceHTTP(svErr.isNull, HTTPStatus.internalServerError, err.message);

Expand Down
2 changes: 1 addition & 1 deletion views/builders/actions.dt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
a.btn.btn-danger(href=format!"/builders/%s/delete"(endpoint.id))
svg.icon: use(xlink:href="/static/tabler/tabler-sprite.svg#tabler-trash")
| Delete
- if (endpoint.status != EndpointStatus.Operational)
- if (endpoint.status != EndpointStatus.Operational || endpoint.workStatus != WorkStatus.Idle)
- {
a.btn.mx-2.btn-primary(href=format!"/builders/%s/repair"(endpoint.id))
svg.icon: use(xlink:href="/static/tabler/tabler-sprite.svg#tabler-hammer")
Expand Down

0 comments on commit 6af2c8f

Please sign in to comment.