Skip to content

Commit cfe2b68

Browse files
author
Tim Etchells
committed
little fixes
1 parent 6da57d4 commit cfe2b68

File tree

7 files changed

+26
-17
lines changed

7 files changed

+26
-17
lines changed

dev/src/command/ProjectOverviewCmd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ async function onRequestEdit(type: ProjectOverview.Editable, project: Project):
163163
case ProjectOverview.Editable.APP_PORT: {
164164
userFriendlySetting = "application port";
165165
settingKey = "internalAppPort";
166-
currentValue = project.ports.internalAppPort ? project.ports.internalAppPort.toString() : undefined;
166+
currentValue = project.ports.internalPort ? project.ports.internalPort.toString() : undefined;
167167
break;
168168
}
169169
case ProjectOverview.Editable.DEBUG_PORT: {

dev/src/microclimate/connection/Connection.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ export default class Connection implements vscode.QuickPickItem, vscode.Disposab
193193
this._projects = [];
194194
}
195195
this.needProjectUpdate = true;
196-
this.updateProjects();
196+
await this.updateProjects();
197+
if (wipeProjects) {
198+
// refresh whole tree
199+
this.onChange();
200+
}
197201
}
198202

199203
/**

dev/src/microclimate/connection/SocketEvents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace SocketEvents {
5353
readonly name: string;
5454
readonly status: string;
5555
readonly ports?: {
56-
readonly internalAppPort?: string;
56+
readonly internalPort?: string;
5757
readonly internalDebugPort?: string;
5858
};
5959
readonly error?: string;

dev/src/microclimate/project/Project.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const STRING_NS = StringNamespaces.PROJECT;
3333
*/
3434
interface IProjectPorts {
3535
appPort: OptionalNumber;
36-
internalAppPort: OptionalNumber;
36+
internalPort: OptionalNumber;
3737
debugPort: OptionalNumber;
3838
internalDebugPort: OptionalNumber;
3939
}
@@ -102,7 +102,7 @@ export default class Project implements vscode.QuickPickItem {
102102
this._ports = {
103103
appPort: undefined,
104104
debugPort: undefined,
105-
internalAppPort: undefined,
105+
internalPort: undefined,
106106
internalDebugPort: undefined,
107107
};
108108

@@ -222,7 +222,7 @@ export default class Project implements vscode.QuickPickItem {
222222
let changed = false;
223223
changed = this.setPort(ports.exposedPort, "appPort");
224224
changed = this.setPort(ports.exposedDebugPort, "debugPort") || changed;
225-
changed = this.setPort(ports.internalPort, "internalAppPort") || changed;
225+
changed = this.setPort(ports.internalPort, "internalPort") || changed;
226226
changed = this.setPort(ports.internalDebugPort, "internalDebugPort") || changed;
227227

228228
return changed;
@@ -255,8 +255,8 @@ export default class Project implements vscode.QuickPickItem {
255255
changed = true;
256256
}
257257
if (event.ports) {
258-
if (event.ports.internalAppPort) {
259-
changed = this.setPort(event.ports.internalAppPort, "internalAppPort");
258+
if (event.ports.internalPort) {
259+
changed = this.setPort(event.ports.internalPort, "internalPort");
260260
}
261261
else if (event.ports.internalDebugPort) {
262262
changed = this.setPort(event.ports.internalDebugPort, "internalDebugPort");
@@ -481,20 +481,24 @@ export default class Project implements vscode.QuickPickItem {
481481
* @returns true if at least one port was changed.
482482
*/
483483
private setPort(newPort: OptionalString, portType: keyof IProjectPorts): boolean {
484+
if (newPort === "") {
485+
newPort = undefined;
486+
}
484487
const newPortNumber = Number(newPort);
485488
const currentPort = this._ports[portType];
486489

487-
if (newPort != null && !MCUtil.isGoodPort(newPortNumber)) {
490+
if (newPort && !MCUtil.isGoodPort(newPortNumber)) {
488491
Log.w(`Invalid ${portType} port ${newPort} given to project ${this.name}, ignoring it`);
489492
return false;
490493
}
491-
else if (currentPort !== newPort) {
492-
this._ports[portType] = newPortNumber;
493-
if (newPortNumber !== currentPort) {
494-
Log.d(`New ${portType} for ${this.name} is ${newPortNumber}`);
494+
else if (currentPort !== newPortNumber) {
495+
if (isNaN(newPortNumber)) {
496+
this._ports[portType] = undefined;
497+
// Log.d(`Unset ${portType} for ${this.name}`);
495498
}
496-
else if (newPort == null) {
497-
Log.d(`Unset ${portType} for ${this.name}`);
499+
else if (newPortNumber !== currentPort) {
500+
Log.d(`New ${portType} for ${this.name} is ${newPortNumber}`);
501+
this._ports[portType] = newPortNumber;
498502
}
499503
// the third case is that (the new port === the old port) and neither are null - we don't log anything in this case.
500504
return true;

dev/src/microclimate/project/ProjectOverviewPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function generateHtml(project: Project): string {
116116
${emptyRow}
117117
${buildRow("Exposed App Port", normalize(project.ports.appPort, notRunning))}
118118
${buildRow("Internal App Port",
119-
normalize(project.ports.internalAppPort, notAvailable),
119+
normalize(project.ports.internalPort, notAvailable),
120120
undefined,
121121
supportsEditableSettings ? Editable.APP_PORT : Editable.DISABLED)}
122122
${buildRow("Application Endpoint",

dev/src/microclimate/project/logs/MCLogManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class MCLogManager {
5757

5858
appLogs.concat(buildLogs).forEach((newLogData) => {
5959
// skip useless container log
60-
if (!(newLogData.logName === "-" || newLogData.logName === "container")) {
60+
if (newLogData.logName === "-" || newLogData.logName === "container") {
6161
return;
6262
}
6363

dev/src/view/TreeItemFactory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ namespace TreeItemFactory {
107107
return [{
108108
label: Translator.t(StringNamespaces.TREEVIEW, "disconnectedConnectionLabel"),
109109
iconPath: Resources.getIconPaths(Resources.Icons.Disconnected),
110+
contextValue: "nothing", // anything truthy works
110111
// Consider putting refresh as the command on this item
111112
}];
112113
}

0 commit comments

Comments
 (0)