Skip to content

Commit 750a363

Browse files
authored
Merge pull request #499 from intersystems/fix-449
Added link back to IRIS management portal
2 parents 313b11b + e4acf51 commit 750a363

File tree

9 files changed

+132
-22
lines changed

9 files changed

+132
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- Files in uncommitted queue in any namespace warn users when opened except for in VSCode (#370)
1212

13+
### Added
14+
- Added link back to IRIS management portal from Settings, Git WebUI pages (#449)
15+
1316
### Fixed
1417
- Changed prompts in configure from 0/1 to no/yes (#461)
1518
- Added warnings when user is using incompatible git version (#488)
19+
- Fixed the back button navigation between WebUI and Settings page (#361)
1620

1721
## [2.5.0] - 2024-09-24
1822

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
2222
set responseJSON = ..GetPackageVersion()
2323
} elseif $extract(pagePath, 6, *) = "git-version" {
2424
set responseJSON = ..GetGitVersion()
25+
} elseif $extract(pagePath,6,*) = "home"{
26+
set responseJSON = {
27+
"url": (..GetHomeURL())
28+
}
2529
} else {
2630
set %response.Status = ##class(%CSP.REST).#HTTP404NOTFOUND
2731
set responseJSON = {"error":("invalid URI: " _ pagePath)}
@@ -340,4 +344,13 @@ ClassMethod GetGitVersion() As %Library.DynamicObject
340344
quit {"version": (version)}
341345
}
342346

347+
ClassMethod GetHomeURL() As %String
348+
{
349+
set prefix = ""
350+
if $IsObject($Get(%request)) {
351+
set prefix = $Piece(%request.Application,%request.AppMatch)
352+
}
353+
quit prefix_"/csp/sys/UtilHome.csp"
354+
}
355+
343356
}

csp/gitprojectsettings.csp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ body {
4040
#webuiURL {
4141
display: none;
4242
}
43+
#homeURL {
44+
display: none;
45+
}
4346

4447
.custom-switch {
4548
padding: 0.4rem 0.5rem 0 2.75rem;
@@ -73,6 +76,7 @@ body {
7376
set version = ##class(SourceControl.Git.Utils).GetPackageVersion()
7477
set webuiURL = "/isc/studio/usertemplates/gitsourcecontrol/webuidriver.csp/"_namespace_"/?CSPSHARE=1"
7578
set webuiURL = ##class(SourceControl.Git.WebUIDriver).GetURLPrefix(%request, webuiURL)
79+
set homeURL = ##class(SourceControl.Git.WebUIDriver).GetHomeURL()
7680

7781
set settings = ##class(SourceControl.Git.Settings).%New()
7882
if $Data(%request.Data("gitsettings",1)) {
@@ -128,12 +132,17 @@ body {
128132
<input type="hidden" name="gitsettings" value="1" />
129133
<div class="col-sm-12"><br></div>
130134
<div class="row">
131-
<div class="offset-sm-1 col-sm-8">
135+
<div class="offset-sm-1 col-sm-7" id="settingsTitle">
132136
<h1>Git Project Settings</h1>
133137
<h3> Package version: #(version)# </h3>
134138
</div>
135139

136-
<div class="col-sm-2">
140+
<div class="col-sm-4" id="settingsNavBtn">
141+
<button class="btn btn-lg btn-outline-dark" id="goToHome">Home
142+
</button>
143+
<div id="homeURL">
144+
#(homeURL)#
145+
</div>
137146
<button class="btn btn-lg btn-outline-dark" id="goToWebUI">Go to WebUI
138147
</button>
139148
<div id="webuiURL">
@@ -542,6 +551,17 @@ body {
542551
<script src="js/popper.min.js"></script>
543552
<script src="js/bootstrap.min.js"></script>
544553
<script type="text/javascript">
554+
555+
// Removing the home button if not a top-level page
556+
if ((window !== window.parent) || (navigator.userAgent.indexOf('MSIE 7') > -1) || (navigator.userAgent.indexOf(" Code/") > -1)) {
557+
$("#goToHome", self.element).remove();
558+
$("#homeURL", self.element).remove();
559+
$('#settingsTitle').removeClass('col-sm-7');
560+
$('#settingsNavBtn').removeClass('col-sm-4');
561+
$('#settingsTitle').addClass('col-sm-8');
562+
$('#settingsNavBtn').addClass('col-sm-2');
563+
}
564+
545565
function getSocket(urlPostfix) {
546566
var socketURL = window.location.href.replace('http','ws').replace('gitprojectsettings.csp','_zpkg.isc.sc.git.Socket.cls') + "&" + urlPostfix;
547567
return new WebSocket(socketURL);
@@ -633,8 +653,12 @@ $(function()
633653

634654
$(document).on('click', "#goToWebUI", function(e){
635655
e.preventDefault();
636-
console.log($("#webuiURL")[0].innerText);
637-
window.location.replace($("#webuiURL")[0].innerText);
656+
window.location.href = $("#webuiURL")[0].innerText;
657+
})
658+
659+
$(document).on('click', "#goToHome", function(e){
660+
e.preventDefault();
661+
window.location.href = $("#homeURL")[0].innerText;
638662
})
639663
});
640664

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ body {
183183
padding-bottom: 100px;
184184
}
185185
#sidebar #sidebar-content > :first-child,
186-
#sidebar #sidebar-content > :nth-last-child(3) {
186+
#sidebar #sidebar-content > :last-child {
187187
border-top: 1px solid #5e5e5e;
188188
}
189189
#sidebar #sidebar-content h4:before {
@@ -227,7 +227,7 @@ body {
227227
}
228228
#sidebar #sidebar-content #sidebar-vscode {
229229
position: absolute;
230-
bottom: 80px;
230+
bottom: 90px;
231231
width: 16.7em;
232232
background-color: #333333;
233233
}
@@ -239,7 +239,7 @@ body {
239239
}
240240
#sidebar #sidebar-content #sidebar-context {
241241
position: absolute;
242-
bottom: 40px;
242+
bottom: 50px;
243243
width: 16.7em;
244244
background-color: #333333;
245245
}
@@ -251,7 +251,19 @@ body {
251251
}
252252
#sidebar #sidebar-content #sidebar-settings {
253253
position: absolute;
254-
bottom: 0px;
254+
bottom: 10px;
255+
width: 16.7em;
256+
background-color: #333333;
257+
}
258+
#sidebar #sidebar-content #sidebar-home h4 {
259+
padding: 0px;
260+
}
261+
#sidebar #sidebar-content #sidebar-home h4:before {
262+
content: url(../img/home.svg);
263+
}
264+
#sidebar #sidebar-content #sidebar-home {
265+
position: absolute;
266+
bottom: 130px;
255267
width: 16.7em;
256268
background-color: #333333;
257269
}
Lines changed: 3 additions & 0 deletions
Loading

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ $.get("api/settings", function(settingsURL){
6969
webui.settingsURL = url.url;
7070
});
7171

72+
webui.homeURL = "";
73+
$.get("api/home", function(homeURL){
74+
var url = JSON.parse(homeURL);
75+
webui.homeURL = url.url;
76+
});
77+
7278
webui.showSuccess = function(message) {
7379
var messageBox = $("#message-box");
7480
messageBox.empty();
@@ -913,7 +919,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
913919
}
914920

915921
self.goToSettingsPage = function() {
916-
window.location.replace(webui.settingsURL);
922+
window.location.href = webui.settingsURL;
923+
}
924+
925+
self.goToHomePage = function() {
926+
window.location.href = webui.homeURL;
917927
}
918928

919929
self.fetchSection = function(section, title, id, gitCommand) {
@@ -986,14 +996,17 @@ webui.SideBarView = function(mainView, noEventHandlers) {
986996
'<section id="sidebar-tags">' +
987997
'<h4>Tags</h4>' +
988998
'</section>' +
989-
'<section id="sidebar-vscode">' +
990-
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
999+
'<section id="sidebar-settings">' +
1000+
'<h4>Settings</h4>' +
9911001
'</section>' +
9921002
'<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="' + self.currentContext + '">' +
9931003
'<h4>Change Context</h4>' +
9941004
'</section>' +
995-
'<section id="sidebar-settings">' +
996-
'<h4>Settings</h4>' +
1005+
'<section id="sidebar-vscode">' +
1006+
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
1007+
'</section>' +
1008+
'<section id="sidebar-home">' +
1009+
'<h4>Home</h4>' +
9971010
'</section>' +
9981011
'</div>' +
9991012
'</div>')[0];
@@ -1019,8 +1032,13 @@ webui.SideBarView = function(mainView, noEventHandlers) {
10191032
$('.btn-prune-remote-branches', self.element).click(self.pruneRemoteBranches);
10201033
$("#sidebar-settings", self.element).click(self.goToSettingsPage);
10211034
$("#sidebar-context", self.element).click(self.changeContextGet);
1035+
$("#sidebar-home", self.element).click(self.goToHomePage);
10221036
}
10231037

1038+
// Removing the link to home if not a top-level page
1039+
if ((window !== window.parent) || (navigator.userAgent.indexOf('MSIE 7') > -1) || (navigator.userAgent.indexOf(" Code/") > -1)) {
1040+
$("#sidebar-home", self.element).remove();
1041+
}
10241042

10251043
self.getPackageVersion();
10261044
self.fetchSection($("#sidebar-local-branches", self.element)[0], "Local Branches", "local-branches", "branch --verbose --verbose");

git-webui/src/share/git-webui/webui/css/git-webui.less

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ body {
257257
color: @gray-lighter;
258258
padding-bottom: 100px;
259259

260-
> :first-child, >:nth-last-child(3) {
260+
> :first-child, >:last-child {
261261
border-top: 1px solid darken(@separator-line, 50%);
262262
}
263263

@@ -315,7 +315,7 @@ body {
315315

316316
#sidebar-vscode {
317317
position: absolute;
318-
bottom: 80px;
318+
bottom: 90px;
319319
width: 16.7em;
320320
background-color: rgba(51, 51, 51, 1);
321321
}
@@ -330,7 +330,7 @@ body {
330330

331331
#sidebar-context {
332332
position: absolute;
333-
bottom: 40px;
333+
bottom: 50px;
334334
width: 16.7em;
335335
background-color: rgba(51, 51, 51, 1);
336336
}
@@ -345,7 +345,22 @@ body {
345345

346346
#sidebar-settings {
347347
position: absolute;
348-
bottom: 0px;
348+
bottom: 10px;
349+
width: 16.7em;
350+
background-color: rgba(51, 51, 51, 1);
351+
}
352+
353+
#sidebar-home h4 {
354+
padding: 0px;
355+
}
356+
357+
#sidebar-home h4:before {
358+
content: url(../img/home.svg);
359+
}
360+
361+
#sidebar-home {
362+
position: absolute;
363+
bottom: 130px;
349364
width: 16.7em;
350365
background-color: rgba(51, 51, 51, 1);
351366
}
Lines changed: 3 additions & 0 deletions
Loading

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ $.get("api/settings", function(settingsURL){
6969
webui.settingsURL = url.url;
7070
});
7171

72+
webui.homeURL = "";
73+
$.get("api/home", function(homeURL){
74+
var url = JSON.parse(homeURL);
75+
webui.homeURL = url.url;
76+
});
77+
7278
webui.showSuccess = function(message) {
7379
var messageBox = $("#message-box");
7480
messageBox.empty();
@@ -913,7 +919,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
913919
}
914920

915921
self.goToSettingsPage = function() {
916-
window.location.replace(webui.settingsURL);
922+
window.location.href = webui.settingsURL;
923+
}
924+
925+
self.goToHomePage = function() {
926+
window.location.href = webui.homeURL;
917927
}
918928

919929
self.fetchSection = function(section, title, id, gitCommand) {
@@ -986,14 +996,17 @@ webui.SideBarView = function(mainView, noEventHandlers) {
986996
'<section id="sidebar-tags">' +
987997
'<h4>Tags</h4>' +
988998
'</section>' +
989-
'<section id="sidebar-vscode">' +
990-
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
999+
'<section id="sidebar-settings">' +
1000+
'<h4>Settings</h4>' +
9911001
'</section>' +
9921002
'<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="' + self.currentContext + '">' +
9931003
'<h4>Change Context</h4>' +
9941004
'</section>' +
995-
'<section id="sidebar-settings">' +
996-
'<h4>Settings</h4>' +
1005+
'<section id="sidebar-vscode">' +
1006+
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
1007+
'</section>' +
1008+
'<section id="sidebar-home">' +
1009+
'<h4>Home</h4>' +
9971010
'</section>' +
9981011
'</div>' +
9991012
'</div>')[0];
@@ -1019,8 +1032,13 @@ webui.SideBarView = function(mainView, noEventHandlers) {
10191032
$('.btn-prune-remote-branches', self.element).click(self.pruneRemoteBranches);
10201033
$("#sidebar-settings", self.element).click(self.goToSettingsPage);
10211034
$("#sidebar-context", self.element).click(self.changeContextGet);
1035+
$("#sidebar-home", self.element).click(self.goToHomePage);
10221036
}
10231037

1038+
// Removing the link to home if not a top-level page
1039+
if ((window !== window.parent) || (navigator.userAgent.indexOf('MSIE 7') > -1) || (navigator.userAgent.indexOf(" Code/") > -1)) {
1040+
$("#sidebar-home", self.element).remove();
1041+
}
10241042

10251043
self.getPackageVersion();
10261044
self.fetchSection($("#sidebar-local-branches", self.element)[0], "Local Branches", "local-branches", "branch --verbose --verbose");

0 commit comments

Comments
 (0)