Skip to content
Snippets Groups Projects
Commit cf4edc71 authored by Jorge Camarero Vera's avatar Jorge Camarero Vera
Browse files

Creation of method toCamelCaseString() for cta-admin

parent 4dfd3ae1
No related branches found
No related tags found
No related merge requests found
......@@ -305,14 +305,13 @@ void TextFormatter::print(const DriveLsItem &drls_item)
//If there is a reason, we only want to display the beginning
std::string reason = cta::utils::postEllipsis(drls_item.reason(),NB_CHAR_REASON);
const std::string mountType = toString(ProtobufToMountType(drls_item.mount_type()));
push_back(
drls_item.logical_library(),
drls_item.drive_name(),
drls_item.host(),
(drls_item.desired_drive_state() == DriveLsItem::UP ? "Up" : "Down"),
mountType != "NO_MOUNT" ? mountType : "-",
toCamelCaseString(ProtobufToMountType(drls_item.mount_type())),
toString(ProtobufToDriveStatus(drls_item.drive_status())),
driveStatusSince,
drls_item.vid(),
......@@ -753,7 +752,7 @@ void TextFormatter::print(const ShowQueuesItem &sq_item) {
}
push_back(
toString(ProtobufToMountType(sq_item.mount_type())),
toCamelCaseString(ProtobufToMountType(sq_item.mount_type())),
sq_item.tapepool(),
sq_item.vo(),
sq_item.logical_library(),
......
......@@ -41,6 +41,25 @@ std::string toString(cta::common::dataStructures::MountType type) {
}
}
std::string toCamelCaseString(cta::common::dataStructures::MountType type) {
switch(type) {
case MountType::ArchiveForUser:
return "ArchiveForUser";
case MountType::ArchiveForRepack:
return "ArchiveForRepack";
case MountType::ArchiveAllTypes:
return "ArchiveAllTypes";
case MountType::Retrieve:
return "Retrieve";
case MountType::Label:
return "Label";
case MountType::NoMount:
return "-";
default:
return "Unknown";
}
}
MountType strToMountType(const std::string& mountTypeStr) {
if(mountTypeStr == "ARCHIVE_FOR_USER") return MountType::ArchiveForUser;
else if(mountTypeStr == "ARCHIVE_FOR_REPACK") return MountType::ArchiveForRepack;
......@@ -61,7 +80,7 @@ MountType getMountBasicType(MountType type) {
}
}
std::ostream & operator<<(std::ostream &os,
std::ostream & operator<<(std::ostream &os,
const cta::common::dataStructures::MountType &obj) {
return os << toString(obj);
}
......
......@@ -43,6 +43,11 @@ MountType getMountBasicType(MountType type);
*/
std::string toString(MountType type);
/**
* Convert enum to string in camel case format to show in cta-admnin
*/
std::string toCamelCaseString(cta::common::dataStructures::MountType type);
/**
* Convert string to enum. Needed to get values from DB.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment