Explorer

html-ui.tree-parts

description
The response of /tree-parts/<project>/<branch>/<module>: the part rows of the module for the explorer, as an HTML fragment of li elements
type
Fn(project: String, branch: String, module: String) -> @definy.service-io
expression
fn(project$0, branch$1, module$2) =>
  @definy.read-branch-snapshot(
    project: $0,
    branch: $1,
    then: fn(commit$3, commits$4) =>
      #done<@definy.service-io>(#respond({
        status: 200,
        headers: [
          {name: "content-type", value: "text/html; charset=utf-8"},
          {name: "cache-control", value: "no-store"}
        ],
        body: #text<@definy.http-body>(@std.string-join(
          items: @core.list-map(
            T: @definy.stored-snapshot-part,
            U: String,
            f: fn(item$5) =>
              @html.to-string(
                node: @html.element(
                  name: "li",
                  attributes: [{name: "class", value: "t-part"}],
                  children: [
                    @html.element(
                      name: "a",
                      attributes: [
                        {name: "href", value: @core.string-join(items: ["/p/", $0, "/", $1, "/", $5.name], separator: "")}
                      ],
                      children: [
                        @html.text(
                          text: @core.string-slice(
                            value: $5.name,
                            start: @core.plus(left: @core.string-length(value: $2), right: 1),
                            end: @core.string-length(value: $5.name)
                          )
                        )
                      ]
                    )
                  ]
                )
              ),
            xs: match $3 {
              #some(found$6) =>
                @definy.snapshot-parts(modules: @html-ui.modules-named(modules: $6.commit.modules, name: $2, index: 0), index: 0),
              #none(_) =>
                []
            }
          ),
          separator: ""
        ))
      }))
  )
visibility
public
html-ui.tree-parts (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: D69M4WhoMVje-mcNkAPQHIS_8QcRe58sAEgTSrgkJDE
content hash: C7IN78Xdzw5ovDD04ldz_-lKnAyRBaTgF7bs9L6c8KM