<commit_before>namespace "Bixby.view.inventory", (exports, top) ->

  class exports.Host extends Stark.View
    el: "div.inventory_content"
    template: "inventory/host"

    bindings: [ "host" ]

    events:
      "click a.edit": ->
        @host_editor.show()

      "click button.refresh-facts": (e) ->
        e.preventDefault()
        return if $(e.target).hasClass("disabled")

        # modify button to display spinner
        $("button.refresh-facts").addClass("disabled")
        $("button.refresh-facts i").css({visibility: "hidden"})
        @spinner = new Bixby.view.Spinner($("button.refresh-facts"), { length: 3, width: 2, radius: 2, top: '-10px', left: '0' })

        view = @
        @host.update_facts (data, status, jqXHR) ->
          view.host = new Bixby.model.Host(data)
          view.redraw()

    links:
      "div.actions a.monitoring": [ "mon_view_host", (el) -> { host: @host } ]

    render: ->
      super
      @host_editor = @partial(exports.HostEditor, { host: @host })
      @<commit_msg>don't render host editor until needed<commit_after>namespace "Bixby.view.inventory", (exports, top) ->

  class exports.Host extends Stark.View
    el: "div.inventory_content"
    template: "inventory/host"

    bindings: [ "host" ]

    events:
      "click a.edit": ->
        host_editor = @partial(exports.HostEditor, { host: @host })
        host_editor.show()

      "click button.refresh-facts": (e) ->
        e.preventDefault()
        return if $(e.target).hasClass("disabled")

        # modify button to display spinner
        $("button.refresh-facts").addClass("disabled")
        $("button.refresh-facts i").css({visibility: "hidden"})
        @spinner = new Bixby.view.Spinner($("button.refresh-facts"), { length: 3, width: 2, radius: 2, top: '-10px', left: '0' })

        view = @
        @host.update_facts (data, status, jqXHR) ->
          view.host = new Bixby.model.Host(data)
          view.redraw()

    links:
      "div.actions a.monitoring": [ "mon_view_host", (el) -> { host: @host } ]
{'fraction_non_alphanumeric': 0.16519607843137254, 'fraction_numerical': 0.0058823529411764705, 'mean_word_length': 2.5933098591549295, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '255229', 'n_tokens_mistral': 686, 'n_tokens_neox': 647, 'n_words': 141}