@@ -10,6 +10,7 @@ XData Menu
10
10
{
11
11
<MenuBase >
12
12
<Menu Name =" %SourceMenu" Type =" 0" >
13
+ <MenuItem Name =" Status" />
13
14
<MenuItem Name =" Settings" />
14
15
<MenuItem Name =" Init" />
15
16
<MenuItem Name =" GitWebUI" />
@@ -43,7 +44,7 @@ XData Menu
43
44
Method UserAction (Type As %Integer , Name As %String , InternalName As %String , SelectedText As %String , ByRef Action As %String , ByRef Target As %String , ByRef Msg As %String , ByRef Reload As %Boolean ) As %Status
44
45
{
45
46
#dim ec as %Status = $$$OK
46
- #dim menu as %Status = $piece (Name , " ," , 1 )
47
+ #dim menu as %Status = $piece (Name , " ," , 1 )
47
48
if menu '= " %SourceMenu" , menu '=" %SourceContext" {
48
49
quit $$$OK
49
50
}
@@ -86,37 +87,41 @@ Method LocalizeName(name As %String) As %String
86
87
" Push" :$$$Text(" @Push@Push to remote branch" ),
87
88
" Fetch" :$$$Text(" @Fetch@Fetch from remote" ),
88
89
" Pull" :$$$Text(" @Pull@Pull changes from remote branch" ),
90
+ " Status" : $$$Text(" @Status@Status" ),
89
91
:name )
90
92
}
91
93
92
94
Method OnSourceMenuItem (name As %String , ByRef Enabled As %String , ByRef DisplayName As %String , InternalName As %String ) As %Status
93
95
{
94
96
if name = " Settings" {
97
+ // what is `Enabled` set to here? 0?
95
98
quit $$$OK
96
99
}
97
100
if ##class (Utils ).NeedSettings () {
98
101
set Enabled = -1
99
102
quit $$$OK
100
103
}
101
- set Enabled = 1
102
104
if ##class (Utils ).IsNamespaceInGit () {
103
- if name = " GitWebUI" {
104
- } elseif name = " Export" {
105
- } elseif name = " ExportForce" {
106
- } elseif name = " Import" {
107
- } elseif name = " ImportForce" {
108
- } elseif $listfind ($listbuild (" AddToSC" ," RemoveFromSC" ," Revert" ," Commit" ),name ) {
109
- quit ..OnSourceMenuContextItem (InternalName ,name ,.Enabled ,.DisplayName )
110
- } elseif name = " NewBranch" {
111
- } elseif name = " SwitchBranch" {
112
- } elseif name = " Push" {
113
- } elseif name = " Fetch" {
114
- } elseif name = " Pull" {
115
- } elseif name = " " {
116
- // enable separators if namespace is in git
117
- } else {
118
- set Enabled = -1
119
- }
105
+ if $listfind ($listbuild (" AddToSC" , " RemoveFromSC" , " Revert" , " Commit" ), name ) {
106
+ quit ..OnSourceMenuContextItem (InternalName ,name ,.Enabled ,.DisplayName )
107
+ }
108
+ set Enabled = $CASE (name ,
109
+ // cases
110
+ " Status" : 1 ,
111
+ " GitWebUI" : 1 ,
112
+ " Export" : 1 ,
113
+ " ExportForce" : 1 ,
114
+ " Import" : 1 ,
115
+ " ImportForce" : 1 ,
116
+ " NewBranch" : 1 ,
117
+ " SwitchBranch" : 1 ,
118
+ " Push" : 1 ,
119
+ " Fetch" : 1 ,
120
+ " Pull" : 1 ,
121
+ " " : 1 ,
122
+ :-1 // default
123
+ )
124
+
120
125
} elseif ##class (Utils ).GitBinExists () {
121
126
if name = " Init" {
122
127
} else {
@@ -335,4 +340,3 @@ Method AddToSourceControl(InternalName As %String, Description As %String = "")
335
340
}
336
341
337
342
}
338
-
0 commit comments