Merge pull request #699 from stephen-turner/search-for-uuid

CA-185020: Search by UUID
This commit is contained in:
Mihaela Stoica 2015-10-07 17:25:16 +01:00
commit 8c451255d0
2 changed files with 23 additions and 2 deletions

View File

@ -64,6 +64,7 @@ namespace XenAdmin.Controls.XenSearch
queryTypes.Add(new UuidQueryType(1, ObjectTypes.AllIncFolders & ~ObjectTypes.VDI | ObjectTypes.Appliance)); // but only actually shown for parent/child queries (see WantQueryType()). Too slow for VDIs and not very useful. queryTypes.Add(new UuidQueryType(1, ObjectTypes.AllIncFolders & ~ObjectTypes.VDI | ObjectTypes.Appliance)); // but only actually shown for parent/child queries (see WantQueryType()). Too slow for VDIs and not very useful.
queryTypes.Add(new StringPropertyQueryType(1, ObjectTypes.AllIncFolders | ObjectTypes.Appliance, PropertyNames.label)); queryTypes.Add(new StringPropertyQueryType(1, ObjectTypes.AllIncFolders | ObjectTypes.Appliance, PropertyNames.label));
queryTypes.Add(new StringPropertyQueryType(1, ObjectTypes.AllExcFolders | ObjectTypes.Appliance, PropertyNames.description)); queryTypes.Add(new StringPropertyQueryType(1, ObjectTypes.AllExcFolders | ObjectTypes.Appliance, PropertyNames.description));
queryTypes.Add(new UuidStringQueryType(1, ObjectTypes.AllExcFolders));
queryTypes.Add(new TagQueryType(1, ObjectTypes.AllExcFolders)); queryTypes.Add(new TagQueryType(1, ObjectTypes.AllExcFolders));
// Replaced by new ParentChildQueryTypes below // Replaced by new ParentChildQueryTypes below
@ -1158,10 +1159,12 @@ namespace XenAdmin.Controls.XenSearch
} }
} }
// The object "Is" query, selected from a list of objects.
// Internally implemented using UUIDs.
internal class UuidQueryType : PropertyQueryType<String> internal class UuidQueryType : PropertyQueryType<String>
{ {
internal UuidQueryType(int group, ObjectTypes appliesTo) internal UuidQueryType(int group, ObjectTypes appliesTo)
: base(group, appliesTo, PropertyNames.uuid) : base(group, appliesTo, PropertyNames.uuid, Messages.UUID_SEARCH)
{ {
} }
@ -1185,6 +1188,24 @@ namespace XenAdmin.Controls.XenSearch
} }
} }
// Search for UUID as a string
internal class UuidStringQueryType: StringPropertyQueryType
{
internal UuidStringQueryType(int group, ObjectTypes appliesTo)
: base(group, appliesTo, PropertyNames.uuid)
{ }
public override object[] MatchTypeComboButtonEntries
{
get {
return new ExtraComboEntry[] {
new ExtraComboEntry(StringPropertyQuery.PropertyQueryType.startswith),
new ExtraComboEntry(StringPropertyQuery.PropertyQueryType.exactmatch)
};
}
}
}
internal class IPAddressQueryType : PropertyQueryType<List<ComparableAddress>> internal class IPAddressQueryType : PropertyQueryType<List<ComparableAddress>>
{ {
internal IPAddressQueryType(int group, ObjectTypes appliesTo, PropertyNames property) internal IPAddressQueryType(int group, ObjectTypes appliesTo, PropertyNames property)

View File

@ -266,7 +266,7 @@ namespace XenAdmin.XenSearch
PropertyNames_i18n[PropertyNames.description] = Messages.DESCRIPTION; PropertyNames_i18n[PropertyNames.description] = Messages.DESCRIPTION;
PropertyNames_i18n[PropertyNames.host] = Messages.SERVER; PropertyNames_i18n[PropertyNames.host] = Messages.SERVER;
PropertyNames_i18n[PropertyNames.label] = Messages.NAME; PropertyNames_i18n[PropertyNames.label] = Messages.NAME;
PropertyNames_i18n[PropertyNames.uuid] = Messages.UUID_SEARCH; PropertyNames_i18n[PropertyNames.uuid] = Messages.UUID;
PropertyNames_i18n[PropertyNames.networks] = Messages.NETWORK; PropertyNames_i18n[PropertyNames.networks] = Messages.NETWORK;
PropertyNames_i18n[PropertyNames.os_name] = Messages.OPERATING_SYSTEM; PropertyNames_i18n[PropertyNames.os_name] = Messages.OPERATING_SYSTEM;
PropertyNames_i18n[PropertyNames.pool] = Messages.POOL; PropertyNames_i18n[PropertyNames.pool] = Messages.POOL;