<commit_before>#= require kubernetes/components/clusters/item

# import
{ div, span, label, select, option, input, i, table, thead, tbody, tr, th, td, button } = React.DOM
{ connect } = ReactRedux
{ ClusterItem, openNewClusterDialog, fetchClusters } = kubernetes



Clusters = React.createClass

  componentDidMount: ->
    @props.loadClusters()

  render: ->
    {flashError, isFetching, clusters, handleNewCluster, error} = @props

    div null,
      if flashError or error
        div className: 'alert alert-error alert-dismissible',
          button className: 'close', type: 'button', 'data-dismiss': 'alert',
            span null,
              '\u00D7' # &times;
          flashError
          error

      unless clusters && clusters.length
        div className: 'toolbar toolbar-controlcenter',
          div className: 'main-control-buttons',
            button className: "btn btn-primary", onClick: ((e) => e.preventDefault(); handleNewCluster()),
              "Create Cluster"


      table className: 'table',
        thead null,
          tr null,
            th null, 'Cluster'
            th null, 'Status'
            th className: 'pool-info-column', 'Nodepools'
            th className: 'pool-info-column', 'Nodepool Status'
            th className: 'snug'


        tbody null,
          if isFetching
            tr null,
              td colSpan: '5',
                span className: 'spinner'
          else
            if clusters && clusters.length
              for cluster in clusters
                React.createElement ClusterItem, cluster: cluster, key: cluster.name

            else
              tr null,
                td colSpan: '5',
                  'No clusters found'

<commit_msg>improve error handling for api error<commit_after>#= require kubernetes/components/clusters/item

# import
{ div, span, label, select, option, input, i, table, thead, tbody, tr, th, td, button } = React.DOM
{ connect } = ReactRedux
{ ClusterItem, openNewClusterDialog, fetchClusters } = kubernetes



Clusters = React.createClass

  componentDidMount: ->
    @props.loadClusters()

  render: ->
    {flashError, isFetching, clusters, handleNewCluster, error} = @props

    div null,
      if flashError or error
        div className: 'alert alert-error alert-dismissible',
          button className: 'close', type: 'button', 'data-dismiss': 'alert',
            span null,
              '\u00D7' # &times;
          flashError
          error

      unless clusters && clusters.length
        div className: 'toolbar toolbar-controlcenter',
          div className: 'main-control-buttons',
            button className: "btn btn-primary", onClick: ((e) => e.preventDefault(); handleNewCluster()),
              "Create Cluster"


      table className: 'table',
        thead null,
          tr null,
            th null, 'Cluster'
            th null, 'Status'
            th className: 'pool-info-column', 'Nodepools'
            th className: 'pool-info-column', 'Nodepool Status'
            th className: 'snug'


        tbody null,
          if isFetching
            tr null,
              td colSpan: '5',
                span className: 'spinner'
          else
            if clusters && clusters.length
              for cluster in clusters
                React.createElement ClusterItem, cluster: cluster, key: cluster.name

            else
              tr null,
                td colSpan: '5',
                  if error
                    'Could not retrieve clusters'
                  else
                    'No clusters found'


{'fraction_non_alphanumeric': 0.09762900976290098, 'fraction_numerical': 0.002789400278940028, 'mean_word_length': 1.8710968775020016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6724332', 'n_tokens_mistral': 958, 'n_tokens_neox': 917, 'n_words': 292}