1+ <!DOCTYPE html>
2+ <html>
3+ <head>
4+ <meta charset="utf-8">
5+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6+ <meta name="viewport" content="width=device-width, initial-scale=1">
7+ <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
8+ <link rel="stylesheet" type="text/css" href="css/git-webui.css" />
9+ <server>set $NAMESPACE = "USER"</server>
10+ #(##class(SourceControl.Git.Utils).GetSourceControlInclude())#
11+ <style type="text/css">
12+ h1 {
13+ margin-top: 10px
14+ }
15+ .A::after {
16+ content: "Added";
17+ position: absolute;
18+ right: 10px;
19+ }
20+
21+ .D::after {
22+ content: "Deleted";
23+ position: absolute;
24+ right: 10px;
25+ }
26+
27+ .M::after {
28+ content: "Modified";
29+ position: absolute;
30+ right: 10px;
31+ }
32+
33+ .R::after {
34+ content: "Renamed";
35+ position: absolute;
36+ right: 10px;
37+ }
38+
39+ .section-header {
40+ margin: 20px 0 15px 0
41+ }
42+
43+ #syncBtn {
44+ position: absolute;
45+ right: 15px;
46+ margin-top: 10px;
47+ }
48+
49+ .output {
50+ margin-top: 100px;
51+ margin-bottom: 20px;
52+ border: 1.5px solid darkgray;
53+ padding: 10px;
54+ border-radius: 4px;
55+ }
56+
57+ </style>
58+ </head>
59+ <body>
60+ <server>
61+ set settings = ##class(SourceControl.Git.Settings).%New()
62+
63+ set uncommittedWithAction = ##class(SourceControl.Git.Utils).UncommittedWithAction().%Get("user")
64+ set commitMsg = ##class(SourceControl.Git.Utils).GenerateCommitMessageFromFiles(uncommittedWithAction)
65+ set filesToSync = ($length(commitMsg) > 0)
66+ set fileSectionDisplay = $select(
67+ filesToSync = 1: "block",
68+ 1: "none"
69+ )
70+ set noFileDisplay = $select(
71+ filesToSync = 0: "block",
72+ 1: "none"
73+ )
74+
75+ </server>
76+
77+ <div class="container">
78+ <h1 class="text-center">Sync Repository</h1>
79+ <div class="row">
80+ <div class="offset-sm-2 col-sm-8">
81+ <div style="display: #(fileSectionDisplay)#">
82+ <h3 class="section-header">Files to be committed with sync:</h3>
83+ <ul class="list-group">
84+ <server>
85+ set iterator = uncommittedWithAction.%GetIterator()
86+ while iterator.%GetNext(,.uncommitted) {
87+ set action = uncommitted.%Get("action")
88+ set file = uncommitted.%Get("file")
89+ &html<<li class="list-group-item #(action)#">#(file)#</li>>
90+ }
91+ </server>
92+ </ul>
93+ <h3 class="section-header">Sync commit message:</h3>
94+ <input class="form-control" type="text" name="syncMsg" id="syncMsg" value="#(commitMsg)#">
95+ </div>
96+ <div style="display: #(noFileDisplay)#">
97+ <h1 class="text-center">No files to commit with sync</h1>
98+ </div>
99+ <h3 class="section-header">Sync details:</h3>
100+ <p>Upon syncing, the local repository will pull the changes from remote and commit the newest changes before committing and pushing</p>
101+ <server>
102+
103+ if settings.defaultMergeBranch '= "" {
104+ &html<<p>Local changes will be merged with #(settings.defaultMergeBranch)# after receiving the latest changes</p>>
105+ }
106+ </server>
107+
108+ <button class="btn btn-lg btn-primary" id="syncBtn" onClick="#server(..PerformSync())#">Sync</button>
109+ <div>
110+ <div class="container output">
111+
112+ </div>
113+ </div>
114+ </div>
115+ </div>
116+
117+ </div>
118+ </body>
119+
120+ <script language="cache" method="PerformSync">
121+ &js<document.getElementById('syncBtn').innerHTML = 'Syncing...'>
122+ &js<document.getElementById('syncBtn').disabled = true>
123+ </script>
124+ </html>
0 commit comments