Skip to content

Commit 24a5e4a

Browse files
authored
Merge pull request #395 from intersystems/ui-revamp
Workspace UI revamp
2 parents 5b1428b + 7af6399 commit 24a5e4a

File tree

7 files changed

+851
-715
lines changed

7 files changed

+851
-715
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- 'New Branch' menu option in basic now will create new branches from the configured default merge branch (#366)
2222
- Merging back with the default merge branch is now a part of the basic mode's Sync flow (#366)
2323
- Added a new option "compileOnImport". If true, Import options will compile files using the pull event handler. (#362)
24+
- Git web UI overhauled for better UX selecting files to commit/stash/discard (#346)
25+
- Git web UI supports discarding some/all changes (#395)
2426

2527
### Fixed
2628
- Modifications to local repo files are now synced with IRIS (#153)
2729
- Menu items names are properly translated from internal name in VSCode, Management Portal (#372)
2830
- Now has proper locking behavior in `##class(SourceControl.Git.WebUIDriver).HandleRequest()`(#385)
2931
- Git operations from the WebUI now don't unlock the session if they aren't read-only
32+
- WebUI works properly for users with %Developer without needing to add further SQL privileges (#365, #358)
33+
- Uncommitted deletes are shown in WebUI (#395)
3034
- Syncing only prompts users for a commit message if there are uncommitted files (#390)
3135
- WebUI works properly for users with %Developer without needing to add further SQL privileges (#365)
3236
- Fixed `<UNDEFINED>` error running Import All (#380)

cls/SourceControl/Git/Settings.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Property gitUserName As %String(MAXLEN = 255) [ InitialExpression = {##class(Sou
2929
/// Attribution: Email address for user ${username}
3030
Property gitUserEmail As %String(MAXLEN = 255) [ InitialExpression = {##class(SourceControl.Git.Utils).GitUserEmail()} ];
3131

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

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

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

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

5050
Property Mappings [ MultiDimensional ];

cls/SourceControl/Git/Utils.cls

Lines changed: 88 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,9 +1602,10 @@ ClassMethod RunGitCommand(command As %String, Output errStream, Output outStream
16021602
ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", Output errStream, Output outStream, args...) As %Integer
16031603
{
16041604
// Special case: git --version is used internally even when the settings incorporated here may be invalid/unspecified.
1605+
set tempFolder = ..TempFolder()
16051606
if (command '= "--version") {
16061607
set newArgs($increment(newArgs)) = "-C"
1607-
set newArgs($increment(newArgs)) = ..TempFolder()
1608+
set newArgs($increment(newArgs)) = tempFolder
16081609

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

1636-
if (command = "checkout"){
1639+
// Find / build file list
1640+
set hasFileList = 0
1641+
for i=1:1:$get(args) {
1642+
if $data(args(i),arg)#2 {
1643+
if hasFileList {
1644+
if arg [ tempFolder {
1645+
set relativeFile = $Piece(arg,tempFolder,2)
1646+
} else {
1647+
set relativeFile = arg
1648+
}
1649+
if (relativeFile '= "") {
1650+
set filterToFiles(relativeFile) = ""
1651+
}
1652+
} elseif arg = "--" {
1653+
set hasFileList = 1
1654+
}
1655+
}
1656+
}
1657+
1658+
if (command = "checkout") {
16371659
set syncIrisWithDiff = 1
1638-
if $data(args) && $data(args(args),diffCompare) {
1660+
if hasFileList {
1661+
set invert = 1
1662+
} elseif $data(args) && $data(args(args),diffCompare) {
16391663
// no-op
16401664
}
1641-
} elseif (command = "merge") || (command = "rebase") || (command = "pull"){
1665+
} elseif (command = "restore") {
1666+
// Leave diffCompare empty, this actually does the right thing.
1667+
set syncIrisWithDiff = 1
1668+
} elseif (command = "merge") || (command = "rebase") || (command = "pull") {
16421669
set syncIrisWithCommand = 1
16431670
if $data(args) && $data(args(args),diffCompare) {
16441671
// no-op
16451672
}
1673+
} elseif (command = "stash") {
1674+
set subcommand = $Get(args(1))
1675+
set whichStash = $Get(args(2))
1676+
if subcommand = "push" {
1677+
set syncIrisWithDiff = 1
1678+
set diffCompare = ""
1679+
set invert = 1
1680+
} elseif (subcommand = "pop") || (subcommand = "apply") {
1681+
set syncIrisWithDiff = 1
1682+
set diffCompare = whichStash
1683+
}
16461684
}
16471685

1686+
// WebUI prefixes with "color.ui=true" so we need to grab the command
1687+
// from later in the args... array
16481688
for i=1:1:$get(args) {
16491689
if ($data(args(i))) {
16501690
set newArgs($increment(newArgs)) = args(i)
16511691
if (args(i) = "checkout") {
16521692
set syncIrisWithDiff = 1
1653-
set diffCompare = args(i + 1)
1654-
1655-
if args = (i + 2) {
1656-
set diffBase = args(i + 2)
1693+
if hasFileList {
1694+
set invert = 1
1695+
} else {
1696+
set diffCompare = args(i + 1)
1697+
if args = (i + 2) {
1698+
set diffBase = args(i + 2)
1699+
}
1700+
}
1701+
} elseif (args(i) = "restore") {
1702+
set syncIrisWithDiff = 1
1703+
set diffCompare = ""
1704+
set invert = 1
1705+
} elseif (args(i) = "stash") {
1706+
set subcommand = $Get(args(i + 1))
1707+
set whichStash = $Get(args(i + 2))
1708+
if subcommand = "push" {
1709+
set syncIrisWithDiff = 1
1710+
set diffCompare = ""
1711+
set invert = 1
1712+
} elseif (subcommand = "pop") || (subcommand = "apply") {
1713+
set syncIrisWithDiff = 1
1714+
set diffCompare = whichStash
16571715
}
16581716
} elseif (args(i) = "merge") || (args(i) = "rebase") || (args(i) = "pull") {
16591717
set syncIrisWithCommand = 1
16601718
set diffCompare = args(i + 1)
16611719
}
1662-
16631720
}
16641721
}
16651722

@@ -1672,6 +1729,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
16721729
if diffBase = "" {
16731730
set diffBase = ..GetCurrentBranch()
16741731
}
1732+
16751733
do ..RunGitCommand("fetch", .errorStream, .outputStream)
16761734
kill errorStream, outputStream
16771735
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("diff",,.errorStream,.outputStream, diffBase_$Case(diffCompare,"":"",:"..")_diffCompare, "--name-status")
@@ -1707,7 +1765,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
17071765

17081766
if syncIrisWithDiff {
17091767
do ..PrintStreams(errStream, outStream)
1710-
$$$ThrowOnError(..SyncIrisWithRepoThroughDiff(.files))
1768+
$$$ThrowOnError(..SyncIrisWithRepoThroughDiff(.files, .filterToFiles, invert))
17111769
} elseif syncIrisWithCommand {
17121770
do ..PrintStreams(errStream, outStream)
17131771
$$$ThrowOnError(..SyncIrisWithRepoThroughCommand(.outStream))
@@ -1772,10 +1830,8 @@ ClassMethod ParseDiffStream(stream As %Stream.Object, verbose As %Boolean = 1, O
17721830
set modification.changeType = "A"
17731831
set modification.internalName = ""
17741832
set modification.externalName = $zstrip($piece(file, $c(9), 3),"<W")
1775-
} elseif (modification.changeType '= "A"){
1776-
set modification.internalName = ##class(SourceControl.Git.Utils).NameToInternalName(modification.externalName,,0)
17771833
} else {
1778-
set modification.internalName = ""
1834+
set modification.internalName = ##class(SourceControl.Git.Utils).NameToInternalName(modification.externalName,,0)
17791835
}
17801836
set files($increment(files)) = modification
17811837
if verbose {
@@ -1784,18 +1840,34 @@ ClassMethod ParseDiffStream(stream As %Stream.Object, verbose As %Boolean = 1, O
17841840
}
17851841
}
17861842

1787-
ClassMethod SyncIrisWithRepoThroughDiff(ByRef files) As %Status
1843+
ClassMethod SyncIrisWithRepoThroughDiff(ByRef files, ByRef filterToFiles, invert As %Boolean = 0) As %Status
17881844
{
1845+
if invert {
1846+
// Change A <-> D
1847+
set key = ""
1848+
for {
1849+
set key = $order(files(key),1,modification)
1850+
quit:key=""
1851+
if '$data(filterToFiles(modification.externalName)) {
1852+
continue
1853+
}
1854+
set modification.changeType = $translate(modification.changeType,"DA","AD")
1855+
set realFiles($increment(realFiles)) = modification
1856+
}
1857+
kill files
1858+
merge files = realFiles
1859+
}
1860+
17891861
set key = $order(files(""))
17901862
set deletedFiles = ""
17911863
set addedFiles = ""
17921864
while (key '= "") {
17931865
set modification = files(key)
1794-
if (modification.changeType = "D"){
1866+
if (modification.changeType = "D") {
17951867
if (modification.internalName '= "") {
17961868
set deletedFiles = deletedFiles_","_modification.internalName
17971869
}
1798-
} elseif (modification.changeType = "A"){
1870+
} elseif (modification.changeType = "A") {
17991871
set modification.internalName = ##class(SourceControl.Git.Utils).NameToInternalName(modification.externalName,,0)
18001872
if (modification.internalName '= "") {
18011873
set addedFiles = addedFiles_","_modification.internalName

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,74 @@ body {
857857
#workspace-view .diff-line-offset {
858858
cursor: pointer;
859859
}
860+
#changedFilesContainer {
861+
max-width: 100% !important;
862+
margin: 0 10px;
863+
overflow-y: auto;
864+
}
865+
#changedFilesContainer .file-area {
866+
padding-top: 15px;
867+
}
868+
#changedFilesContainer .file-area .select-all {
869+
border-bottom: 1px solid lightgray;
870+
}
871+
#changedFilesContainer .file-area .select-all .form-check-label {
872+
font-size: 1rem;
873+
padding-top: 1px;
874+
padding-left: 8px;
875+
}
876+
#changedFilesContainer .file-area .select-all .form-check-input {
877+
margin-bottom: 2px;
878+
}
879+
#changedFilesContainer .file-area .diffed-file {
880+
background-color: #7fceff;
881+
}
882+
#changedFilesContainer .file-area .form-check {
883+
padding: 3px 5px 3px 15px;
884+
}
885+
#changedFilesContainer .file-area .changes-check:hover {
886+
background-color: rgba(61, 174, 253, 0.2);
887+
}
888+
#changedFilesContainer .file-area .file-item-label {
889+
padding-top: 1px;
890+
padding-left: 8px;
891+
font-size: 1rem;
892+
}
893+
#changedFilesContainer .file-area .form-check-input {
894+
margin-left: -12px !important;
895+
}
896+
#changedFilesContainer .file-area .A::after {
897+
content: "Added";
898+
position: absolute;
899+
right: 5px;
900+
}
901+
#changedFilesContainer .file-area .D::after {
902+
content: "Deleted";
903+
position: absolute;
904+
right: 5px;
905+
}
906+
#changedFilesContainer .file-area .M::after {
907+
content: "Modified";
908+
position: absolute;
909+
right: 5px;
910+
}
911+
#changedFilesContainer .file-area .R::after {
912+
content: "Renamed";
913+
position: absolute;
914+
right: 5px;
915+
}
916+
#changedFilesContainer .file-area .other-user-label svg {
917+
margin-right: 5px;
918+
}
919+
#changedFilesContainer .commit-area {
920+
padding-top: 15px;
921+
}
922+
#changedFilesContainer .commit-area .button-group .btn {
923+
margin-right: 5px;
924+
}
925+
#confirmAction li {
926+
margin-left: 20%;
927+
}
860928
#commit-explorer-view #commit-explorer-navigator-view .panel .panel-body {
861929
flex: 1 1 0px;
862930
-webkit-flex: 1 1 0px;

0 commit comments

Comments
 (0)