diff --git a/ci.yml b/ci.yml index 6b6cf4a..a9e538e 100644 --- a/ci.yml +++ b/ci.yml @@ -7,7 +7,7 @@ prepare: - name: Change node version command: sudo -u admin n 18.18.0 - name: Install Dependencies - command: npm install @vscode/vsce + command: npm i - name: Compile project command: npm run compile - name: bundle project diff --git a/package-lock.json b/package-lock.json index 85c4de2..eb851a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "codesphere", "version": "0.1.11", "dependencies": { - "@vscode/vsce": "^2.26.1", + "@vscode/vsce": "^2.32.0", "ansi-to-html": "^0.7.2", "axios": "^1.6.8", "bufferutil": "^4.0.8", @@ -1212,11 +1212,13 @@ } }, "node_modules/@vscode/vsce": { - "version": "2.26.1", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.26.1.tgz", - "integrity": "sha512-QOG6Ht7V93nhwcBxPWcG33UK0qDGEoJdg0xtVeaTN27W6PGdMJUJGTPhB/sNHUIFKwvwzv/zMAHvDgMNXbcwlA==", + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.32.0.tgz", + "integrity": "sha512-3EFJfsgrSftIqt3EtdRcAygy/OJ3hstyI1cDmIgkU9CFZW5C+3djr6mfosndCUqcVYuyjmxOK1xmFp/Bq7+NIg==", + "license": "MIT", "dependencies": { "@azure/identity": "^4.1.0", + "@vscode/vsce-sign": "^2.0.0", "azure-devops-node-api": "^12.5.0", "chalk": "^2.4.2", "cheerio": "^1.0.0-rc.9", @@ -1250,6 +1252,141 @@ "keytar": "^7.7.0" } }, + "node_modules/@vscode/vsce-sign": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.5.tgz", + "integrity": "sha512-GfYWrsT/vypTMDMgWDm75iDmAOMe7F71sZECJ+Ws6/xyIfmB3ELVnVN+LwMFAvmXY+e6eWhR2EzNGF/zAhWY3Q==", + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optionalDependencies": { + "@vscode/vsce-sign-alpine-arm64": "2.0.2", + "@vscode/vsce-sign-alpine-x64": "2.0.2", + "@vscode/vsce-sign-darwin-arm64": "2.0.2", + "@vscode/vsce-sign-darwin-x64": "2.0.2", + "@vscode/vsce-sign-linux-arm": "2.0.2", + "@vscode/vsce-sign-linux-arm64": "2.0.2", + "@vscode/vsce-sign-linux-x64": "2.0.2", + "@vscode/vsce-sign-win32-arm64": "2.0.2", + "@vscode/vsce-sign-win32-x64": "2.0.2" + } + }, + "node_modules/@vscode/vsce-sign-alpine-arm64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.2.tgz", + "integrity": "sha512-E80YvqhtZCLUv3YAf9+tIbbqoinWLCO/B3j03yQPbjT3ZIHCliKZlsy1peNc4XNZ5uIb87Jn0HWx/ZbPXviuAQ==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "alpine" + ] + }, + "node_modules/@vscode/vsce-sign-alpine-x64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.2.tgz", + "integrity": "sha512-n1WC15MSMvTaeJ5KjWCzo0nzjydwxLyoHiMJHu1Ov0VWTZiddasmOQHekA47tFRycnt4FsQrlkSCTdgHppn6bw==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "alpine" + ] + }, + "node_modules/@vscode/vsce-sign-darwin-arm64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.2.tgz", + "integrity": "sha512-rz8F4pMcxPj8fjKAJIfkUT8ycG9CjIp888VY/6pq6cuI2qEzQ0+b5p3xb74CJnBbSC0p2eRVoe+WgNCAxCLtzQ==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@vscode/vsce-sign-darwin-x64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.2.tgz", + "integrity": "sha512-MCjPrQ5MY/QVoZ6n0D92jcRb7eYvxAujG/AH2yM6lI0BspvJQxp0o9s5oiAM9r32r9tkLpiy5s2icsbwefAQIw==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@vscode/vsce-sign-linux-arm": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.2.tgz", + "integrity": "sha512-Fkb5jpbfhZKVw3xwR6t7WYfwKZktVGNXdg1m08uEx1anO0oUPUkoQRsNm4QniL3hmfw0ijg00YA6TrxCRkPVOQ==", + "cpu": [ + "arm" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@vscode/vsce-sign-linux-arm64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.2.tgz", + "integrity": "sha512-Ybeu7cA6+/koxszsORXX0OJk9N0GgfHq70Wqi4vv2iJCZvBrOWwcIrxKjvFtwyDgdeQzgPheH5nhLVl5eQy7WA==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@vscode/vsce-sign-linux-x64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.2.tgz", + "integrity": "sha512-NsPPFVtLaTlVJKOiTnO8Cl78LZNWy0Q8iAg+LlBiCDEgC12Gt4WXOSs2pmcIjDYzj2kY4NwdeN1mBTaujYZaPg==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@vscode/vsce-sign-win32-arm64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.2.tgz", + "integrity": "sha512-wPs848ymZ3Ny+Y1Qlyi7mcT6VSigG89FWQnp2qRYCyMhdJxOpA4lDwxzlpL8fG6xC8GjQjGDkwbkWUcCobvksQ==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@vscode/vsce-sign-win32-x64": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.2.tgz", + "integrity": "sha512-pAiRN6qSAhDM5SVOIxgx+2xnoVUePHbRNC7OD2aOR3WltTKxxF25OfpK8h8UQ7A0BuRkSgREbB59DBlFk4iAeg==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@vscode/vsce/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", diff --git a/package.json b/package.json index 939536d..293100a 100644 --- a/package.json +++ b/package.json @@ -182,7 +182,7 @@ "ws": "^8.16.0" }, "dependencies": { - "@vscode/vsce": "^2.26.1", + "@vscode/vsce": "^2.32.0", "ansi-to-html": "^0.7.2", "axios": "^1.6.8", "bufferutil": "^4.0.8", diff --git a/src/CiPipelineProvider.ts b/src/CiPipelineProvider.ts index 57c12ab..c3eb537 100644 --- a/src/CiPipelineProvider.ts +++ b/src/CiPipelineProvider.ts @@ -58,6 +58,7 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider { const ciPipelineCheck = checkCiPipelineStructure(uaSocket, 324); ciPipelineCheck.then((ci: any) => { ciStructure = ci; + console.log("ciStructure: ", JSON.stringify(ciStructure)); this._view?.webview.postMessage({ type: "CIPipelineStages", value: { diff --git a/src/SidebarProvider.ts b/src/SidebarProvider.ts index 824ab7d..323bf80 100644 --- a/src/SidebarProvider.ts +++ b/src/SidebarProvider.ts @@ -55,7 +55,7 @@ export class SidebarProvider implements vscode.WebviewViewProvider { } - if (cache.get("codesphere.isLoggedIn") === true) { + if (cache.get("codesphere.isLoggedIn") === true && cache.get('codesphere.currentWorkspace') === '') { vscode.commands.executeCommand('setContext', 'codesphere.isLoggedIn', true); cache.update("codesphere.isLoggedIn", true); webviewView.webview.html = this._getHtmlForWebviewAfterSignIn(webviewView.webview); @@ -66,9 +66,7 @@ export class SidebarProvider implements vscode.WebviewViewProvider { vscode.commands.executeCommand('setContext', 'codesphere.isLoggedIn', true); cache.update("codesphere.isLoggedIn", true); webviewView.webview.html = this._getHtmlWebviewOverview(webviewView.webview); - cache.update('codesphere.workspaceOverview', cache.get('codesphere.currentWorkspace')); - vscode.commands.executeCommand('setContext', 'codesphere.workspaceOverview', cache.get('codesphere.currentWorkspace')); - console.log('Congratulations, your extension "codesphere" is now active! You are logged in.'); + // todo: instead of passing just the workspace id we need to pass the whole workspace object let currentWorkspace = parseInt(cache.get('codesphere.currentWorkspace') as string); const workspacesInTeam: any = cache.get("codesphere.workspaces"); @@ -86,7 +84,9 @@ export class SidebarProvider implements vscode.WebviewViewProvider { break; } } - cache.update("codesphere.currentconnectedWorkspace", matchingObject); + + console.log('matchingObject', matchingObject); + cache.update("codesphere.workspaceOverview", matchingObject); if (matchingObject) { this._view?.webview.postMessage({ @@ -96,6 +96,10 @@ export class SidebarProvider implements vscode.WebviewViewProvider { }, }); } + + // cache.update('codesphere.workspaceOverview', cache.get('codesphere.currentWorkspace')); + vscode.commands.executeCommand('setContext', 'codesphere.workspaceOverview', cache.get('codesphere.currentWorkspace')); + console.log('Congratulations, your extension "codesphere" is now active! You are logged in.'); } if (!cache.get("codesphere.isLoggedIn")) { diff --git a/src/extension.ts b/src/extension.ts index 7473360..1cf654d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -25,14 +25,16 @@ export function activate(context: vscode.ExtensionContext) { const fileTreeProvider = new FileTreeProvider(rootPath); const ciPipelineProvider = new CiPipelineProvider(context.extensionUri, context); - //TODO: the line below disables vscode to remember the last opened windows. - // change it that it only disables it inside remote tunnels - vscode.workspace.getConfiguration('window').update('restoreWindows', 'none', vscode.ConfigurationTarget.Global); context.subscriptions.push( vscode.window.registerWebviewViewProvider( "codesphere-sidebar", - sidebarProvider + sidebarProvider, + { + webviewOptions: { + retainContextWhenHidden: true + } + } ) ); @@ -100,7 +102,10 @@ export function activate(context: vscode.ExtensionContext) { if (workspaceId !== "" && workspaceId !== "$WORKSPACE_ID") { const pwdUri = vscode.Uri.parse('home/user/app'); + vscode.workspace.getConfiguration('window').update('restoreWindows', 'none', vscode.ConfigurationTarget.Global); vscode.commands.executeCommand('vscode.openFolder', pwdUri); + } else { + vscode.workspace.getConfiguration('window').update('restoreWindows', 'all', vscode.ConfigurationTarget.Global); } }); diff --git a/webviews/components/CiPipeline.svelte b/webviews/components/CiPipeline.svelte index 6f9336f..5f9034c 100644 --- a/webviews/components/CiPipeline.svelte +++ b/webviews/components/CiPipeline.svelte @@ -45,21 +45,30 @@ } step.open = false }); - prepareStageSteps[0].open = true; + + if (stagelength > 0) { + prepareStageSteps[0].open = true + } } if (stage == "test") { stageRunning = [...stageRunning, stage] testStageSate = true; testStageSuccess = ''; stagelength = testStageSteps.length - testStageSteps[0].open = true + + if (stagelength > 0) { + testStageSteps[0].open = true + } } if (stage == "run") { stageRunning = [...stageRunning, stage] runStageSate = true; runStageSuccess = ''; stagelength = runStageSteps.length - runStageSteps[0].open = true + + if (stagelength > 0) { + runStageSteps[0].open = true + } } vscode.postMessage({ type: 'startCiStage', @@ -120,6 +129,10 @@ currentWorkspace = message.value.currentWorkspace; teamId = message.value.teamId; dcId = message.value.dcId; + + console.log("currentWorkspace", currentWorkspace); + console.log("teamId", teamId); + console.log("dcId", dcId); vscode.postMessage({ type: 'getCiPipelineStages', @@ -174,6 +187,7 @@ break; case 'ciPipelineStatus': if (message.value.dynamic) { + console.log("dynamic", message.value.dynamic); switch (message.value.dynamic) { case 'prepare': prepareStageSuccess = message.value.prepare.state; @@ -182,6 +196,8 @@ }); if (prepareStageSuccess === 'running') { prepareStageSate = true; + stageRunning = [...stageRunning, 'prepare'] + } if (prepareStageSuccess === 'success' || prepareStageSuccess === 'failure') { prepareStageSate = false; @@ -194,6 +210,8 @@ }); if (testStageSuccess === 'running') { testStageSate = true; + stageRunning = [...stageRunning, 'test'] + } if (testStageSuccess === 'success' || testStageSuccess === 'failure') { testStageSate = false; @@ -206,6 +224,7 @@ }); if (runStageSuccess === 'running') { runStageSate = true; + stageRunning = [...stageRunning, 'run'] } if (runStageSuccess === 'success' || runStageSuccess === 'failure') { runStageSate = false; @@ -216,12 +235,15 @@ } if (message.value.dynamic === false && message.value.prepare.state){ + console.log("prepare dynamic false", message.value.prepare.state); prepareStageSuccess = message.value.prepare.state; prepareStageSteps.forEach(( step, index) => { Object.assign(step, message.value.prepare.steps[index]); }); if (prepareStageSuccess === 'running') { prepareStageSate = true; + stageRunning = [...stageRunning, 'prepare'] + } if (prepareStageSuccess === 'success' || prepareStageSuccess === 'failure') { prepareStageSate = false; @@ -229,12 +251,15 @@ } if (message.value.dynamic === false && message.value.test.state){ + console.log("test dynamic false", message.value.test.state); testStageSuccess = message.value.test.state; testStageSteps.forEach(( step, index) => { Object.assign(step, message.value.test.steps[index]); }); if (testStageSuccess === 'running') { testStageSate = true; + stageRunning = [...stageRunning, 'test'] + } if (testStageSuccess === 'success' || testStageSuccess === 'failure') { testStageSate = false; @@ -242,12 +267,14 @@ } if (message.value.dynamic === false && message.value.run.state){ + console.log("run dynamic false", message.value.run.state); runStageSuccess = message.value.run.state; runStageSteps.forEach(( step, index) => { Object.assign(step, message.value.run.steps[index]); }); if (runStageSuccess === 'running') { runStageSate = true; + stageRunning = [...stageRunning, 'run'] } if (runStageSuccess === 'success' || runStageSuccess === 'failure') { runStageSate = false; diff --git a/webviews/components/Codesphere.svelte b/webviews/components/Codesphere.svelte index 7880c38..5c0932d 100644 --- a/webviews/components/Codesphere.svelte +++ b/webviews/components/Codesphere.svelte @@ -12,6 +12,7 @@ let notDeployedWorkspaces = []; let indexOfWorkspace; let currentWorkspace; + let username; function openOverview(workspaceId, teamId) { vscode.postMessage({ @@ -93,6 +94,10 @@ break; case 'getUserData': user = JSON.parse(message.value); + console.log("User: " , user); + if (user.avatarURL === null) { + username = getInitials(user); + } break; case 'activeWorkspaces': activeWorkspaces = message.value; @@ -148,6 +153,26 @@ const teamIndex = teamArray.findIndex(team => team.id === teamId); teamArray[teamIndex].open = !teamArray[teamIndex].open; } + + function getInitials(user) { + console.log("User Names: ", user.firstName, user.lastName, user.email); + + if (user.firstName && user.lastName) { + return user.firstName[0].toUpperCase() + user.lastName[0].toUpperCase(); + } + + if (user.firstName) { + return user.firstName[0].toUpperCase(); + } + + if (user.lastName) { + return user.lastName[0].toUpperCase(); + } + + if (user.email) { + return user.email[0].toUpperCase(); + } + } @@ -200,6 +225,17 @@ height: 32px; border-radius: 50%; object-fit: cover; + display: flex; + align-items: center; + justify-content: center; + font-size: 1rem; + font-weight: bold; + color: white; + text-transform: uppercase; + } + + .defaultAvatar { + background-color: #80808026; } .workspace { @@ -213,17 +249,24 @@ color: white!important; } - .workspaceList { + .workspaceList { position: relative; - overflow-x: auto; + overflow-x: auto; white-space: nowrap; padding-left: 16px; } - .workspaceList:nth-child(2) { + .workspaceList:nth-child(1) { padding-top:8px } + + + .workspaceList { + scrollbar-width: none; + -ms-overflow-style: none; + } + .workspaceBox { display: flex; flex-direction: column; @@ -249,10 +292,12 @@ } .height-indicator { + margin: 0; + margin-bottom: -8px; position: absolute; left: 8px; height: 100%; - border-left: .5px solid #80808026;; + border-left: 1.8px solid #80808026; } @@ -261,7 +306,13 @@
Workspace is ready to connect
- + {#if connectedWorkspace === false} +Workspace is ready to connect
+ +