pull/4791/head
Your Name 5 months ago
parent 087dd2c262
commit 97802c9a63
  1. 27
      apps/remix-ide-e2e/src/tests/dgit_local.test.ts
  2. 15
      apps/remix-ide/src/app/files/dgitProvider.ts
  3. 4
      libs/remix-api/src/lib/plugins/notification-api.ts
  4. 2
      libs/remix-ui/git/src/components/navigation/clone.tsx
  5. 4
      libs/remix-ui/git/src/components/panels/clone.tsx
  6. 8
      libs/remix-ui/git/src/components/panels/githubcredentials.tsx
  7. 2
      libs/remix-ui/git/src/components/panels/init.tsx
  8. 8
      libs/remix-ui/git/src/lib/gitactions.ts

@ -22,15 +22,36 @@ module.exports = {
done()
})
},
'clone a repository': function (browser) {
console.log('cloning')
'Update settings for git': function (browser) {
browser.
clickLaunchIcon('dgit')
.waitForElementVisible('*[data-id="initgit-btn"]')
.click('*[data-id="initgit-btn"]')
.setValue('*[data-id="gitubUsername"]', 'git')
.setValue('*[data-id="githubEmail"]', 'git@example.com')
.click('*[data-id="saveGitHubCredentials"]')
.modalFooterOKClick('github-credentials-error')
.pause(2000)
},
'clone a repo': function (browser) {
browser
.waitForElementVisible('*[data-id="clone-panel"]')
.click('*[data-id="clone-panel"]')
.waitForElementVisible('*[data-id="clone-url"]')
.setValue('*[data-id="clone-url"]', 'http://localhost:6868/bare.git')
.waitForElementVisible('*[data-id="clone-btn"]')
.click('*[data-id="clone-btn"]')
.clickLaunchIcon('filePanel')
.waitForElementVisible('*[data-id="treeViewDivtreeViewItem.git"]')
.addFile('test.txt')
.pause(10000)
}
}
async function spawnGitServer(path: string): Promise<ChildProcess> {
console.log(process.cwd())
try {
const server = spawn('yarn && npx ts-node server.ts', [`${path}`], { cwd: process.cwd() + '/apps/remix-ide-e2e/src/githttpbackend/', shell: true, detached: true })
const server = spawn('yarn && sh setup.sh && npx ts-node server.ts', [`${path}`], { cwd: process.cwd() + '/apps/remix-ide-e2e/src/githttpbackend/', shell: true, detached: true })
console.log('spawned', server.stdout.closed, server.stderr.closed)
return new Promise((resolve, reject) => {
server.stdout.on('data', function (data) {

@ -89,7 +89,7 @@ class DGitProvider extends Plugin {
async addIsomorphicGitConfig(input) {
const token = await this.call('config' as any, 'getAppParameter', 'settings/gist-access-token')
let config = {
corsProxy: 'https://corsproxy.remixproject.org/',
http,
@ -102,7 +102,7 @@ class DGitProvider extends Plugin {
return auth
}
}
if(input.url) {
if (input.url) {
const url = new URL(input.url)
if (url.hostname.includes('localhost')) {
@ -112,7 +112,7 @@ class DGitProvider extends Plugin {
}
}
}
if((input.remote && input.remote.url)) {
if ((input.remote && input.remote.url)) {
const url = new URL(input.remote.url)
if (url.hostname.includes('localhost')) {
@ -123,14 +123,14 @@ class DGitProvider extends Plugin {
}
}
if(input.provider && input.provider === 'github') {
if (input.provider && input.provider === 'github') {
config = {
...config,
corsProxy: 'https://corsproxy.remixproject.org/',
}
}
if(input.provider && input.provider === 'localhost') {
if (input.provider && input.provider === 'localhost') {
config = {
...config,
corsProxy: null
@ -339,12 +339,11 @@ class DGitProvider extends Plugin {
}
async getCommitChanges(commitHash1: string, commitHash2: string): Promise<commitChange[]> {
const result: commitChange[] = await git.walk({
const result: commitChange[] = await git.walk({
...await this.addIsomorphicGitConfigFS(),
trees: [git.TREE({ ref: commitHash1 }), git.TREE({ ref: commitHash2 })],
map: async function (filepath, [A, B]) {
if (filepath === '.') {
return
}
@ -366,7 +365,6 @@ class DGitProvider extends Plugin {
path: filepath,
}
// determine modification type
if (Aoid !== Boid) {
commitChange.type = "modified"
@ -1029,7 +1027,6 @@ class DGitProvider extends Plugin {
async remotebranches(input: { owner: string, repo: string, token: string, page: number, per_page: number }) {
const octokit = new Octokit({
auth: input.token
})

@ -9,10 +9,12 @@ export interface INotificationApi {
toast(key: string): Promise<void>,
alert({
title,
message
message,
id
}:{
title: string,
message: string,
id: string
}): Promise<void>,
modal({
title,

@ -16,7 +16,7 @@ export const CloneNavigation = ({ eventKey, activePanel, callback }) => {
return (
<>
<div className={'d-flex justify-content-between pb-1 pt-1 ' + (activePanel === eventKey? 'bg-light': '')}>
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'>
<span data-id='clone-panel' onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'>
{
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon>
}

@ -65,11 +65,11 @@ export const Clone = () => {
return (
<>
<InputGroup className="mb-1">
<FormControl id="cloneulr" placeholder="url" name='cloneurl' value={cloneUrl} onChange={e => onGitHubCloneUrlChange(e.target.value)} aria-describedby="urlprepend" />
<FormControl data-id="clone-url" id="cloneulr" placeholder="url" name='cloneurl' value={cloneUrl} onChange={e => onGitHubCloneUrlChange(e.target.value)} aria-describedby="urlprepend" />
</InputGroup>
<input name='clonebranch' onChange={e => onCloneBranchChange(e.target.value)} value={cloneBranch} className="form-control mb-1 mt-2" placeholder="branch" type="text" id="clonebranch" />
<GitUIButton disabledCondition={!cloneUrl} data-id='clonebtn' className='btn btn-primary mt-1 w-100' onClick={async () => {
<GitUIButton disabledCondition={!cloneUrl} data-id='clone-btn' className='btn btn-primary mt-1 w-100' onClick={async () => {
clone()
}}>clone</GitUIButton>
<hr />

@ -68,15 +68,15 @@ export const GitHubCredentials = () => {
return (
<>
<div className="input-group text-secondary mb-1 h6">
<input type="password" value={githubToken} placeholder="GitHub token" className="form-control" name='githubToken' onChange={e => handleChangeTokenState(e.target.value)} />
<input data-id='githubToken' type="password" value={githubToken} placeholder="GitHub token" className="form-control" name='githubToken' onChange={e => handleChangeTokenState(e.target.value)} />
<div className="input-group-append">
<CopyToClipboard content={githubToken} data-id='copyToClipboardCopyIcon' className='far fa-copy ml-1 p-2 mt-1' direction={"top"} />
</div>
</div>
<input name='githubUsername' onChange={e => handleChangeUserNameState(e.target.value)} value={githubUsername} className="form-control mb-1" placeholder="Git username" type="text" id="githubUsername" />
<input name='githubEmail' onChange={e => handleChangeEmailState(e.target.value)} value={githubEmail} className="form-control mb-1" placeholder="Git email" type="text" id="githubEmail" />
<input data-id='gitubUsername' name='githubUsername' onChange={e => handleChangeUserNameState(e.target.value)} value={githubUsername} className="form-control mb-1" placeholder="Git username" type="text" id="githubUsername" />
<input data-id='githubEmail' name='githubEmail' onChange={e => handleChangeEmailState(e.target.value)} value={githubEmail} className="form-control mb-1" placeholder="Git email" type="text" id="githubEmail" />
<div className="d-flex justify-content-between">
<button className="btn btn-primary w-100" onClick={saveGithubToken}>
<button data-id='saveGitHubCredentials' className="btn btn-primary w-100" onClick={saveGithubToken}>
<FormattedMessage id="save" defaultMessage="Save" />
</button>
<button className="btn btn-danger far fa-trash-alt" onClick={removeToken}>

@ -20,7 +20,7 @@ export const Init = () => {
<GitUIButton
onClick={init}
className="btn w-md-25 w-100 btn-primary"
id="initgit-btn"
data-id="initgit-btn"
><FormattedMessage id='git.init'/></GitUIButton>
</div>
</div>

@ -438,6 +438,7 @@ export const repositories = async () => {
} else {
plugin.call('notification', 'alert', {
id: 'github-token-error',
title: 'Error getting repositories',
message: `Please check your GitHub token in the GitHub settings... cannot connect to GitHub`
})
@ -446,6 +447,7 @@ export const repositories = async () => {
} catch (e) {
console.log(e)
plugin.call('notification', 'alert', {
id: 'github-token-error',
title: 'Error getting repositories',
message: `${e.message}: Please check your GitHub token in the GitHub settings.`
})
@ -474,6 +476,7 @@ export const remoteBranches = async (owner: string, repo: string) => {
} else {
plugin.call('notification', 'alert', {
title: 'Error getting branches',
id: 'github-token-error',
message: `Please check your GitHub token in the GitHub settings. It needs to have access to the branches.`
})
dispatch(setRemoteBranches([]))
@ -482,6 +485,7 @@ export const remoteBranches = async (owner: string, repo: string) => {
console.log(e)
plugin.call('notification', 'alert', {
title: 'Error',
id: 'github-error',
message: e.message
})
dispatch(setRemoteBranches([]))
@ -530,8 +534,9 @@ export const saveGitHubCredentials = async (credentials: { username: string, ema
const userFetched = await loadGitHubUserFromToken()
if (!userFetched) {
if (credentials.username && credentials.email) {
await plugin.call('notification', 'alert', {
await plugin.call('notification', 'alert' , {
title: 'Error',
id: 'github-credentials-error',
message: `Could not retreive the user from GitHub. You can continue to use the app, but you will not be able to push or pull.`
})
}
@ -570,6 +575,7 @@ export const getGitHubCredentialsFromLocalStorage = async () => {
export const showAlert = async ({ title, message }: { title: string, message: string }) => {
await plugin.call('notification', 'alert', {
id: 'github-alert',
title: title,
message: message
})

Loading…
Cancel
Save