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

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

@ -65,7 +65,7 @@ export const setUpstreamRemote = async (remote: remote) => {
} }
export const getFileStatusMatrix = async (filepaths: string[]) => { export const getFileStatusMatrix = async (filepaths: string[]) => {
console.log('getFileStatusMatrix', filepaths)
dispatch(setLoading(true)) dispatch(setLoading(true))
const fileStatusResult = await statusMatrix(filepaths); const fileStatusResult = await statusMatrix(filepaths);
fileStatusResult.map((m) => { fileStatusResult.map((m) => {
@ -81,7 +81,7 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
dispatch(fileStatusMerge(fileStatusResult)) dispatch(fileStatusMerge(fileStatusResult))
setFileDecorators(fileStatusResult) setFileDecorators(fileStatusResult)
} }
console.log('getFileStatusMatrix end')
dispatch(setLoading(false)) dispatch(setLoading(false))
} }
@ -93,7 +93,7 @@ export const getCommits = async (depth: number) => {
"log", "log",
{ ref: "HEAD", depth: depth } { ref: "HEAD", depth: depth }
); );
console.log('commits', commits)
return commits; return commits;
} catch (e) { } catch (e) {
return []; return [];
@ -101,7 +101,7 @@ export const getCommits = async (depth: number) => {
} }
export const gitlog = async (depth: number) => { export const gitlog = async (depth: number) => {
console.log('gitlog start')
let commits = [] let commits = []
try { try {
commits = await getCommits(depth) commits = await getCommits(depth)
@ -110,7 +110,7 @@ export const gitlog = async (depth: number) => {
dispatch(setCommits(commits)) dispatch(setCommits(commits))
await showCurrentBranch() await showCurrentBranch()
dispatch(setLoading(false)) dispatch(setLoading(false))
console.log('gitlog end')
} }
export const setStateGitLogCount = async (count: number) => { 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) => { export const remoteCommits = async (url: string, branch: string, length: number) => {
console.log('get remote commits')
const urlParts = url.split("/"); const urlParts = url.split("/");
// check if it's github // check if it's github
@ -680,9 +680,9 @@ export const loadGitHubUserFromToken = async () => {
} }
export const statusMatrix = async (filepaths: string[]) => { export const statusMatrix = async (filepaths: string[]) => {
console.log('calling status')
const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']}); const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']});
console.log('calling status end')
const result = (matrix || []).map((x) => { const result = (matrix || []).map((x) => {
return { return {
filename: `/${x.shift()}`, 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) => { export const getCommitChanges = async (oid1: string, oid2: string, branch?: branch, remote?: remote) => {
console.log('getCommitChanges', oid1, oid2, branch, remote)
try { try {
let log let log
try { try {
@ -758,7 +758,7 @@ export const getCommitChanges = async (oid1: string, oid2: string, branch?: bran
console.log(e, 'log error') console.log(e, 'log error')
} }
if (log) { if (log) {
console.log('log', log)
const foundCommit = log.find((commit: ReadCommitResult) => commit.oid === oid2) const foundCommit = log.find((commit: ReadCommitResult) => commit.oid === oid2)
if (!foundCommit && remote) { if (!foundCommit && remote) {
@ -795,7 +795,7 @@ async function getRepoDetails(url: string) {
} }
export const fetchBranch = async (branch: branch, page: number) => { export const fetchBranch = async (branch: branch, page: number) => {
console.log('fetch branch')
if (!branch.remote || !branch.remote.url) return if (!branch.remote || !branch.remote.url) return
const token = await tokenWarning(); const token = await tokenWarning();
if (page == 1) { 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) => { export const getBranchDifferences = async (branch: branch, remote: remote, state: gitState) => {
console.log('get branch diff')
if (!remote && state) { if (!remote && state) {
if (state.defaultRemote) { if (state.defaultRemote) {
remote = 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) => { plugin.on('fs', 'workingDirChanged', async (path: string) => {
console.log('workingDirChanged', path)
gitDispatcher(setDesktopWorkingDir(path)) gitDispatcher(setDesktopWorkingDir(path))
gitDispatch(setCanUseApp(path ? true : false)) gitDispatch(setCanUseApp(path ? true : false))
const version = await plugin.call('dgitApi', 'version') const version = await plugin.call('dgitApi', 'version')
console.log(version)
gitDispatch(setVersion(version)) gitDispatch(setVersion(version))
loadFileQueue.enqueue(async () => { loadFileQueue.enqueue(async () => {
loadFiles() loadFiles()
@ -90,13 +90,12 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}) })
plugin.on("filePanel", "setWorkspace", async (x: any) => { plugin.on("filePanel", "setWorkspace", async (x: any) => {
console.log('setWorkspace', x)
if (platform == appPlatformTypes.desktop) { if (platform == appPlatformTypes.desktop) {
const workingDir = await plugin.call('fs', 'getWorkingDir') const workingDir = await plugin.call('fs', 'getWorkingDir')
gitDispatch(setCanUseApp(workingDir? true : false)) gitDispatch(setCanUseApp(workingDir? true : false))
const version = await plugin.call('dgitApi', 'version') const version = await plugin.call('dgitApi', 'version')
console.log(version)
gitDispatch(setVersion(version)) gitDispatch(setVersion(version))
} else { } else {
gitDispatch(setCanUseApp(x && !x.isLocalhost && x.name)) gitDispatch(setCanUseApp(x && !x.isLocalhost && x.name))
@ -144,7 +143,7 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}, 10) }, 10)
}) })
plugin.on('dgitApi', 'commit', async () => { plugin.on('dgitApi', 'commit', async () => {
console.log('commit')
loadFileQueue.enqueue(async () => { loadFileQueue.enqueue(async () => {
loadFiles() loadFiles()
}, 10) }, 10)

Loading…
Cancel
Save