pull/4791/head
filip mertens 6 months ago
parent d95bfe1797
commit 9c850f7bbe
  1. 14
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  2. 1
      apps/remix-ide/src/app/udapp/run-tab.js
  3. 2
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  4. 8
      libs/remix-ui/git/src/components/buttons/commitmessage.tsx
  5. 2
      libs/remix-ui/git/src/components/buttons/sourceControlBase.tsx
  6. 4
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  7. 2
      libs/remix-ui/git/src/components/github/devicecode.tsx
  8. 2
      libs/remix-ui/git/src/components/github/repositoryselect.tsx
  9. 4
      libs/remix-ui/git/src/components/gitui.tsx
  10. 4
      libs/remix-ui/git/src/components/panels/branches.tsx
  11. 1
      libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
  12. 2
      libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
  13. 1
      libs/remix-ui/git/src/components/panels/commands/merge.tsx
  14. 1
      libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
  15. 1
      libs/remix-ui/git/src/components/panels/commits.tsx
  16. 2
      libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx
  17. 2
      libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx
  18. 1
      libs/remix-ui/git/src/components/panels/githubcredentials.tsx
  19. 4
      libs/remix-ui/git/src/components/panels/remotes.tsx
  20. 6
      libs/remix-ui/git/src/components/panels/remotesimport.tsx
  21. 4
      libs/remix-ui/git/src/components/panels/sourcecontrol/sourcecontrolitem.tsx
  22. 8
      libs/remix-ui/git/src/components/panels/sourcontrol.tsx
  23. 24
      libs/remix-ui/git/src/lib/gitactions.ts
  24. 8
      libs/remix-ui/git/src/lib/listeners.ts
  25. 1
      libs/remix-ui/git/src/lib/pluginActions.ts
  26. 1
      libs/remix-ui/git/src/state/gitreducer.tsx

@ -319,24 +319,24 @@ module.exports = {
// DGIT
'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'dgit')
await clickAndCheckLog(browser, 'dGitProvider:status', [[".prettierrc.json",0,2,0], ["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,0],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
await clickAndCheckLog(browser, 'dgitApi:status', [[".prettierrc.json",0,2,0], ["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,0],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
},
'Should stage contract #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:add', null, null, {
await clickAndCheckLog(browser, 'dgitApi:add', null, null, {
filepath: 'contracts/1_Storage.sol'
})
await clickAndCheckLog(browser, 'dGitProvider:status', [[".prettierrc.json",0,2,0],["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,2],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
await clickAndCheckLog(browser, 'dgitApi:status', [[".prettierrc.json",0,2,0],["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,2],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
},
'Should commit changes #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' })
await clickAndCheckLog(browser, 'dGitProvider:log', 'commit-message', null, null)
await clickAndCheckLog(browser, 'dgitApi:commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' })
await clickAndCheckLog(browser, 'dgitApi:log', 'commit-message', null, null)
},
'Should have git log #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:log', 'commit-message', null, null)
await clickAndCheckLog(browser, 'dgitApi:log', 'commit-message', null, null)
},
'Should have branches #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:branches', [{ name: 'main' }], null, null)
await clickAndCheckLog(browser, 'dgitApi:branches', [{ name: 'main' }], null, null)
},
// resolver
'Should resolve url #group4': async function (browser: NightwatchBrowser) {

@ -161,7 +161,6 @@ export class RunTab extends ViewPlugin {
await addProvider(position, name, displayName, true, false, false)
}
const registerInjectedProvider = async (event) => {
console.log('registerInjectedProvider', event)
const name = 'injected-' + event.detail.info.name
const displayName = 'Injected Provider - ' + event.detail.info.name
await this.engine.register([new InjectedProviderDefault(event.detail.provider, name)])

@ -644,13 +644,11 @@ export const EditorUI = (props: EditorUIProps) => {
}
function handleDiffEditorDidMount(editor: any) {
console.log('diff editor mounted')
diffEditorRef.current = editor
setReducerListener()
}
function handleEditorDidMount(editor) {
console.log('editor mounted')
editorRef.current = editor
defineAndSetTheme(monacoRef.current)
setReducerListener()

@ -24,12 +24,6 @@ export const CommitMessage = () => {
setMessage({ value: e.currentTarget.value })
}
useEffect(() => {
if (context.fileStatusResult) {
console.log(context.staged.length + ' staged')
}
}, [context.fileStatusResult])
const commit = async() => {
if (context.staged.length === 0 && context.allchangesnotstaged.length == 0) return
if (context.staged.length === 0)
@ -92,7 +86,7 @@ export const CommitMessage = () => {
}
const setButtonStateValues = () => {
console.log('setButtonStateValues', context)
if (!commitNotAllowed() || context.allchangesnotstaged.length > 0 || context.staged.length > 0){
if (context.allchangesnotstaged.length == 0 && context.staged.length == 0 && message.value === "" && publishEnabled()){
setButtonState(buttonStateValues.PublishBranch)

@ -32,7 +32,7 @@ export const SourceControlBase = (props: SourceControlButtonsProps) => {
const [commitsBehind, setCommitsBehind] = useState<ReadCommitResult[]>([])
useEffect(() => {
//console.log('BRANCH DIFF SourceControlButtons',branch, remote, context.branchDifferences, context.currentBranch)
setDefaultRemote()
if (remote && branch && context.branchDifferences && context.branchDifferences[`${remote.name}/${branch.name}`]) {
setCommitsAhead(context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueHeadCommits)

@ -16,10 +16,6 @@ export const SourceControlButtons = () => {
const [branch, setBranch] = useState<branch>(syncState.branch)
const [remote, setRemote] = useState<remote>(syncState.remote)
useEffect(() => {
console.log('SC BUTTONS', branch, remote)
}, [])
const getRemote = () => {
return remote ? remote : context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
}

@ -31,7 +31,6 @@ export const GetDeviceCode = () => {
// convert response to json
const githubrespone = await response.data;
console.log('json', githubrespone)
setGitHubResponse(githubrespone)
}
@ -54,7 +53,6 @@ export const GetDeviceCode = () => {
// convert response to json
const response = await accestokenresponse.data;
console.log('json2', response)
if (response.error) {

@ -57,7 +57,7 @@ const RepositorySelect = (props: RepositorySelectProps) => {
setShow(true)
setLoading(true)
setRepoOptions([])
console.log(await actions.repositories())
await actions.repositories()
} catch (e) {
// do nothing
}

@ -66,7 +66,7 @@ export const GitUI = (props: IGitUi) => {
setCallBacks(plugin, gitDispatch, loaderDispatch)
setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true })
//console.log(props)
}, [appLoaded])
useEffect(() => {
@ -76,7 +76,7 @@ export const GitUI = (props: IGitUi) => {
const username = await plugin.call('settings', 'get', 'settings/github-user-name')
const email = await plugin.call('settings', 'get', 'settings/github-email')
const token = await plugin.call('settings', 'get', 'settings/gist-access-token')
//console.log('gitState', gitState, username, email, token)
setSetup(!(username && email))
}
checkconfig()

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

@ -40,7 +40,6 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => {
}
const loadNextPage = () => {
console.log('LOAD NEXT PAGE', lastPageNumber + 1)
actions.getBranchCommits(branch, lastPageNumber + 1)
}

@ -54,7 +54,6 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
}
const loadNextPage = () => {
console.log('LOAD NEXT PAGE', lastPageNumber + 1)
actions.getBranchCommits(branch, lastPageNumber + 1)
}
@ -70,7 +69,6 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
const getCommitChanges = async (commit: ReadCommitResult) => {
const changes = await actions.getCommitChanges(commit.oid, commit.commit.parent[0], branch, branch.remote)
console.log('CHANGES', changes)
if (!changes) {
// try to fetch the data
//await actions.fetch(branch.remote.name, branch.name,null,20, true, false, true)

@ -16,7 +16,6 @@ export const Merge = () => {
}, [context.currentBranch])
const onLocalBranchChange = (value: any) => {
console.log('onLocalBranchChange', value)
setLocalBranch(value)
}

@ -47,7 +47,6 @@ export const PushPull = () => {
}
const push = async () => {
console.log('PUSH', context.upstream, localBranch, remoteBranch, force)
await actions.push({
remote: context.upstream,
ref: {

@ -24,7 +24,6 @@ export const Commits = () => {
};
const loadNextPage = () => {
console.log('LOAD NEXT PAGE', context.commits.length)
//actions.fetch(null, context.currentBranch.name, null, 5, true, true)
actions.fetch({
remote: null,

@ -22,7 +22,6 @@ export const CommitDetails = (props: CommitDetailsProps) => {
useEffect(() => {
if (activePanel === "0") {
console.log(context)
getCommitChanges(commit)
}
}, [activePanel])
@ -41,7 +40,6 @@ export const CommitDetails = (props: CommitDetailsProps) => {
}
const openFileOnRemote = (file: string, hash: string) => {
console.log("open file on remote", file, hash, getRemote() ? `${getRemote().name}/${branch.name}/commit/${hash}/${file}` : "")
if (!getRemote()) return
window.open(`${getRemote() ? `${getRemote().url}/blob/${hash}/${file}` : ""}`, "_blank")
}

@ -17,9 +17,7 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => {
const pluginActions = React.useContext(pluginActionsContext)
const openChanges = async (change: commitChange) => {
console.log("open changes", change);
await actions.diff(change)
console.log("open changes", change);
await pluginActions.openDiff(change)
}

@ -43,7 +43,6 @@ export const GitHubCredentials = () => {
async function refresh() {
const credentials = await pluginactions.getGitHubCredentialsFromLocalStorage()
if (!credentials) return
console.log('credentials', credentials)
setGithubToken(credentials.token || '')
setGithubUsername(credentials.username || '')
setGithubEmail(credentials.email || '')

@ -24,10 +24,6 @@ export const Remotes = () => {
})
}
useEffect(() => {
console.log('SHOW REMOTES', context.remotes)
}, [context.remotes])
return (
<>

@ -37,7 +37,7 @@ export const RemotesImport = () => {
setShow(true)
setLoading(true)
setRepoOptions([])
console.log(await actions.repositories())
await actions.repositories()
} catch (e) {
// do nothing
}
@ -47,10 +47,6 @@ export const RemotesImport = () => {
setRepo(repo)
}
useEffect(() => {
console.log('OTIONS', repoOtions)
},[repoOtions])
const addRemote = async () => {
try {
actions.addRemote({

@ -18,8 +18,6 @@ export const SourceControlItem = (props: SourceControlItemProps) => {
const pluginActions = React.useContext(pluginActionsContext)
async function fileClick(file: fileStatusResult) {
console.log(file)
//let status = fileservice.getFileStatusForFile(file.filename || "");
if (file.statusNames && file.statusNames.indexOf("modified") !== -1) {
const headHash = await actions.resolveRef("HEAD")
const change: commitChange = {
@ -31,8 +29,6 @@ export const SourceControlItem = (props: SourceControlItemProps) => {
}
await actions.diff(change)
await pluginActions.openDiff(change)
console.log("diff", change)
} else {
await pluginActions.openFile(file.filename)
//await client.call('fileManager', 'open', file.filename)

@ -12,21 +12,13 @@ export const SourceControl = () => {
useEffect(() => {
if (context.fileStatusResult) {
console.log(context)
const total = context.allchangesnotstaged.length
const badges = total + context.staged.length
pluginactions.statusChanged(badges)
//console.log("allchangesnotstaged", context.allchangesnotstaged, context.fileStatusResult)
setShow((context.deleted.length > 0 || context.staged.length > 0 || context.untracked.length > 0 || context.modified.length > 0))
}
}, [context.fileStatusResult, context.modified, context.allchangesnotstaged, context.untracked, context.deleted])
useEffect(() => {
if (context.commits) {
console.log("SC commits", context.localCommitCount, context.currentBranch)
}
}, [context.localCommitCount, context.currentBranch])
function RenderGroups() {
const groups: sourceControlGroup[] = [{ name: 'Staged', group: context.staged }, { name: 'Changes', group: context.allchangesnotstaged }]
return (<>

@ -1,18 +1,12 @@
import { ViewPlugin } from "@remixproject/engine-web";
import { ReadBlobResult, ReadCommitResult } from "isomorphic-git";
import React from "react";
import { fileStatus, fileStatusMerge, setRemoteBranchCommits, resetRemoteBranchCommits, setBranches, setCanCommit, setCommitChanges, setCommits, setCurrentBranch, setGitHubUser, setLoading, setRemoteBranches, setRemotes, setRepos, setUpstream, setLocalBranchCommits, setBranchDifferences, setRemoteAsDefault, setScopes, setLog, clearLog, setUserEmails } from "../state/gitpayload";
import { GitHubUser, branch, commitChange, gitActionDispatch, statusMatrixType, gitState, branchDifference, remote, gitLog, fileStatusResult, customGitApi, IGitApi, cloneInputType, fetchInputType, pullInputType, pushInputType, checkoutInput, rmInput, addInput, repository, userEmails } from '../types';
import { removeSlash } from "../utils";
import { disableCallBacks, enableCallBacks } from "./listeners";
import { AlertModal, ModalTypes } from "@remix-ui/app";
import { gitActions, gitActionsContext } from "../state/context";
import { gitPluginContext } from "../components/gitui";
import { ModalTypes } from "@remix-ui/app";
import { setFileDecorators } from "./pluginActions";
import { IDgitSystem, IRemixApi, RemixApi } from "@remixproject/plugin-api";
import { Plugin } from "@remixproject/engine";
import { AnyMxRecord } from "dns";
import { StatusEvents } from "@remixproject/plugin-utils";
import { CustomRemixApi } from "@remix-api";
export const fileStatuses = [
@ -73,12 +67,10 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
fileStatusResult.map((m) => {
statusmatrix.map((sm) => {
if (JSON.stringify(sm.status) === JSON.stringify(m.status)) {
//Utils.log(m, sm);
m.statusNames = sm.matrix;
}
});
});
//console.log(fileStatusResult);
if (!filepaths) {
dispatch(fileStatus(fileStatusResult))
} else {
@ -95,7 +87,7 @@ export const getCommits = async () => {
"log",
{ ref: "HEAD" }
);
console.log('commits :>>', commits)
return commits;
} catch (e) {
return [];
@ -198,7 +190,6 @@ export const commit = async (message: string = "") => {
export const addall = async (files: fileStatusResult[]) => {
try {
console.log('addall', files.map(f => removeSlash(f.filename)))
const filesToAdd = files.map(f => removeSlash(f.filename))
try {
add({ filepath: filesToAdd })
@ -379,7 +370,6 @@ const parseError = async (e: any) => {
cancelLabel: 'Close',
type: ModalTypes.confirm
})
console.log(result)
}
// if message contains 404 Not Found, show repo not found
else if (e.message.includes('404')) {
@ -648,8 +638,6 @@ export const diff = async (commitChange: commitChange) => {
}
export const getCommitChanges = async (oid1: string, oid2: string, branch?: branch, remote?: remote) => {
console.log(oid1, oid2, branch, remote)
try {
let log
try {
@ -700,13 +688,11 @@ async function getRepoDetails(url: string) {
export const fetchBranch = async (branch: branch, page: number) => {
if (!branch.remote || !branch.remote.url) return
const token = await tokenWarning();
console.log('fetch', branch)
if (page == 1) {
dispatch(resetRemoteBranchCommits({ branch }))
}
const { owner, repo } = await getRepoDetails(branch.remote.url);
const rc = await plugin.call('dgitApi', 'remotecommits', { token, owner: owner, repo: repo, branch: branch.name, length, page });
console.log(rc, 'remote commits from octokit')
dispatch(setRemoteBranchCommits({ branch, commits: rc }))
return
}
@ -724,7 +710,7 @@ export const getBranchDifferences = async (branch: branch, remote: remote, state
}
if (!remote) return
try {
console.log('compare', branch, remote)
const branchDifference: branchDifference = await plugin.call('dgitApi', 'compareBranches', {
branch,
remote
@ -737,7 +723,7 @@ export const getBranchDifferences = async (branch: branch, remote: remote, state
branchDifference: branchDifference
}))
} catch (e) {
console.log(e)
// do nothing
}
}
@ -745,12 +731,10 @@ export const getBranchCommits = async (branch: branch, page: number) => {
dispatch(setLoading(true))
await disableCallBacks()
try {
console.log(branch)
if (!branch.remote) {
const commits: ReadCommitResult[] = await plugin.call('dgitApi', 'log', {
ref: branch.name,
})
console.log(commits)
dispatch(setLocalBranchCommits({ branch, commits }))
} else {
await fetchBranch(branch, page)

@ -43,7 +43,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
setPlugin(viewPlugin, gitDispatcher)
plugin.on("fileManager", "fileSaved", async (file: string) => {
//console.log(file)
loadFileQueue.enqueue(async () => {
loadFiles()
})
@ -60,7 +59,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
});
plugin.on("fileManager", "currentFileChanged", async (e) => {
//console.log('current file change', e)
//await synTimerStart();
});
@ -92,7 +90,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
});
plugin.on('dgitApi', 'checkout', async () => {
console.log('checkout callback')
loadFileQueue.enqueue(async () => {
gitlog()
})
@ -129,7 +126,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}))
})
plugin.on('dgitApi', 'branch', async () => {
console.log('branch callback')
loadFileQueue.enqueue(async () => {
gitlog()
})
@ -158,11 +154,9 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
})
plugin.on('config', 'configChanged', async () => {
//console.log('config changed')
await getGitConfig()
})
plugin.on('settings', 'configChanged', async () => {
//console.log('settings changed')
await getGitConfig()
})
@ -183,7 +177,6 @@ export const getGitConfig = async () => {
export const loadFiles = async (filepaths: string[] = null) => {
try {
const branch = await plugin.call('dgitApi', "currentbranch")
//console.log('load files', branch)
if (branch) {
await getFileStatusMatrix(filepaths);
} else {
@ -191,7 +184,6 @@ export const loadFiles = async (filepaths: string[] = null) => {
statusChanged(0)
}
} catch (e) {
// TODO: handle error
console.error(e);
}
}

@ -29,7 +29,6 @@ export const openFile = async (path: string) => {
}
export const openDiff = async (change: commitChange) => {
console.log('openDiff', change)
if (!plugin) return
plugin.call('fileManager', 'diff', change)
}

@ -4,7 +4,6 @@ import { branch, commitChange, defaultGitState, fileStatusResult, gitState, setR
import { Actions } from "./actions"
export const gitReducer = (state: gitState = defaultGitState, action: Actions): gitState => {
///console.log(action, state)
switch (action.type) {
case 'FILE_STATUS':

Loading…
Cancel
Save