Skip to content

Added link back to IRIS management portal #499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [2.5.1] - Unreleased

### Added
- Added link back to IRIS management portal from Settings, Git WebUI pages (#449)

### Fixed
- Changed prompts in configure from 0/1 to no/yes (#461)
- Added warnings when user is using incompatible git version (#488)
- Fixed the back button navigation between WebUI and Settings page (#361)

## [2.5.0] - 2024-09-24

Expand Down
13 changes: 13 additions & 0 deletions cls/SourceControl/Git/WebUIDriver.cls
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ ClassMethod HandleRequest(pagePath As %String, InternalName As %String = "", Out
set responseJSON = ..GetPackageVersion()
} elseif $extract(pagePath, 6, *) = "git-version" {
set responseJSON = ..GetGitVersion()
} elseif $extract(pagePath,6,*) = "home"{
set responseJSON = {
"url": (..GetHomeURL())
}
} else {
set %response.Status = ##class(%CSP.REST).#HTTP404NOTFOUND
set responseJSON = {"error":("invalid URI: " _ pagePath)}
Expand Down Expand Up @@ -340,4 +344,13 @@ ClassMethod GetGitVersion() As %Library.DynamicObject
quit {"version": (version)}
}

ClassMethod GetHomeURL() As %String
{
set prefix = ""
if $IsObject($Get(%request)) {
set prefix = $Piece(%request.Application,%request.AppMatch)
}
quit prefix_"/csp/sys/UtilHome.csp"
}

}
32 changes: 28 additions & 4 deletions csp/gitprojectsettings.csp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ body {
#webuiURL {
display: none;
}
#homeURL {
display: none;
}

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

set settings = ##class(SourceControl.Git.Settings).%New()
if $Data(%request.Data("gitsettings",1)) {
Expand Down Expand Up @@ -128,12 +132,17 @@ body {
<input type="hidden" name="gitsettings" value="1" />
<div class="col-sm-12"><br></div>
<div class="row">
<div class="offset-sm-1 col-sm-8">
<div class="offset-sm-1 col-sm-7" id="settingsTitle">
<h1>Git Project Settings</h1>
<h3> Package version: #(version)# </h3>
</div>

<div class="col-sm-2">
<div class="col-sm-4" id="settingsNavBtn">
<button class="btn btn-lg btn-outline-dark" id="goToHome">Home
</button>
<div id="homeURL">
#(homeURL)#
</div>
<button class="btn btn-lg btn-outline-dark" id="goToWebUI">Go to WebUI
</button>
<div id="webuiURL">
Expand Down Expand Up @@ -542,6 +551,17 @@ body {
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">

// Removing the home button if not a top-level page
if ((window !== window.parent) || (navigator.userAgent.indexOf('MSIE 7') > -1) || (navigator.userAgent.indexOf(" Code/") > -1)) {
$("#goToHome", self.element).remove();
$("#homeURL", self.element).remove();
$('#settingsTitle').removeClass('col-sm-7');
$('#settingsNavBtn').removeClass('col-sm-4');
$('#settingsTitle').addClass('col-sm-8');
$('#settingsNavBtn').addClass('col-sm-2');
}

function getSocket(urlPostfix) {
var socketURL = window.location.href.replace('http','ws').replace('gitprojectsettings.csp','_zpkg.isc.sc.git.Socket.cls') + "&" + urlPostfix;
return new WebSocket(socketURL);
Expand Down Expand Up @@ -633,8 +653,12 @@ $(function()

$(document).on('click', "#goToWebUI", function(e){
e.preventDefault();
console.log($("#webuiURL")[0].innerText);
window.location.replace($("#webuiURL")[0].innerText);
window.location.href = $("#webuiURL")[0].innerText;
})

$(document).on('click', "#goToHome", function(e){
e.preventDefault();
window.location.href = $("#homeURL")[0].innerText;
})
});

Expand Down
20 changes: 16 additions & 4 deletions git-webui/release/share/git-webui/webui/css/git-webui.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ body {
padding-bottom: 100px;
}
#sidebar #sidebar-content > :first-child,
#sidebar #sidebar-content > :nth-last-child(3) {
#sidebar #sidebar-content > :last-child {
border-top: 1px solid #5e5e5e;
}
#sidebar #sidebar-content h4:before {
Expand Down Expand Up @@ -227,7 +227,7 @@ body {
}
#sidebar #sidebar-content #sidebar-vscode {
position: absolute;
bottom: 80px;
bottom: 90px;
width: 16.7em;
background-color: #333333;
}
Expand All @@ -239,7 +239,7 @@ body {
}
#sidebar #sidebar-content #sidebar-context {
position: absolute;
bottom: 40px;
bottom: 50px;
width: 16.7em;
background-color: #333333;
}
Expand All @@ -251,7 +251,19 @@ body {
}
#sidebar #sidebar-content #sidebar-settings {
position: absolute;
bottom: 0px;
bottom: 10px;
width: 16.7em;
background-color: #333333;
}
#sidebar #sidebar-content #sidebar-home h4 {
padding: 0px;
}
#sidebar #sidebar-content #sidebar-home h4:before {
content: url(../img/home.svg);
}
#sidebar #sidebar-content #sidebar-home {
position: absolute;
bottom: 130px;
width: 16.7em;
background-color: #333333;
}
Expand Down
3 changes: 3 additions & 0 deletions git-webui/release/share/git-webui/webui/img/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 23 additions & 5 deletions git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ $.get("api/settings", function(settingsURL){
webui.settingsURL = url.url;
});

webui.homeURL = "";
$.get("api/home", function(homeURL){
var url = JSON.parse(homeURL);
webui.homeURL = url.url;
});

webui.showSuccess = function(message) {
var messageBox = $("#message-box");
messageBox.empty();
Expand Down Expand Up @@ -913,7 +919,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
}

self.goToSettingsPage = function() {
window.location.replace(webui.settingsURL);
window.location.href = webui.settingsURL;
}

self.goToHomePage = function() {
window.location.href = webui.homeURL;
}

self.fetchSection = function(section, title, id, gitCommand) {
Expand Down Expand Up @@ -986,14 +996,17 @@ webui.SideBarView = function(mainView, noEventHandlers) {
'<section id="sidebar-tags">' +
'<h4>Tags</h4>' +
'</section>' +
'<section id="sidebar-vscode">' +
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
'<section id="sidebar-settings">' +
'<h4>Settings</h4>' +
'</section>' +
'<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="' + self.currentContext + '">' +
'<h4>Change Context</h4>' +
'</section>' +
'<section id="sidebar-settings">' +
'<h4>Settings</h4>' +
'<section id="sidebar-vscode">' +
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
'</section>' +
'<section id="sidebar-home">' +
'<h4>Home</h4>' +
'</section>' +
'</div>' +
'</div>')[0];
Expand All @@ -1019,8 +1032,13 @@ webui.SideBarView = function(mainView, noEventHandlers) {
$('.btn-prune-remote-branches', self.element).click(self.pruneRemoteBranches);
$("#sidebar-settings", self.element).click(self.goToSettingsPage);
$("#sidebar-context", self.element).click(self.changeContextGet);
$("#sidebar-home", self.element).click(self.goToHomePage);
}

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

self.getPackageVersion();
self.fetchSection($("#sidebar-local-branches", self.element)[0], "Local Branches", "local-branches", "branch --verbose --verbose");
Expand Down
23 changes: 19 additions & 4 deletions git-webui/src/share/git-webui/webui/css/git-webui.less
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ body {
color: @gray-lighter;
padding-bottom: 100px;

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

Expand Down Expand Up @@ -315,7 +315,7 @@ body {

#sidebar-vscode {
position: absolute;
bottom: 80px;
bottom: 90px;
width: 16.7em;
background-color: rgba(51, 51, 51, 1);
}
Expand All @@ -330,7 +330,7 @@ body {

#sidebar-context {
position: absolute;
bottom: 40px;
bottom: 50px;
width: 16.7em;
background-color: rgba(51, 51, 51, 1);
}
Expand All @@ -345,7 +345,22 @@ body {

#sidebar-settings {
position: absolute;
bottom: 0px;
bottom: 10px;
width: 16.7em;
background-color: rgba(51, 51, 51, 1);
}

#sidebar-home h4 {
padding: 0px;
}

#sidebar-home h4:before {
content: url(../img/home.svg);
}

#sidebar-home {
position: absolute;
bottom: 130px;
width: 16.7em;
background-color: rgba(51, 51, 51, 1);
}
Expand Down
3 changes: 3 additions & 0 deletions git-webui/src/share/git-webui/webui/img/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 23 additions & 5 deletions git-webui/src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ $.get("api/settings", function(settingsURL){
webui.settingsURL = url.url;
});

webui.homeURL = "";
$.get("api/home", function(homeURL){
var url = JSON.parse(homeURL);
webui.homeURL = url.url;
});

webui.showSuccess = function(message) {
var messageBox = $("#message-box");
messageBox.empty();
Expand Down Expand Up @@ -913,7 +919,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
}

self.goToSettingsPage = function() {
window.location.replace(webui.settingsURL);
window.location.href = webui.settingsURL;
}

self.goToHomePage = function() {
window.location.href = webui.homeURL;
}

self.fetchSection = function(section, title, id, gitCommand) {
Expand Down Expand Up @@ -986,14 +996,17 @@ webui.SideBarView = function(mainView, noEventHandlers) {
'<section id="sidebar-tags">' +
'<h4>Tags</h4>' +
'</section>' +
'<section id="sidebar-vscode">' +
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
'<section id="sidebar-settings">' +
'<h4>Settings</h4>' +
'</section>' +
'<section id="sidebar-context" data-toggle="tooltip" data-placement="right" title="' + self.currentContext + '">' +
'<h4>Change Context</h4>' +
'</section>' +
'<section id="sidebar-settings">' +
'<h4>Settings</h4>' +
'<section id="sidebar-vscode">' +
'<h4><a href="vscode-workspace" target="_blank">Code Workspace</a></h4>' +
'</section>' +
'<section id="sidebar-home">' +
'<h4>Home</h4>' +
'</section>' +
'</div>' +
'</div>')[0];
Expand All @@ -1019,8 +1032,13 @@ webui.SideBarView = function(mainView, noEventHandlers) {
$('.btn-prune-remote-branches', self.element).click(self.pruneRemoteBranches);
$("#sidebar-settings", self.element).click(self.goToSettingsPage);
$("#sidebar-context", self.element).click(self.changeContextGet);
$("#sidebar-home", self.element).click(self.goToHomePage);
}

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

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