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