cc-os/plugins/os-backlog/lib/backlog/board_spec.rb

35 lines
1.3 KiB
Ruby
Raw Normal View History

module Backlog
# The uniform board contract every os-backlog board must have: list order
# and the enforced label set. Values only — no client/network code.
module BoardSpec
# Lists in required left-to-right order.
LISTS = %w[Backlog Next Doing Waiting Review Done].freeze
# Label name => ordered candidate colors, tried in turn until the server
# accepts one (Planka's palette-name whitelist is not documented, so we
# can't assert it in advance — cf. planka-api gem's Priority::COLOR_CANDIDATES
# pattern). The first candidate in each list is the verified-good default.
LABEL_COLOR_CANDIDATES = {
"P0" => %w[berry-red red-burgundy salsa-red],
"P1" => %w[pumpkin-orange orange-peel sunset-orange],
"P2" => %w[egg-yellow sunny-grass bright-moss],
"P3" => %w[steel-grey morning-sky light-cocoa],
"hitl" => %w[tank-green bright-moss lagoon-blue],
"semi" => %w[lagoon-blue summer-sky navy-blue],
"afk-ready" => %w[antique-blue bright-moss slate-blue]
}.freeze
LABEL_NAMES = LABEL_COLOR_CANDIDATES.keys.freeze
ARCHIVE_PREFIX = "archived--"
class << self
def archived_name(name) = "#{ARCHIVE_PREFIX}#{name}"
def archived?(name) = name.to_s.start_with?(ARCHIVE_PREFIX)
def active_name(name) = archived?(name) ? name.sub(ARCHIVE_PREFIX, "") : name
end
end
end