Revision ecf43dcb src/Ganeti/Query/Common.hs

b/src/Ganeti/Query/Common.hs
37 37
  , serialFields
38 38
  , tagsFields
39 39
  , dictFieldGetter
40
  , buildQFTLookup
41 40
  , buildNdParamField
42 41
  ) where
43 42

  
......
147 146
dictFieldGetter :: (DictObject a) => String -> Maybe a -> ResultEntry
148 147
dictFieldGetter k = maybe rsNoData (rsMaybeNoData . lookup k . toDict)
149 148

  
150
-- | Build an optimised lookup map from a Python _PARAMETER_TYPES
151
-- association list.
152
buildQFTLookup :: [(String, String)] -> Map.Map String FieldType
153
buildQFTLookup =
154
  Map.fromList .
155
  map (\(k, v) -> (k, maybe QFTOther vTypeToQFT (vTypeFromRaw v)))
156

  
157 149
-- | Ndparams optimised lookup map.
158 150
ndParamTypes :: Map.Map String FieldType
159
ndParamTypes = buildQFTLookup C.ndsParameterTypes
151
ndParamTypes = Map.map vTypeToQFT C.ndsParameterTypes
160 152

  
161 153
-- | Ndparams title map.
162 154
ndParamTitles :: Map.Map String FieldTitle
163
ndParamTitles = Map.fromList C.ndsParameterTitles
155
ndParamTitles = C.ndsParameterTitles
164 156

  
165 157
-- | Ndparam getter builder: given a field, it returns a FieldConfig
166 158
-- getter, that is a function that takes the config and the object and

Also available in: Unified diff