Explorer

html-ui.project-branches-page

description
The page of a project /p/<project>: its description and every branch with its status (main first, then in progress, waiting for review and done), the creator, the number of snapshots and the time of the latest snapshot. On the editable html-ui the creator of a branch can change its status here (definy_set_branch_status). info is the project text of main (html-ui.project-text), branches is GetProjectBranches. See docs/branch.md
type
Fn(
  language: String,
  editable: Boolean,
  me: String,
  project: String,
  accounts: String,
  info: @html-ui.response,
  branches: @html-ui.response
) -> @definy.service-io
expression
fn(language$990, editable$0, me$1, project$2, accounts$3, info$4, branches$5) =>
  let items$6 = @core.list-fold(
      T: @definy.json,
      A: List<@definy.json>,
      reducer: fn(acc$7, item$8) =>
        match @core.equal(left: @html-ui.json-string(value: $8, key: "projectName"), right: $2) {
          true =>
            @core.list-append(list: $7, item: $8),
          false =>
            $7
        },
      init: [],
      xs: @definy.json-get-array(value: $5.json, key: "branches")
    );
  let main$13 = @html-ui.branches-with-status(items: $6, status: "");
  let in_progress$14 = @html-ui.branches-with-status(items: $6, status: "in_progress");
  let review$15 = @html-ui.branches-with-status(items: $6, status: "review");
  let done$16 = @html-ui.branches-with-status(items: $6, status: "done");
  let description$17 = @html-ui.localized-text-in(
      texts: @definy.mcp-read-descriptions(value: @definy.json-get(value: $4.json, key: "descriptions")),
      language: $990,
      fallback: true
    );
  @html-ui.page(
    language: $990,
    title: $2,
    body: @html.concat(
      lists: [
        [
          @html.element(
            name: "nav",
            attributes: [],
            children: [
              @html.element(
                name: "a",
                attributes: [{name: "href", value: "/"}],
                children: [
                  @html.text(text: @html-ui.text(language: $990, en: "Projects", ja: "プロジェクト", eo: "Projektoj"))
                ]
              ),
              @html.text(text: " / "),
              @html.text(text: $2)
            ]
          ),
          @html.element(name: "h1", attributes: [], children: [@html.text(text: $2)])
        ],
        @html-ui.status-note(language: $990, response: $5),
        match @core.equal(left: $17, right: "") {
          true =>
            [],
          false =>
            [
              @html.element(name: "p", attributes: [{name: "class", value: "muted"}], children: [@html.text(text: $17)])
            ]
        },
        [
          @html.element(
            name: "p",
            attributes: [],
            children: [
              @html.element(
                name: "a",
                attributes: [
                  {
                    name: "href",
                    value: @core.string-concat(left: "/p/", right: @core.string-concat(left: $2, right: "/main"))
                  }
                ],
                children: [
                  @html.text(text: @html-ui.text(language: $990, en: "Open main", ja: "main を開く", eo: "Malfermi main"))
                ]
              ),
              @html.text(text: " · "),
              @html.element(
                name: "a",
                attributes: [
                  {
                    name: "href",
                    value: @core.string-concat(left: "/h/", right: @core.string-concat(left: $2, right: "/main"))
                  }
                ],
                children: [
                  @html.text(
                    text: @html-ui.text(
                      language: $990,
                      en: "Snapshot history of main",
                      ja: "main のスナップショット履歴",
                      eo: "Historio de momentfotoj de main"
                    )
                  )
                ]
              )
            ]
          ),
          @html.element(
            name: "h2",
            attributes: [],
            children: [
              @html.text(
                text: @core.string-join(
                  items: [
                    @html-ui.text(language: $990, en: "Branches", ja: "ブランチ", eo: "Branĉoj"),
                    " (",
                    @std.number-to-string(value: @core.list-length(value: $6)),
                    ")"
                  ],
                  separator: ""
                )
              )
            ]
          ),
          @html.element(
            name: "p",
            attributes: [{name: "class", value: "muted"}],
            children: [
              @html.text(
                text: @core.string-join(
                  items: [
                    @html-ui.branch-status-label(language: $990, status: "in_progress"),
                    " ",
                    @std.number-to-string(value: @core.list-length(value: $14)),
                    " · ",
                    @html-ui.branch-status-label(language: $990, status: "review"),
                    " ",
                    @std.number-to-string(value: @core.list-length(value: $15)),
                    " · ",
                    @html-ui.branch-status-label(language: $990, status: "done"),
                    " ",
                    @std.number-to-string(value: @core.list-length(value: $16)),
                    @html-ui.text(
                      language: $990,
                      en: " (the explorer on the left hides done branches unless shown)",
                      ja: " (左のエクスプローラーは完了したブランチを既定で隠します)",
                      eo: " (la esplorilo maldekstre kaŝas faritajn branĉojn, krom se montrataj)"
                    )
                  ],
                  separator: ""
                )
              )
            ]
          ),
          @html.element(
            name: "table",
            attributes: [{name: "class", value: "branches"}],
            children: [
              @html.element(
                name: "thead",
                attributes: [],
                children: [
                  @html.element(
                    name: "tr",
                    attributes: [],
                    children: @core.list-map(
                      T: String,
                      U: @html.node,
                      f: fn(item$18) =>
                        @html.element(name: "th", attributes: [], children: [@html.text(text: $18)]),
                      xs: [
                        @html-ui.text(language: $990, en: "Branch", ja: "ブランチ", eo: "Branĉo"),
                        @html-ui.text(language: $990, en: "Status", ja: "状態", eo: "Stato"),
                        @html-ui.text(language: $990, en: "Created by", ja: "作成者", eo: "Kreinto"),
                        @html-ui.text(language: $990, en: "Snapshots", ja: "スナップショット", eo: "Momentfotoj"),
                        @html-ui.text(
                          language: $990,
                          en: "Latest snapshot",
                          ja: "最新のスナップショット",
                          eo: "Lasta momentfoto"
                        )
                      ]
                    )
                  )
                ]
              ),
              @html.element(
                name: "tbody",
                attributes: [],
                children: @core.list-map(
                  T: @definy.json,
                  U: @html.node,
                  f: fn(item$19) =>
                    @html-ui.project-branch-row(language: $990, editable: $0, me: $1, accounts: $3, project: $2, item: $19),
                  xs: @core.list-concat(left: @core.list-concat(left: $13, right: $14), right: @core.list-concat(left: $15, right: $16))
                )
              )
            ]
          ),
          @html-ui.time-script
        ],
        match $0 {
          true =>
            [
              @html.element(
                name: "script",
                attributes: [{name: "type", value: "module"}],
                children: [@html.text(text: @html-ui.tool-script)]
              )
            ],
          false =>
            []
        }
      ]
    )
  )
visibility
public
html-ui.project-branches-page (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: OyIj1nx4AQevceKOGvjdOaRhoTDiXJPEhXxgtbR2R2Y
content hash: mLFNBAS2HPxNK-WkyaNIuDIv-KmY_y5zDfTQsOG_Z6A