Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge main to sync branch #94

Merged
merged 12 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "codesphere",
"displayName": "Codesphere",
"description": "Connect VS Code to your Codesphere workspaces",
"version": "0.1.7",
"version": "0.1.11",
"icon": "media/Codesphere.png",
"repository": {
"type": "git",
Expand All @@ -18,7 +18,7 @@
],
"pricing": "Free",
"activationEvents": [
"*"
"onStartupFinished"
],
"capabilities": {
"untrustedWorkspaces": {
Expand Down Expand Up @@ -62,7 +62,7 @@
"type": "webview",
"id": "codesphere-sidebar",
"name": "Codesphere",
"icon": "media/Codesphere.svg",
"icon": "media/codesphere.svg",
"contextualTitle": "Codesphere"
}
],
Expand Down Expand Up @@ -185,8 +185,10 @@
"@vscode/vsce": "^2.26.1",
"ansi-to-html": "^0.7.2",
"axios": "^1.6.8",
"bufferutil": "^4.0.8",
"exec-sh": "^0.4.0",
"merge": "^2.1.1",
"n": "^9.2.1"
"n": "^9.2.1",
"utf-8-validate": "^6.0.5"
}
}
18 changes: 7 additions & 11 deletions src/CiPipelineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,22 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider {
let cache = this.extensionContext.globalState;

webviewView.webview.options = {
// Allow scripts in the webview
enableScripts: true,

localResourceRoots: [this._extensionUri],

};

webviewView.webview.html = this._getHtmlWebview(webviewView.webview);

webviewView.webview.onDidReceiveMessage(async (data) => {
let socket: any;
let uaSocket = getUaSocket();
let instanceURL: string = cache.get("codesphere.instanceURL") as string;
instanceURL = instanceURL.replace(/^https?:\/\//, '');
instanceURL = instanceURL.replace(/\/$/, '');

switch (data.type) {
case "getCiPipelineStages": {
const socketURL = `wss://${data.value.dataCenterId}.codesphere.com/workspace-proxy`;
console.log(socketURL + `socketURL`);
const socketURL = `wss://${data.value.dataCenterId}.${instanceURL}/workspace-proxy`;
const accessToken = await this.extensionContext.secrets.get("codesphere.accessToken") as string;
const workspaceID: number = parseInt(data.value.workspaceId);
socket = await setupWs(new wsLib.WebSocket(socketURL), "workspace-proxy", accessToken, cache, workspaceID);
Expand All @@ -59,7 +58,6 @@ 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: {
Expand Down Expand Up @@ -101,7 +99,7 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider {
value: {
stage: data.value.stage
}
})
});
break;
}

Expand All @@ -111,7 +109,7 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider {
}
const delay = (ms: any) => new Promise(resolve => setTimeout(resolve, ms));
const workspaceId = parseInt(data.value.workspaceId);
const socketURL = `wss://${data.value.datacenterId}.codesphere.com/workspace-proxy`;
const socketURL = `wss://${data.value.datacenterId}.${instanceURL}/workspace-proxy`;
const accessToken = cache.get("codesphere.accessTokenCache");
socket = await setupWs(new wsLib.WebSocket(socketURL), "workspace-proxy", accessToken, cache, workspaceId);
let uaSocketconnect2 = getUaSocket();
Expand Down Expand Up @@ -172,7 +170,7 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider {
const workspaceId = parseInt(data.value.workspaceId);
const stage = data.value.stage;
let endpoint: number = 0;
const socketURL = `wss://${data.value.dataCenterId}.codesphere.com/workspace-proxy`;
const socketURL = `wss://${data.value.dataCenterId}.${instanceURL}/workspace-proxy`;
const accessToken = await this.extensionContext.secrets.get("codesphere.accessToken") as string;
socket = await setupWs(new wsLib.WebSocket(socketURL), "workspace-proxy", accessToken, cache, workspaceId);
let uaSocket = getUaSocket();
Expand All @@ -196,7 +194,6 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider {
await request(uaSocket, "startPipeline", { workspaceId: workspaceId, stage: stage }, "workspace-proxy", 32);

for (let i = 0; i < data.value.stepcount; i++) {
console.log('stage');
request(uaSocket, "logs", { workspaceId: workspaceId, stage: stage, step:i }, "workspace-proxy", (400+i));
}

Expand All @@ -208,7 +205,6 @@ export class CiPipelineProvider implements vscode.WebviewViewProvider {


while (!ciStageFinished) {
console.log('Ci Pipeline is runing');
await delay(1000);

if (ciPipelineStatus === 'success') {
Expand Down
2 changes: 0 additions & 2 deletions src/NoCurrentWorkspaceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export class NoCurrentWorkspaceProvider implements vscode.WebviewViewProvider {
this._view = webviewView;

webviewView.webview.options = {
// Allow scripts in the webview
enableScripts: true,

localResourceRoots: [this._extensionUri],
};

Expand Down
Loading
Loading