Skip to content

Commit 66b4025

Browse files
author
Tim Etchells
committed
Show editable settings as disabled on old MC
1 parent f0dc0c8 commit 66b4025

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

dev/.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"${workspaceFolder}/dev/out/test/**/*.js"
3535
],
3636
"env": {
37-
"project_types": "node.js",
37+
"project_types": "node.js, spring, go",
3838
"test_scope": "extended, restart"
3939
},
4040
"preLaunchTask": "build"

dev/src/microclimate/project/ProjectOverviewPage.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export enum Editable {
4141
CONTEXT_ROOT = "context-root",
4242
APP_PORT = "app-port",
4343
DEBUG_PORT = "debug-port",
44+
DISABLED = "disabled",
4445
}
4546

4647
export function refreshProjectOverview(webviewPanel: vscode.WebviewPanel, project: Project): void {
@@ -117,17 +118,17 @@ export function generateHtml(project: Project): string {
117118
${buildRow("Internal App Port",
118119
normalize(project.ports.internalAppPort, notAvailable),
119120
undefined,
120-
supportsEditableSettings ? Editable.APP_PORT : undefined)}
121+
supportsEditableSettings ? Editable.APP_PORT : Editable.DISABLED)}
121122
${buildRow("Application Endpoint",
122123
normalize(project.appBaseUrl, notRunning),
123124
(project.appBaseUrl != null ? Openable.WEB : undefined),
124-
supportsEditableSettings ? Editable.CONTEXT_ROOT : undefined)}
125+
supportsEditableSettings ? Editable.CONTEXT_ROOT : Editable.DISABLED)}
125126
${emptyRow}
126127
${buildRow("Exposed Debug Port", normalize(project.ports.debugPort, notDebugging))}
127128
${buildRow("Internal Debug Port",
128129
normalize(project.ports.internalDebugPort, notAvailable),
129130
undefined,
130-
supportsEditableSettings ? Editable.DEBUG_PORT : undefined)}
131+
supportsEditableSettings ? Editable.DEBUG_PORT : Editable.DISABLED)}
131132
${buildRow("Debug URL", normalize(project.debugUrl, notDebugging))}
132133
</table>
133134
@@ -179,8 +180,12 @@ function buildRow(label: string, data: string, openable?: Openable, editable?: E
179180
}
180181

181182
if (editable) {
183+
const tooltip = `title=` + (editable === Editable.DISABLED ? `"Upgrade your Microclimate version to use this feature"` : "Edit");
184+
const cursor = editable === Editable.DISABLED ? `style="cursor: not-allowed;"` : "";
185+
const onClick = editable === Editable.DISABLED ? "" : `onclick="sendMsg('${Messages.EDIT}', { type: '${editable}' })"`;
186+
182187
thirdColTdContents = `
183-
<img id="edit-${MCUtil.slug(label)}" class="edit-btn" title="Edit" onclick="sendMsg('${Messages.EDIT}', { type: '${editable}' })"` +
188+
<img id="edit-${MCUtil.slug(label)}" class="edit-btn" ${tooltip} ${cursor} ${onClick}` +
184189
`src="${getIcon(Resources.Icons.Edit)}"/>
185190
`;
186191
}

0 commit comments

Comments
 (0)