selfprivacy.org.app/lib/logic/cubit/server_volumes/server_volume_state.dart

43 lines
1.1 KiB
Dart
Raw Normal View History

2022-08-24 23:45:02 +00:00
part of 'server_volume_cubit.dart';
class ApiServerVolumeState extends ServerInstallationDependendState {
2022-09-02 05:59:46 +00:00
const ApiServerVolumeState(
this._volumes,
this.status,
this.usesBinds,
this._diskStatus,
2022-09-02 05:59:46 +00:00
);
2022-08-24 23:45:02 +00:00
ApiServerVolumeState.initial()
: this(const [], LoadingStatus.uninitialized, null, DiskStatus());
2022-09-02 05:59:46 +00:00
2022-08-24 23:45:02 +00:00
final List<ServerDiskVolume> _volumes;
final DiskStatus _diskStatus;
2022-09-02 05:59:46 +00:00
final bool? usesBinds;
2022-08-24 23:45:02 +00:00
final LoadingStatus status;
List<DiskVolume> get volumes => _diskStatus.diskVolumes;
DiskStatus get diskStatus => _diskStatus;
2022-09-16 13:49:53 +00:00
DiskVolume getVolume(final String volumeName) => volumes.firstWhere(
(final volume) => volume.name == volumeName,
orElse: () => DiskVolume(),
);
2022-08-24 23:45:02 +00:00
ApiServerVolumeState copyWith({
final List<ServerDiskVolume>? volumes,
final LoadingStatus? status,
2022-09-02 05:59:46 +00:00
final bool? usesBinds,
final DiskStatus? diskStatus,
2022-08-24 23:45:02 +00:00
}) =>
ApiServerVolumeState(
volumes ?? _volumes,
status ?? this.status,
2022-09-02 05:59:46 +00:00
usesBinds ?? this.usesBinds,
diskStatus ?? _diskStatus,
2022-08-24 23:45:02 +00:00
);
@override
2022-09-02 05:59:46 +00:00
List<Object?> get props => [_volumes, status, usesBinds];
2022-08-24 23:45:02 +00:00
}