Working webhook

This commit is contained in:
nemunaire 2022-09-05 12:20:33 +02:00
commit 7b45214ca9
6 changed files with 157 additions and 39 deletions

View file

@ -84,7 +84,23 @@
<div class="card-body d-flex justify-content-between">
<div class="d-flex flex-column justify-content-center">
<div>
Dépôt lié&nbsp;: <strong style="font-family: monospace">{repo.uri}</strong><br>
<div class="row">
<label for={repo.id + "url"} class="col-sm-6 col-form-label">Dépôt lié&nbsp;:</label>
<div class="col-sm-6">
<input type="text" class="form-control form-control-sm" style="font-family: monospace" disabled id={repo.id + "url"} value={repo.uri}>
</div>
</div>
<div class="row">
<label for={repo.id + "secret"} class="col-sm-6 col-form-label">Webhook Secret token (à indiquer dans GitLab)&nbsp;:</label>
<div class="col-sm-6">
<div class="input-group">
<input type={repo.show_secret?"text":"password"} class="form-control form-control-sm" disabled id={repo.id + "secret"} value={repo.secret}>
<button class="btn btn-sm btn-outline-info" on:click={() => { repo.show_secret = !repo.show_secret}}>
<i class="bi" class:bi-eye={!repo.show_secret} class:bi-eye-slash={repo.show_secret}></i>
</button>
</div>
</div>
</div>
Dernière récupération&nbsp;: <strong>{#if repo.last_check}<DateFormat date={new Date(repo.last_check)} dateStyle="medium" timeStyle="medium" />{:else}-{/if}</strong>
{#if repo_pull_state}
{#await repo_pull_state}

View file

@ -5,11 +5,12 @@ export class WorkRepository {
}
}
update({ id, id_user, id_work, uri, last_check }) {
update({ id, id_user, id_work, uri, secret, last_check }) {
this.id = id;
this.id_user = id_user;
this.id_work = id_work;
this.uri = uri;
this.secret = secret;
this.last_check = last_check;
}

View file

@ -146,7 +146,7 @@
<li>être dans l'espace de nom de votre utilisateur (à la fin de la liste des <span class="fst-italic">namespaces</span>),</li>
<li>avoir la visibilité «&nbsp;Privé&nbsp;»,</li>
<li>avoir invité <a href="https://gitlab.cri.epita.fr/nemunaire" target="_blank" style="font-family: monospace">nemunaire</a> avec le rôle <span class="fst-italic">Reporter</span> une fois le dépôt créé,</li>
<li>configuré un <span class="fst-italic">webhook</span> pointant sur <code>https://lessons.nemunai.re/api/callbacks/trigger.json</code></li>
<li>avoir configuré un <span class="fst-italic">webhook <strong>Tag push events</strong></span> pointant sur <code>https://lessons.nemunai.re/api/callbacks/trigger.json</code> avec le secret donné.</li>
</ul>
{#if w.tag}