constructor()

in source/console/src/Components/Create/Create.js [34:107]


    constructor(props){
        super(props);
        if (this.props.location.state && this.props.location.state.data.testId) {
            let fileType = '';
            if (this.props.location.state.data.testType && this.props.location.state.data.testType !== 'simple') {
                if (this.props.location.state.data.fileType) {
                    fileType = this.props.location.state.data.fileType;
                } else {
                    fileType = 'script';
                }
            }

            this.state = {
                isLoading: false,
                runningTasks: false,
                testId: this.props.location.state.data.testId,
                file: null,
                validFile: false,
                chooseNewFile: false,
                formValues: {
                    testName: this.props.location.state.data.testName,
                    testDescription: this.props.location.state.data.testDescription,
                    taskCount: this.props.location.state.data.taskCount,
                    concurrency: this.props.location.state.data.concurrency,
                    holdFor: this.props.location.state.data.holdFor.slice(0, -1),
                    holdForUnits: this.props.location.state.data.holdFor.slice(-1),
                    rampUp: this.props.location.state.data.rampUp.slice(0, -1),
                    rampUpUnits: this.props.location.state.data.rampUp.slice(-1),
                    endpoint: this.props.location.state.data.endpoint,
                    method: this.props.location.state.data.method,
                    body: JSON.stringify(this.props.location.state.data.body, null, 2),
                    headers: JSON.stringify(this.props.location.state.data.headers, null, 2),
                    testType: this.props.location.state.data.testType ? this.props.location.state.data.testType : 'simple',
                    fileType: fileType
                }
            }
        } else {
            this.state = {
                isLoading: false,
                runningTasks: false,
                testId: null,
                file: null,
                validFile: false,
                chooseNewFile: false,
                formValues: {
                    testName:'',
                    testDescription: '',
                    taskCount: 0,
                    concurrency:0,
                    holdFor: 0,
                    holdForUnits:'m',
                    rampUp: 0,
                    rampUpUnits: 'm',
                    endpoint: '',
                    method:'GET',
                    body: '',
                    headers: '',
                    testType: 'simple',
                    fileType: ''
                }
            };
        }

        this.form = React.createRef();
        this.handleSubmit = this.handleSubmit.bind(this);
        this.handleInputChange = this.handleInputChange.bind(this);
        this.setFormValue = this.setFormValue.bind(this);
        this.handleBodyPayloadChange = this.handleBodyPayloadChange.bind(this);
        this.handleHeadersChange = this.handleHeadersChange.bind(this);
        this.handleFileChange = this.handleFileChange.bind(this);
        this.handleCheckBox = this.handleCheckBox.bind(this);
        this.parseJson = this.parseJson.bind(this);
        this.listTasks = this.listTasks.bind(this);
    }