Skip to content

Workspace UI revamp #395

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 34 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5ee6e26
started ui revamp
isc-hwojnick Jun 18, 2024
999a4b6
saving before checking out another branch
isc-hwojnick Jun 24, 2024
d57b753
changes to commit area ui
isc-hwojnick Jun 25, 2024
8abb7fe
added file area buttons
isc-hwojnick Jun 25, 2024
f957ab3
changed div to button
isc-hwojnick Jun 25, 2024
e2adde2
should I just be stashing?
isc-hwojnick Jun 25, 2024
b5982da
.
isc-hwojnick Jun 27, 2024
5d37a75
massive progress made to ui
isc-hwojnick Jun 28, 2024
0836ea0
mostly finished ui revamp
isc-hwojnick Jul 1, 2024
ab89a30
started ui revamp
isc-hwojnick Jun 18, 2024
e43462e
saving before checking out another branch
isc-hwojnick Jun 24, 2024
9ce2f4a
changes to commit area ui
isc-hwojnick Jun 25, 2024
1a780f4
added file area buttons
isc-hwojnick Jun 25, 2024
7ff8a00
changed div to button
isc-hwojnick Jun 25, 2024
db3fc63
should I just be stashing?
isc-hwojnick Jun 25, 2024
47a02c3
massive progress made to ui
isc-hwojnick Jun 28, 2024
af3588f
mostly finished ui revamp
isc-hwojnick Jul 1, 2024
4b99792
Merge branch 'ui-revamp' of https://github.com/intersystems/git-sourc…
isc-hwojnick Jul 1, 2024
9d912b3
git ui revamp ready for release
isc-hwojnick Jul 1, 2024
157d198
working on modal to confirm action to other user change
isc-hwojnick Jul 2, 2024
97bf8fb
Merge branch 'main' into ui-revamp
isc-tleavitt Jul 2, 2024
43a11e1
Merge branch 'main' into ui-revamp
isc-hwojnick Jul 2, 2024
97a0155
now works with other user's uncommitted changes
isc-hwojnick Jul 3, 2024
2811ffa
Merge branch 'ui-revamp' of https://github.com/intersystems/git-sourc…
isc-tleavitt Jul 5, 2024
bcaaf95
style: clean up some spurious diffs
isc-tleavitt Jul 5, 2024
0f6da51
Update CHANGELOG.md
isc-tleavitt Jul 5, 2024
e2cf1c9
Merge branch 'main' into ui-revamp
isc-tleavitt Jul 5, 2024
acddd30
feat: sync on restore/stash as well
isc-tleavitt Jul 5, 2024
9e1c5ff
fix: reword a few things in Settings
isc-tleavitt Jul 5, 2024
1fad7a5
feat: sync works for web stash operations, discard
isc-tleavitt Jul 5, 2024
6719fdc
feat: smarter sync with stash ops
isc-tleavitt Jul 5, 2024
6ebaef1
Fixed issue highlighting file to diff in workspace view
isc-pbarton Jul 5, 2024
30981af
fix: cover top-level stash command too
isc-tleavitt Jul 8, 2024
7af6399
Merge branch 'ui-revamp' of https://github.com/intersystems/git-sourc…
isc-tleavitt Jul 8, 2024
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 @@ -21,12 +21,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 'New Branch' menu option in basic now will create new branches from the configured default merge branch (#366)
- Merging back with the default merge branch is now a part of the basic mode's Sync flow (#366)
- Added a new option "compileOnImport". If true, Import options will compile files using the pull event handler. (#362)
- Git web UI overhauled for better UX selecting files to commit/stash/discard (#346)
- Git web UI supports discarding some/all changes (#395)

### Fixed
- Modifications to local repo files are now synced with IRIS (#153)
- Menu items names are properly translated from internal name in VSCode, Management Portal (#372)
- Now has proper locking behavior in `##class(SourceControl.Git.WebUIDriver).HandleRequest()`(#385)
- Git operations from the WebUI now don't unlock the session if they aren't read-only
- WebUI works properly for users with %Developer without needing to add further SQL privileges (#365, #358)
- Uncommitted deletes are shown in WebUI (#395)
- Syncing only prompts users for a commit message if there are uncommitted files (#390)
- WebUI works properly for users with %Developer without needing to add further SQL privileges (#365)
- Fixed `<UNDEFINED>` error running Import All (#380)
Expand Down
6 changes: 3 additions & 3 deletions cls/SourceControl/Git/Settings.cls
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Property gitUserName As %String(MAXLEN = 255) [ InitialExpression = {##class(Sou
/// Attribution: Email address for user ${username}
Property gitUserEmail As %String(MAXLEN = 255) [ InitialExpression = {##class(SourceControl.Git.Utils).GitUserEmail()} ];

/// Attribution: Whether mapped items should be read-only, preventing them from being added to source control
/// Whether mapped items should be read-only, preventing them from being added to source control
Property mappedItemsReadOnly As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).MappedItemsReadOnly()} ];

/// Whether basic mode should be enabled for user ${username}, greatly simplifying the functionality of the package, requiring no knowledge of git
Expand All @@ -41,10 +41,10 @@ Property userBasicMode As %String [ InitialExpression = {##class(SourceControl.G
/// The system's default mode. If true, the system defaults to basic mode
Property systemBasicMode As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).SystemBasicMode()} ];

/// In Basic mode, Sync will merge changes from this remote branch
/// Branch from which Sync will merge changes, in basic mode
Property defaultMergeBranch As %String [ InitialExpression = {##class(SourceControl.Git.Utils).DefaultMergeBranch()} ];

/// Import All options compile imported options using the configured pull event handler
/// Compile using the configured pull event handler when "Import All" is run
Property compileOnImport As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).CompileOnImport()} ];

Property Mappings [ MultiDimensional ];
Expand Down
104 changes: 88 additions & 16 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1602,9 +1602,10 @@ ClassMethod RunGitCommand(command As %String, Output errStream, Output outStream
ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", Output errStream, Output outStream, args...) As %Integer
{
// Special case: git --version is used internally even when the settings incorporated here may be invalid/unspecified.
set tempFolder = ..TempFolder()
if (command '= "--version") {
set newArgs($increment(newArgs)) = "-C"
set newArgs($increment(newArgs)) = ..TempFolder()
set newArgs($increment(newArgs)) = tempFolder

set privateKeyFile = ..PrivateKeyFile()
if (privateKeyFile '= "") {
Expand Down Expand Up @@ -1632,34 +1633,90 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
set syncIrisWithCommand = 0 // // whether IRIS needs to be synced with repo file changes using command output
set diffBase = ""
set diffCompare = ""
set invert = 0
set whichStash = ""

if (command = "checkout"){
// Find / build file list
set hasFileList = 0
for i=1:1:$get(args) {
if $data(args(i),arg)#2 {
if hasFileList {
if arg [ tempFolder {
set relativeFile = $Piece(arg,tempFolder,2)
} else {
set relativeFile = arg
}
if (relativeFile '= "") {
set filterToFiles(relativeFile) = ""
}
} elseif arg = "--" {
set hasFileList = 1
}
}
}

if (command = "checkout") {
set syncIrisWithDiff = 1
if $data(args) && $data(args(args),diffCompare) {
if hasFileList {
set invert = 1
} elseif $data(args) && $data(args(args),diffCompare) {
// no-op
}
} elseif (command = "merge") || (command = "rebase") || (command = "pull"){
} elseif (command = "restore") {
// Leave diffCompare empty, this actually does the right thing.
set syncIrisWithDiff = 1
} elseif (command = "merge") || (command = "rebase") || (command = "pull") {
set syncIrisWithCommand = 1
if $data(args) && $data(args(args),diffCompare) {
// no-op
}
} elseif (command = "stash") {
set subcommand = $Get(args(1))
set whichStash = $Get(args(2))
if subcommand = "push" {
set syncIrisWithDiff = 1
set diffCompare = ""
set invert = 1
} elseif (subcommand = "pop") || (subcommand = "apply") {
set syncIrisWithDiff = 1
set diffCompare = whichStash
}
}

// WebUI prefixes with "color.ui=true" so we need to grab the command
// from later in the args... array
for i=1:1:$get(args) {
if ($data(args(i))) {
set newArgs($increment(newArgs)) = args(i)
if (args(i) = "checkout") {
set syncIrisWithDiff = 1
set diffCompare = args(i + 1)

if args = (i + 2) {
set diffBase = args(i + 2)
if hasFileList {
set invert = 1
} else {
set diffCompare = args(i + 1)
if args = (i + 2) {
set diffBase = args(i + 2)
}
}
} elseif (args(i) = "restore") {
set syncIrisWithDiff = 1
set diffCompare = ""
set invert = 1
} elseif (args(i) = "stash") {
set subcommand = $Get(args(i + 1))
set whichStash = $Get(args(i + 2))
if subcommand = "push" {
set syncIrisWithDiff = 1
set diffCompare = ""
set invert = 1
} elseif (subcommand = "pop") || (subcommand = "apply") {
set syncIrisWithDiff = 1
set diffCompare = whichStash
}
} elseif (args(i) = "merge") || (args(i) = "rebase") || (args(i) = "pull") {
set syncIrisWithCommand = 1
set diffCompare = args(i + 1)
}

}
}

Expand All @@ -1672,6 +1729,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
if diffBase = "" {
set diffBase = ..GetCurrentBranch()
}

do ..RunGitCommand("fetch", .errorStream, .outputStream)
kill errorStream, outputStream
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("diff",,.errorStream,.outputStream, diffBase_$Case(diffCompare,"":"",:"..")_diffCompare, "--name-status")
Expand Down Expand Up @@ -1707,7 +1765,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O

if syncIrisWithDiff {
do ..PrintStreams(errStream, outStream)
$$$ThrowOnError(..SyncIrisWithRepoThroughDiff(.files))
$$$ThrowOnError(..SyncIrisWithRepoThroughDiff(.files, .filterToFiles, invert))
} elseif syncIrisWithCommand {
do ..PrintStreams(errStream, outStream)
$$$ThrowOnError(..SyncIrisWithRepoThroughCommand(.outStream))
Expand Down Expand Up @@ -1772,10 +1830,8 @@ ClassMethod ParseDiffStream(stream As %Stream.Object, verbose As %Boolean = 1, O
set modification.changeType = "A"
set modification.internalName = ""
set modification.externalName = $zstrip($piece(file, $c(9), 3),"<W")
} elseif (modification.changeType '= "A"){
set modification.internalName = ##class(SourceControl.Git.Utils).NameToInternalName(modification.externalName,,0)
} else {
set modification.internalName = ""
set modification.internalName = ##class(SourceControl.Git.Utils).NameToInternalName(modification.externalName,,0)
}
set files($increment(files)) = modification
if verbose {
Expand All @@ -1784,18 +1840,34 @@ ClassMethod ParseDiffStream(stream As %Stream.Object, verbose As %Boolean = 1, O
}
}

ClassMethod SyncIrisWithRepoThroughDiff(ByRef files) As %Status
ClassMethod SyncIrisWithRepoThroughDiff(ByRef files, ByRef filterToFiles, invert As %Boolean = 0) As %Status
{
if invert {
// Change A <-> D
set key = ""
for {
set key = $order(files(key),1,modification)
quit:key=""
if '$data(filterToFiles(modification.externalName)) {
continue
}
set modification.changeType = $translate(modification.changeType,"DA","AD")
set realFiles($increment(realFiles)) = modification
}
kill files
merge files = realFiles
}

set key = $order(files(""))
set deletedFiles = ""
set addedFiles = ""
while (key '= "") {
set modification = files(key)
if (modification.changeType = "D"){
if (modification.changeType = "D") {
if (modification.internalName '= "") {
set deletedFiles = deletedFiles_","_modification.internalName
}
} elseif (modification.changeType = "A"){
} elseif (modification.changeType = "A") {
set modification.internalName = ##class(SourceControl.Git.Utils).NameToInternalName(modification.externalName,,0)
if (modification.internalName '= "") {
set addedFiles = addedFiles_","_modification.internalName
Expand Down
68 changes: 68 additions & 0 deletions git-webui/release/share/git-webui/webui/css/git-webui.css
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,74 @@ body {
#workspace-view .diff-line-offset {
cursor: pointer;
}
#changedFilesContainer {
max-width: 100% !important;
margin: 0 10px;
overflow-y: auto;
}
#changedFilesContainer .file-area {
padding-top: 15px;
}
#changedFilesContainer .file-area .select-all {
border-bottom: 1px solid lightgray;
}
#changedFilesContainer .file-area .select-all .form-check-label {
font-size: 1rem;
padding-top: 1px;
padding-left: 8px;
}
#changedFilesContainer .file-area .select-all .form-check-input {
margin-bottom: 2px;
}
#changedFilesContainer .file-area .diffed-file {
background-color: #7fceff;
}
#changedFilesContainer .file-area .form-check {
padding: 3px 5px 3px 15px;
}
#changedFilesContainer .file-area .changes-check:hover {
background-color: rgba(61, 174, 253, 0.2);
}
#changedFilesContainer .file-area .file-item-label {
padding-top: 1px;
padding-left: 8px;
font-size: 1rem;
}
#changedFilesContainer .file-area .form-check-input {
margin-left: -12px !important;
}
#changedFilesContainer .file-area .A::after {
content: "Added";
position: absolute;
right: 5px;
}
#changedFilesContainer .file-area .D::after {
content: "Deleted";
position: absolute;
right: 5px;
}
#changedFilesContainer .file-area .M::after {
content: "Modified";
position: absolute;
right: 5px;
}
#changedFilesContainer .file-area .R::after {
content: "Renamed";
position: absolute;
right: 5px;
}
#changedFilesContainer .file-area .other-user-label svg {
margin-right: 5px;
}
#changedFilesContainer .commit-area {
padding-top: 15px;
}
#changedFilesContainer .commit-area .button-group .btn {
margin-right: 5px;
}
#confirmAction li {
margin-left: 20%;
}
#commit-explorer-view #commit-explorer-navigator-view .panel .panel-body {
flex: 1 1 0px;
-webkit-flex: 1 1 0px;
Expand Down
Loading
Loading