mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 09:16:54 +00:00
refactor: Apply formatting
This commit is contained in:
parent
bb846b08c1
commit
ea85ce6064
|
@ -194,7 +194,8 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<bool> attachVolume(final ServerVolume volume, final int serverId) async {
|
||||
Future<bool> attachVolume(
|
||||
final ServerVolume volume, final int serverId) async {
|
||||
bool success = false;
|
||||
|
||||
final Response dbPostResponse;
|
||||
|
@ -311,8 +312,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
|||
|
||||
final int serverId = serverCreateResponse.data['server']['id'];
|
||||
final ServerVolume? newVolume = await createVolume();
|
||||
final bool attachedVolume =
|
||||
await attachVolume(newVolume!, serverId);
|
||||
final bool attachedVolume = await attachVolume(newVolume!, serverId);
|
||||
|
||||
if (attachedVolume) {
|
||||
serverDetails = ServerHostingDetails(
|
||||
|
@ -367,10 +367,12 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
|||
|
||||
final Dio client = await getClient();
|
||||
try {
|
||||
await client.post('/droplets/${server.id}/actions',
|
||||
await client.post(
|
||||
'/droplets/${server.id}/actions',
|
||||
data: {
|
||||
'type': 'reboot',
|
||||
},);
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
} finally {
|
||||
|
@ -386,7 +388,8 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
|||
|
||||
final Dio client = await getClient();
|
||||
try {
|
||||
await client.post('/droplets/${server.id}/actions',
|
||||
await client.post(
|
||||
'/droplets/${server.id}/actions',
|
||||
data: {
|
||||
'type': 'power_on',
|
||||
},
|
||||
|
|
|
@ -229,7 +229,8 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<bool> attachVolume(final ServerVolume volume, final int serverId) async {
|
||||
Future<bool> attachVolume(
|
||||
final ServerVolume volume, final int serverId) async {
|
||||
bool success = false;
|
||||
|
||||
final Response dbPostResponse;
|
||||
|
|
|
@ -7,16 +7,10 @@ import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart';
|
|||
|
||||
class ProviderFormCubit extends FormCubit {
|
||||
ProviderFormCubit(this.serverInstallationCubit) {
|
||||
final RegExp regExp =
|
||||
serverInstallationCubit.getServerProviderApiTokenValidation();
|
||||
apiKey = FieldCubit(
|
||||
initalValue: '',
|
||||
validations: [
|
||||
RequiredStringValidation('validations.required'.tr()),
|
||||
ValidationModel<String>(
|
||||
regExp.hasMatch,
|
||||
'validations.invalid_format'.tr(),
|
||||
),
|
||||
LengthStringNotEqualValidation(64)
|
||||
],
|
||||
);
|
||||
|
|
|
@ -71,9 +71,7 @@ class ApiProviderVolumeCubit
|
|||
}
|
||||
|
||||
Future<void> detachVolume(final DiskVolume volume) async {
|
||||
await providerApi!
|
||||
.getVolumeProvider()
|
||||
.detachVolume(volume.providerVolume!);
|
||||
await providerApi!.getVolumeProvider().detachVolume(volume.providerVolume!);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -135,9 +133,7 @@ class ApiProviderVolumeCubit
|
|||
}
|
||||
|
||||
Future<void> deleteVolume(final DiskVolume volume) async {
|
||||
await providerApi!
|
||||
.getVolumeProvider()
|
||||
.deleteVolume(volume.providerVolume!);
|
||||
await providerApi!.getVolumeProvider().deleteVolume(volume.providerVolume!);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -141,13 +141,13 @@ class InitializingPage extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget _stepServerProviderToken(
|
||||
final ServerInstallationCubit serverInstallationCubit) =>
|
||||
ServerProviderPicker(
|
||||
serverInstallationCubit: serverInstallationCubit,
|
||||
);
|
||||
final ServerInstallationCubit serverInstallationCubit,
|
||||
) =>
|
||||
const ServerProviderPicker();
|
||||
|
||||
Widget _stepServerType(
|
||||
final ServerInstallationCubit serverInstallationCubit) =>
|
||||
final ServerInstallationCubit serverInstallationCubit,
|
||||
) =>
|
||||
ServerTypePicker(
|
||||
serverInstallationCubit: serverInstallationCubit,
|
||||
);
|
||||
|
|
|
@ -11,12 +11,9 @@ import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
|||
|
||||
class ServerProviderPicker extends StatefulWidget {
|
||||
const ServerProviderPicker({
|
||||
required this.serverInstallationCubit,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ServerInstallationCubit serverInstallationCubit;
|
||||
|
||||
@override
|
||||
State<ServerProviderPicker> createState() => _ServerProviderPickerState();
|
||||
}
|
||||
|
@ -40,7 +37,6 @@ class _ServerProviderPickerState extends State<ServerProviderPicker> {
|
|||
|
||||
case ServerProvider.hetzner:
|
||||
return ProviderInputDataPage(
|
||||
serverInstallationCubit: widget.serverInstallationCubit,
|
||||
providerInfo: ProviderPageInfo(
|
||||
providerType: ServerProvider.hetzner,
|
||||
pathToHow: 'hetzner_how',
|
||||
|
@ -53,7 +49,6 @@ class _ServerProviderPickerState extends State<ServerProviderPicker> {
|
|||
|
||||
case ServerProvider.digitalOcean:
|
||||
return ProviderInputDataPage(
|
||||
serverInstallationCubit: widget.serverInstallationCubit,
|
||||
providerInfo: ProviderPageInfo(
|
||||
providerType: ServerProvider.digitalOcean,
|
||||
pathToHow: 'hetzner_how',
|
||||
|
@ -82,17 +77,15 @@ class ProviderPageInfo {
|
|||
class ProviderInputDataPage extends StatelessWidget {
|
||||
const ProviderInputDataPage({
|
||||
required this.providerInfo,
|
||||
required this.serverInstallationCubit,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ProviderPageInfo providerInfo;
|
||||
final ServerInstallationCubit serverInstallationCubit;
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => BlocProvider(
|
||||
create: (final context) => ProviderFormCubit(
|
||||
serverInstallationCubit,
|
||||
context.watch<ServerInstallationCubit>(),
|
||||
),
|
||||
child: Builder(
|
||||
builder: (final context) {
|
||||
|
|
Loading…
Reference in a new issue