diff --git a/front/app.js b/front/app.js
index e0fbd78..2b44603 100644
--- a/front/app.js
+++ b/front/app.js
@@ -36,6 +36,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
};
var App;
(function (App) {
+ App.l = [];
+ function download() {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4, fetch('/app/list')];
+ case 1: return [4, (_a.sent()).json()];
+ case 2:
+ App.l = _a.sent();
+ return [2];
+ }
+ });
+ });
+ }
+ App.download = download;
function list() {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
@@ -47,16 +62,15 @@ var App;
App.list = list;
function listSimple() {
return __awaiter(this, void 0, void 0, function () {
- var table, l;
+ var table;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
table = Deskop.table(['ID', 'Name', 'URL']);
- return [4, fetch('/app/list')];
- case 1: return [4, (_a.sent()).json()];
- case 2:
- l = _a.sent();
- l.forEach(function (app) {
+ return [4, download()];
+ case 1:
+ _a.sent();
+ App.l.forEach(function (app) {
var e = $("
\n\t\t\t\t\t
" + app.ID + "
\n\t\t\t\t\t
" + app.Name + "
\n\t\t\t\t\t
" + app.URL + "
\n\t\t\t\t
");
table.append(e);
});
@@ -250,15 +264,29 @@ var Edit;
}
Edit.create = create;
function createP(name) {
- var p = new Promise(function (resolve) { return create(name, function (s) {
+ return new Promise(function (resolve) { return create(name, function (s) {
document.getElementById('edit')
.querySelector('div.input-group.input-group-lg.mb-3')
.remove();
resolve(s);
}); });
- return p;
}
Edit.createP = createP;
+ function optionP(name, values) {
+ var g = $("
\n\t\t\t
\n\t\t\t\t" + name + " :\n\t\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
");
+ document.getElementById('edit').append(g);
+ var select = g.querySelector('select');
+ values.forEach(function (v) {
+ select.innerHTML += "";
+ });
+ return new Promise(function (resolve) {
+ g.querySelector('#submit').addEventListener('click', function () {
+ g.remove();
+ resolve(select.value);
+ });
+ });
+ }
+ Edit.optionP = optionP;
function confirm(v, end) {
var g = $("
\n\t\t\t
\n\t\t\t\tRecopier : \n\t\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
");
document.getElementById('edit').append(g);
@@ -580,14 +608,17 @@ var Visit;
switch (_c.label) {
case 0:
Deskop.edit("Cr\u00E9ation d'un ticket de visite", list);
- return [4, Edit.createP('Application ID')];
+ return [4, App.download()];
case 1:
+ _c.sent();
+ return [4, Edit.optionP('Application ID', App.l.map(function (a) { return a.ID; }))];
+ case 2:
app = _c.sent();
return [4, Edit.createP('Pseudo')];
- case 2:
+ case 3:
pseudo = _c.sent();
return [4, Edit.createP('Email')];
- case 3:
+ case 4:
email = _c.sent();
_b = (_a = Deskop).errorRep;
return [4, fetch('/visit/add', {
@@ -601,7 +632,7 @@ var Visit;
email: email
})
})];
- case 4:
+ case 5:
_b.apply(_a, [_c.sent()]);
return [2];
}
diff --git a/front/ts/app.ts b/front/ts/app.ts
index 90685d6..46e5099 100644
--- a/front/ts/app.ts
+++ b/front/ts/app.ts
@@ -9,13 +9,20 @@ namespace App {
URL: string;
}
+ // The list of the apps.
+ export var l: Array = [];
+
+ export async function download() {
+ l = await (await fetch('/app/list')).json();
+ }
+
// List all the application
export async function list() {
(User.admin ? listAdmin : listSimple)()
}
async function listSimple() {
let table = Deskop.table(['ID', 'Name', 'URL']);
- let l: Array = await (await fetch('/app/list')).json();
+ await download();
l.forEach(app => {
let e = $(`
${app.ID}
diff --git a/front/ts/edit.ts b/front/ts/edit.ts
index ccc5325..574a009 100644
--- a/front/ts/edit.ts
+++ b/front/ts/edit.ts
@@ -34,13 +34,36 @@ namespace Edit {
}
// Return a promise resolved with the string.
export function createP(name: string): Promise {
- let p = new Promise(resolve => create(name, s => {
+ return new Promise(resolve => create(name, s => {
document.getElementById('edit')
.querySelector('div.input-group.input-group-lg.mb-3')
.remove();
resolve(s);
}));
- return p;
+ }
+
+ export function optionP(name: string, values: string[]): Promise {
+ let g = $(`