forked from kherel/selfprivacy.org.app
parent
20cca91e00
commit
bc6c55b528
@ -1,68 +0,0 @@ |
||||
// import 'dart:async'; |
||||
|
||||
// import 'package:cubit_form/cubit_form.dart'; |
||||
// import 'package:selfprivacy/logic/api_maps/cloudflare.dart'; |
||||
// import 'package:selfprivacy/logic/cubit/app_config/app_config_cubit.dart'; |
||||
// import 'package:selfprivacy/logic/models/cloudflare_domain.dart'; |
||||
|
||||
// class DomainFormCubit extends FormCubit { |
||||
// CloudflareApi apiClient = CloudflareApi(); |
||||
|
||||
// DomainFormCubit(this.initializingCubit) { |
||||
// var regExp = |
||||
// RegExp(r"^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}"); |
||||
// domainName = FieldCubit( |
||||
// initalValue: '', |
||||
// validations: [ |
||||
// RequiredStringValidation('required'), |
||||
// ValidationModel<String>( |
||||
// (s) => !regExp.hasMatch(s), |
||||
// 'invalid domain format', |
||||
// ), |
||||
// ], |
||||
// ); |
||||
|
||||
// super.setFields([domainName]); |
||||
// } |
||||
|
||||
// @override |
||||
// FutureOr<void> onSubmit() async { |
||||
// var domain = CloudFlareDomain( |
||||
// domainName: domainName.state.value, |
||||
// zoneId: zoneId, |
||||
// ); |
||||
// initializingCubit.setDomain(domain); |
||||
// } |
||||
|
||||
// final AppConfigCubit initializingCubit; |
||||
|
||||
// FieldCubit<String> domainName; |
||||
// String zoneId; |
||||
|
||||
// @override |
||||
// FutureOr<bool> asyncValidation() async { |
||||
// var key = initializingCubit.state.cloudFlareKey; |
||||
|
||||
// String zoneId; |
||||
|
||||
// try { |
||||
// zoneId = await apiClient.getZoneId(key, domainName.state.value); |
||||
// } catch (e) { |
||||
// addError(e); |
||||
// } |
||||
|
||||
// if (zoneId == null) { |
||||
// domainName.setError('Domain not in the list'); |
||||
// return false; |
||||
// } |
||||
// this.zoneId = zoneId; |
||||
// return true; |
||||
// } |
||||
|
||||
// @override |
||||
// Future<void> close() async { |
||||
// apiClient.close(); |
||||
|
||||
// return super.close(); |
||||
// } |
||||
// } |
@ -1,28 +0,0 @@ |
||||
// import 'package:bloc/bloc.dart'; |
||||
// import 'package:equatable/equatable.dart'; |
||||
// import 'package:meta/meta.dart'; |
||||
// import 'package:selfprivacy/logic/models/service.dart'; |
||||
// import 'package:selfprivacy/logic/models/state_types.dart'; |
||||
|
||||
// export 'package:provider/provider.dart'; |
||||
// export 'package:selfprivacy/logic/models/state_types.dart'; |
||||
|
||||
// part 'services_state.dart'; |
||||
|
||||
// class ServicesCubit extends Cubit<ServicesState> { |
||||
// ServicesCubit() : super(ServicesState(all)); |
||||
|
||||
// void connect(Service service) { |
||||
// var newState = state.updateElement(service, StateType.stable); |
||||
// emit(newState); |
||||
// } |
||||
// } |
||||
|
||||
// final all = ServiceTypes.values |
||||
// .map( |
||||
// (type) => Service( |
||||
// state: StateType.uninitialized, |
||||
// type: type, |
||||
// ), |
||||
// ) |
||||
// .toList(); |
@ -1,26 +0,0 @@ |
||||
// part of 'services_cubit.dart'; |
||||
|
||||
// @immutable |
||||
// class ServicesState extends Equatable{ |
||||
// ServicesState(this.all); |
||||
|
||||
// final List<Service> all; |
||||
|
||||
// ServicesState updateElement(Service service, StateType newState) { |
||||
// var newList = [...all]; |
||||
// var index = newList.indexOf(service); |
||||
// newList[index] = service.updateState(newState); |
||||
// return ServicesState(newList); |
||||
// } |
||||
|
||||
// List<Service> get connected => all |
||||
// .where((service) => service.state != StateType.uninitialized) |
||||
// .toList(); |
||||
|
||||
// List<Service> get uninitialized => all |
||||
// .where((service) => service.state == StateType.uninitialized) |
||||
// .toList(); |
||||
|
||||
// @override |
||||
// List<Object> get props => all; |
||||
// } |
@ -0,0 +1,23 @@ |
||||
import 'package:json_annotation/json_annotation.dart'; |
||||
|
||||
@JsonSerializable(createFactory: false) |
||||
class ServerInfo { |
||||
final String id; |
||||
final String name; |
||||
final ServerStatus status; |
||||
final DateTime created; |
||||
|
||||
ServerInfo(this.id, this.name, this.status, this.created); |
||||
} |
||||
|
||||
enum ServerStatus { |
||||
running, |
||||
initializing, |
||||
starting, |
||||
stopping, |
||||
off, |
||||
deleting, |
||||
migrating, |
||||
rebuilding, |
||||
unknown, |
||||
} |
@ -1,25 +0,0 @@ |
||||
// import 'package:equatable/equatable.dart'; |
||||
// import 'package:selfprivacy/logic/models/state_types.dart'; |
||||
|
||||
// enum ServiceTypes { |
||||
// messanger, |
||||
// mail, |
||||
// passwordManager, |
||||
// github, |
||||
// cloud, |
||||
// } |
||||
|
||||
// class Service extends Equatable { |
||||
// const Service({required this.state, required this.type}); |
||||
|
||||
// final StateType state; |
||||
// final ServiceTypes type; |
||||
|
||||
// Service updateState(StateType newState) => Service( |
||||
// state: newState, |
||||
// type: type, |
||||
// ); |
||||
|
||||
// @override |
||||
// List<Object?> get props => [state, type]; |
||||
// } |
Loading…
Reference in new issue