<commit_before>window.DataDash = ReactiveComponent
  displayName: 'DataDash'

  render : ->

    subdomain = fetch '/subdomain'
    current_user = fetch '/current_user'

    if current_user.is_super_admin
      tables = ['Users', 'Proposals', 'Opinions', 'Points', 'Comments']
    else 
      tables = ['Proposals']

    paid = permit('configure paid feature') > 0

    query = ''
    user_tags = customization 'user_tags'
    if user_tags

      query = "?#{(v.key for v in user_tags).join('=1&')}" 

    DIV null, 

      if current_user.is_super_admin
        DIV 
          style: 
            marginBottom: 24
          BUTTON 
            onClick: => 
              if confirm("Are you sure you want to delete everything on this forum?")
                
                $.ajax
                  url: "/nuke_everything",
                  type: "PUT"
                  data: 
                    authenticity_token: current_user.csrf
                  success: =>
                    location.reload()

            "Delete all data on this forum"
      

      if !paid
        UpgradeForumButton
          big: true
          text: "Upgrade to enable data import and export"

      FORM 
        action: "/dashboard/export#{query}"
        method: 'post'
        style: 
          pointerEvents: if !paid then 'none'
          opacity: if !paid then .4

        INPUT 
          type: 'hidden'
          name: 'authenticity_token'
          value: current_user.csrf

        H4
          style: 
            fontSize: 20
            marginBottom: 12

          "Export data from your forum"

        DIV 
          className: 'explanation'
          "A download will begin in a couple seconds after hitting export. The zip file contains four spreadsheets: opinions, points, proposals, and users."

        BUTTON
          type: 'submit'
          className: 'btn' 
          style: 
            marginTop: 18
            fontSize: 20

          'Export'




<commit_msg>flash message when exporting, as it can take a little while<commit_after>window.DataDash = ReactiveComponent
  displayName: 'DataDash'

  render : ->

    subdomain = fetch '/subdomain'
    current_user = fetch '/current_user'

    if current_user.is_super_admin
      tables = ['Users', 'Proposals', 'Opinions', 'Points', 'Comments']
    else 
      tables = ['Proposals']

    paid = permit('configure paid feature') > 0

    query = ''
    user_tags = customization 'user_tags'
    if user_tags

      query = "?#{(v.key for v in user_tags).join('=1&')}" 

    DIV null, 

      if current_user.is_super_admin
        DIV 
          style: 
            marginBottom: 24
          BUTTON 
            onClick: => 
              if confirm("Are you sure you want to delete everything on this forum?")
                
                $.ajax
                  url: "/nuke_everything",
                  type: "PUT"
                  data: 
                    authenticity_token: current_user.csrf
                  success: =>
                    location.reload()

            "Delete all data on this forum"
      

      if !paid
        UpgradeForumButton
          big: true
          text: "Upgrade to enable data import and export"

      FORM 
        action: "/dashboard/export#{query}"
        method: 'post'
        style: 
          pointerEvents: if !paid then 'none'
          opacity: if !paid then .4

        INPUT 
          type: 'hidden'
          name: 'authenticity_token'
          value: current_user.csrf

        H4
          style: 
            fontSize: 20
            marginBottom: 12

          "Export data from your forum"

        DIV 
          className: 'explanation'
          "A download will begin in a couple seconds after hitting export. The zip file contains four spreadsheets: opinions, points, proposals, and users."

        INPUT
          type: 'submit'
          className: 'btn' 
          style: 
            marginTop: 18
            fontSize: 20

          onClick: => 
            show_flash(translator('admin.flashes.export_started', "Your export has started. It can take a little while."))

          value: 'Export'





{'fraction_non_alphanumeric': 0.08279181708784597, 'fraction_numerical': 0.006738868832731649, 'mean_word_length': 1.5233758348512447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3208743', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1066, 'n_words': 343}