Skip to content

Fix JS bugs in Studio Git WebUI #298

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 1 commit into from
Dec 6, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Pulling add/delete of multiple non-IRIS files no longer causes error (#273)
- Fixed -2 timestamp for some items (#275)
- Reset SourceControlClass during module uninstall to prevent "Class does not exist error" (#285)
- Unreleased bug breaking Git WebUI from Studio (#297)

## [2.2.0] - 2023-06-05

Expand Down
11 changes: 8 additions & 3 deletions git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,14 @@ webui.SideBarView = function(mainView, noEventHandlers) {
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
if (id.indexOf("local-branches") > -1) {
// parses the output of git branch --verbose --verbose
var branchInfo = /^\*?\s*(?<branch_name>[\w-]+)\s+(?<hash>[^\s]+)\s+(?<remote>\[.*\])?.*/.exec(ref).groups;
var matches = /^\*?\s*([\w-]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);
var branchInfo = {
"branch_name": matches[1],
"hash": matches[2],
"remote": matches[3]
}
var refname = branchInfo.branch_name;
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.includes("ahead")) // either no upstream or ahead of upstream
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.indexOf("ahead") > -1) // either no upstream or ahead of upstream
var itemId = refname + idPostfix;
var cardHeader = $('<div class="card-header" id="heading-' + itemId + '">').appendTo(cardDiv);
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-toggle="collapse" data-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
Expand Down Expand Up @@ -656,7 +661,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
e.preventDefault();
var refName = $(this).parent().parent().parent().siblings(
".card-header").children("button").html();
webui.git(`push -u origin ${refName}`, "", self.upToDateHandler)
webui.git('push -u origin '+refName, "", self.upToDateHandler)
}

self.goToSettingsPage = function() {
Expand Down
11 changes: 8 additions & 3 deletions git-webui/src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,14 @@ webui.SideBarView = function(mainView, noEventHandlers) {
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
if (id.indexOf("local-branches") > -1) {
// parses the output of git branch --verbose --verbose
var branchInfo = /^\*?\s*(?<branch_name>[\w-]+)\s+(?<hash>[^\s]+)\s+(?<remote>\[.*\])?.*/.exec(ref).groups;
var matches = /^\*?\s*([\w-]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);
var branchInfo = {
"branch_name": matches[1],
"hash": matches[2],
"remote": matches[3]
}
var refname = branchInfo.branch_name;
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.includes("ahead")) // either no upstream or ahead of upstream
var canPush = (branchInfo.remote === undefined) || (branchInfo.remote.indexOf("ahead") > -1) // either no upstream or ahead of upstream
var itemId = refname + idPostfix;
var cardHeader = $('<div class="card-header" id="heading-' + itemId + '">').appendTo(cardDiv);
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-toggle="collapse" data-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
Expand Down Expand Up @@ -656,7 +661,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
e.preventDefault();
var refName = $(this).parent().parent().parent().siblings(
".card-header").children("button").html();
webui.git(`push -u origin ${refName}`, "", self.upToDateHandler)
webui.git('push -u origin '+refName, "", self.upToDateHandler)
}

self.goToSettingsPage = function() {
Expand Down