querysub 0.257.0 → 0.258.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.257.0",
3
+ "version": "0.258.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -105,7 +105,10 @@ export async function setRecord(type: string, key: string, value: string, proxie
105
105
  });
106
106
  // NOTE: Apparently... even if the record didn't exist, we still have to wait...
107
107
  console.log(`Waiting ${ttl} seconds for DNS to propagate...`);
108
- await delay(ttl * 1000);
108
+ for (let ttlLeft = ttl; ttlLeft > 0; ttlLeft--) {
109
+ await delay(1000);
110
+ console.log(`${ttlLeft} seconds left...`);
111
+ }
109
112
  console.log(`Done waiting for DNS to update.`);
110
113
 
111
114
  }
@@ -127,6 +130,9 @@ export async function addRecord(type: string, key: string, value: string, proxie
127
130
  proxied: proxied === "proxied",
128
131
  });
129
132
  console.log(`Waiting ${ttl} seconds for DNS to propagate...`);
130
- await delay(ttl * 1000);
133
+ for (let ttlLeft = ttl; ttlLeft > 0; ttlLeft--) {
134
+ await delay(1000);
135
+ console.log(`${ttlLeft} seconds left...`);
136
+ }
131
137
  console.log(`Done waiting for DNS to update.`);
132
138
  }
@@ -18,6 +18,7 @@ import { ScrollOnMount } from "../../library-components/ScrollOnMount";
18
18
  import { StickyBottomScroll } from "../../library-components/StickyBottomScroll";
19
19
  import { PrimitiveDisplay } from "../../diagnostics/logs/ObjectDisplay";
20
20
  import { parseAnsiColors, rgbToHsl } from "../../diagnostics/logs/ansiFormat";
21
+ import { RenderGitRefInfo, UpdateServiceButtons, bigEmoji, buttonStyle } from "./deployButtons";
21
22
 
22
23
  // Type declarations for Monaco editor
23
24
  declare global {
@@ -199,6 +200,8 @@ type ServiceConfig = ${serviceConfigType}
199
200
  const selectedServiceId = selectedServiceIdParam.value;
200
201
  if (!selectedServiceId) return <div>No service selected</div>;
201
202
 
203
+ const gitInfo = MachineServiceController(SocketFunction.browserNodeId()).getGitInfo();
204
+
202
205
  let controller = MachineServiceController(SocketFunction.browserNodeId());
203
206
  let originalConfig = controller.getServiceConfig(selectedServiceId);
204
207
  let serviceConfigType = controller.getServiceConfigType();
@@ -511,6 +514,25 @@ type ServiceConfig = ${serviceConfigType}
511
514
  </button>
512
515
  </>}
513
516
 
517
+ {gitInfo?.repoUrl === config.parameters.repoUrl && gitInfo.latestRef !== config.parameters.gitRef &&
518
+ <button
519
+ className={buttonStyle.hsl(120, 70, 90).alignSelf("stretch")}
520
+ onClick={async () => {
521
+ configT.parameters.gitRef = gitInfo.latestRef;
522
+ this.updateUnsavedChanges(configT);
523
+ }}
524
+ >
525
+ <div className={css.hbox(5)}>
526
+ <b>New</b>
527
+ <RenderGitRefInfo gitRef={gitInfo.latestRef} />
528
+ </div>
529
+ <div className={css.hbox(5)}>
530
+ <b>Current</b>
531
+ <RenderGitRefInfo gitRef={config.parameters.gitRef} />
532
+ </div>
533
+ </button>
534
+ }
535
+
514
536
  {this.state.isSaving && <div className={css.pad2(12, 8).bord2(0, 0, 20) + " rainbow-flash"}>
515
537
  Deploying changes
516
538
  </div>}
@@ -12,7 +12,7 @@ import { unique } from "../../misc";
12
12
 
13
13
  module.hotreload = true;
14
14
 
15
- function bigEmoji(emoji: string, topOffset = 0) {
15
+ export function bigEmoji(emoji: string, topOffset = 0) {
16
16
  return <span className={css.fontSize(26).marginTop(topOffset)}>{emoji}</span>;
17
17
  }
18
18
 
@@ -33,7 +33,7 @@ export class RenderGitRefInfo extends qreact.Component<{
33
33
  }
34
34
  }
35
35
 
36
- const buttonStyle = css.pad2(12, 8).button.bord2(0, 0, 20).fontWeight("bold").vbox(0).alignItems("center");
36
+ export const buttonStyle = css.pad2(12, 8).button.bord2(0, 0, 20).fontWeight("bold").vbox(0).alignItems("center");
37
37
 
38
38
  export class UpdateButtons extends qreact.Component<{
39
39
  services: ServiceConfig[];
@@ -50,7 +50,7 @@ export class UpdateButtons extends qreact.Component<{
50
50
 
51
51
  return <>
52
52
  {!!gitInfo?.querysubUncommitted.length && <button
53
- className={buttonStyle.hsl(260, 60, 55)}
53
+ className={buttonStyle.hsl(260, 60, 90)}
54
54
  title={gitInfo?.querysubUncommitted.join("\n")}
55
55
  onClick={() => {
56
56
  showFullscreenModal({
@@ -61,10 +61,14 @@ export class UpdateButtons extends qreact.Component<{
61
61
  textarea
62
62
  fillWidth
63
63
  focusOnMount
64
- onChangeValue={async value => {
64
+ noEnterKeyCommit
65
+ onKeyDown={async e => {
66
+ let value = e.currentTarget.value;
65
67
  if (!value) return;
66
- await controller.commitPushAndPublishQuerysub.promise(value);
67
- closeAllModals();
68
+ if (e.key === "Enter" && e.shiftKey) {
69
+ await controller.commitPushAndPublishQuerysub.promise(value);
70
+ closeAllModals();
71
+ }
68
72
  }}
69
73
  />
70
74
  <div className={css.vbox(5)}>
@@ -88,7 +92,7 @@ export class UpdateButtons extends qreact.Component<{
88
92
  </div>
89
93
  </button>}
90
94
  {!!gitInfo?.uncommitted.length && <button
91
- className={buttonStyle.hsl(210, 40, 50)}
95
+ className={buttonStyle.hsl(210, 40, 90)}
92
96
  title={gitInfo?.uncommitted.join("\n")}
93
97
  onClick={() => {
94
98
  showFullscreenModal({
@@ -99,10 +103,14 @@ export class UpdateButtons extends qreact.Component<{
99
103
  textarea
100
104
  fillWidth
101
105
  focusOnMount
102
- onChangeValue={async value => {
106
+ noEnterKeyCommit
107
+ onKeyDown={async e => {
108
+ let value = e.currentTarget.value;
103
109
  if (!value) return;
104
- await controller.commitPushService.promise(value);
105
- closeAllModals();
110
+ if (e.key === "Enter" && e.shiftKey) {
111
+ await controller.commitPushService.promise(value);
112
+ closeAllModals();
113
+ }
106
114
  }}
107
115
  />
108
116
  <div className={css.vbox(5)}>
@@ -121,7 +129,7 @@ export class UpdateButtons extends qreact.Component<{
121
129
 
122
130
  {outdatedServices.length > 0 && gitInfo &&
123
131
  <button
124
- className={buttonStyle.hsl(120, 70, 50)}
132
+ className={buttonStyle.hsl(120, 70, 90)}
125
133
  onClick={async () => {
126
134
  for (let service of outdatedServices) {
127
135
  service.parameters.gitRef = gitInfo.latestRef;
@@ -158,14 +166,14 @@ export class UpdateServiceButtons extends qreact.Component<{
158
166
 
159
167
  return <>
160
168
  {gitRef !== gitInfo.latestRef && <button
161
- className={buttonStyle.hsl(120, 70, 50).alignSelf("stretch")}
169
+ className={buttonStyle.hsl(120, 70, 90).alignSelf("stretch")}
162
170
  onClick={async () => {
163
171
  this.props.service.parameters.gitRef = gitInfo.latestRef;
164
172
  await controller.setServiceConfigs.promise([this.props.service]);
165
173
  }}
166
174
  >
167
175
  <div>
168
- {bigEmoji("🎯", -4)} <span>Deploy & Restart</span>
176
+ {bigEmoji("🎯", -4)} <span>Update to New & Restart</span>
169
177
  </div>
170
178
  <div className={css.hbox(5)}>
171
179
  <b>New</b>
@@ -185,13 +185,15 @@ export class MachineServiceControllerBase {
185
185
  throw new Error(`Service ${serviceId} does not exist`);
186
186
  }
187
187
 
188
- // Set the new service config
189
188
  await serviceConfigs.set(serviceId, config);
190
- for (let machineId of config.machineIds) {
191
- newMachines.add(machineId);
192
- }
193
- for (let machineId of serviceConfig.machineIds) {
194
- oldMachines.add(machineId);
189
+ // Only notify we were or are deployed. If it's not deployed, this will be ignored anyways.
190
+ if (config.parameters.deploy || serviceConfig.parameters.deploy) {
191
+ for (let machineId of config.machineIds) {
192
+ newMachines.add(machineId);
193
+ }
194
+ for (let machineId of serviceConfig.machineIds) {
195
+ oldMachines.add(machineId);
196
+ }
195
197
  }
196
198
  }
197
199
  await this.notifyMachines([...newMachines], [...oldMachines]);
@@ -1,17 +1,10 @@
1
- 7.1) Verify quick node removal work by having a repeatedly crashing service, verifying the node exists, and then goes away on crash.
2
-
1
+ OH! Each service has a different machine id?
2
+ Hmm... well... it's the WORST thing every. It is a bit annoying...
3
+ - That explains the slow startup time...
4
+
3
5
 
4
6
 
5
- In general, hit our servers hard, to make sure we can launch them, they can talk to each other, etc. Even with entirely new folders (to somewhat emulate another machine), and they can all startup smoothly.
6
-
7
- AH, I think I fixed that bug. I think it was an issue with using old hosts?
8
- 6) BUG! On startup, new nodes might take a poll interval to be fully ready? Hmm... we should restart our servers a lot again to make sure they come back up QUICKLY
9
- - OH! It might be that the identity takes some time to propagate (the DNS), which causes us to require a second poll to be alive? Maybe... our local machine deleted it, because it couldn't see the DNS? No... none of these are reasonable...
10
- - Try changing the key, so it syncs again, so we start fresh with the server
11
- - Reduce it to just 1 instance as well?
12
- 6.1) HTTP required a reboot when it was running without PathValueServer, as it didn't clone the right hashes, and then never did, even with PathValueServer was up?
13
- - But maybe it was a node polling issue? But we are supposed to send notifications when nodes are launched? Hmm...
14
- FORTUNATELY, looking at logs is now very simple, as well as updating nodes, so... this shouldn't be too hard to debug
7
+ 7.1) Verify quick node removal work by having a repeatedly crashing service, verifying the node exists, and then goes away on crash.
15
8
 
16
9
 
17
10
  8) Fix deploy user notification issue, where the refresh button doesn't work?
@@ -5,12 +5,17 @@ import fs from "fs";
5
5
  import { getStorageDir, getSubFolder } from "./fs";
6
6
  import { isClient } from "./config2";
7
7
  import { getDomain } from "./config";
8
+ import os from "os";
8
9
 
9
10
  export function createKeyStore<T>(key: string): {
10
11
  value: T | null;
11
12
  } {
12
13
  if (isNode()) {
13
- let path = getStorageDir() + key + ".json";
14
+ let keyStoreDir = os.homedir() + "/querysub/";
15
+ if (!fs.existsSync(keyStoreDir)) {
16
+ fs.mkdirSync(keyStoreDir);
17
+ }
18
+ let path = keyStoreDir + key + ".json";
14
19
  return {
15
20
  get value() {
16
21
  let contents: string | undefined = undefined;