@@ -25,7 +25,7 @@ abstract class ContainerState with _$ContainerState {
2525 @Default (null ) List <ContainerPs >? items,
2626 @Default (null ) List <ContainerImg >? images,
2727 @Default (null ) String ? version,
28- @Default (null ) ContainerErr ? error ,
28+ @Default (< ContainerErr > []) List < ContainerErr > errors ,
2929 @Default (null ) String ? runLog,
3030 @Default (ContainerType .docker) ContainerType type,
3131 @Default (false ) bool isBusy,
@@ -48,7 +48,7 @@ class ContainerNotifier extends _$ContainerNotifier {
4848 }
4949
5050 Future <void > setType (ContainerType type) async {
51- state = state.copyWith (type: type, error : null , runLog: null , items: null , images: null , version: null );
51+ state = state.copyWith (type: type, errors : [] , runLog: null , items: null , images: null , version: null );
5252 Stores .container.setType (type, hostId);
5353 sudoCompleter = Completer <bool >();
5454 await refresh ();
@@ -98,18 +98,20 @@ class ContainerNotifier extends _$ContainerNotifier {
9898
9999 /// Code 127 means command not found
100100 if (code == 127 || raw.contains (_dockerNotFound)) {
101- state = state.copyWith (error : ContainerErr (type: ContainerErrType .notInstalled));
101+ state = state.copyWith (errors : [ ContainerErr (type: ContainerErrType .notInstalled)] );
102102 return ;
103103 }
104104
105105 // Check result segments count
106106 final segments = raw.split (ScriptConstants .separator);
107107 if (segments.length != ContainerCmdType .values.length) {
108108 state = state.copyWith (
109- error: ContainerErr (
110- type: ContainerErrType .segmentsNotMatch,
111- message: 'Container segments: ${segments .length }' ,
112- ),
109+ errors: [
110+ ContainerErr (
111+ type: ContainerErrType .segmentsNotMatch,
112+ message: 'Container segments: ${segments .length }' ,
113+ ),
114+ ],
113115 );
114116 Loggers .app.warning ('Container segments: ${segments .length }\n $raw ' );
115117 return ;
@@ -119,10 +121,10 @@ class ContainerNotifier extends _$ContainerNotifier {
119121 final verRaw = ContainerCmdType .version.find (segments);
120122 try {
121123 final version = json.decode (verRaw)['Client' ]['Version' ];
122- state = state.copyWith (version: version, error : null );
124+ state = state.copyWith (version: version);
123125 } catch (e, trace) {
124126 state = state.copyWith (
125- error : ContainerErr (type: ContainerErrType .invalidVersion, message: '$e ' ),
127+ errors : [...state.errors, ContainerErr (type: ContainerErrType .invalidVersion, message: '$e ' )] ,
126128 );
127129 Loggers .app.warning ('Container version failed' , e, trace);
128130 }
@@ -140,7 +142,7 @@ class ContainerNotifier extends _$ContainerNotifier {
140142 state = state.copyWith (items: items);
141143 } catch (e, trace) {
142144 state = state.copyWith (
143- error : ContainerErr (type: ContainerErrType .parsePs, message: '$e ' ),
145+ errors : [...state.errors, ContainerErr (type: ContainerErrType .parsePs, message: '$e ' )] ,
144146 );
145147 Loggers .app.warning ('Container ps failed' , e, trace);
146148 }
@@ -162,7 +164,7 @@ class ContainerNotifier extends _$ContainerNotifier {
162164 state = state.copyWith (images: images);
163165 } catch (e, trace) {
164166 state = state.copyWith (
165- error : ContainerErr (type: ContainerErrType .parseImages, message: '$e ' ),
167+ errors : [...state.errors, ContainerErr (type: ContainerErrType .parseImages, message: '$e ' )] ,
166168 );
167169 Loggers .app.warning ('Container images failed' , e, trace);
168170 }
@@ -189,7 +191,7 @@ class ContainerNotifier extends _$ContainerNotifier {
189191 }
190192 } catch (e, trace) {
191193 state = state.copyWith (
192- error : ContainerErr (type: ContainerErrType .parseStats, message: '$e ' ),
194+ errors : [...state.errors, ContainerErr (type: ContainerErrType .parseStats, message: '$e ' )] ,
193195 );
194196 Loggers .app.warning ('Parse docker stats: $statsRaw ' , e, trace);
195197 }
0 commit comments