comparison index.html @ 4:f714a6a7842c

start new web view for hgand github syncing
author drewp@bigasterisk.com
date Fri, 24 Jul 2020 14:42:08 -0700
parents
children a0d9679c4f4a
comparison
equal deleted inserted replaced
3:4077903a9520 4:f714a6a7842c
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <title>reposync</title>
7 <style>
8 body {
9 background: #1f1f1f;
10 color: white;
11 font-family: monospace;
12 }
13 th {
14 text-align: left;
15 white-space: nowrap;
16 }
17 td.github {
18 white-space: nowrap;
19 opacity: 0.5;
20 }
21 td.github.on {
22 opacity: 1;
23 }
24 span.check {
25 font-size: 200%;
26 }
27 </style>
28 </head>
29 <body>
30 <h1>repo statuses</h1>
31
32 <script type="module">
33 import Litedom from "https://bigasterisk.com/lib/litedom/0.12.1/litedom.es.js";
34 Litedom({
35 tagName: "bigast-loginbar",
36 template: `<span>{this.responseHtml}</span>`,
37 data: { responseHtml: "..." },
38 async created() {
39 const resp = await fetch("/_loginBar");
40 this.data.responseHtml = await resp.text();
41 },
42 });
43 </script>
44
45 <script type="module">
46 import Litedom from "https://bigasterisk.com/lib/litedom/0.12.1/litedom.es.js";
47 const repos = [{ dir: "dir1", summary: "ok" }];
48 Litedom({
49 tagName: "reposync-top",
50 template: `<div id="top">
51 <table>
52 <tr :for="repo in this.repos">
53 <th>{repo.path}</th>
54 <td> {repo.status.error || ''}
55 <span :if="repo.status.changed==0 && repo.status.unknown==0">
56 clean
57 </span>
58 <span :else>
59 changed {repo.status.changed}, unknown {repo.status.unknown}
60 </span>
61 </td>
62 <td :class="github: true; on: repo.github">
63 <span class="check" :if="repo.github">☑</span>
64 <span class="check" :else>☐</span> github
65 <span :if="repo.github">
66 <table style="display: inline-block">
67 <tr><td>github latest</td><td>{repo.githubLatest.t}</td></tr>
68 <tr><td>home latest</td><td>{repo.hgLatest.t}</td></tr>
69 </table>
70 </span>
71 </td>
72 </tr>
73 </table>
74 </div>`,
75 data: { repos: [] },
76 created() {
77 const statuses = new EventSource("status/events");
78 statuses.addEventListener("message", (ev) => {
79 const update = JSON.parse(ev.data);
80 update.update.repoDir = update.key;
81
82 var found = false;
83 this.data.repos.forEach((r) => {
84 if (r.repoDir == update.key) {
85 found = true;
86 Object.assign(r, update.update);
87 }
88 });
89 if (!found) {
90 this.data.repos.push(update.update);
91 this.data.repos.sort((a, b) => (a.repoDir > b.repoDir ? 1 : -1));
92 }
93 });
94 },
95 });
96 </script>
97
98 <reposync-top></reposync-top>
99 <bigast-loginbar></bigast-loginbar>
100 <pre>
101 repo1 clean synced to github github up to date [sync now]
102 dirty [msg____] [commit]
103
104 repo1 is a link to my hgserve
105
106 GET /status/events
107
108 GET /recent?repo=/my/dir
109 GET /recent?all
110 GET /recent/events?repo=/my/dir|all
111
112 POST /githubSync?all
113 POST /githubSync?repo=/my/dir
114
115 GET /homepage -> a CE table of all changes using /recent
116
117 each event are a json message:
118 key: string
119 update: replace the data for that key
120 Here, keys are repo paths.
121
122 </pre>
123 </body>
124 </html>