pull/4791/head
filip mertens 6 months ago
parent 5964cfd619
commit 91aaf32ab8
  1. 11
      libs/remix-ui/git/src/components/buttons/commitmessage.tsx
  2. 2
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  3. 10
      libs/remix-ui/git/src/components/gitui.tsx
  4. 2
      libs/remix-ui/git/src/components/navigation/branchedetails.tsx
  5. 2
      libs/remix-ui/git/src/components/panels/branches.tsx
  6. 6
      libs/remix-ui/git/src/components/panels/branches/branchdifferences.tsx
  7. 1
      libs/remix-ui/git/src/components/panels/commits.tsx
  8. 4
      libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx
  9. 1
      libs/remix-ui/git/src/components/panels/githubcredentials.tsx
  10. 3
      libs/remix-ui/git/src/components/panels/setup.tsx
  11. 8
      libs/remix-ui/git/src/components/panels/sourcecontrol/sourcontrolitembuttons.tsx
  12. 24
      libs/remix-ui/git/src/lib/gitactions.ts
  13. 75
      libs/remix-ui/git/src/lib/listeners.ts
  14. 5
      libs/remix-ui/git/src/state/gitreducer.tsx
  15. 81
      libs/remix-ui/git/src/types/index.ts
  16. 13
      libs/remix-ui/workspace/src/lib/actions/workspace.ts

@ -8,7 +8,7 @@ import { syncStateContext } from "./sourceControlBase";
enum buttonStateValues { enum buttonStateValues {
Commit , Commit ,
Sync = 1, Sync = 1,
PublishBranch = 2 PublishBranch = 2
} }
@ -93,19 +93,19 @@ export const CommitMessage = () => {
const setButtonStateValues = () => { const setButtonStateValues = () => {
console.log('setButtonStateValues', context) console.log('setButtonStateValues', context)
if(!commitNotAllowed() || context.allchangesnotstaged.length > 0 || context.staged.length > 0){ if (!commitNotAllowed() || context.allchangesnotstaged.length > 0 || context.staged.length > 0){
if(context.allchangesnotstaged.length == 0 && context.staged.length == 0 && message.value === "" && publishEnabled()){ if (context.allchangesnotstaged.length == 0 && context.staged.length == 0 && message.value === "" && publishEnabled()){
setButtonState(buttonStateValues.PublishBranch) setButtonState(buttonStateValues.PublishBranch)
return return
} }
setButtonState(buttonStateValues.Commit) setButtonState(buttonStateValues.Commit)
return return
} }
if(syncEnabled()){ if (syncEnabled()){
setButtonState(buttonStateValues.Sync) setButtonState(buttonStateValues.Sync)
return return
} }
if(publishEnabled()){ if (publishEnabled()){
setButtonState(buttonStateValues.PublishBranch) setButtonState(buttonStateValues.PublishBranch)
return return
} }
@ -116,7 +116,6 @@ export const CommitMessage = () => {
setButtonStateValues() setButtonStateValues()
},[context.canCommit, context.staged, context.allchangesnotstaged, context.currentBranch, syncState.commitsAhead, syncState.commitsBehind, message.value]) },[context.canCommit, context.staged, context.allchangesnotstaged, context.currentBranch, syncState.commitsAhead, syncState.commitsBehind, message.value])
return ( return (
<> <>
<div className="form-group"> <div className="form-group">

@ -71,7 +71,7 @@ export const SourceControlButtons = () => {
<span className='d-flex justify-content-end align-items-center'> <span className='d-flex justify-content-end align-items-center'>
<CustomTooltip tooltipText={getTooltipText('git.pull')}> <CustomTooltip tooltipText={getTooltipText('git.pull')}>
<GitUIButton disabledCondition={buttonsDisabled()} onClick={pull} className='btn btn-sm pl-0 pr-2'> <GitUIButton disabledCondition={buttonsDisabled()} onClick={pull} className='btn btn-sm pl-0 pr-2'>
<div className="d-flex align-items-baseline"> <div className="d-flex align-items-baseline">
{syncState.commitsBehind.length ? <div className="badge badge-pill pl-0"> {syncState.commitsBehind.length ? <div className="badge badge-pill pl-0">
{syncState.commitsBehind.length} {syncState.commitsBehind.length}
</div> : null} </div> : null}

@ -50,7 +50,6 @@ export const GitUI = (props: IGitUi) => {
const [needsInit, setNeedsInit] = useState<boolean>(true) const [needsInit, setNeedsInit] = useState<boolean>(true)
const [appLoaded, setAppLoaded] = useState<boolean>(false) const [appLoaded, setAppLoaded] = useState<boolean>(false)
useEffect(() => { useEffect(() => {
plugin.emit('statusChanged', { plugin.emit('statusChanged', {
key:'loading', key:'loading',
@ -63,7 +62,7 @@ export const GitUI = (props: IGitUi) => {
},[]) },[])
useEffect(() => { useEffect(() => {
if(!appLoaded) return if (!appLoaded) return
setCallBacks(plugin, gitDispatch, loaderDispatch) setCallBacks(plugin, gitDispatch, loaderDispatch)
setPlugin(plugin, gitDispatch, loaderDispatch) setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true }) loaderDispatch({ type: 'plugin', payload: true })
@ -71,7 +70,7 @@ export const GitUI = (props: IGitUi) => {
}, [appLoaded]) }, [appLoaded])
useEffect(() => { useEffect(() => {
if(!appLoaded) return if (!appLoaded) return
async function checkconfig() { async function checkconfig() {
const username = await plugin.call('settings', 'get', 'settings/github-user-name') const username = await plugin.call('settings', 'get', 'settings/github-user-name')
@ -84,7 +83,7 @@ export const GitUI = (props: IGitUi) => {
}, [gitState.gitHubAccessToken, gitState.gitHubUser, gitState.userEmails]) }, [gitState.gitHubAccessToken, gitState.gitHubUser, gitState.userEmails])
useEffect(() => { useEffect(() => {
if(!appLoaded) return if (!appLoaded) return
async function setDecorators(gitState: gitState) { async function setDecorators(gitState: gitState) {
await plugin.call('fileDecorator', 'clearFileDecorators') await plugin.call('fileDecorator', 'clearFileDecorators')
await setModifiedDecorator(gitState.modified) await setModifiedDecorator(gitState.modified)
@ -98,7 +97,7 @@ export const GitUI = (props: IGitUi) => {
}, [gitState.fileStatusResult]) }, [gitState.fileStatusResult])
useEffect(() => { useEffect(() => {
if(!appLoaded) return if (!appLoaded) return
async function updatestate() { async function updatestate() {
console.log('updatestate', gitState) console.log('updatestate', gitState)
if (gitState.currentBranch && gitState.currentBranch.remote && gitState.currentBranch.remote.url) { if (gitState.currentBranch && gitState.currentBranch.remote && gitState.currentBranch.remote.url) {
@ -113,7 +112,6 @@ export const GitUI = (props: IGitUi) => {
}, [gitState.gitHubUser, gitState.currentBranch, gitState.remotes, gitState.gitHubAccessToken]) }, [gitState.gitHubUser, gitState.currentBranch, gitState.remotes, gitState.gitHubAccessToken])
const gitActionsProviderValue = { const gitActionsProviderValue = {
commit, commit,
addall, addall,

@ -89,7 +89,7 @@ export const BrancheDetailsNavigation = (props: BrancheDetailsNavigationProps) =
<GitUIButton className="btn btn-sm p-0 mr-1 text-muted" onClick={() => openRemote()}> <GitUIButton className="btn btn-sm p-0 mr-1 text-muted" onClick={() => openRemote()}>
<FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon> <FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon>
</GitUIButton> </GitUIButton>
</>} </>}
</div> </div>
</> </>

@ -24,12 +24,10 @@ export const Branches = () => {
} }
}; };
useEffect(() => { useEffect(() => {
console.log("branches", context.branches) console.log("branches", context.branches)
}, [context.branches]) }, [context.branches])
return ( return (
<> <>
<div className="pt-1"> <div className="pt-1">

@ -26,16 +26,16 @@ export const BranchDifferences = (props: BrancheDetailsProps) => {
}, [context.branchDifferences]) }, [context.branchDifferences])
const commitsAhead = (remote: remote) => { const commitsAhead = (remote: remote) => {
if(!remote) return []; if (!remote) return [];
return context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueHeadCommits || []; return context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueHeadCommits || [];
} }
const commitsBehind = (remote: remote) => { const commitsBehind = (remote: remote) => {
if(!remote) return []; if (!remote) return [];
return context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueRemoteCommits || []; return context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueRemoteCommits || [];
} }
if(!getRemote()) return null; if (!getRemote()) return null;
return ( return (

@ -40,7 +40,6 @@ export const Commits = () => {
return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
} }
const getCommitChanges = async (commit: ReadCommitResult) => { const getCommitChanges = async (commit: ReadCommitResult) => {
await actions.getCommitChanges(commit.oid, commit.commit.parent[0],null, getRemote()) await actions.getCommitChanges(commit.oid, commit.commit.parent[0],null, getRemote())
} }

@ -50,8 +50,8 @@ export const CommitSummary = (props: CommitSummaryProps) => {
} }
const openRemote = () => { const openRemote = () => {
if(getRemote()) if (getRemote())
window.open(`${getRemote().url}/commit/${commit.oid}`, '_blank'); window.open(`${getRemote().url}/commit/${commit.oid}`, '_blank');
} }
return ( return (

@ -6,7 +6,6 @@ import { CustomTooltip } from "@remix-ui/helper";
import { useIntl, FormattedMessage } from "react-intl"; import { useIntl, FormattedMessage } from "react-intl";
import { CopyToClipboard } from "@remix-ui/clipboard"; import { CopyToClipboard } from "@remix-ui/clipboard";
export const GitHubCredentials = () => { export const GitHubCredentials = () => {
const context = React.useContext(gitPluginContext) const context = React.useContext(gitPluginContext)
const pluginactions = React.useContext(pluginActionsContext) const pluginactions = React.useContext(pluginActionsContext)

@ -6,7 +6,6 @@ export const Setup = () => {
const [screen, setScreen] = useState(0) const [screen, setScreen] = useState(0)
if (screen === 0) { if (screen === 0) {
return ( return (
<> <>
@ -22,7 +21,7 @@ export const Setup = () => {
</div> </div>
</> </>
) )
}else if (screen === 1) { } else if (screen === 1) {
return ( return (
<> <>
<h5>SETUP</h5> <h5>SETUP</h5>

@ -23,17 +23,17 @@ export const SourceControlItemButtons = (props: SourceControlItemButtonsProps) =
{status && status.indexOf("modified") === -1 ? <></> : <button onClick={async () => await actions.checkoutfile(file.filename)} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button>} {status && status.indexOf("modified") === -1 ? <></> : <button onClick={async () => await actions.checkoutfile(file.filename)} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button>}
{status && status.indexOf("deleted") === -1 ? <></> : <button onClick={async () => await actions.checkoutfile(file.filename)} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button>} {status && status.indexOf("deleted") === -1 ? <></> : <button onClick={async () => await actions.checkoutfile(file.filename)} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button>}
{status && status.indexOf("deleted") !== -1 ? <></> : <button data-id={`unStage${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.rm({filepath:file.filename})} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faMinus} className="" /></button>} {status && status.indexOf("deleted") !== -1 ? <></> : <button data-id={`unStage${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.rm({ filepath:file.filename })} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faMinus} className="" /></button>}
</> </>
} }
if (group.name === 'Changes') { if (group.name === 'Changes') {
return <> return <>
{status && status.indexOf("deleted") === -1 ? <></> : <><button onClick={async () => await actions.checkoutfile(file.filename)} data-id={`undo${group.name}${path.basename(file.filename)}`} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button><button data-id={`addToGit${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.rm({filepath:file.filename})} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faPlus} className="" /></button></>} {status && status.indexOf("deleted") === -1 ? <></> : <><button onClick={async () => await actions.checkoutfile(file.filename)} data-id={`undo${group.name}${path.basename(file.filename)}`} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button><button data-id={`addToGit${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.rm({ filepath:file.filename })} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faPlus} className="" /></button></>}
{status && status.indexOf("modified") === -1 ? <></> : <button onClick={async () => await actions.checkoutfile(file.filename)} data-id={`undo${group.name}${path.basename(file.filename)}`} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button>} {status && status.indexOf("modified") === -1 ? <></> : <button onClick={async () => await actions.checkoutfile(file.filename)} data-id={`undo${group.name}${path.basename(file.filename)}`} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faUndo} className="" /></button>}
{(status && status.indexOf("unstaged") !== -1 || status && status.indexOf("deleted") !== -1) ? <></> : <button data-id={`addToGit${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.add({filepath:file.filename})} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faPlus} className="" /></button>} {(status && status.indexOf("unstaged") !== -1 || status && status.indexOf("deleted") !== -1) ? <></> : <button data-id={`addToGit${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.add({ filepath:file.filename })} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faPlus} className="" /></button>}
{(status && status.indexOf("unstaged") !== -1 && status && status.indexOf("modified") !== -1) ? <button data-id={`addToGit${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.add({filepath:file.filename})} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faPlus} className="" /></button> : <></>} {(status && status.indexOf("unstaged") !== -1 && status && status.indexOf("modified") !== -1) ? <button data-id={`addToGit${group.name}${path.basename(file.filename)}`} onClick={async () => await actions.add({ filepath:file.filename })} className='btn btn-sm btn-secondary mr-1 '><FontAwesomeIcon icon={faPlus} className="" /></button> : <></>}
</> </>
} }
return <></> return <></>

@ -128,19 +128,17 @@ export const showCurrentBranch = async () => {
} }
export const currentBranch = async () => { export const currentBranch = async () => {
try {
const branch: branch = const branch: branch =
(await plugin.call('dgitApi', "currentbranch")) || { (await plugin.call('dgitApi', "currentbranch")) || {
name: "",
remote: {
name: "", name: "",
remote: { url: "",
name: "", },
url: "", };
}, return branch;
};
return branch;
} catch (e) {
throw e;
}
} }
export const createBranch = async (name: string = "") => { export const createBranch = async (name: string = "") => {
@ -595,7 +593,7 @@ export const loadGitHubUserFromToken = async () => {
} }
export const statusMatrix = async (filepaths: string[]) => { export const statusMatrix = async (filepaths: string[]) => {
const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.'] }); const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']});
const result = (matrix || []).map((x) => { const result = (matrix || []).map((x) => {
return { return {
filename: `/${x.shift()}`, filename: `/${x.shift()}`,

@ -14,27 +14,25 @@ let callBackEnabled: boolean = false
type AsyncCallback = () => Promise<void>; type AsyncCallback = () => Promise<void>;
class AsyncDebouncedQueue { class AsyncDebouncedQueue {
private queues: Map<AsyncCallback, { timer: any, lastCall: number }>; private queues: Map<AsyncCallback, { timer: any, lastCall: number }>;
constructor(private delay: number = 300) { constructor(private delay: number = 300) {
this.queues = new Map(); this.queues = new Map();
} }
enqueue(callback: AsyncCallback, customDelay?:number): void {
if (this.queues.has(callback)) {
clearTimeout(this.queues.get(callback)!.timer);
}
let timer = setTimeout(async () => {
await callback();
this.queues.delete(callback);
}, customDelay || this.delay);
this.queues.set(callback, { timer, lastCall: Date.now() }); enqueue(callback: AsyncCallback, customDelay?:number): void {
if (this.queues.has(callback)) {
clearTimeout(this.queues.get(callback)!.timer);
} }
}
const timer = setTimeout(async () => {
await callback();
this.queues.delete(callback);
}, customDelay || this.delay);
this.queues.set(callback, { timer, lastCall: Date.now() });
}
}
export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<gitActionDispatch>, loaderDispatcher: React.Dispatch<any>) => { export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<gitActionDispatch>, loaderDispatcher: React.Dispatch<any>) => {
plugin = viewPlugin plugin = viewPlugin
@ -172,42 +170,13 @@ export const getGitConfig = async () => {
} }
const syncFromWorkspace = async (callback: Function, isLocalhost = false) => {
//gitDispatch(setLoading(true));
await disableCallBacks();
if (isLocalhost) {
gitDispatch(setCanUseApp(false));
gitDispatch(setLoading(false));
await enableCallBacks();
return;
}
try {
const workspace = await plugin.call(
"filePanel",
"getCurrentWorkspace"
);
if (workspace.isLocalhost) {
gitDispatch(setCanUseApp(false));
await enableCallBacks();
return
}
gitDispatch(setRepoName(workspace.name));
gitDispatch(setCanUseApp(true));
} catch (e) {
gitDispatch(setCanUseApp(false));
}
await callback();
await enableCallBacks();
}
export const loadFiles = async (filepaths: string[] = null) => { export const loadFiles = async (filepaths: string[] = null) => {
try { try {
const branch = await plugin.call('dgitApi', "currentbranch") const branch = await plugin.call('dgitApi', "currentbranch")
console.log('load files', branch) console.log('load files', branch)
if(branch) { if (branch) {
await getFileStatusMatrix(filepaths); await getFileStatusMatrix(filepaths);
}else{ } else {
await plugin.call('fileDecorator', 'clearFileDecorators') await plugin.call('fileDecorator', 'clearFileDecorators')
statusChanged(0) statusChanged(0)
} }
@ -217,18 +186,6 @@ export const loadFiles = async (filepaths: string[] = null) => {
} }
} }
const getStorageUsed = async () => {
try {
const storageUsed = await plugin.call("storage" as any, "getStorage" as any);
} catch (e) {
const storage: string = await plugin.call('dgitApi', "localStorageUsed" as any);
const storageUsed = {
usage: parseFloat(storage) * 1000,
quota: 10000000,
};
}
}
export const disableCallBacks = async () => { export const disableCallBacks = async () => {
callBackEnabled = false; callBackEnabled = false;
} }

@ -178,11 +178,10 @@ export const gitReducer = (state: gitState = defaultGitState, action: Actions):
case 'SET_USER_EMAILS': case 'SET_USER_EMAILS':
return { return {
...state, ...state,
userEmails: action.payload userEmails: action.payload
} }
case 'SET_DEFAULT_REMOTE': case 'SET_DEFAULT_REMOTE':
return { return {
...state, ...state,

@ -142,11 +142,10 @@ export interface repositoriesInput { token: string, page?: number, per_page?: nu
export interface statusInput { ref: string, filepaths?: string[] } export interface statusInput { ref: string, filepaths?: string[] }
export const dGitProfile: LibraryProfile<IGitApi> = { export const dGitProfile: LibraryProfile<IGitApi> = {
name: 'dgitApi', name: 'dgitApi',
methods: ['clone', 'branches', 'remotes', 'getCommitChanges', 'log', 'remotecommits'], methods: ['clone', 'branches', 'remotes', 'getCommitChanges', 'log', 'remotecommits'],
} }
export interface customGitApi extends IRemixApi { export interface customGitApi extends IRemixApi {
dgit: IGitApi dgit: IGitApi
} }
@ -266,47 +265,47 @@ export type remoteBranch = {
} }
export const defaultGitState: gitState = { export const defaultGitState: gitState = {
currentBranch: { name: "", remote: { name: "", url: "" } }, currentBranch: { name: "", remote: { name: "", url: "" } },
commits: [], commits: [],
branch: "", branch: "",
canCommit: true, canCommit: true,
branches: [], branches: [],
remotes: [], remotes: [],
defaultRemote: null, defaultRemote: null,
fileStatusResult: [], fileStatusResult: [],
staged: [], staged: [],
untracked: [], untracked: [],
deleted: [], deleted: [],
modified: [], modified: [],
allchangesnotstaged: [], allchangesnotstaged: [],
canUseApp: false, canUseApp: false,
loading: false, loading: false,
storageUsed: {}, storageUsed: {},
reponame: "", reponame: "",
repositories: [], repositories: [],
remoteBranches: [], remoteBranches: [],
commitChanges: [], commitChanges: [],
remoteBranchCommits: {}, remoteBranchCommits: {},
localBranchCommits: {}, localBranchCommits: {},
branchDifferences: {}, branchDifferences: {},
syncStatus: syncStatus.none, syncStatus: syncStatus.none,
localCommitCount: 0, localCommitCount: 0,
remoteCommitCount: 0, remoteCommitCount: 0,
upstream: null, upstream: null,
gitHubUser: {} as GitHubUser, gitHubUser: {} as GitHubUser,
rateLimit: {} as RateLimit, rateLimit: {} as RateLimit,
userEmails: [] as userEmails, userEmails: [] as userEmails,
gitHubScopes: [], gitHubScopes: [],
gitHubAccessToken: "", gitHubAccessToken: "",
log: [] log: []
} }
export const defaultLoaderState: loaderState = { export const defaultLoaderState: loaderState = {
branches: false, branches: false,
commits: false, commits: false,
sourcecontrol: false, sourcecontrol: false,
remotes: false, remotes: false,
plugin: false plugin: false
} }
export type fileStatusResult = { export type fileStatusResult = {

@ -204,11 +204,7 @@ export const createWorkspace = async (
}, 5000) }, 5000)
} else if (!isEmpty && !(isGitRepo && createCommit)) await loadWorkspacePreset(workspaceTemplateName, opts) } else if (!isEmpty && !(isGitRepo && createCommit)) await loadWorkspacePreset(workspaceTemplateName, opts)
cb && cb(null, workspaceName) cb && cb(null, workspaceName)
if (isGitRepo && false) {
await checkGit()
const isActive = await plugin.call('manager', 'isActive', 'dgit')
if (!isActive) await plugin.call('manager', 'activatePlugin', 'dgit')
}
if (workspaceTemplateName === 'semaphore' || workspaceTemplateName === 'hashchecker' || workspaceTemplateName === 'rln') { if (workspaceTemplateName === 'semaphore' || workspaceTemplateName === 'hashchecker' || workspaceTemplateName === 'rln') {
const isCircomActive = await plugin.call('manager', 'isActive', 'circuit-compiler') const isCircomActive = await plugin.call('manager', 'isActive', 'circuit-compiler')
if (!isCircomActive) await plugin.call('manager', 'activatePlugin', 'circuit-compiler') if (!isCircomActive) await plugin.call('manager', 'activatePlugin', 'circuit-compiler')
@ -513,10 +509,7 @@ export const switchToWorkspace = async (name: string) => {
await plugin.fileProviders.workspace.setWorkspace(name) await plugin.fileProviders.workspace.setWorkspace(name)
await plugin.setWorkspace({ name, isLocalhost: false }) await plugin.setWorkspace({ name, isLocalhost: false })
const isGitRepo = await plugin.fileManager.isGitRepo() const isGitRepo = await plugin.fileManager.isGitRepo()
if (isGitRepo && false) {
const isActive = await plugin.call('manager', 'isActive', 'dgit')
if (!isActive) await plugin.call('manager', 'activatePlugin', 'dgit')
}
dispatch(setMode('browser')) dispatch(setMode('browser'))
dispatch(setCurrentWorkspace({ name, isGitRepo })) dispatch(setCurrentWorkspace({ name, isGitRepo }))
dispatch(setReadOnlyMode(false)) dispatch(setReadOnlyMode(false))
@ -669,7 +662,7 @@ export const cloneRepository = async (url: string) => {
const repoName = await getRepositoryTitle(url) const repoName = await getRepositoryTitle(url)
await createWorkspace(repoName, 'blank', null, true, null, true, false) await createWorkspace(repoName, 'blank', null, true, null, true, false)
const promise = dgitPlugin.call('dgitApi', 'clone', {...repoConfig, workspaceExists: true, workspaceName: repoName}) const promise = dgitPlugin.call('dgitApi', 'clone', { ...repoConfig, workspaceExists: true, workspaceName: repoName })
dispatch(cloneRepositoryRequest()) dispatch(cloneRepositoryRequest())
promise promise

Loading…
Cancel
Save