mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-10-31 22:17:29 +00:00
Merge pull request 'fix' (#73) from fix-Oct13 into master
Reviewed-on: https://git.selfprivacy.org/kherel/selfprivacy.org.app/pulls/73
This commit is contained in:
commit
be55a1b13b
|
@ -63,6 +63,8 @@ class AppConfigCubit extends Cubit<AppConfigState> {
|
||||||
oneMoreReset(state: state, isImmediate: true);
|
oneMoreReset(state: state, isImmediate: true);
|
||||||
} else if (state.progress == 9) {
|
} else if (state.progress == 9) {
|
||||||
finishCheckIfServerIsOkay(state: state, isImmediate: true);
|
finishCheckIfServerIsOkay(state: state, isImmediate: true);
|
||||||
|
} else {
|
||||||
|
emit(state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw 'wrong state';
|
throw 'wrong state';
|
||||||
|
|
|
@ -211,6 +211,7 @@ class AppConfigRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveHetznerKey(String key) async {
|
Future<void> saveHetznerKey(String key) async {
|
||||||
|
print('saved');
|
||||||
await getIt<ApiConfigModel>().storeHetznerKey(key);
|
await getIt<ApiConfigModel>().storeHetznerKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +255,13 @@ class AppConfigRepository {
|
||||||
domainName: cloudFlareDomain.domainName,
|
domainName: cloudFlareDomain.domainName,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await box.put(BNames.hasFinalChecked, false);
|
||||||
|
await box.put(BNames.isServerStarted, false);
|
||||||
|
await box.put(BNames.isServerResetedFirstTime, false);
|
||||||
|
await box.put(BNames.isServerResetedSecondTime, false);
|
||||||
|
await box.put(BNames.isLoading, false);
|
||||||
|
await box.put(BNames.hetznerServer, null);
|
||||||
|
|
||||||
await cloudFlare.removeSimilarRecords(cloudFlareDomain: cloudFlareDomain);
|
await cloudFlare.removeSimilarRecords(cloudFlareDomain: cloudFlareDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ abstract class AppConfigState extends Equatable {
|
||||||
bool get isUserFilled => rootUser != null;
|
bool get isUserFilled => rootUser != null;
|
||||||
bool get isServerCreated => hetznerServer != null;
|
bool get isServerCreated => hetznerServer != null;
|
||||||
|
|
||||||
// bool get isFullyInitilized => _fulfilementList.every((el) => el!);
|
bool get isFullyInitilized => _fulfilementList.every((el) => el!);
|
||||||
int get progress => _fulfilementList.where((el) => el!).length;
|
int get progress => _fulfilementList.where((el) => el!).length;
|
||||||
|
|
||||||
int get porgressBar {
|
int get porgressBar {
|
||||||
|
|
|
@ -21,6 +21,8 @@ class UserFormCubit extends FormCubit {
|
||||||
login = FieldCubit(
|
login = FieldCubit(
|
||||||
initalValue: isEdit ? user!.login : '',
|
initalValue: isEdit ? user!.login : '',
|
||||||
validations: [
|
validations: [
|
||||||
|
ValidationModel<String>(
|
||||||
|
(s) => s.toLowerCase() == 'root', 'validations.root_name'.tr()),
|
||||||
ValidationModel(
|
ValidationModel(
|
||||||
(login) => users.any((user) => user.login == login),
|
(login) => users.any((user) => user.login == login),
|
||||||
'validations.user_alredy_exist'.tr(),
|
'validations.user_alredy_exist'.tr(),
|
||||||
|
|
|
@ -55,6 +55,7 @@ class ApiConfigModel {
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
_hetznerKey = _box.get(BNames.hetznerKey);
|
_hetznerKey = _box.get(BNames.hetznerKey);
|
||||||
|
|
||||||
_cloudFlareKey = _box.get(BNames.cloudFlareKey);
|
_cloudFlareKey = _box.get(BNames.cloudFlareKey);
|
||||||
_backblazeCredential = _box.get(BNames.backblazeKey);
|
_backblazeCredential = _box.get(BNames.backblazeKey);
|
||||||
_cloudFlareDomain = _box.get(BNames.cloudFlareDomain);
|
_cloudFlareDomain = _box.get(BNames.cloudFlareDomain);
|
||||||
|
|
|
@ -35,7 +35,6 @@ class InitializingPage extends StatelessWidget {
|
||||||
() => _stepCheck(cubit),
|
() => _stepCheck(cubit),
|
||||||
() => _stepCheck(cubit),
|
() => _stepCheck(cubit),
|
||||||
() => _stepCheck(cubit),
|
() => _stepCheck(cubit),
|
||||||
() => _stepCheck(cubit),
|
|
||||||
() => Container(child: Center(child: Text('initializing.finish'.tr())))
|
() => Container(child: Center(child: Text('initializing.finish'.tr())))
|
||||||
][cubit.state.progress]();
|
][cubit.state.progress]();
|
||||||
return BlocListener<AppConfigCubit, AppConfigState>(
|
return BlocListener<AppConfigCubit, AppConfigState>(
|
||||||
|
@ -48,10 +47,15 @@ class InitializingPage extends StatelessWidget {
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: paddingH15V0.copyWith(top: 10, bottom: 10),
|
padding: paddingH15V0.copyWith(top: 10, bottom: 10),
|
||||||
child: ProgressBar(
|
child: cubit.state.isFullyInitilized
|
||||||
|
? SizedBox(
|
||||||
|
height: 80,
|
||||||
|
)
|
||||||
|
: ProgressBar(
|
||||||
steps: [
|
steps: [
|
||||||
'Hetzner',
|
'Hetzner',
|
||||||
'CloudFlare',
|
'CloudFlare',
|
||||||
|
|
|
@ -5,7 +5,6 @@ class _Chart extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
var cubit = context.watch<HetznerMetricsCubit>();
|
var cubit = context.watch<HetznerMetricsCubit>();
|
||||||
var period = cubit.state.period;
|
var period = cubit.state.period;
|
||||||
var state = cubit.state;
|
var state = cubit.state;
|
||||||
|
@ -21,8 +20,8 @@ class _Chart extends StatelessWidget {
|
||||||
} else if (state is HetznerMetricsLoaded) {
|
} else if (state is HetznerMetricsLoaded) {
|
||||||
charts = [
|
charts = [
|
||||||
Legend(color: Colors.red, text: 'CPU %'),
|
Legend(color: Colors.red, text: 'CPU %'),
|
||||||
getCpuChart(state),
|
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
|
getCpuChart(state),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
|
@ -33,8 +32,9 @@ class _Chart extends StatelessWidget {
|
||||||
Legend(color: Colors.green, text: 'OUT'),
|
Legend(color: Colors.green, text: 'OUT'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
getPpsChart(state),
|
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
|
getPpsChart(state),
|
||||||
|
SizedBox(height: 1),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
|
@ -45,6 +45,7 @@ class _Chart extends StatelessWidget {
|
||||||
Legend(color: Colors.green, text: 'OUT'),
|
Legend(color: Colors.green, text: 'OUT'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
getBandwidthChart(state),
|
getBandwidthChart(state),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -47,6 +47,7 @@ class CpuChart extends StatelessWidget {
|
||||||
maxY: 100,
|
maxY: 100,
|
||||||
minX: data.length - 200,
|
minX: data.length - 200,
|
||||||
titlesData: FlTitlesData(
|
titlesData: FlTitlesData(
|
||||||
|
topTitles: SideTitles(showTitles: false),
|
||||||
bottomTitles: SideTitles(
|
bottomTitles: SideTitles(
|
||||||
interval: 20,
|
interval: 20,
|
||||||
rotateAngle: 90.0,
|
rotateAngle: 90.0,
|
||||||
|
|
|
@ -35,7 +35,7 @@ class NetworkChart extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 150,
|
height: 150,
|
||||||
width: MediaQuery.of(context).size.width * 0.90,
|
width: MediaQuery.of(context).size.width,
|
||||||
child: LineChart(
|
child: LineChart(
|
||||||
LineChartData(
|
LineChartData(
|
||||||
lineTouchData: LineTouchData(enabled: false),
|
lineTouchData: LineTouchData(enabled: false),
|
||||||
|
@ -67,6 +67,7 @@ class NetworkChart extends StatelessWidget {
|
||||||
1.2,
|
1.2,
|
||||||
minX: listData[0].length - 200,
|
minX: listData[0].length - 200,
|
||||||
titlesData: FlTitlesData(
|
titlesData: FlTitlesData(
|
||||||
|
topTitles: SideTitles(showTitles: false),
|
||||||
bottomTitles: SideTitles(
|
bottomTitles: SideTitles(
|
||||||
interval: 20,
|
interval: 20,
|
||||||
rotateAngle: 90.0,
|
rotateAngle: 90.0,
|
||||||
|
@ -80,12 +81,13 @@ class NetworkChart extends StatelessWidget {
|
||||||
return bottomTitle(value.toInt());
|
return bottomTitle(value.toInt());
|
||||||
}),
|
}),
|
||||||
leftTitles: SideTitles(
|
leftTitles: SideTitles(
|
||||||
margin: 15,
|
reservedSize: 50,
|
||||||
|
margin: 5,
|
||||||
interval: [
|
interval: [
|
||||||
...listData[0].map((e) => e.value),
|
...listData[0].map((e) => e.value),
|
||||||
...listData[1].map((e) => e.value)
|
...listData[1].map((e) => e.value)
|
||||||
].reduce(max) *
|
].reduce(max) *
|
||||||
1.2 /
|
2 /
|
||||||
10,
|
10,
|
||||||
getTextStyles: (_, __) => progressTextStyleLight.copyWith(
|
getTextStyles: (_, __) => progressTextStyleLight.copyWith(
|
||||||
color: Theme.of(context).brightness == Brightness.dark
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
|
|
@ -89,6 +89,9 @@ class _ServerDetailsState extends State<ServerDetails>
|
||||||
providerState: providerState,
|
providerState: providerState,
|
||||||
tabController: tabController),
|
tabController: tabController),
|
||||||
BrandText.body1('providers.server.bottom_sheet.1'.tr()),
|
BrandText.body1('providers.server.bottom_sheet.1'.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => HetznerMetricsCubit()..restart(),
|
create: (context) => HetznerMetricsCubit()..restart(),
|
||||||
|
@ -102,9 +105,6 @@ class _ServerDetailsState extends State<ServerDetails>
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
_ServerSettings(tabController: tabController),
|
_ServerSettings(tabController: tabController),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -43,7 +43,7 @@ class UsersPage extends StatelessWidget {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
users.insert(0, user);
|
users.insert(0, user);
|
||||||
}
|
}
|
||||||
final isEmpty = usersCubitState.isEmpty;
|
final isEmpty = users.isEmpty;
|
||||||
Widget child;
|
Widget child;
|
||||||
|
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
|
|
Loading…
Reference in a new issue