activity_host_scriptable_labels.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "activity_host_scriptable_labels.h"
  2. namespace sunrise::server::ui::activity_host::scriptable_labels {
  3. namespace catalog = state::build_data::scriptables;
  4. /** @return Stable UI text for one catalog build status. */
  5. const char* status(catalog::BuildStatus value) noexcept {
  6. switch (value) {
  7. case catalog::BuildStatus::idle:
  8. return "idle";
  9. case catalog::BuildStatus::queued:
  10. return "queued";
  11. case catalog::BuildStatus::building:
  12. return "building";
  13. case catalog::BuildStatus::ready:
  14. return "ready";
  15. case catalog::BuildStatus::failed:
  16. return "failed";
  17. }
  18. return "unknown";
  19. }
  20. /** @return Stable UI text for one package-presence classification. */
  21. const char* presence(catalog::GroupSafety value) noexcept {
  22. switch (value) {
  23. case catalog::GroupSafety::notApplicable:
  24. return "no declared slots";
  25. case catalog::GroupSafety::destinationSafe:
  26. return "all destination states";
  27. case catalog::GroupSafety::bubbleSafe:
  28. return "all bubble states";
  29. case catalog::GroupSafety::stateOnly:
  30. return "selected state only";
  31. case catalog::GroupSafety::incomplete:
  32. return "incomplete package read";
  33. case catalog::GroupSafety::ambiguous:
  34. return "duplicate identity";
  35. }
  36. return "unknown";
  37. }
  38. /** @return Stable UI text for one package-name evidence tier. */
  39. const char* provenance(catalog::NameProvenance value) noexcept {
  40. switch (value) {
  41. case catalog::NameProvenance::unresolved:
  42. return "unresolved";
  43. case catalog::NameProvenance::packageInline:
  44. return "package-inline hash match";
  45. case catalog::NameProvenance::packagePath:
  46. return "package-path hash match";
  47. case catalog::NameProvenance::packageIdentifierCandidate:
  48. return "package identifier candidate";
  49. }
  50. return "unresolved";
  51. }
  52. /** @return Stable UI text for one registry descriptor scope. */
  53. const char* scope(std::uint16_t descriptor) noexcept {
  54. switch (descriptor) {
  55. case 8:
  56. return "shared/8";
  57. case 24:
  58. return "registry/24";
  59. case 40:
  60. return "state-local/40";
  61. default:
  62. return "unknown";
  63. }
  64. }
  65. } // namespace sunrise::server::ui::activity_host::scriptable_labels