<commit_before>'use strict';

import React from 'react';
import memoize from 'memoize-one';
import _ from 'underscore';
import url from 'url';
import { DropdownItem, DropdownButton, Modal } from 'react-bootstrap';
import { getAbstractTypeForType } from '@hms-dbmi-bgm/shared-portal-components/es/components/util/schema-transforms';
import { SearchView as CommonSearchView } from '@hms-dbmi-bgm/shared-portal-components/es/components/browse/SearchView';
import { console, isSelectAction, ajax, navigate , object } from '@hms-dbmi-bgm/shared-portal-components/es/components/util';
import { Alerts } from '@hms-dbmi-bgm/shared-portal-components/es/components/ui/Alerts';
import { columnExtensionMap } from './columnExtensionMap';
import { memoizedUrlParse } from './../globals';
import { Schemas } from './../util';


const microscopyColExtensionMap = _.extend({}, columnExtensionMap, {
    "microscope.Tier": { "widthMap": { "sm": 50, "md": 70, "lg": 80 } },
    "microscope.Manufacturer": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "microscope.Serial": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "microscope.Model": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "microscope.Type": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "submitted_by.display_title": { "widthMap": { "sm": 100, "md": 100, "lg": 120 } },
});
export default class MicroscopySearchView extends React.PureComponent {
    constructor(props) {
        super(props);
        this.handleModalCancel = this.handleModalCancel.bind(this);
        this.handleConfirm = _.throttle(this.handleConfirm.bind(this), 3000);
        this.handleMicroscopeNameChange = this.handleMicroscopeNameChange.bind(this);

        this.state = {
            show: false,
            tier: 1,
            validationTier: 1,
            microscopeName: '',
            cloneLoading: false
        };

        this.searchResultTableRef = React.createRef();
    }
    leftButtonDropDownButton() {
        const { show, tier, validationTier, microscopeName,cloneLoading } = this.state;
        const validationTierOptions=_.range(1,tier+1);
        return (
            <>
                <DropdownButton id="search-item-type-selector" onSelect={(eventKey, evt) => { this.onChangeCreateTier(eventKey) }}
                    title={'Crete New Configuration'} >
                    <DropdownItem eventKey="1" data-key="1" type="number" >
                        Tier 1
                    </DropdownItem>
                    <DropdownItem eventKey="2" data-key="2" type="number" >
                        Tier 2
                    </DropdownItem>
                    <DropdownItem eventKey="3" data-key="3" type="number" >
                        Tier 3
                    </DropdownItem>
                    <DropdownItem eventKey="4" data-key="4" type="number" >
                        Tier 4
                    </DropdownItem>
                    <DropdownItem eventKey="5" data-key="5" type="number" >
                        Tier 5
                    </DropdownItem>
                </DropdownButton>


                <Modal show={show} >
                    <Modal.Header>
                        <Modal.Title>New Microscope - Tier {tier} </Modal.Title>
                    </Modal.Header>
                    <Modal.Body><commit_msg>Create new config.Button draft<commit_after>'use strict';

import React from 'react';
import memoize from 'memoize-one';
import _ from 'underscore';
import url from 'url';
import { DropdownItem, DropdownButton, Modal } from 'react-bootstrap';
import { getAbstractTypeForType } from '@hms-dbmi-bgm/shared-portal-components/es/components/util/schema-transforms';
import { SearchView as CommonSearchView } from '@hms-dbmi-bgm/shared-portal-components/es/components/browse/SearchView';
import { console, isSelectAction, ajax, navigate , object } from '@hms-dbmi-bgm/shared-portal-components/es/components/util';
import { Alerts } from '@hms-dbmi-bgm/shared-portal-components/es/components/ui/Alerts';
import { columnExtensionMap } from './columnExtensionMap';
import { memoizedUrlParse } from './../globals';
import { Schemas } from './../util';


const microscopyColExtensionMap = _.extend({}, columnExtensionMap, {
    "microscope.Tier": { "widthMap": { "sm": 50, "md": 70, "lg": 80 } },
    "microscope.Manufacturer": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "microscope.Serial": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "microscope.Model": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "microscope.Type": { "widthMap": { "sm": 80, "md": 100, "lg": 120 } },
    "submitted_by.display_title": { "widthMap": { "sm": 100, "md": 100, "lg": 120 } },
});
export default class MicroscopySearchView extends React.PureComponent {
    constructor(props) {
        super(props);
        this.handleModalCancel = this.handleModalCancel.bind(this);
        this.handleConfirm = _.throttle(this.handleConfirm.bind(this), 3000);
        this.handleMicroscopeNameChange = this.handleMicroscopeNameChange.bind(this);

        this.state = {
            show: false,
            tier: 1,
            validationTier: 1,
            microscopeName: '',
            cloneLoading: false
        };

        this.searchResultTableRef = React.createRef();
    }
    leftButtonDropDownButton() {
        const { show, tier, validationTier, microscopeName,cloneLoading } = this.state;
        const validationTierOptions=_.range(1,tier+1);
        return (
            <>
                <DropdownButton id="search-item-type-selector" onSelect={(eventKey, evt) => { this.onChangeCreateTier(eventKey); }}
                    title={'Crete New Configuration'} >
                    <DropdownItem eventKey="1" data-key="1" type="number" >
                        Tier 1
                    </DropdownItem>
                    <DropdownItem eventKey="2" data-key="2" type="number" >
                        Tier 2
                    </DropdownItem>
                    <DropdownItem eventKey="3" data-key="3" type="number" >
                        Tier 3
                    </DropdownItem>
                    <DropdownItem eventKey="4" data-key="4" type="number" >
                        Tier 4
                    </DropdownItem>
                    <DropdownItem eventKey="5" data-key="5" type="number" >
                        Tier 5
                    </DropdownItem>
                </DropdownButton>


                <Modal show={show} >
                    <Modal.Header>
                        <Modal.Title>New Microscope - Tier {tier} </Modal.Title>
                    </Modal.Header>
                    <Modal.Body>
{'fraction_non_alphanumeric': 0.14238609112709832, 'fraction_numerical': 0.020983213429256596, 'mean_word_length': 2.2159036144578312, 'pattern_counts': {'":': 60, '<': 41, '<?xml version=': 0, '>': 43, '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': '1562648', 'n_tokens_mistral': 2089, 'n_tokens_neox': 1894, 'n_words': 402}