repo: Admin can override default expected tag
This commit is contained in:
parent
20016a99c6
commit
1859a715df
@ -189,7 +189,12 @@ func declareAPIAuthRepositoriesRoutes(router *gin.RouterGroup) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerTagUpdate(c, work, repo, u, nil)
|
var tag *string
|
||||||
|
if loggeduser.IsAdmin {
|
||||||
|
c.ShouldBindJSON(&tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
TriggerTagUpdate(c, work, repo, u, tag)
|
||||||
})
|
})
|
||||||
|
|
||||||
repositoriesRoutes.GET("/state", func(c *gin.Context) {
|
repositoriesRoutes.GET("/state", func(c *gin.Context) {
|
||||||
|
@ -54,10 +54,11 @@ export class WorkRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async retrieveWork() {
|
async retrieveWork(tag) {
|
||||||
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/trigger`:`api/repositories/${this.id}/trigger`, {
|
const res = await fetch(this.id_work?`api/works/${this.id_work}/repositories/${this.id}/trigger`:`api/repositories/${this.id}/trigger`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Accept': 'application/json'}
|
headers: {'Accept': 'application/json'},
|
||||||
|
body: !tag || tag.length == 0?null:JSON.stringify(tag)
|
||||||
});
|
});
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
import SubmissionStatus from '../../../components/SubmissionStatus.svelte';
|
import SubmissionStatus from '../../../components/SubmissionStatus.svelte';
|
||||||
import SurveyBadge from '../../../components/SurveyBadge.svelte';
|
import SurveyBadge from '../../../components/SurveyBadge.svelte';
|
||||||
import { getRepositories } from '../../../lib/repositories';
|
import { getRepositories } from '../../../lib/repositories';
|
||||||
|
import { ToastsStore } from '../../../stores/toasts';
|
||||||
import { getUsers } from '../../../lib/users';
|
import { getUsers } from '../../../lib/users';
|
||||||
|
|
||||||
export let work = null;
|
export let work = null;
|
||||||
@ -36,6 +37,7 @@
|
|||||||
let nb_users = 0;
|
let nb_users = 0;
|
||||||
|
|
||||||
let show_logs = null;
|
let show_logs = null;
|
||||||
|
let run_pull_for = {repo: null, user: null, tag: null};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await work then w}
|
{#await work then w}
|
||||||
@ -86,7 +88,7 @@
|
|||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-primary mx-1"
|
class="btn btn-sm btn-primary mx-1"
|
||||||
title="Rafraîchir"
|
title="Rafraîchir"
|
||||||
on:click={() => repo.retrieveWork()}
|
on:click={() => { run_pull_for = { repo, user, tag: '', modal: new bootstrap.Modal(document.getElementById('pullModal'))}; run_pull_for.modal.show(); }}
|
||||||
>
|
>
|
||||||
<i class="bi bi-arrow-clockwise"></i>
|
<i class="bi bi-arrow-clockwise"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -112,6 +114,28 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
|
<div class="modal fade" tabindex="-1" id="pullModal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<form class="modal-content" on:submit|preventDefault={() => {run_pull_for.modal.hide(); try { run_pull_for.repo.retrieveWork(run_pull_for.tag) } catch(err) { ToastsStore.addToast({color: "danger", title: "Connexion impossible", msg: err}) };}}>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Repository Pull {#if run_pull_for.user}{run_pull_for.user.login}{/if}</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="form-group row mb-2">
|
||||||
|
<label class="col-2 col-form-label" for="pull-tag">Tag</label>
|
||||||
|
<input class="form-control col" id="pull-tag" autofocus placeholder={w.tag} bind:value={run_pull_for.tag}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Récupérer le travail
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<div class="modal fade" tabindex="-1" id="logsModal">
|
<div class="modal fade" tabindex="-1" id="logsModal">
|
||||||
|
Reference in New Issue
Block a user