涂煌豪
2022-04-19 7ee2437b006cfc30e940cfb1711bf42f2ca3553d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<aura:component controller="EinsteinVisionController">
    
    <aura:attribute name="dataset" type="Object"/>
    <aura:attribute name="models" type="Object[]"/>
    <aura:attribute name="currentTab" type="String" default="labels"/>
    
    <aura:registerEvent name="onchange" type="c:EinsteinVisionDatasetEvent"/>
    
    <lightning:card title="{!v.dataset.name}" iconName="utility:preview">
        
        <aura:set attribute="actions">
            <aura:if isTrue="{!v.currentTab=='labels'}">
                <lightning:button label="Train" onclick="{!c.onTrainModel}" />
                <lightning:button label="Delete" onclick="{!c.onDeleteDataset}" />
            </aura:if>
            <aura:if isTrue="{!v.currentTab=='models'}">
                <lightning:button label="Refresh Models" onclick="{!c.onRefresh}" />
            </aura:if>                
        </aura:set>
 
        Dataset Id: {!v.dataset.id}
        <lightning:tabset >
            <lightning:tab label="Labels" onactive="{!c.onLabelsTab}">                
                <table class="slds-table slds-table--bordered slds-table--cell-buffer">
                    <thead>
                        <tr class="slds-text-title--caps">
                            <th scope="col">
                                <div class="slds-truncate" title="Name">Label</div>
                            </th>
                            <th scope="col">
                                <div class="slds-truncate" title="Examples">Examples</div>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <aura:iteration items="{!v.dataset.labelSummary.labels}" var="label">
                            <tr>
                                <td data-label="Account Name">
                                    <div class="slds-truncate" title="{!label.name}">{!label.name}</div>
                                </td>
                                <td data-label="Account Name">
                                    <div class="slds-truncate" title="{!label.numExamples}">{!label.numExamples}</div>
                                </td>
                            </tr>
                        </aura:iteration>
                    </tbody>
                </table>
            </lightning:tab>
            <lightning:tab label="Models" onactive="{!c.onModelsTab}">
                <table class="slds-table slds-table--bordered slds-table--cell-buffer">
                    <thead>
                        <tr class="slds-text-title--caps">
                            <th scope="col">
                                <div class="slds-truncate" title="Model Id">Model Id</div>
                            </th>
                            <th scope="col">
                                <div class="slds-truncate" title="Progress">Progress</div>
                            </th>
                            <th scope="col">
                                <div class="slds-truncate" title="Status">Status</div>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <aura:iteration items="{!v.models}" var="model">
                            <tr>
                                <td data-label="Model Id">
                                    <div class="slds-truncate" title="{!model.modelId}">{!model.modelId}</div>
                                </td>
                                <td data-label="Progress">
                                    <div class="slds-truncate" title="{!model.progress}">{!model.progress}</div>
                                </td>
                                <td data-label="Status">
                                    <div class="slds-truncate" title="{!model.status}">{!model.status}</div>
                                </td>
                            </tr>
                        </aura:iteration>
                    </tbody>
                </table>
            </lightning:tab>
        </lightning:tabset>    
        
    </lightning:card>
    
</aura:component>