@@ -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" />
@@ -42,6 +43,12 @@ XData Menu
42
43
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
{
46
+ // If namespace change event
47
+ if Type = 1 , Name = 5 {
48
+ // reroute to Status menu option
49
+ set Name = " %SourceMenu,Status"
50
+ }
51
+
45
52
#dim ec as %Status = $$$OK
46
53
#dim menu as %Status = $piece (Name , " ," , 1 )
47
54
if menu '= " %SourceMenu" , menu '=" %SourceContext" {
@@ -86,37 +93,41 @@ Method LocalizeName(name As %String) As %String
86
93
" Push" :$$$Text(" @Push@Push to remote branch" ),
87
94
" Fetch" :$$$Text(" @Fetch@Fetch from remote" ),
88
95
" Pull" :$$$Text(" @Pull@Pull changes from remote branch" ),
96
+ " Status" : $$$Text(" @Status@Status" ),
89
97
:name )
90
98
}
91
99
92
100
Method OnSourceMenuItem (name As %String , ByRef Enabled As %String , ByRef DisplayName As %String , InternalName As %String ) As %Status
93
101
{
94
102
if name = " Settings" {
103
+ set Enabled = 1
95
104
quit $$$OK
96
105
}
97
106
if ##class (Utils ).NeedSettings () {
98
107
set Enabled = -1
99
108
quit $$$OK
100
109
}
101
- set Enabled = 1
102
110
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
- }
111
+ if $listfind ($listbuild (" AddToSC" , " RemoveFromSC" , " Revert" , " Commit" ), name ) {
112
+ quit ..OnSourceMenuContextItem (InternalName ,name ,.Enabled ,.DisplayName )
113
+ }
114
+ set Enabled = $CASE (name ,
115
+ // cases
116
+ " Status" : 1 ,
117
+ " GitWebUI" : 1 ,
118
+ " Export" : 1 ,
119
+ " ExportForce" : 1 ,
120
+ " Import" : 1 ,
121
+ " ImportForce" : 1 ,
122
+ " NewBranch" : 1 ,
123
+ " SwitchBranch" : 1 ,
124
+ " Push" : 1 ,
125
+ " Fetch" : 1 ,
126
+ " Pull" : 1 ,
127
+ " " : 1 ,
128
+ :-1 // default
129
+ )
130
+
120
131
} elseif ##class (Utils ).GitBinExists () {
121
132
if name = " Init" {
122
133
} else {
@@ -335,4 +346,3 @@ Method AddToSourceControl(InternalName As %String, Description As %String = "")
335
346
}
336
347
337
348
}
338
-
0 commit comments