|
|
@ -28,6 +28,7 @@ import { |
|
|
|
setGitConfig, |
|
|
|
setGitConfig, |
|
|
|
setElectronRecentFolders, |
|
|
|
setElectronRecentFolders, |
|
|
|
setCurrentWorkspaceHasGitSubmodules, |
|
|
|
setCurrentWorkspaceHasGitSubmodules, |
|
|
|
|
|
|
|
setCurrentLocalFilePath, |
|
|
|
} from './payload' |
|
|
|
} from './payload' |
|
|
|
import { addSlash, checkSlash, checkSpecialChars } from '@remix-ui/helper' |
|
|
|
import { addSlash, checkSlash, checkSpecialChars } from '@remix-ui/helper' |
|
|
|
|
|
|
|
|
|
|
@ -86,7 +87,9 @@ export const setPlugin = (filePanelPlugin, reducerDispatch) => { |
|
|
|
await checkGit() |
|
|
|
await checkGit() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
plugin.on('fs', 'workingDirChanged', async (path: string) => { |
|
|
|
plugin.on('fs', 'workingDirChanged', async (dir: string) => { |
|
|
|
|
|
|
|
console.log('workingDirChanged', dir) |
|
|
|
|
|
|
|
dispatch(setCurrentLocalFilePath(dir)) |
|
|
|
await checkGit() |
|
|
|
await checkGit() |
|
|
|
}) |
|
|
|
}) |
|
|
|
checkGit() |
|
|
|
checkGit() |
|
|
@ -368,7 +371,6 @@ export const fetchWorkspaceDirectory = async (path: string) => { |
|
|
|
provider.resolveDirectory(path, (error, fileTree: FileTree) => { |
|
|
|
provider.resolveDirectory(path, (error, fileTree: FileTree) => { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
reject(error) |
|
|
|
reject(error) |
|
|
|
console.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
resolve(fileTree) |
|
|
|
resolve(fileTree) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -546,11 +548,13 @@ export const uploadFolder = async (target, targetFolder: string, cb?: (err: Erro |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const getWorkspaces = async (): Promise<{ name: string; isGitRepo: boolean; hasGitSubmodules: boolean; branches?: { remote: any; name: string }[]; currentBranch?: string }[]> | undefined => { |
|
|
|
export const getWorkspaces = async (): Promise<{ name: string; isGitRepo: boolean; hasGitSubmodules: boolean; branches?: { remote: any; name: string }[]; currentBranch?: string }[]> | undefined => { |
|
|
|
|
|
|
|
console.log('getWorkspaces') |
|
|
|
try { |
|
|
|
try { |
|
|
|
const workspaces: { name: string; isGitRepo: boolean; hasGitSubmodules: boolean; branches?: { remote: any; name: string }[]; currentBranch?: string }[] = await new Promise((resolve, reject) => { |
|
|
|
const workspaces: { name: string; isGitRepo: boolean; hasGitSubmodules: boolean; branches?: { remote: any; name: string }[]; currentBranch?: string }[] = await new Promise((resolve, reject) => { |
|
|
|
const workspacesPath = plugin.fileProviders.workspace.workspacesPath |
|
|
|
const workspacesPath = plugin.fileProviders.workspace.workspacesPath |
|
|
|
|
|
|
|
console.log('workspacesPath', workspacesPath) |
|
|
|
plugin.fileProviders.browser.resolveDirectory('/' + workspacesPath, (error, items) => { |
|
|
|
plugin.fileProviders.browser.resolveDirectory('/' + workspacesPath, (error, items) => { |
|
|
|
|
|
|
|
|
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
return reject(error) |
|
|
|
return reject(error) |
|
|
|
} |
|
|
|
} |
|
|
@ -584,6 +588,7 @@ export const getWorkspaces = async (): Promise<{ name: string; isGitRepo: boolea |
|
|
|
).then((workspacesList) => resolve(workspacesList)) |
|
|
|
).then((workspacesList) => resolve(workspacesList)) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
console.log('workspaces', workspaces) |
|
|
|
await plugin.setWorkspaces(workspaces) |
|
|
|
await plugin.setWorkspaces(workspaces) |
|
|
|
return workspaces |
|
|
|
return workspaces |
|
|
|
} catch (e) {} |
|
|
|
} catch (e) {} |
|
|
@ -652,13 +657,15 @@ export const cloneRepository = async (url: string) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const checkGit = async () => { |
|
|
|
export const checkGit = async () => { |
|
|
|
const isGitRepo = await plugin.fileManager.isGitRepo() |
|
|
|
try { |
|
|
|
const hasGitSubmodule = await plugin.fileManager.hasGitSubmodules() |
|
|
|
const isGitRepo = await plugin.fileManager.isGitRepo() |
|
|
|
dispatch(setCurrentWorkspaceIsGitRepo(isGitRepo)) |
|
|
|
const hasGitSubmodule = await plugin.fileManager.hasGitSubmodules() |
|
|
|
dispatch(setCurrentWorkspaceHasGitSubmodules(hasGitSubmodule)) |
|
|
|
dispatch(setCurrentWorkspaceIsGitRepo(isGitRepo)) |
|
|
|
await refreshBranches() |
|
|
|
dispatch(setCurrentWorkspaceHasGitSubmodules(hasGitSubmodule)) |
|
|
|
const currentBranch = await plugin.call('dGitProvider', 'currentbranch') |
|
|
|
await refreshBranches() |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(currentBranch)) |
|
|
|
const currentBranch = await plugin.call('dGitProvider', 'currentbranch') |
|
|
|
|
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(currentBranch)) |
|
|
|
|
|
|
|
} catch (e) {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const getRepositoryTitle = async (url: string) => { |
|
|
|
export const getRepositoryTitle = async (url: string) => { |
|
|
|