@@ -13,6 +13,7 @@ import { ModelLink, OTALink, VendorLink } from '../vendor-links/vendor-links';
1313import { useTranslation , WithTranslation , withTranslation } from 'react-i18next' ;
1414import { Column } from 'react-table' ;
1515import { Table } from '../grid/ReactTableCom' ;
16+ import cx from 'classnames' ;
1617
1718type OtaRowProps = {
1819 device : Device ;
@@ -21,7 +22,7 @@ type OtaRowProps = {
2122
2223const StateCell : FunctionComponent < OtaRowProps & OtaApi > = ( props ) => {
2324 const { t } = useTranslation ( 'ota' ) ;
24- const { device, state, checkOTA, updateOTA } = props ;
25+ const { device, state, checkOTA, scheduleOTA , unscheduleOTA , updateOTA } = props ;
2526 const otaState = ( state ?. update ?? { } ) as OTAState ;
2627 switch ( otaState . state ) {
2728 case 'updating' :
@@ -40,20 +41,67 @@ const StateCell: FunctionComponent<OtaRowProps & OtaApi> = (props) => {
4041 ) ;
4142 case 'available' :
4243 return (
43- < Button < string >
44- className = "btn btn-danger btn-sm"
45- onClick = { updateOTA }
46- item = { device . friendly_name }
47- prompt
48- >
49- { t ( 'update' ) }
50- </ Button >
44+ < div className = "btn-group btn-group-sm" role = "group" >
45+ < Button < string >
46+ className = "btn btn-danger btn-sm me-1"
47+ onClick = { updateOTA }
48+ item = { device . friendly_name }
49+ prompt
50+ >
51+ { t ( 'update' ) }
52+ </ Button >
53+ < Button < string >
54+ className = "btn btn-sm btn-info"
55+ onClick = { scheduleOTA }
56+ item = { device . friendly_name }
57+ title = { t ( 'schedule' ) }
58+ prompt
59+ >
60+ < i className = { cx ( 'fa' , 'fa-clock' ) } />
61+ </ Button >
62+ </ div >
63+ ) ;
64+ case 'scheduled' :
65+ return (
66+ < div className = "btn-group btn-group-sm" role = "group" >
67+ < Button < string >
68+ className = "btn btn-primary btn-sm me-1"
69+ onClick = { checkOTA }
70+ item = { device . friendly_name }
71+ >
72+ { t ( 'check' ) }
73+ </ Button >
74+ < Button < string >
75+ className = { cx ( 'btn' , 'btn-sm' , 'btn-danger' ) }
76+ onClick = { unscheduleOTA }
77+ item = { device . friendly_name }
78+ title = { t ( 'scheduled' ) }
79+ prompt
80+ >
81+ < i className = { cx ( 'fa' , 'fa-clock' ) } />
82+ </ Button >
83+ </ div >
5184 ) ;
5285 default :
5386 return (
54- < Button < string > className = "btn btn-primary btn-sm" onClick = { checkOTA } item = { device . friendly_name } >
55- { t ( 'check' ) }
56- </ Button >
87+ < div className = "btn-group btn-group-sm" role = "group" >
88+ < Button < string >
89+ className = "btn btn-primary btn-sm me-1"
90+ onClick = { checkOTA }
91+ item = { device . friendly_name }
92+ >
93+ { t ( 'check' ) }
94+ </ Button >
95+ < Button < string >
96+ className = { cx ( 'btn' , 'btn-sm' , 'btn-info' ) }
97+ onClick = { scheduleOTA }
98+ item = { device . friendly_name }
99+ title = { t ( 'schedule' ) }
100+ prompt
101+ >
102+ < i className = { cx ( 'fa' , 'fa-clock' ) } />
103+ </ Button >
104+ </ div >
57105 ) ;
58106 }
59107} ;
@@ -85,8 +133,8 @@ class OtaPage extends Component<PropsFromStore & OtaApi & WithTranslation<'ota'>
85133 otaDevices . forEach ( ( { device } ) => checkOTA ( device . friendly_name ) ) ;
86134 } ;
87135 render ( ) {
88- const { checkOTA, updateOTA, t } = this . props ;
89- const otaApi = { checkOTA, updateOTA } ;
136+ const { checkOTA, scheduleOTA , unscheduleOTA , updateOTA, t } = this . props ;
137+ const otaApi = { checkOTA, scheduleOTA , unscheduleOTA , updateOTA } ;
90138 const otaDevices = this . getAllOtaDevices ( ) ;
91139 const columns : Column < OtaGridData > [ ] = [
92140 {
0 commit comments