From e8e707112db8763b40032277c6950694742f127a Mon Sep 17 00:00:00 2001 From: "daniel.terletzkiy" Date: Tue, 14 Feb 2023 14:49:13 +0100 Subject: [PATCH] ULT-1 added project search, fixed master branch fetch --- electron/controller/ProjectScraper.ts | 7 +++--- electron/router/ProjectRouter.ts | 4 ++-- package.json | 2 +- src/components/JiraProjectList.vue | 31 +++++++++++++++++++++------ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/electron/controller/ProjectScraper.ts b/electron/controller/ProjectScraper.ts index c50dd49..2eaee3c 100644 --- a/electron/controller/ProjectScraper.ts +++ b/electron/controller/ProjectScraper.ts @@ -53,14 +53,15 @@ module.exports = class ProjectScraper { return projectBranches; } - static open(path: Project["path"], issue: Task["key"], event?: any) { + static async open(path: Project["path"], issue: Task["key"], event?: any) { try { const shell = require("shelljs"); shell.config.execPath = shell.which("node").stdout; shell.cd(path); - const masterBranch = GitShell.getMasterBranch(path); - shell.exec(`git fetch && git pull origin ${masterBranch}`, { windowsHide: true }); //update master + const masterBranch = (await GitShell.getMasterBranch(path)).replace('/',' '); + console.log("change project: ", masterBranch, issue, path, !!event); + shell.exec(`git fetch && git pull ${masterBranch}`, { windowsHide: true }); //update master shell.exec(`git stash`, { windowsHide: true }); //sash current uncommitted files if ( shell.exec(`git checkout ${issue}`, { windowsHide: true }).code !== 0 diff --git a/electron/router/ProjectRouter.ts b/electron/router/ProjectRouter.ts index d74a8b8..f4dc9c4 100644 --- a/electron/router/ProjectRouter.ts +++ b/electron/router/ProjectRouter.ts @@ -7,10 +7,10 @@ const ProjectScraper = require("../controller/ProjectScraper"); ipcMain.on( "open/project", - (event: any, arg: { path: string; issue: Task["key"] }) => { + async (event: any, arg: { path: string; issue: Task["key"] }) => { event.sender.send( "result/open/project", - ProjectScraper.open(arg.path, arg.issue, event) + await ProjectScraper.open(arg.path, arg.issue, event) ); } ); diff --git a/package.json b/package.json index eceeac4..eb50924 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ultira", - "version": "0.0.3", + "version": "0.0.4", "private": true, "description": "ultimate jira tool", "author": { diff --git a/src/components/JiraProjectList.vue b/src/components/JiraProjectList.vue index 224927e..4281c45 100644 --- a/src/components/JiraProjectList.vue +++ b/src/components/JiraProjectList.vue @@ -1,5 +1,10 @@