Skip to content

Commit

Permalink
reset branch error state (resolves #114)
Browse files Browse the repository at this point in the history
  • Loading branch information
neel1996 committed Dec 2, 2020
1 parent 6a38db4 commit 7347d8d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,11 @@ export default function GitTrackedComponent(props) {
<div
className={`git-tracked--menu-default ${styleSelector}`}
key={item}
onClick={(event) => {
onClick={() => {
setTopMenuItemState(item);
// Resetting branch error in top bar component to prevent the error banner from getting displayed after \
// switching the menu
props.resetBranchError();
}}
>
{item}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export default function RepositoryAction() {
const memoizedGitTracker = useMemo(() => {
if (defaultRepo && defaultRepo.id) {
return (
<GitTrackedComponent repoId={defaultRepo.id}></GitTrackedComponent>
<GitTrackedComponent
repoId={defaultRepo.id}
resetBranchError={() => {
setBranchError(false);
}}
></GitTrackedComponent>
);
}
}, [defaultRepo]);
Expand Down Expand Up @@ -176,7 +181,11 @@ export default function RepositoryAction() {
<select
className="top-pane--select bg-green-100 text-green-700 border-green-400"
defaultValue={"checked"}
onClick={() => {
setBranchError(false);
}}
onChange={(event) => {
setActiveBranch("...");
if (event.currentTarget.value !== defaultRepo.repoName) {
setSelectedRepoDetails({
...selectedRepoDetails,
Expand Down Expand Up @@ -211,18 +220,22 @@ export default function RepositoryAction() {
<div className="flex items-center">
<div className="select--label">Branch</div>
<select
className="top-pane--select bg-indigo-100 border-indigo-400 text-indigo-700 "
value={activeBranch}
defaultChecked={activeBranch}
className="top-pane--select bg-indigo-100 border-indigo-400 text-indigo-700"
disabled={activeBranch ? false : true}
onChange={(event) => {
event.persist();
setActiveBranch("");
setActiveBranch("...");
setTrackingBranch(event.target.value, event);
}}
onClick={() => {
setBranchError(false);
}}
>
<option key={activeBranch} value={activeBranch}>
{activeBranch}
</option>
{availableBranch()}
</select>
</div>
Expand All @@ -249,7 +262,7 @@ export default function RepositoryAction() {
const { gitBranchList } = selectedRepoDetails;

return gitBranchList.map((branch, index) => {
if (branch !== "NO_BRANCH") {
if (branch !== "NO_BRANCH" && branch !== activeBranch) {
return (
<option key={branch} value={branch}>
{branch}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Components/DashBoard/Settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default function Settings(props) {
) : null}

{deleteRepoStatus === "loading" ? (
<div className="cursor-pointer mx-auto my-4 text-center p-3 text-white rounded shadow bg-gray-400 hover:bg-gray-500 text-white text-xl">
<div className="cursor-pointer mx-auto my-4 text-center p-3 rounded shadow bg-gray-400 hover:bg-gray-500 text-white text-xl">
Deletion in progress
</div>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/Components/styles/GitDiffView.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}

.git-diff--files--filename_lg {
font-size: 1.25rem;
font-size: 1rem;
margin-left: 0.5rem;
margin-right: 0.5rem;
border-bottom-width: 1px;
Expand Down

0 comments on commit 7347d8d

Please sign in to comment.