Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add welcome to setup ui and welcome on ext activate
Browse files Browse the repository at this point in the history
brianignacio5 committed Nov 24, 2023
1 parent 8e08533 commit b56f718
Showing 10 changed files with 434 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/checkExtensionSettings.ts
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ export async function checkExtensionSettings(
}
const isExtensionConfigured = await isCurrentInstallValid(workspace);
if (isExtensionConfigured) {
vscode.commands.executeCommand("espIdf.welcome.start");
return;
}
await vscode.window.withProgress(
34 changes: 27 additions & 7 deletions src/setup/SetupPanel.ts
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ import { ESP } from "../config";
import * as idfConf from "../idfConfiguration";
import { ensureDir } from "fs-extra";
import path from "path";
import vscode, { ConfigurationTarget, Uri } from "vscode";
import vscode, { ConfigurationTarget, Uri, commands } from "vscode";
import { expressInstall } from "./espIdfDownloadStep";
import { IdfToolsManager } from "../idfToolsManager";
import { OutputChannel } from "../logger/outputChannel";
@@ -208,6 +208,7 @@ export class SetupPanel {
command: "initialLoad",
espIdfContainer: defaultEspIdfPathContainer,
espIdf: setupArgs.espIdfPath,
extensionVersion: setupArgs.extensionVersion,
espToolsPath: setupArgs.espToolsPath,
gitVersion: setupArgs.gitVersion,
hasPrerequisites: setupArgs.hasPrerequisites,
@@ -264,8 +265,9 @@ export class SetupPanel {
});
SetupPanel.postMessage({
command: "setEspIdfErrorStatus",
errorMsg: `ESP-IDF is installed in ${setupArgs.existingIdfSetups[message.selectedIdfSetup].idfPath
}`,
errorMsg: `ESP-IDF is installed in ${
setupArgs.existingIdfSetups[message.selectedIdfSetup].idfPath
}`,
});
this.panel.webview.postMessage({
command: "updateEspIdfToolsStatus",
@@ -294,6 +296,18 @@ export class SetupPanel {
case "cleanIdfSetups":
await clearPreviousIdfSetups();
break;
case "newProject":
await commands.executeCommand("espIdf.newProject.start");
break;
case "importProject":
await commands.executeCommand("espIdf.importProject");
break;
case "showExamples":
await commands.executeCommand("espIdf.examples.start");
break;
case "exploreComponents":
await commands.executeCommand("esp.component-manager.ui.show");
break;
default:
break;
}
@@ -374,7 +388,9 @@ export class SetupPanel {
} else if (selectedIdfVersion.filename === "master") {
idfVersion = "5.1";
} else {
const matches = selectedIdfVersion.name.split(" ")[0].match(/v(.+)/);
const matches = selectedIdfVersion.name
.split(" ")[0]
.match(/v(.+)/);
if (matches && matches.length) {
idfVersion = matches[1];
} else {
@@ -390,7 +406,10 @@ export class SetupPanel {
idfGitPath = embedPaths.idfGitPath;
idfPythonPath = embedPaths.idfPythonPath;
}
const pathToCheck = selectedIdfVersion.filename === "manual" ? espIdfPath : idfContainerPath;
const pathToCheck =
selectedIdfVersion.filename === "manual"
? espIdfPath
: idfContainerPath;
this.checkSpacesInPaths(
pathToCheck,
toolsPath,
@@ -436,8 +455,9 @@ export class SetupPanel {
);
const updatedToolsInfo = toolsInfo.map((tool) => {
const isToolVersionCorrect =
tool.expected.indexOf(foundVersions[tool.name]) > -1 ||
(foundVersions[tool.name] && foundVersions[tool.name] === "No command version");
tool.expected.indexOf(foundVersions[tool.name]) > -1 ||
(foundVersions[tool.name] &&
foundVersions[tool.name] === "No command version");
tool.doesToolExist = isToolVersionCorrect;
if (isToolVersionCorrect) {
tool.progress = "100.00%";
4 changes: 4 additions & 0 deletions src/setup/setupInit.ts
Original file line number Diff line number Diff line change
@@ -35,11 +35,13 @@ import {
loadIdfSetupsFromEspIdfJson,
} from "./existingIdfSetups";
import { checkPyVenv } from "./setupValidation/pythonEnv";
import { packageJson } from "../utils";

export interface ISetupInitArgs {
espIdfPath: string;
espToolsPath: string;
existingIdfSetups: IdfSetup[];
extensionVersion: string;
espIdfVersionsList: IEspIdfLink[];
espIdfTagsList: IEspIdfLink[];
gitPath: string;
@@ -132,9 +134,11 @@ export async function getSetupInitialValues(
progress.report({ increment: 10, message: "Getting Python versions..." });
const pythonVersions = await getPythonList(extensionPath);
const idfSetups = await getPreviousIdfSetups();
const extensionVersion = packageJson.version as string;
const setupInitArgs = {
espIdfVersionsList,
espIdfTagsList,
extensionVersion,
existingIdfSetups: idfSetups,
pythonVersions,
} as ISetupInitArgs;
42 changes: 6 additions & 36 deletions src/views/setup/App.vue
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ import { useSetupStore } from "./store";
import { storeToRefs } from "pinia";
import { router } from "./main";
import { IconHome } from "@iconify-prerendered/vue-codicon";
import Logo from "./components/logo.vue";
import Welcome from "./Welcome.vue";
const store = useSetupStore();
@@ -40,41 +42,7 @@ const openOCDRulesPathText = computed(() => {
</div>
<div class="control centerize">
<h1 class="title is-spaced">
<svg
width="28"
height="28"
viewBox="0 0 13.94 14"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<title>1</title>
<path
class="cls-1"
d="M4.64,10.41a1,1,0,1,1-1-1,1,1,0,0,1,1,1"
transform="translate(-0.03)"
/>
<path
class="cls-1"
d="M13.23,9.39A10.19,10.19,0,0,0,4.58.74a6.29,6.29,0,0,0-1.42,1v1a8.1,8.1,0,0,1,8.09,8.09h.95a6.61,6.61,0,0,0,1-1.42"
transform="translate(-0.03)"
/>
<path
class="cls-1"
d="M14,6.4A6.41,6.41,0,0,0,7.57,0a4.78,4.78,0,0,0-.66,0L6.76.46A11,11,0,0,1,13.5,7.2l.43-.15c0-.22,0-.43,0-.65"
transform="translate(-0.03)"
/>
<path
class="cls-1"
d="M7.64,14A7.61,7.61,0,0,1,0,6.39,7.56,7.56,0,0,1,2.26,1l.41.41a7,7,0,1,0,9.94,10l.41.4A7.56,7.56,0,0,1,7.64,14"
transform="translate(-0.03)"
/>
<path
class="cls-1"
d="M7.56,11.25a4.42,4.42,0,0,0-4-4.84A.4.4,0,0,1,3.24,6a.39.39,0,0,1,.43-.36,5.12,5.12,0,0,1,2.44.9,5.2,5.2,0,0,1,2.23,4.81,5.3,5.3,0,0,1-.17.9l1.15.32a6.74,6.74,0,0,0,1-.37,7.76,7.76,0,0,0,.12-1.37A7.3,7.3,0,0,0,4.23,3.59a3.17,3.17,0,0,0-1.16,0,2.41,2.41,0,0,0-1.26.76,2.49,2.49,0,0,0,1.11,4,6.22,6.22,0,0,0,.63.12h0a2.34,2.34,0,0,1,1.94,2.3,2.25,2.25,0,0,1-.37,1.26l.8.51a6.88,6.88,0,0,0,1.19.2,4.38,4.38,0,0,0,.45-1.53"
transform="translate(-0.03)"
/>
</svg>
<Logo size="28" />
ESPRESSIF
</h1>
<h2 class="subtitle">ESP-IDF Extension for Visual Studio Code</h2>
@@ -86,7 +54,7 @@ const openOCDRulesPathText = computed(() => {
</router-view>
<div class="centerize install-finished" v-if="isIdfInstalled">
<h2 class="subtitle" data-config-id="setup-is-finished">
All settings have been configured. You can close this window.
All settings have been configured.
</h2>

<div v-if="isLinuxPlatform">
@@ -102,6 +70,8 @@ const openOCDRulesPathText = computed(() => {
{{ openOCDRulesPathText }}
</div>
</div>

<Welcome />
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion src/views/setup/Install.vue
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ function setToolsFolder(newToolsPath: string) {
</div>

<folderOpen
propLabel="Enter ESP-IDF Tools directory (IDF_TOOLS_PATH)"
propLabel="Enter ESP-IDF Tools directory (IDF_TOOLS_PATH):"
:propModel="toolsFolder"
:propMutate="setToolsFolder"
:openMethod="store.openEspIdfToolsFolder"
Loading

0 comments on commit b56f718

Please sign in to comment.