desktop-master-git2
bunsenstraat 3 months ago
parent edca0712d1
commit 3181e66e6b
  1. 18
      apps/remix-ide/src/app/files/dgitProvider.ts
  2. 22
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  3. 24
      libs/remix-ui/git/src/lib/gitactions.ts
  4. 9
      libs/remix-ui/git/src/lib/listeners.ts

@ -101,10 +101,9 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
}
async status(cmd: statusInput): Promise<Array<StatusRow>> {
console.log('status', cmd)
if ((Registry.getInstance().get('platform').api.isDesktop())) {
const status = await this.call('isogit', 'status', cmd)
console.log('STATUS', { ...status })
return status
}
@ -112,7 +111,7 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
...await this.addIsomorphicGitConfigFS(),
...cmd
})
console.log('STATUS', JSON.stringify(status))
return status
}
@ -131,7 +130,7 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
}
async rm(cmd: rmInputType) {
console.log('RM', cmd)
if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'rm', cmd)
} else {
@ -144,7 +143,7 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
}
async checkout(cmd: checkoutInputType): Promise<void> {
console.log('checkout', cmd)
if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'checkout', cmd)
} else {
@ -185,12 +184,12 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
}
async log(cmd: logInputType): Promise<ReadCommitResult[]> {
console.log('LOG', cmd)
if ((Registry.getInstance().get('platform').api.isDesktop())) {
const status = await this.call('isogit', 'log', {
...cmd,
})
console.log('LOG END', status)
return status
}
@ -198,7 +197,7 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
...await this.addIsomorphicGitConfigFS(),
...cmd,
})
console.log('LOG END', status)
return status
}
@ -260,7 +259,6 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
if ((Registry.getInstance().get('platform').api.isDesktop())) {
const branches = await this.call('isogit', 'branches')
console.log(branches)
return branches
}
const defaultConfig = await this.addIsomorphicGitConfigFS()
@ -618,7 +616,7 @@ class DGitProvider extends Plugin<any, CustomRemixApi> {
}
async remotecommits(input: remoteCommitsInputType): Promise<pagedCommits[]> {
console.log('remotecommits', input)
const octokit = new Octokit({
auth: input.token
})

@ -1,15 +1,15 @@
import {faArrowDown, faArrowUp, faArrowsUpDown, faArrowRotateRight} from '@fortawesome/free-solid-svg-icons'
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'
import {CustomTooltip} from '@remix-ui/helper'
import React, {useEffect, useState} from 'react'
import {FormattedMessage} from 'react-intl'
import {gitActionsContext} from '../../state/context'
import {branch, remote} from '@remix-api'
import {defaultGitState, gitMatomoEventTypes, gitUIPanels} from '../../types'
import {gitPluginContext} from '../gitui'
import { faArrowDown, faArrowUp, faArrowsUpDown, faArrowRotateRight } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { CustomTooltip } from '@remix-ui/helper'
import React, { useEffect, useState } from 'react'
import { FormattedMessage } from 'react-intl'
import { gitActionsContext } from '../../state/context'
import { branch, remote } from '@remix-api'
import { defaultGitState, gitMatomoEventTypes, gitUIPanels } from '../../types'
import { gitPluginContext } from '../gitui'
import GitUIButton from './gituibutton'
import {syncStateContext} from './sourceControlBase'
import {sendToMatomo} from '../../lib/pluginActions'
import { syncStateContext } from './sourceControlBase'
import { sendToMatomo } from '../../lib/pluginActions'
export interface SourceControlButtonsProps {
panel: string

@ -65,7 +65,7 @@ export const setUpstreamRemote = async (remote: remote) => {
}
export const getFileStatusMatrix = async (filepaths: string[]) => {
console.log('getFileStatusMatrix', filepaths)
dispatch(setLoading(true))
const fileStatusResult = await statusMatrix(filepaths);
fileStatusResult.map((m) => {
@ -81,7 +81,7 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
dispatch(fileStatusMerge(fileStatusResult))
setFileDecorators(fileStatusResult)
}
console.log('getFileStatusMatrix end')
dispatch(setLoading(false))
}
@ -93,7 +93,7 @@ export const getCommits = async (depth: number) => {
"log",
{ ref: "HEAD", depth: depth }
);
console.log('commits', commits)
return commits;
} catch (e) {
return [];
@ -101,7 +101,7 @@ export const getCommits = async (depth: number) => {
}
export const gitlog = async (depth: number) => {
console.log('gitlog start')
let commits = []
try {
commits = await getCommits(depth)
@ -110,7 +110,7 @@ export const gitlog = async (depth: number) => {
dispatch(setCommits(commits))
await showCurrentBranch()
dispatch(setLoading(false))
console.log('gitlog end')
}
export const setStateGitLogCount = async (count: number) => {
@ -533,7 +533,7 @@ export const remoteBranches = async (owner: string, repo: string) => {
}
export const remoteCommits = async (url: string, branch: string, length: number) => {
console.log('get remote commits')
const urlParts = url.split("/");
// check if it's github
@ -680,9 +680,9 @@ export const loadGitHubUserFromToken = async () => {
}
export const statusMatrix = async (filepaths: string[]) => {
console.log('calling status')
const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']});
console.log('calling status end')
const result = (matrix || []).map((x) => {
return {
filename: `/${x.shift()}`,
@ -745,7 +745,7 @@ export const diff = async (commitChange: commitChange) => {
}
export const getCommitChanges = async (oid1: string, oid2: string, branch?: branch, remote?: remote) => {
console.log('getCommitChanges', oid1, oid2, branch, remote)
try {
let log
try {
@ -758,7 +758,7 @@ export const getCommitChanges = async (oid1: string, oid2: string, branch?: bran
console.log(e, 'log error')
}
if (log) {
console.log('log', log)
const foundCommit = log.find((commit: ReadCommitResult) => commit.oid === oid2)
if (!foundCommit && remote) {
@ -795,7 +795,7 @@ async function getRepoDetails(url: string) {
}
export const fetchBranch = async (branch: branch, page: number) => {
console.log('fetch branch')
if (!branch.remote || !branch.remote.url) return
const token = await tokenWarning();
if (page == 1) {
@ -815,7 +815,7 @@ export const fetchBranch = async (branch: branch, page: number) => {
}
export const getBranchDifferences = async (branch: branch, remote: remote, state: gitState) => {
console.log('get branch diff')
if (!remote && state) {
if (state.defaultRemote) {
remote = state.defaultRemote

@ -69,11 +69,11 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
});
plugin.on('fs', 'workingDirChanged', async (path: string) => {
console.log('workingDirChanged', path)
gitDispatcher(setDesktopWorkingDir(path))
gitDispatch(setCanUseApp(path ? true : false))
const version = await plugin.call('dgitApi', 'version')
console.log(version)
gitDispatch(setVersion(version))
loadFileQueue.enqueue(async () => {
loadFiles()
@ -90,13 +90,12 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
})
plugin.on("filePanel", "setWorkspace", async (x: any) => {
console.log('setWorkspace', x)
if (platform == appPlatformTypes.desktop) {
const workingDir = await plugin.call('fs', 'getWorkingDir')
gitDispatch(setCanUseApp(workingDir? true : false))
const version = await plugin.call('dgitApi', 'version')
console.log(version)
gitDispatch(setVersion(version))
} else {
gitDispatch(setCanUseApp(x && !x.isLocalhost && x.name))
@ -144,7 +143,7 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}, 10)
})
plugin.on('dgitApi', 'commit', async () => {
console.log('commit')
loadFileQueue.enqueue(async () => {
loadFiles()
}, 10)

Loading…
Cancel
Save