svelte-migrate: updated files
This commit is contained in:
parent
ca12b3dde5
commit
3cf92b4798
37 changed files with 597 additions and 533 deletions
14
frontend/ui/src/routes/issues/+page.js
Normal file
14
frontend/ui/src/routes/issues/+page.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { get_store_value } from 'svelte/internal';
|
||||
|
||||
import { exercices_idx } from '../../stores/themes.js';
|
||||
|
||||
export async function load({ url }) {
|
||||
const eidx = get_store_value(exercices_idx);
|
||||
|
||||
const exercice = eidx[url.searchParams.get("eid")]?eidx[url.searchParams.get("eid")]:null;
|
||||
|
||||
return {
|
||||
exercice: exercice,
|
||||
fillIssue: exercice !== null || url.searchParams.get("fill-issue") !== null,
|
||||
};
|
||||
}
|
||||
|
|
@ -1,23 +1,3 @@
|
|||
<script context="module">
|
||||
import { get_store_value } from 'svelte/internal';
|
||||
|
||||
import { exercices_idx } from '../stores/themes.js';
|
||||
|
||||
export async function load({ url, stuff }) {
|
||||
const eidx = get_store_value(exercices_idx);
|
||||
|
||||
const exercice = eidx[url.searchParams.get("eid")]?eidx[url.searchParams.get("eid")]:null;
|
||||
|
||||
return {
|
||||
props: {
|
||||
refresh_issues: stuff.refresh_issues,
|
||||
exercice: exercice,
|
||||
fillIssue: exercice !== null || url.searchParams.get("fill-issue") !== null,
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import {
|
||||
Alert,
|
||||
|
|
@ -30,22 +10,20 @@
|
|||
Table,
|
||||
} from 'sveltestrap';
|
||||
|
||||
import DateFormat from '../components/DateFormat.svelte';
|
||||
import DateFormat from '../../components/DateFormat.svelte';
|
||||
|
||||
import { issues, issues_nb_responses, issues_known_responses } from '../stores/issues.js';
|
||||
import { settings } from '../stores/settings.js';
|
||||
import { issues, issues_nb_responses, issues_known_responses } from '../../stores/issues.js';
|
||||
import { settings } from '../../stores/settings.js';
|
||||
|
||||
import FormIssue from '../components/FormIssue.svelte';
|
||||
import FormIssue from '../../components/FormIssue.svelte';
|
||||
|
||||
export let refresh_issues = null;
|
||||
export let exercice = null;
|
||||
export let fillIssue = false;
|
||||
export let data;
|
||||
let issue = {};
|
||||
|
||||
issues_known_responses.set($issues_nb_responses);
|
||||
|
||||
function newIssue() {
|
||||
fillIssue = true;
|
||||
data.fillIssue = true;
|
||||
}
|
||||
|
||||
let sberr = "";
|
||||
|
|
@ -53,7 +31,7 @@
|
|||
let messageClass = "success";
|
||||
|
||||
function waitDiff(curissues, i) {
|
||||
refresh_issues((issues) => {
|
||||
issues.refresh((issues) => {
|
||||
if (i > 0 && (!issues || issues.length <= curissues)) {
|
||||
setTimeout(waitDiff, 850, curissues, i-1);
|
||||
}
|
||||
|
|
@ -61,9 +39,9 @@
|
|||
}
|
||||
|
||||
function respondTo(_issue) {
|
||||
exercice = null;
|
||||
data.exercice = null;
|
||||
issue = {id: _issue.id, description: ''};
|
||||
fillIssue = true;
|
||||
data.fillIssue = true;
|
||||
}
|
||||
|
||||
async function submit_issue(event) {
|
||||
|
|
@ -85,8 +63,8 @@
|
|||
messageClass = 'success';
|
||||
message = data.errmsg;
|
||||
issue = { };
|
||||
exercice = null;
|
||||
fillIssue = false;
|
||||
data.exercice = null;
|
||||
data.fillIssue = false;
|
||||
|
||||
const currentissues = get_store_value(issues);
|
||||
waitDiff(currentissues.length, 7);
|
||||
|
|
@ -120,7 +98,7 @@
|
|||
</Alert>
|
||||
{/if}
|
||||
|
||||
{#if fillIssue}
|
||||
{#if data.fillIssue}
|
||||
<Card class="border-warning mt-3 mb-5">
|
||||
<CardHeader class="bg-warning text-light">
|
||||
<Icon name="file-earmark-plus" />
|
||||
|
|
@ -135,7 +113,7 @@
|
|||
<p class="card-text">Rapprochez-vous d'un membre de l'équipe afin d'obtenir de l'aide.</p>
|
||||
{:else}
|
||||
<FormIssue
|
||||
{exercice}
|
||||
exercice={data.exercice}
|
||||
bind:issue={issue}
|
||||
on:submit={submit_issue}
|
||||
/>
|
||||
|
|
@ -153,7 +131,7 @@
|
|||
<th>Géré par</th>
|
||||
<th>Messages</th>
|
||||
<th>
|
||||
{#if !fillIssue}
|
||||
{#if !data.fillIssue}
|
||||
<Button sm color="warning" on:click={newIssue}>
|
||||
<Icon name="file-earmark-plus" />
|
||||
</Button>
|
||||
|
|
|
|||
Reference in a new issue