PaiTrialLog.tsx 2.03 KB
Newer Older
1
import * as React from 'react';
2
import { DOWNLOAD_IP } from '@static/const';
3
import PaiTrialChild from './PaiTrialChild';
4
import LogPathChild from './LogPathChild';
5
6
7
8

interface PaitrialLogProps {
    logStr: string;
    id: string;
9
    logCollection: boolean;
10
11
12
13
14
15
16
}

class PaitrialLog extends React.Component<PaitrialLogProps, {}> {
    constructor(props: PaitrialLogProps) {
        super(props);
    }

Lijiao's avatar
Lijiao committed
17
    render(): React.ReactNode {
18
        const { logStr, id, logCollection } = this.props;
19
        const isTwopath = logStr.indexOf(',') !== -1 ? true : false;
20
21
22
        return (
            <div>
                <div>
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
                    {isTwopath ? (
                        <div>
                            {logCollection ? (
                                <div>
                                    <a
                                        target='_blank'
                                        rel='noopener noreferrer'
                                        href={`${DOWNLOAD_IP}/trial_${id}.log`}
                                        style={{ marginRight: 10 }}
                                    >
                                        Trial stdout
                                    </a>
                                    <a target='_blank' rel='noopener noreferrer' href={logStr.split(',')[1]}>
                                        NFS log
                                    </a>
                                </div>
                            ) : (
                                <div>
                                    <LogPathChild eachLogpath={logStr.split(',')[0]} logName='Trial stdout:' />
                                    <LogPathChild eachLogpath={logStr.split(',')[1]} logName='Log on NFS:' />
                                </div>
                            )}
                        </div>
                    ) : (
                        <PaiTrialChild logString={logStr} id={id} logCollect={logCollection} />
                    )}
49
50
51
52
53
54
55
                </div>
            </div>
        );
    }
}

export default PaitrialLog;