From d6f265ec064551c8d72b816f96fc5722ac4b1a6f Mon Sep 17 00:00:00 2001 From: isc-hwojnick Date: Thu, 25 Jul 2024 14:15:14 -0400 Subject: [PATCH 1/4] implemented Presync part of webui --- cls/SourceControl/Git/Utils.cls | 2 +- csp/sync.csp | 124 ++++++++++++++++++++++++++++++++ module.xml | 1 + 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 csp/sync.csp diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 5c08b581..74eb2ea6 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1947,7 +1947,7 @@ ClassMethod GenerateCommitMessageFromFiles(filesWithActions) As %String set commitMsg = commitMsg_$LISTBUILD(oneFileMsg) } - quit $LISTTOSTRING(commitMsg, ",") + quit $LISTTOSTRING(commitMsg, ", ") } ClassMethod GitStatus(ByRef files, IncludeAllFiles = 0) diff --git a/csp/sync.csp b/csp/sync.csp new file mode 100644 index 00000000..51ce9884 --- /dev/null +++ b/csp/sync.csp @@ -0,0 +1,124 @@ + + + + + + + + + set $NAMESPACE = "USER" + #(##class(SourceControl.Git.Utils).GetSourceControlInclude())# + + + + + set settings = ##class(SourceControl.Git.Settings).%New() + + set uncommittedWithAction = ##class(SourceControl.Git.Utils).UncommittedWithAction().%Get("user") + set commitMsg = ##class(SourceControl.Git.Utils).GenerateCommitMessageFromFiles(uncommittedWithAction) + set filesToSync = ($length(commitMsg) > 0) + set fileSectionDisplay = $select( + filesToSync = 1: "block", + 1: "none" + ) + set noFileDisplay = $select( + filesToSync = 0: "block", + 1: "none" + ) + + + +
+

Sync Repository

+
+
+
+

Files to be committed with sync:

+
    + + set iterator = uncommittedWithAction.%GetIterator() + while iterator.%GetNext(,.uncommitted) { + set action = uncommitted.%Get("action") + set file = uncommitted.%Get("file") + &html<
  • #(file)#
  • > + } +
    +
+

Sync commit message:

+ +
+
+

No files to commit with sync

+
+

Sync details:

+

Upon syncing, the local repository will pull the changes from remote and commit the newest changes before committing and pushing

+ + + if settings.defaultMergeBranch '= "" { + &html<

Local changes will be merged with #(settings.defaultMergeBranch)# after receiving the latest changes

> + } +
+ + +
+
+ +
+
+
+
+ +
+ + + + \ No newline at end of file diff --git a/module.xml b/module.xml index bca6ae6a..ea8274fd 100644 --- a/module.xml +++ b/module.xml @@ -27,6 +27,7 @@ + From 3cd0382538e464f53baa91d9c02f4b4b1a8aa980 Mon Sep 17 00:00:00 2001 From: isc-hwojnick Date: Mon, 29 Jul 2024 15:19:05 -0400 Subject: [PATCH 2/4] feat: new UI for the basic mode sync --- CHANGELOG.md | 5 ++ cls/SourceControl/Git/Utils.cls | 24 +++++----- csp/sync.csp | 83 +++++++++++++++++++++++++++++---- 3 files changed, 91 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bf0d744..eb779cc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.0] - Unreleased + +### Added +- New UI for the basic mode Sync (#415) + ## [2.4.1] - Unreleased ### Fixed diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 74eb2ea6..653b5769 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -253,17 +253,19 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe set Action = 7 quit $$$OK } elseif (menuItemName = "Sync") { - if ..CheckForUncommittedFiles() { - set Target = "Enter a commit message for the sync operation" - set Action = 7 - set Msg = ..PreSync() - } else { - set Target = "" - do ..Sync("",.Target) - if (Target '= "") { - set Action = 6 - } - } + #; if ..CheckForUncommittedFiles() { + #; set Target = "Enter a commit message for the sync operation" + #; set Action = 7 + #; set Msg = ..PreSync() + #; } else { + #; set Target = "" + #; do ..Sync("",.Target) + #; if (Target '= "") { + #; set Action = 6 + #; } + #; } + set Action = 2 + externalBrowser + set Target = urlPrefix _ "/isc/studio/usertemplates/gitsourcecontrol/sync.csp" quit $$$OK } elseif (menuItemName = "Push") { diff --git a/csp/sync.csp b/csp/sync.csp index 51ce9884..7d199a25 100644 --- a/csp/sync.csp +++ b/csp/sync.csp @@ -9,9 +9,10 @@ set $NAMESPACE = "USER" #(##class(SourceControl.Git.Utils).GetSourceControlInclude())#