Explorer

html-ui.project-branch-row

description
A row of the branch table of the project page (html-ui.project-branches-page): the branch, its status, the creator, the number of snapshots, the time of the latest snapshot, and for the creator on the editable html-ui the form to change the status (html-ui.branch-status-form). item is a branch of GetProjectBranches
type
Fn(
  language: String,
  editable: Boolean,
  me: String,
  accounts: String,
  project: String,
  item: @definy.json
) -> @html.node
expression
fn(language$990, editable$0, me$1, accounts$2, project$3, item$4) =>
  let branch$5 = @html-ui.json-string(value: $4, key: "branch");
  let status$6 = @html-ui.json-string(value: $4, key: "status");
  let creator$7 = @html-ui.json-string(value: $4, key: "creatorAccountId");
  @html.element(
    name: "tr",
    attributes: [
      {
        name: "class",
        value: @core.string-concat(
          left: "b-",
          right: match @core.equal(left: $6, right: "") {
            true =>
              "main",
            false =>
              $6
          }
        )
      }
    ],
    children: [
      @html.element(
        name: "td",
        attributes: [],
        children: [
          @html.element(
            name: "a",
            attributes: [{name: "href", value: @core.string-join(items: ["/p/", $3, "/", $5], separator: "")}],
            children: [@html.text(text: $5)]
          )
        ]
      ),
      @html.element(
        name: "td",
        attributes: [],
        children: match @core.equal(left: $6, right: "") {
          true =>
            [
              @html.element(
                name: "span",
                attributes: [{name: "class", value: "muted"}],
                children: [
                  @html.text(
                    text: @html-ui.text(language: $990, en: "main (always shown)", ja: "main (常に表示)", eo: "main (ĉiam montrata)")
                  )
                ]
              )
            ],
          false =>
            match @core.and(
                left: $0,
                right: @core.and(left: @core.not(value: @core.equal(left: $1, right: "")), right: @core.equal(left: $1, right: $7))
              ) {
              true =>
                [@html-ui.branch-status-form(language: $990, project: $3, branch: $5, status: $6)],
              false =>
                [
                  @html.element(
                    name: "span",
                    attributes: [{name: "class", value: @core.string-concat(left: "st st-", right: $6)}],
                    children: [@html.text(text: @html-ui.branch-status-label(language: $990, status: $6))]
                  )
                ]
            }
        }
      ),
      @html.element(
        name: "td",
        attributes: [],
        children: [
          @html-ui.account-link(account_id: $7, name: @html-ui.account-name-in(accounts: $2, account_id: $7))
        ]
      ),
      @html.element(
        name: "td",
        attributes: [{name: "class", value: "num"}],
        children: [
          @html.text(
            text: @std.number-to-string(
              value: match @definy.json-get-number(value: $4, key: "commitCount") {
                #some(count$8) =>
                  $8,
                #none(_) =>
                  0
              }
            )
          )
        ]
      ),
      @html.element(
        name: "td",
        attributes: [],
        children: match @definy.json-get(value: $4, key: "latestEvent") {
          #some(event$9) =>
            match @definy.json-get-number(value: $9, key: "timeMs") {
              #some(ms$10) =>
                [@html-ui.time-span(ms: @std.number-to-string(value: $10))],
              #none(_) =>
                []
            },
          #none(_) =>
            []
        }
      )
    ]
  )
visibility
public
html-ui.project-branch-row (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: U_fW8pYENXr35zdp_oC3aDEEsyEYqBSDfhG5BrD-pFs
content hash: MWcvlaUnExe1Kqus6EzM-LJFCwLpW73v0SNeseLoV1U