<commit_before>// @flow
/* eslint-disable jsx-a11y/href-no-hash */

import _ from "lodash";
import * as React from "react";
import { Table, Tag, Icon, Spin, Button, Input, Modal } from "antd";
import TemplateHelpers from "libs/template_helpers";
import Utils from "libs/utils";
import Request from "libs/request";
import app from "app";
import messages from "messages";
import type { APIProjectType } from "admin/api_flow_types";

const { Column } = Table;
const { Search } = Input;

type State = {
  isLoading: boolean,
  projects: Array<APIProjectType>,
  searchQuery: string,
};

class ProjectListView extends React.PureComponent<{}, State> {
  state = {
    isLoading: true,
    projects: [],
    searchQuery: "",
  };

  componentDidMount() {
    this.fetchData();
  }

  async fetchData(): Promise<void> {
    const url = "/api/projects";
    const projects = await Request.receiveJSON(url);

    this.setState({
      isLoading: false,
      projects,
    });
  }

  handleSearch = (event: SyntheticInputEvent<>): void => {
    this.setState({ searchQuery: event.target.value });
  };

  deleteProject = async (project: APIProjectType) => {
    Modal.confirm({
      title: messages["project.delete"],
      onOk: () => {
        this.setState({
          isLoading: true,
        });

        const url = `/api/projects/${project.name}`;
        Request.receiveJSON(url, {
          method: "DELETE",<commit_msg>quick fix for project list view<commit_after>// @flow
/* eslint-disable jsx-a11y/href-no-hash */

import _ from "lodash";
import * as React from "react";
import { Table, Tag, Icon, Spin, Button, Input, Modal } from "antd";
import TemplateHelpers from "libs/template_helpers";
import Utils from "libs/utils";
import Request from "libs/request";
import app from "app";
import messages from "messages";
import type { APIProjectType } from "admin/api_flow_types";

const { Column } = Table;
const { Search } = Input;

type State = {
  isLoading: boolean,
  projects: Array<APIProjectType>,
  searchQuery: string,
};

class ProjectListView extends React.PureComponent<{}, State> {
  state = {
    isLoading: true,
    projects: [],
    searchQuery: "",
  };

  componentDidMount() {
    this.fetchData();
  }

  async fetchData(): Promise<void> {
    const url = "/api/projects";
    const projects = await Request.receiveJSON(url);

    this.setState({
      isLoading: false,
      projects: projects.filter(p => p.owner),
    });
  }

  handleSearch = (event: SyntheticInputEvent<>): void => {
    this.setState({ searchQuery: event.target.value });
  };

  deleteProject = async (project: APIProjectType) => {
    Modal.confirm({
      title: messages["project.delete"],
      onOk: () => {
        this.setState({
          isLoading: true,
        });

        const url = `/api/projects/${project.name}`;
        Request.receiveJSON(url, {
          method: "DELETE",
{'fraction_non_alphanumeric': 0.14364832121841467, 'fraction_numerical': 0.0013845621322256837, 'mean_word_length': 3.256259204712813, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 18, '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': '3314650', 'n_tokens_mistral': 894, 'n_tokens_neox': 873, 'n_words': 228}