render()

in source/idea/idea-cluster-manager/webapp/src/pages/hpc/update-hpc-license.tsx [157:384]


    render() {
        const getOpenPBSResourceDefText = () => {
            return `${this.state.license.name} type=long`;
        };
        const getOpenPBSServerDynResourceText = () => {
            return `server_dyn_res: "${this.state.license.name} !python ${this.state.license.availability_check_cmd}"`;
        };

        return (
            <IdeaAppLayout
                ideaPageId={this.props.ideaPageId}
                toolsOpen={this.props.toolsOpen}
                tools={this.props.tools}
                onToolsChange={this.props.onToolsChange}
                onPageChange={this.props.onPageChange}
                sideNavHeader={this.props.sideNavHeader}
                sideNavItems={this.props.sideNavItems}
                onSideNavChange={this.props.onSideNavChange}
                sideNavActivePath={"/soca/licenses"}
                onFlashbarChange={this.props.onFlashbarChange}
                flashbarItems={this.props.flashbarItems}
                breadcrumbItems={[
                    {
                        text: "IDEA",
                        href: "#/",
                    },
                    {
                        text: "Scale-Out Computing",
                        href: "#/soca/active-jobs",
                    },
                    {
                        text: "Licenses",
                        href: "#/soca/licenses",
                    },
                    {
                        text: this.isCreate() ? "Create License Resource" : "Update License Resource",
                        href: "#",
                    },
                ]}
                contentType={"wizard"}
                content={
                    <Wizard
                        activeStepIndex={this.state.activeStepIndex}
                        onNavigate={(event) => {
                            if (event.detail.requestedStepIndex === 0) {
                                this.setState({
                                    activeStepIndex: 0,
                                });
                            } else if (event.detail.requestedStepIndex === 1) {
                                if (!this.createForm.current!.validate()) {
                                    return;
                                }
                                let values = this.createForm.current!.getValues();
                                this.createOrUpdate(values, true);
                            }
                        }}
                        onSubmit={() => {
                            this.createOrUpdate(this.state.license, false);
                        }}
                        onCancel={() => {
                            this.props.navigate("/soca/licenses");
                        }}
                        steps={[
                            {
                                title: "Define License Resource",
                                errorText: this.state.errorMessage,
                                content: (
                                    <Container>
                                        <SpaceBetween size={"m"}>
                                            {this.state.showForm && (
                                                <IdeaForm
                                                    ref={this.createForm}
                                                    name={"license-resource"}
                                                    showActions={false}
                                                    values={this.state.license}
                                                    params={[
                                                        {
                                                            name: "title",
                                                            title: "Title",
                                                            description: "Enter a user friendly license resource title",
                                                            data_type: "str",
                                                            param_type: "text",
                                                            validate: {
                                                                required: true,
                                                            },
                                                        },
                                                        {
                                                            name: "name",
                                                            title: "Resource Name",
                                                            description: "Enter name for the license resource",
                                                            help_text: "Name cannot contain white spaces or special characters and must be of format: {app}_lic_{feature}",
                                                            data_type: "str",
                                                            param_type: "text",
                                                            readonly: this.isUpdate(),
                                                            validate: {
                                                                required: true,
                                                                regex: "^(^[a-z][a-z0-9]*)_lic_([a-z][a-z0-9]*)$",
                                                                message: "Should be in the format: {app}_lic_{feature} where {app} and {feature} only use numbers and lowercase alphabets"
                                                            },
                                                        },
                                                        {
                                                            name: "reserved_count",
                                                            title: "Reserved Licenses",
                                                            description: "Prevent HPC to consume all license by keeping a reserved pool for local usage",
                                                            data_type: "int",
                                                            param_type: "text",
                                                        },
                                                        {
                                                            name: "availability_check_cmd",
                                                            title: "Availability Check Script",
                                                            description: "The script to be executed to with applicable parameters to get the available license count",
                                                            data_type: "str",
                                                            param_type: "text",
                                                            validate: {
                                                                required: true,
                                                            },
                                                        },
                                                    ]}
                                                />
                                            )}
                                            <Alert onDismiss={() => false} dismissAriaLabel="Close alert" header="Info">
                                                <li>IDEA generates a template license check script when scheduler is deployed.</li>
                                                <li>
                                                    Ensure you have updated <b>{this.getPythonScriptPath()}</b> as per your environment and requirements after first time deployment.
                                                </li>
                                                <ExpandableSection header={"license_check.py Usage"}>
                                                    <code className="idea-code-block">
                                                        python {this.getPythonScriptPath()} --help <br />
                                                        usage: license_check.py [-h] -s [SERVER] -p [PORT] -f [FEATURE] <br />
                                                        <br />
                                                        optional arguments:
                                                        <br />
                                                        &nbsp;&nbsp;-h, --help show this help message and exit
                                                        <br />
                                                        &nbsp;&nbsp;-s [SERVER], --server [SERVER]
                                                        <br />
                                                        &nbsp;&nbsp;FlexLM hostname
                                                        <br />
                                                        &nbsp;&nbsp;-p [PORT], --port [PORT]
                                                        <br />
                                                        &nbsp;&nbsp;FlexLM Port
                                                        <br />
                                                        &nbsp;&nbsp;-f [FEATURE], --feature [FEATURE]
                                                        <br />
                                                        &nbsp;&nbsp;FlexLM Feature
                                                        <br />
                                                    </code>
                                                </ExpandableSection>
                                            </Alert>
                                        </SpaceBetween>
                                    </Container>
                                ),
                            },
                            {
                                title: "Update OpenPBS Configuration",
                                errorText: this.state.errorMessage,
                                content: (
                                    <SpaceBetween size={"l"}>
                                        <Alert>A few manual configuration steps are required to configure the license resource in OpenPBS. Review the License Resource definition and follow the steps outlined below.</Alert>
                                        <Container
                                            header={
                                                <Header
                                                    variant={"h3"}
                                                    actions={
                                                        <SpaceBetween size={"s"}>
                                                            <Button
                                                                variant={"normal"}
                                                                onClick={() => {
                                                                    this.setState({
                                                                        activeStepIndex: 0,
                                                                    });
                                                                }}
                                                            >
                                                                Edit
                                                            </Button>
                                                        </SpaceBetween>
                                                    }
                                                >
                                                    License Resource
                                                </Header>
                                            }
                                        >
                                            <ColumnLayout variant={"text-grid"} columns={2}>
                                                <KeyValue title="Title" value={this.state.license.title} />
                                                <KeyValue title="Resource Name" value={this.state.license.name} clipboard={true} />
                                                <KeyValue title="Availability Check Script" value={this.state.license.availability_check_cmd} clipboard={true} />
                                                <KeyValue title="Reserved Licenses" value={this.state.license.reserved_count} />
                                            </ColumnLayout>
                                        </Container>
                                        <Container header={<Header variant={"h3"}>SSH into Scheduler EC2 Instance</Header>}>
                                            <ColumnLayout columns={2}>
                                                <Box>
                                                    <h3>SSH via SSM</h3>
                                                    <p>
                                                        <Link external={true} href={Utils.getSessionManagerConnectionUrl(AppContext.get().getAwsRegion(), this.state.schedulerInstanceId)}>
                                                            Connect via SSM
                                                        </Link>
                                                    </p>
                                                </Box>
                                                <Box>
                                                    <h3>SSH via Bastion Host</h3>
                                                    <p>
                                                        <Link external={true} href={"#/home/ssh-access"}>
                                                            SSH Connection Details
                                                        </Link>
                                                    </p>
                                                </Box>
                                            </ColumnLayout>
                                        </Container>
                                        <Container header={<Header variant={"h3"}>Update resourcedef</Header>}>
                                            <Box variant={"h4"}>
                                                Edit:{" "}
                                                <b>
                                                    <code>{OPENPBS_RESOURCE_DEF_FILE}</code>
                                                </b>
                                                <CopyToClipBoard text={OPENPBS_RESOURCE_DEF_FILE} feedback={`${OPENPBS_RESOURCE_DEF_FILE} copied`} />
                                            </Box>
                                            <p>
                                                Resources created on this file will be visible by OpenPBS and will be usable at qsub time via the -l parameter. Add your new resource with <b>type=long</b>.
                                            </p>
                                            <p>
                                                <code>{getOpenPBSResourceDefText()}</code>
                                                <CopyToClipBoard text={getOpenPBSResourceDefText()} feedback={`${getOpenPBSResourceDefText()} copied`} />
                                            </p>

                                            <p>Save and Close</p>
                                        </Container>
                                        <Container header={<Header variant={"h3"}>Update sched_config</Header>}>