parent
32d9abf089
commit
c3db5384c9
@ -1,32 +1,32 @@ |
||||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
||||
import React, { } from "react"; |
||||
import React, { } from "react"; |
||||
import { gitActionsContext, pluginActionsContext } from "../../state/context"; |
||||
import LoaderIndicator from "./loaderindicator"; |
||||
|
||||
export const BranchesNavigation = ({ eventKey, activePanel, callback }) => { |
||||
const pluginactions = React.useContext(pluginActionsContext) |
||||
const context = React.useContext(gitActionsContext) |
||||
export const BranchesNavigation = ({ eventKey, activePanel, callback }) => { |
||||
const pluginactions = React.useContext(pluginActionsContext) |
||||
const context = React.useContext(gitActionsContext) |
||||
|
||||
const handleClick = () => { |
||||
if (!callback) return |
||||
if (activePanel === eventKey) { |
||||
callback('') |
||||
} else { |
||||
callback(eventKey) |
||||
} |
||||
const handleClick = () => { |
||||
if (!callback) return |
||||
if (activePanel === eventKey) { |
||||
callback('') |
||||
} else { |
||||
callback(eventKey) |
||||
} |
||||
return ( |
||||
<> |
||||
<div className={'d-flex justify-content-between pt-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||
<span 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> |
||||
} |
||||
<label className="pl-1 nav form-check-label">BRANCHES</label> |
||||
<LoaderIndicator></LoaderIndicator> |
||||
</span> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
||||
return ( |
||||
<> |
||||
<div className={'d-flex justify-content-between pt-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||
<span 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> |
||||
} |
||||
<label className="pl-1 nav form-check-label">BRANCHES</label> |
||||
<LoaderIndicator></LoaderIndicator> |
||||
</span> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
@ -1,29 +1,29 @@ |
||||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
||||
import React, { } from "react"; |
||||
import React, { } from "react"; |
||||
import { pluginActionsContext } from "../../state/context"; |
||||
|
||||
export const GitHubNavigation = ({ eventKey, activePanel, callback }) => { |
||||
const pluginactions = React.useContext(pluginActionsContext) |
||||
export const GitHubNavigation = ({ eventKey, activePanel, callback }) => { |
||||
const pluginactions = React.useContext(pluginActionsContext) |
||||
|
||||
const handleClick = () => { |
||||
if (!callback) return |
||||
if (activePanel === eventKey) { |
||||
callback('') |
||||
} else { |
||||
callback(eventKey) |
||||
} |
||||
const handleClick = () => { |
||||
if (!callback) return |
||||
if (activePanel === eventKey) { |
||||
callback('') |
||||
} else { |
||||
callback(eventKey) |
||||
} |
||||
return ( |
||||
<> |
||||
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||
<span 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> |
||||
} |
||||
<label className="pl-1 nav form-check-label">GITHUB</label> |
||||
</span> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
||||
return ( |
||||
<> |
||||
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||
<span 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> |
||||
} |
||||
<label className="pl-1 nav form-check-label">GITHUB</label> |
||||
</span> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
@ -1,32 +1,32 @@ |
||||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
||||
import React, { } from "react"; |
||||
import React, { } from "react"; |
||||
import { gitActionsContext, pluginActionsContext } from "../../state/context"; |
||||
import LoaderIndicator from "./loaderindicator"; |
||||
|
||||
export const RemotesNavigation = ({ eventKey, activePanel, callback }) => { |
||||
const pluginactions = React.useContext(pluginActionsContext) |
||||
const context = React.useContext(gitActionsContext) |
||||
export const RemotesNavigation = ({ eventKey, activePanel, callback }) => { |
||||
const pluginactions = React.useContext(pluginActionsContext) |
||||
const context = React.useContext(gitActionsContext) |
||||
|
||||
const handleClick = () => { |
||||
if (!callback) return |
||||
if (activePanel === eventKey) { |
||||
callback('') |
||||
} else { |
||||
callback(eventKey) |
||||
} |
||||
const handleClick = () => { |
||||
if (!callback) return |
||||
if (activePanel === eventKey) { |
||||
callback('') |
||||
} else { |
||||
callback(eventKey) |
||||
} |
||||
return ( |
||||
<> |
||||
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||
<span 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> |
||||
} |
||||
<label className="pl-1 nav form-check-label">REMOTES</label> |
||||
<LoaderIndicator></LoaderIndicator> |
||||
</span> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
||||
return ( |
||||
<> |
||||
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||
<span 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> |
||||
} |
||||
<label className="pl-1 nav form-check-label">REMOTES</label> |
||||
<LoaderIndicator></LoaderIndicator> |
||||
</span> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
@ -1,59 +1,56 @@ |
||||
import { fileStatusResult, gitState } from "../types"; |
||||
|
||||
export const getFilesCountByStatus = (status: string, files: fileStatusResult[]) => { |
||||
let count = 0; |
||||
|
||||
files.map((m) => { |
||||
if (m.statusNames !== undefined) { |
||||
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
||||
count++; |
||||
} |
||||
} |
||||
}); |
||||
return count; |
||||
let count = 0; |
||||
|
||||
files.map((m) => { |
||||
if (m.statusNames !== undefined) { |
||||
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
||||
count++; |
||||
} |
||||
} |
||||
}); |
||||
return count; |
||||
} |
||||
|
||||
export const getFilesByStatus = (status: string, files: fileStatusResult[]): fileStatusResult[] => { |
||||
const result: fileStatusResult[] = [] |
||||
files.map((m) => { |
||||
if (m.statusNames !== undefined) { |
||||
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
||||
result.push(m) |
||||
} |
||||
} |
||||
}); |
||||
return result; |
||||
const result: fileStatusResult[] = [] |
||||
files.map((m) => { |
||||
if (m.statusNames !== undefined) { |
||||
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
||||
result.push(m) |
||||
} |
||||
} |
||||
}); |
||||
return result; |
||||
} |
||||
|
||||
export const getFilesWithNotModifiedStatus = (files: fileStatusResult[]): fileStatusResult[] => { |
||||
const result: fileStatusResult[] = [] |
||||
|
||||
const result: fileStatusResult[] = [] |
||||
|
||||
files.map((m) => { |
||||
files.map((m) => { |
||||
|
||||
|
||||
if (m.statusNames !== undefined) { |
||||
if (m.statusNames && m.statusNames.indexOf("unmodified") === -1) { |
||||
result.push(m) |
||||
} |
||||
} |
||||
}); |
||||
return result; |
||||
if (m.statusNames !== undefined) { |
||||
if (m.statusNames && m.statusNames.indexOf("unmodified") === -1) { |
||||
result.push(m) |
||||
} |
||||
} |
||||
}); |
||||
return result; |
||||
} |
||||
|
||||
export const allChangedButNotStagedFiles = (files: fileStatusResult[]): fileStatusResult[] => { |
||||
let allfiles = getFilesWithNotModifiedStatus(files) |
||||
const staged = getFilesByStatus("staged", files) |
||||
allfiles = allfiles.filter((trackedFile) => { |
||||
return staged.findIndex((stagedFile) => stagedFile.filename === trackedFile.filename) === -1 |
||||
}) |
||||
return allfiles; |
||||
let allfiles = getFilesWithNotModifiedStatus(files) |
||||
const staged = getFilesByStatus("staged", files) |
||||
allfiles = allfiles.filter((trackedFile) => { |
||||
return staged.findIndex((stagedFile) => stagedFile.filename === trackedFile.filename) === -1 |
||||
}) |
||||
return allfiles; |
||||
} |
||||
|
||||
|
||||
export const getFileStatusForFile = (filename: string, files: fileStatusResult[]) => { |
||||
for (let i: number = 0; i < files.length; i++) { |
||||
if (files[i].filename === filename) |
||||
return files[i].statusNames; |
||||
} |
||||
for (let i: number = 0; i < files.length; i++) { |
||||
if (files[i].filename === filename) |
||||
return files[i].statusNames; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue