otsdaq-utilities  3.05.00
ConfigurationGUISupervisor.h
1 #ifndef _ots_ConfigurationGUISupervisor_h_
2 #define _ots_ConfigurationGUISupervisor_h_
3 
4 #include "otsdaq/ConfigurationInterface/ConfigurationManagerRW.h"
5 #include "otsdaq/CoreSupervisors/CoreSupervisorBase.h"
6 
7 namespace ots
8 {
9 // clang-format off
10 
14 {
15  public:
16  static xdaq::Application* instantiate(xdaq::ApplicationStub* s);
17 
18  ConfigurationGUISupervisor (xdaq::ApplicationStub* s);
19  virtual ~ConfigurationGUISupervisor (void);
20 
21  void init (void);
22  void destroy (void);
23 
24  virtual void defaultPage (xgi::Input* in, xgi::Output* out) override;
25  virtual void request (const std::string& requestType,cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, const WebUsers::RequestUserInfo& userInfo) override;
26 
27  virtual void setSupervisorPropertyDefaults (void) override;
28  virtual void forceSupervisorPropertyValues (void) override;
29 
30  private:
31  void handleSaveTableInfoXML (HttpXmlDocument& xmldoc,
32  ConfigurationManagerRW* cfgMgr,
33  std::string& tableName,
34  const std::string& columnCSV,
35  const std::string& tableDescription,
36  const std::string& columnChoicesCSV,
37  bool allowOverwrite = false);
38  void handleDeleteTableInfoXML (HttpXmlDocument& xmldoc,
39  ConfigurationManagerRW* cfgMgr,
40  std::string& tableName);
41 
42  void handleGroupAliasesXML (HttpXmlDocument& xmldoc, ConfigurationManagerRW* cfgMgr);
43  void handleSetGroupAliasInBackboneXML (HttpXmlDocument& xmldoc,
44  ConfigurationManagerRW* cfgMgr,
45  const std::string& groupAliasCSV,
46  const std::string& groupNameCSV,
47  const std::string& groupKeyCSV,
48  const std::string& author);
49  void handleSetTableAliasInBackboneXML (HttpXmlDocument& xmldoc,
50  ConfigurationManagerRW* cfgMgr,
51  const std::string& versionAlias,
52  const std::string& tableName,
53  TableVersion version,
54  const std::string& author);
55  void handleAliasGroupMembersInBackboneXML (HttpXmlDocument& xmldoc,
56  ConfigurationManagerRW* cfgMgr,
57  const std::string& versionAlias,
58  const std::string& groupName,
59  TableGroupKey groupKey,
60  const std::string& author);
61  void handleVersionAliasesXML (HttpXmlDocument& xmldoc, ConfigurationManagerRW* cfgMgr);
62  void handleTableGroupsXML (HttpXmlDocument& xmldoc,
63  ConfigurationManagerRW* cfgMgr,
64  bool returnMembers);
65  void handleGetTableGroupTypeXML (HttpXmlDocument& xmldoc,
66  ConfigurationManagerRW* cfgMgr,
67  const std::string& configList);
68 
69  void handleTablesXML (HttpXmlDocument& xmldoc,
70  ConfigurationManagerRW* cfgMgr);
71  void handleGetTableXML (HttpXmlDocument& xmldoc,
72  ConfigurationManagerRW* cfgMgr,
73  const std::string& tableName,
74  TableVersion version,
75  bool allowIllegalColumns = false,
76  bool getRawData = false,
77  bool descriptionOnly = false);
78 
79  void setupActiveTablesXML (HttpXmlDocument& xmldoc,
80  ConfigurationManagerRW* cfgMgr,
81  const std::string& groupName,
82  const TableGroupKey& groupKey,
83  const std::string& modifiedTables,
84  bool refreshAll = true,
85  bool getGroupInfo = false,
86  std::map<std::string /*name*/,
87  TableVersion /*version*/>* returnMemberMap = 0,
88  bool outputActiveTables = true,
89  std::string* accumulatedErrors = 0);
90  void handleFillTreeViewXML (HttpXmlDocument& xmldoc,
91  ConfigurationManagerRW* cfgMgr,
92  const std::string& groupName,
93  const TableGroupKey& groupKey,
94  const std::string& startPath,
95  unsigned int depth,
96  bool hideStatusFalse,
97  const std::string& modifiedTables,
98  const std::string& filterList,
99  const std::string& diffGroupName = "",
100  const TableGroupKey& diffGroupKey = TableGroupKey());
101  static void recursiveTreeToXML (const ConfigurationTree& t,
102  unsigned int depth,
103  HttpXmlDocument& xmldoc,
104  DOMElement* parentEl,
105  bool hideStatusFalse,
106  std::optional<std::reference_wrapper<const ConfigurationTree>> diffTree = std::nullopt);
107  void handleFillTreeNodeCommonFieldsXML (HttpXmlDocument& xmldoc,
108  ConfigurationManagerRW* cfgMgr,
109  const std::string& groupName,
110  const TableGroupKey& groupKey,
111  const std::string& startPath,
112  unsigned int depth,
113  const std::string& modifiedTables,
114  const std::string& recordList,
115  const std::string& fieldList);
116  void handleFillUniqueFieldValuesForRecordsXML(HttpXmlDocument& xmldoc,
117  ConfigurationManagerRW* cfgMgr,
118  const std::string& groupName,
119  const TableGroupKey& groupKey,
120  const std::string& startPath,
121  const std::string& modifiedTables,
122  const std::string& recordList,
123  const std::string& fieldList);
124  void handleFillGetTreeNodeFieldValuesXML (HttpXmlDocument& xmldoc,
125  ConfigurationManagerRW* cfgMgr,
126  const std::string& groupName,
127  const TableGroupKey& groupKey,
128  const std::string& startPath,
129  const std::string& modifiedTables,
130  const std::string& recordList,
131  const std::string& fieldList);
132  void handleFillSetTreeNodeFieldValuesXML (HttpXmlDocument& xmldoc,
133  ConfigurationManagerRW* cfgMgr,
134  const std::string& groupName,
135  const TableGroupKey& groupKey,
136  const std::string& startPath,
137  const std::string& modifiedTables,
138  const std::string& recordList,
139  const std::string& fieldList,
140  const std::string& valueList,
141  const std::string& author);
142  void handleFillCreateTreeNodeRecordsXML (HttpXmlDocument& xmldoc,
143  ConfigurationManagerRW* cfgMgr,
144  const std::string& groupName,
145  const TableGroupKey& groupKey,
146  const std::string& startPath,
147  const std::string& modifiedTables,
148  const std::string& recordList,
149  const std::string& author);
150  void handleFillDeleteTreeNodeRecordsXML (HttpXmlDocument& xmldoc,
151  ConfigurationManagerRW* cfgMgr,
152  const std::string& groupName,
153  const TableGroupKey& groupKey,
154  const std::string& startPath,
155  const std::string& modifiedTables,
156  const std::string& recordList);
157  void handleFillRenameTreeNodeRecordsXML (HttpXmlDocument& xmldoc,
158  ConfigurationManagerRW* cfgMgr,
159  const std::string& groupName,
160  const TableGroupKey& groupKey,
161  const std::string& startPath,
162  const std::string& modifiedTables,
163  const std::string& recordList,
164  const std::string& newRecordList);
165  void handleFillCopyTreeNodeRecordsXML (HttpXmlDocument& xmldoc,
166  ConfigurationManagerRW* cfgMgr,
167  const std::string& groupName,
168  const TableGroupKey& groupKey,
169  const std::string& startPath,
170  const std::string& modifiedTables,
171  const std::string& recordList,
172  unsigned int numberOfCopies = 1);
173  void handleFillModifiedTablesXML (HttpXmlDocument& xmldoc, ConfigurationManagerRW* cfgMgr);
174 
175  void handleSaveTreeNodeEditXML (HttpXmlDocument& xmldoc,
176  ConfigurationManagerRW* cfgMgr,
177  const std::string& tableName,
178  TableVersion version,
179  const std::string& type,
180  const std::string& uid,
181  const std::string& column,
182  const std::string& newValue,
183  const std::string& author);
184  void handleGetAffectedGroupsXML (HttpXmlDocument& xmldoc,
185  ConfigurationManagerRW* cfgMgr,
186  const std::string& rootGroupName,
187  const TableGroupKey& rootGroupKey,
188  const std::string& modifiedTables);
189  void handleGetLinkToChoicesXML (HttpXmlDocument& xmldoc,
190  ConfigurationManagerRW* cfgMgr,
191  const std::string& linkToTableName,
192  const TableVersion& linkToTableVersion,
193  const std::string& linkIdType,
194  const std::string& linkIndex,
195  const std::string& linkInitId);
196 
197  void handleSavePlanCommandSequenceXML (HttpXmlDocument& xmldoc,
198  ConfigurationManagerRW* cfgMgr,
199  const std::string& groupName,
200  const TableGroupKey& groupKey,
201  const std::string& modifiedTables,
202  const std::string& author,
203  const std::string& planName,
204  const std::string& commandString);
205 
206  void handleMergeGroupsXML (HttpXmlDocument& xmlOut,
207  ConfigurationManagerRW* cfgMgr,
208  const std::string& groupANameContext,
209  const TableGroupKey& groupAKeyContext,
210  const std::string& groupBNameContext,
211  const TableGroupKey& groupBKeyContext,
212  const std::string& groupANameConfig,
213  const TableGroupKey& groupAKeyConfig,
214  const std::string& groupBNameConfig,
215  const TableGroupKey& groupBKeyConfig,
216  const std::string& author,
217  const std::string& mergeApproach);
218 
219 
220  void handleGetArtdaqNodeRecordsXML (HttpXmlDocument& xmlOut,
221  ConfigurationManagerRW* cfgMgr,
222  const std::string& modifiedTables);
223  void handleSaveArtdaqNodeRecordsXML (const std::string& nodeString,
224  const std::string& subsystemString,
225  HttpXmlDocument& xmlOut,
226  ConfigurationManagerRW* cfgMgr,
227  const std::string& modifiedTables);
228  void handleLoadArtdaqNodeLayoutXML (HttpXmlDocument& xmlOut,
229  ConfigurationManager* cfgMgr,
230  const std::string& contextGroupName = "",
231  const TableGroupKey& contextGroupKey = TableGroupKey()) const;
232  void handleSaveArtdaqNodeLayoutXML (HttpXmlDocument& xmlOut,
233  ConfigurationManagerRW* cfgMgr,
234  const std::string& layoutString,
235  const std::string& contextGroupName = "",
236  const TableGroupKey& contextGroupKey = TableGroupKey());
237  void handleOtherSubsystemActiveGroups (HttpXmlDocument& xmlOut,
238  ConfigurationManagerRW* cfgMgr,
239  bool getFullList,
240  std::string targetSubsystem = "");
241  void handleGroupDiff (HttpXmlDocument& xmlOut,
242  ConfigurationManagerRW* cfgMgr,
243  const std::string& groupName,
244  const TableGroupKey& groupKey,
245  const TableGroupKey& diffKey = TableGroupKey(),
246  const std::string& diffGroupName = "");
247  void handleTableDiff (HttpXmlDocument& xmlOut,
248  ConfigurationManagerRW* cfgMgr,
249  const std::string& tableName,
250  const TableVersion& vA,
251  const TableVersion& vB);
252 
253 
254 
255  void testXDAQContext (void);
256 
257  enum
258  {
259  CONFIGURATION_MANAGER_EXPIRATION_TIME = 60 * 60 * 24 * 2,
260  CONFIGURATION_MANAGER_REFRESH_THRESHOLD = 60 * 60 * 24,
261  };
262 
263  ConfigurationManagerRW* refreshUserSession (std::string username,
264  bool refresh);
265 
266  std::map<std::string, ConfigurationManagerRW*> userConfigurationManagers_;
267  std::map<std::string, time_t> userLastUseTime_;
268 };
269 
270 // clang-format on
271 } // namespace ots
272 
273 #endif
virtual void forceSupervisorPropertyValues(void) override
override to force supervisor property values (and ignore user settings)
virtual void setSupervisorPropertyDefaults(void) override
ConfigurationGUISupervisor(xdaq::ApplicationStub *s)
static xdaq::Application * instantiate(xdaq::ApplicationStub *s)