Skip to content

Commit a846912

Browse files
Creating a new branch, checking out an existing branch and deleting a local branch (#24)
* Merge conflict * Merge conflict * Create testfile.md Test file to make changes to and test git pull functionality * Merge conflict * Update testfile.md Will now test in VS Code and Studio * Adding mappins is possible from the project page * Merge conflict * Create testfile.md Test file to make changes to and test git pull functionality * Merge conflict * Update testfile.md Will now test in VS Code and Studio * Adding mappins is possible from the project page * Changed add button UX * Refactoring * Mappings is a MultiDimensional property * More merge conflicts * Update to latest bootstrap, jquery, popper versions * Fixed UI errors + minimal look * Minor UI updates * Updated buttons * Update to latest bootstrap, jquery, popper versions * Fixed UI errors + minimal look * Minor UI updates * Updated buttons * Minor updates * Merge conflict * Create testfile.md Test file to make changes to and test git pull functionality * Merge conflict * Update testfile.md Will now test in VS Code and Studio * Adding mappins is possible from the project page * Changed add button UX * Refactoring * Mappings is a MultiDimensional property * Update to latest bootstrap, jquery, popper versions * Fixed UI errors + minimal look * Minor UI updates * Updated buttons * Minor updates * Fixed UI errors + minimal look * Minor UI updates * Merge conflicts * Delete testfile.md * Added back the copyright * UI changes to fix either broken things or make it look more it war before * Can create a new branch and switch to a new branch from VS Code and Studio * Removed errant comment * UI for new branch * New branches created using web UI * UI for switching and deleting branches * Merge conflict * Create testfile.md Test file to make changes to and test git pull functionality * Merge conflict * Update testfile.md Will now test in VS Code and Studio * Adding mappins is possible from the project page * Changed add button UX * Refactoring * Mappings is a MultiDimensional property * Fixed UI errors + minimal look * Fixed UI errors + minimal look * Minor UI updates * Changed add button UX * Refactoring * Mappings is a MultiDimensional property * Fixed UI errors + minimal look * Create testfile.md Test file to make changes to and test git pull functionality * Update testfile.md Will now test in VS Code and Studio * Delete testfile.md * UI changes to fix either broken things or make it look more it war before * Can create a new branch and switch to a new branch from VS Code and Studio * Removed errant comment * UI for new branch * New branches created using web UI * UI for switching and deleting branches * Branch checkout and delete now work * No checkout and delete buttons for current branch * Fixing stale code after improper merge * Minor changes * Refresh page button added * Sidebar now updates after changes to branches * Fixed an issue where the error message was not displaying properly because the sidebar reload was overwriting it with a blank message * Minor code cleanup + propagating changes to related files * Changed the name of checked out remote branch back Co-authored-by: Sarmishta Velury <[email protected]> Co-authored-by: isc-tleavitt <[email protected]>
1 parent 9157395 commit a846912

File tree

9 files changed

+446
-78
lines changed

9 files changed

+446
-78
lines changed

cls/SourceControl/Git/Extension.cls

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ XData Menu
2020
<MenuItem Separator="true"/>
2121
<MenuItem Name="%AddToSC" />
2222
<MenuItem Name="%RemoveFromSC"/>
23+
<MenuItem Name="%NewBranch" />
24+
<MenuItem Name="%SwitchBranch" />
2325
<MenuItem Name="%Revert" />
2426
<MenuItem Name="%Commit" />
2527
<MenuItem Separator="true"/>
@@ -86,16 +88,24 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
8688
set DisplayName = "Import All Force"
8789
} elseif $ListFind($ListBuild("%AddToSC","%RemoveFromSC","%Revert","%Commit"),name) {
8890
quit ..OnSourceMenuContextItem(InternalName,name,.Enabled,.DisplayName)
91+
} elseif name = "%RepoStatus" && ##class(Utils).GitBinExists() {
92+
set DisplayName = "Check for modifications"
93+
} elseif name = "%NewBranch" {
94+
set DisplayName = "Create a new branch"
95+
set Enabled = 1
96+
} elseif name = "%SwitchBranch" {
97+
set DisplayName = "Check out an existing branch"
98+
set Enabled = 1
8999
} elseif name = "%Push" {
90100
// TODO: Only display if there are no files checked out by other users
91101
set Enabled = 1
92-
set DisplayName = "Push"
102+
set DisplayName = "Push to remote branch"
93103
} elseif name = "%Fetch" {
94104
set Enabled = 1
95-
set DisplayName = "Fetch"
105+
set DisplayName = "Fetch from remote"
96106
} elseif name = "%Pull" {
97107
set Enabled = 1
98-
set DisplayName = "Pull"
108+
set DisplayName = "Pull changes from remote branch"
99109
} elseif ##class(Utils).IsMenuGitCommand(name) && ##class(Utils).GitBinExists() {
100110
set DisplayName = $case(name,"%StashSave":"Stash save",
101111
"%StashPop":"Stash pop",
@@ -290,4 +300,3 @@ Method GetStatus(InternalName As %String, ByRef IsInSourceControl As %Boolean, B
290300
}
291301

292302
}
293-

cls/SourceControl/Git/Settings.cls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
8080
}
8181

8282
}
83-

cls/SourceControl/Git/Utils.cls

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
140140
($system.Version.GetOS()="Windows") {
141141
write !!,"===Path to git.exe not found: "_..GitBinPath()_"!===",!
142142
}
143-
143+
144144
if (..Type(InternalName) = "csp") && ($Extract(InternalName,1) '= "/") {
145145
set InternalName = "/" _ InternalName
146146
}
147-
147+
148148
if (menuItemName = "%Settings") {
149149
set Action = 2
150150
set Target = "/isc/studio/usertemplates/gitsourcecontrol/gitprojectsettings.csp?NSpace="_$namespace_"&Username="_$username
@@ -180,6 +180,14 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
180180
} elseif (menuItemName = "%Revert") {
181181
set Reload = 1
182182
quit ..Revert(InternalName)
183+
} elseif (menuItemName = "%NewBranch") {
184+
set Target = "Please enter the name of the new branch"
185+
set Action = 7
186+
quit $$$OK
187+
} elseif (menuItemName = "%SwitchBranch") {
188+
set Target = "Please enter the name of the existing branch"
189+
set Action = 7
190+
quit $$$OK
183191
} elseif (menuItemName = "%Commit") {
184192
set Target = "Please enter a commit message"
185193
set Action = 7
@@ -219,6 +227,16 @@ ClassMethod AfterUserAction(Type As %Integer, Name As %String, InternalName As %
219227
do ..Commit(InternalName, Msg)
220228
set Reload = 1
221229
}
230+
} elseif (menuItemName = "%NewBranch") {
231+
if (Answer = 1) {
232+
do ..NewBranch(Msg)
233+
set Reload = 1
234+
}
235+
} elseif (menuItemName = "%SwitchBranch") {
236+
if (Answer = 1) {
237+
do ..SwitchBranch(Msg)
238+
set Reload = 1
239+
}
222240
}
223241
quit $$$OK
224242
}
@@ -233,6 +251,22 @@ ClassMethod Revert(InternalName As %String) As %Status
233251
quit $$$OK
234252
}
235253

254+
ClassMethod NewBranch(newBranchName As %String) As %Status
255+
{
256+
do ..RunGitWithArgs(.errStream, .outStream, "checkout", "-b", newBranchName)
257+
do errStream.OutputToDevice()
258+
do outStream.OutputToDevice()
259+
quit $$$OK
260+
}
261+
262+
ClassMethod SwitchBranch(targetBranchName As %String) As %Status
263+
{
264+
do ..RunGitWithArgs(.errStream, .outStream, "checkout", targetBranchName)
265+
do errStream.OutputToDevice()
266+
do outStream.OutputToDevice()
267+
quit $$$OK
268+
}
269+
236270
ClassMethod Commit(InternalName As %String, Message As %String = "example commit message") As %Status
237271
{
238272
set filename = ..FullExternalName(InternalName)
@@ -1322,4 +1356,3 @@ ClassMethod OutputConfigureMessage()
13221356
}
13231357

13241358
}
1325-

csp/gitprojectsettings.csp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ body {
3636
hr {
3737
opacity: 0.15
3838
}
39-
4039
</STYLE>
4140
</head>
4241
<body>
@@ -192,7 +191,6 @@ hr {
192191
<script src="js/jquery.min.js"></script>
193192
<script src="js/popper.min.js"></script>
194193
<script src="js/bootstrap.min.js"></script>
195-
<script src="js/git-webui.js"></script>
196194
<script language="JavaScript">
197195
$(function () {
198196
$('[data-toggle="tooltip"]').tooltip()

git-webui/release/share/git-webui/webui/css/git-webui.css

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ body {
5757
min-width: 0;
5858
flex-direction: column;
5959
-webkit-flex-direction: column;
60-
width: 14em;
60+
padding: 0 0.5% 0 0.5%;
61+
width: 17em;
6162
background-color: #333333;
6263
}
6364
#sidebar #sidebar-logo {
@@ -94,14 +95,46 @@ body {
9495
cursor: pointer;
9596
padding: 10px 0;
9697
}
98+
#sidebar-switch-branches > h4 a {
99+
color: inherit;
100+
}
101+
102+
.accordion-item {
103+
background-color: #333333;
104+
color: #eeeeee;
105+
padding-bottom:1%;
106+
margin: 0%;
107+
border: none;
108+
}
109+
110+
.accordion-header {
111+
padding: 1% 2% 0% 14%;
112+
background-color: #333333;
113+
color: #eeeeee;
114+
border:none;
115+
}
116+
117+
.btn-branch {
118+
background-color: #333333;
119+
color: #eee;
120+
padding: 0%;
121+
margin: 0%;
122+
border: none;
123+
}
124+
125+
.btn-branch:hover {
126+
color: #fff;
127+
}
128+
97129
#sidebar #sidebar-content #sidebar-workspace h4:before {
98130
content: url(../img/computer.svg);
99131
}
100132
#sidebar #sidebar-content #sidebar-remote h4:before {
101133
content: url(../img/daemon.svg);
102134
}
103135
#sidebar #sidebar-content #sidebar-local-branches h4:before,
104-
#sidebar #sidebar-content #sidebar-remote-branches h4:before {
136+
#sidebar #sidebar-content #sidebar-remote-branches h4:before,
137+
#sidebar #sidebar-content #sidebar-switch-branches h4:before {
105138
content: url(../img/branch.svg);
106139
}
107140
#sidebar #sidebar-content #sidebar-tags h4:before {
@@ -123,11 +156,57 @@ body {
123156
text-overflow: ellipsis;
124157
}
125158
#sidebar #sidebar-content .active {
126-
background-color: #428bca;
127-
}
128-
#sidebar .modal-dialog .list-group-item {
129-
border: 0;
159+
background-color: #0d6efd;
130160
}
161+
#newBranchName {
162+
background-color: inherit;
163+
max-width: 12em;
164+
color: inherit;
165+
overflow: hidden;
166+
margin: 0 3% 0 12%
167+
}
168+
169+
.form-control-xs {
170+
height: calc(1em + .375rem + 2px) !important;
171+
padding: .125rem .25rem !important;
172+
font-size: .75rem !important;
173+
line-height: 1.5;
174+
border-radius: .2rem;
175+
}
176+
177+
.btn-refresh {
178+
color: #B39D5C;
179+
background-color: #fff3cd;
180+
border: solid 1px;
181+
border-color: #B39D5C;
182+
margin-left: 0.5%;
183+
}
184+
185+
.btn-xxs {
186+
height: calc(1.2em + .175rem + 2px) !important;
187+
padding: .2rem .1rem !important;
188+
font-size: .7rem !important;
189+
line-height: 1;
190+
border-radius: .2rem;
191+
}
192+
193+
.btn-xs {
194+
height: calc(1.5em + .375rem + 2px) !important;
195+
padding: .125rem .25rem !important;
196+
font-size: .75rem !important;
197+
line-height: 1.5;
198+
border-radius: .2rem;
199+
}
200+
201+
.btn-add {
202+
padding: 0% 0% 2% 5%;
203+
}
204+
205+
.btn-ok {
206+
float: right;
207+
margin-top:-3%
208+
}
209+
131210
#main-view {
132211
display: flex;
133212
display: -webkit-flex;
@@ -185,7 +264,7 @@ body {
185264
background-color: rgba(244, 244, 244, 0.9);
186265
}
187266
#log-view .log-entry.active {
188-
background-color: rgba(46, 127, 197, 0.9);
267+
background-color: rgba(2, 82, 202, 0.9);
189268
}
190269
#log-view .log-entry.active header h6 a {
191270
color: #ffffff;
@@ -293,6 +372,9 @@ body {
293372
border-right: 0;
294373
white-space: nowrap;
295374
}
375+
.list-group-item{
376+
border-radius: 0;
377+
}
296378
.diff-view-container {
297379
display: flex;
298380
display: -webkit-flex;
@@ -367,7 +449,7 @@ body {
367449
border: 0;
368450
}
369451
.diff-view-container .panel-body .diff-view .diff-view-lines .diff-view-line.active {
370-
background-color: #428bca;
452+
background-color: #0d6efd;
371453
color: white;
372454
}
373455
.diff-view-container .panel-body .diff-view .diff-view-lines .diff-line-header {
@@ -565,6 +647,7 @@ body {
565647
padding: 5px 10px;
566648
border-left: 0;
567649
border-right: 0;
650+
border-radius: 0;
568651
white-space: nowrap;
569652
}
570653
#workspace-view #workspace-editor #working-copy-view .file-list-container .list-group .list-group-item.available,

git-webui/release/share/git-webui/webui/index.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
<link rel="icon" href="img/git-icon.png" />
2929
</head>
3030
<body>
31-
<script src="js/jquery.min.js"></script>
32-
<script src="js/popper.min.js"></script>
33-
<script src="js/bootstrap.min.js"></script>
34-
<script src="js/git-webui.js"></script>
35-
3631
<!-- Error modal dialog -->
3732
<div class="modal fade" id="error-modal" tabindex="-1" role="dialog">
3833
<div class="modal-dialog">
3934
<div class="modal-content">
4035
<div class="modal-header">
41-
<button type="button" class="close" data-dismiss="modal"><span>&times;</span><span class="sr-only">Close</span></button>
4236
<h4 class="modal-title">Error</h4>
37+
<button type="button" class="btn btn-default close" data-bs-dismiss="modal">
38+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
39+
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.854 2.146a.5.5 0 0 1 0 .708l-11 11a.5.5 0 0 1-.708-.708l11-11a.5.5 0 0 1 .708 0Z" fill="#000"/>
40+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.146 2.146a.5.5 0 0 0 0 .708l11 11a.5.5 0 0 0 .708-.708l-11-11a.5.5 0 0 0-.708 0Z" fill="#000"/>
41+
</svg>
42+
</button>
4343
</div>
4444
<pre class="modal-body alert alert-danger"></pre>
4545
</div>
@@ -80,4 +80,8 @@ <h4>License</h4>
8080
</div>
8181
</div>
8282
</body>
83+
<script src="js/jquery.min.js"></script>
84+
<script src="js/popper.min.js"></script>
85+
<script src="js/bootstrap.min.js"></script>
86+
<script src="js/git-webui.js"></script>
8387
</html>

0 commit comments

Comments
 (0)