Update cubit for volume management and graphql
parent
c747dcd4ae
commit
96c7d7966a
|
@ -1,4 +1,5 @@
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
|
import 'package:selfprivacy/config/get_it_config.dart';
|
||||||
|
|
||||||
abstract class ApiMap {
|
abstract class ApiMap {
|
||||||
Future<GraphQLClient> getClient() async {
|
Future<GraphQLClient> getClient() async {
|
||||||
|
@ -8,7 +9,9 @@ abstract class ApiMap {
|
||||||
|
|
||||||
final Link graphQLLink = isWithToken
|
final Link graphQLLink = isWithToken
|
||||||
? AuthLink(
|
? AuthLink(
|
||||||
getToken: () async => authToken,
|
getToken: () async => customToken == ''
|
||||||
|
? getIt<ApiConfigModel>().serverDetails!.apiToken
|
||||||
|
: customToken,
|
||||||
).concat(httpLink)
|
).concat(httpLink)
|
||||||
: httpLink;
|
: httpLink;
|
||||||
|
|
||||||
|
@ -21,5 +24,5 @@ abstract class ApiMap {
|
||||||
abstract final String? rootAddress;
|
abstract final String? rootAddress;
|
||||||
abstract final bool hasLogger;
|
abstract final bool hasLogger;
|
||||||
abstract final bool isWithToken;
|
abstract final bool isWithToken;
|
||||||
abstract final String authToken;
|
abstract final String customToken;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
query GetServerDiskVolumesQuery {
|
||||||
|
storage {
|
||||||
|
volumes {
|
||||||
|
freeSpace
|
||||||
|
model
|
||||||
|
name
|
||||||
|
root
|
||||||
|
serial
|
||||||
|
totalSpace
|
||||||
|
type
|
||||||
|
usedSpace
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation MountVolumeMutation($name: String!) {
|
||||||
|
mountVolume(name: $name) {
|
||||||
|
code
|
||||||
|
message
|
||||||
|
success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation ResizeVolumeMutation($name: String!) {
|
||||||
|
resizeVolume(name: $name) {
|
||||||
|
code
|
||||||
|
message
|
||||||
|
success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation UnmountVolumeMutation($name: String!) {
|
||||||
|
unmountVolume(name: $name) {
|
||||||
|
code
|
||||||
|
message
|
||||||
|
success
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,211 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'disk_volumes.graphql.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
Query$GetServerDiskVolumesQuery _$Query$GetServerDiskVolumesQueryFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Query$GetServerDiskVolumesQuery(
|
||||||
|
storage: Query$GetServerDiskVolumesQuery$storage.fromJson(
|
||||||
|
json['storage'] as Map<String, dynamic>),
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Query$GetServerDiskVolumesQueryToJson(
|
||||||
|
Query$GetServerDiskVolumesQuery instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'storage': instance.storage.toJson(),
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Query$GetServerDiskVolumesQuery$storage
|
||||||
|
_$Query$GetServerDiskVolumesQuery$storageFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Query$GetServerDiskVolumesQuery$storage(
|
||||||
|
volumes: (json['volumes'] as List<dynamic>)
|
||||||
|
.map((e) =>
|
||||||
|
Query$GetServerDiskVolumesQuery$storage$volumes.fromJson(
|
||||||
|
e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Query$GetServerDiskVolumesQuery$storageToJson(
|
||||||
|
Query$GetServerDiskVolumesQuery$storage instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'volumes': instance.volumes.map((e) => e.toJson()).toList(),
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Query$GetServerDiskVolumesQuery$storage$volumes
|
||||||
|
_$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Query$GetServerDiskVolumesQuery$storage$volumes(
|
||||||
|
freeSpace: json['freeSpace'] as String,
|
||||||
|
model: json['model'] as String,
|
||||||
|
name: json['name'] as String,
|
||||||
|
root: json['root'] as bool,
|
||||||
|
serial: json['serial'] as String,
|
||||||
|
totalSpace: json['totalSpace'] as String,
|
||||||
|
type: json['type'] as String,
|
||||||
|
usedSpace: json['usedSpace'] as String,
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Query$GetServerDiskVolumesQuery$storage$volumesToJson(
|
||||||
|
Query$GetServerDiskVolumesQuery$storage$volumes instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'freeSpace': instance.freeSpace,
|
||||||
|
'model': instance.model,
|
||||||
|
'name': instance.name,
|
||||||
|
'root': instance.root,
|
||||||
|
'serial': instance.serial,
|
||||||
|
'totalSpace': instance.totalSpace,
|
||||||
|
'type': instance.type,
|
||||||
|
'usedSpace': instance.usedSpace,
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Variables$Mutation$MountVolumeMutation
|
||||||
|
_$Variables$Mutation$MountVolumeMutationFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Variables$Mutation$MountVolumeMutation(
|
||||||
|
name: json['name'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Variables$Mutation$MountVolumeMutationToJson(
|
||||||
|
Variables$Mutation$MountVolumeMutation instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
};
|
||||||
|
|
||||||
|
Mutation$MountVolumeMutation _$Mutation$MountVolumeMutationFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Mutation$MountVolumeMutation(
|
||||||
|
mountVolume: Mutation$MountVolumeMutation$mountVolume.fromJson(
|
||||||
|
json['mountVolume'] as Map<String, dynamic>),
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Mutation$MountVolumeMutationToJson(
|
||||||
|
Mutation$MountVolumeMutation instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'mountVolume': instance.mountVolume.toJson(),
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Mutation$MountVolumeMutation$mountVolume
|
||||||
|
_$Mutation$MountVolumeMutation$mountVolumeFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Mutation$MountVolumeMutation$mountVolume(
|
||||||
|
code: json['code'] as int,
|
||||||
|
message: json['message'] as String,
|
||||||
|
success: json['success'] as bool,
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Mutation$MountVolumeMutation$mountVolumeToJson(
|
||||||
|
Mutation$MountVolumeMutation$mountVolume instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'code': instance.code,
|
||||||
|
'message': instance.message,
|
||||||
|
'success': instance.success,
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Variables$Mutation$ResizeVolumeMutation
|
||||||
|
_$Variables$Mutation$ResizeVolumeMutationFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Variables$Mutation$ResizeVolumeMutation(
|
||||||
|
name: json['name'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Variables$Mutation$ResizeVolumeMutationToJson(
|
||||||
|
Variables$Mutation$ResizeVolumeMutation instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
};
|
||||||
|
|
||||||
|
Mutation$ResizeVolumeMutation _$Mutation$ResizeVolumeMutationFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Mutation$ResizeVolumeMutation(
|
||||||
|
resizeVolume: Mutation$ResizeVolumeMutation$resizeVolume.fromJson(
|
||||||
|
json['resizeVolume'] as Map<String, dynamic>),
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Mutation$ResizeVolumeMutationToJson(
|
||||||
|
Mutation$ResizeVolumeMutation instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'resizeVolume': instance.resizeVolume.toJson(),
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Mutation$ResizeVolumeMutation$resizeVolume
|
||||||
|
_$Mutation$ResizeVolumeMutation$resizeVolumeFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Mutation$ResizeVolumeMutation$resizeVolume(
|
||||||
|
code: json['code'] as int,
|
||||||
|
message: json['message'] as String,
|
||||||
|
success: json['success'] as bool,
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Mutation$ResizeVolumeMutation$resizeVolumeToJson(
|
||||||
|
Mutation$ResizeVolumeMutation$resizeVolume instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'code': instance.code,
|
||||||
|
'message': instance.message,
|
||||||
|
'success': instance.success,
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Variables$Mutation$UnmountVolumeMutation
|
||||||
|
_$Variables$Mutation$UnmountVolumeMutationFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Variables$Mutation$UnmountVolumeMutation(
|
||||||
|
name: json['name'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Variables$Mutation$UnmountVolumeMutationToJson(
|
||||||
|
Variables$Mutation$UnmountVolumeMutation instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
};
|
||||||
|
|
||||||
|
Mutation$UnmountVolumeMutation _$Mutation$UnmountVolumeMutationFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Mutation$UnmountVolumeMutation(
|
||||||
|
unmountVolume: Mutation$UnmountVolumeMutation$unmountVolume.fromJson(
|
||||||
|
json['unmountVolume'] as Map<String, dynamic>),
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Mutation$UnmountVolumeMutationToJson(
|
||||||
|
Mutation$UnmountVolumeMutation instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'unmountVolume': instance.unmountVolume.toJson(),
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Mutation$UnmountVolumeMutation$unmountVolume
|
||||||
|
_$Mutation$UnmountVolumeMutation$unmountVolumeFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Mutation$UnmountVolumeMutation$unmountVolume(
|
||||||
|
code: json['code'] as int,
|
||||||
|
message: json['message'] as String,
|
||||||
|
success: json['success'] as bool,
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Mutation$UnmountVolumeMutation$unmountVolumeToJson(
|
||||||
|
Mutation$UnmountVolumeMutation$unmountVolume instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'code': instance.code,
|
||||||
|
'message': instance.message,
|
||||||
|
'success': instance.success,
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
|
@ -1,5 +0,0 @@
|
||||||
query GetApiVersionQuery {
|
|
||||||
api {
|
|
||||||
version
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,301 +0,0 @@
|
||||||
import 'package:gql/ast.dart';
|
|
||||||
import 'package:graphql/client.dart' as graphql;
|
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
part 'get_api_version.graphql.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class Query$GetApiVersionQuery {
|
|
||||||
Query$GetApiVersionQuery({required this.api, required this.$__typename});
|
|
||||||
|
|
||||||
@override
|
|
||||||
factory Query$GetApiVersionQuery.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$Query$GetApiVersionQueryFromJson(json);
|
|
||||||
|
|
||||||
final Query$GetApiVersionQuery$api api;
|
|
||||||
|
|
||||||
@JsonKey(name: '__typename')
|
|
||||||
final String $__typename;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$Query$GetApiVersionQueryToJson(this);
|
|
||||||
int get hashCode {
|
|
||||||
final l$api = api;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
return Object.hashAll([l$api, l$$__typename]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
if (!(other is Query$GetApiVersionQuery) ||
|
|
||||||
runtimeType != other.runtimeType) return false;
|
|
||||||
final l$api = api;
|
|
||||||
final lOther$api = other.api;
|
|
||||||
if (l$api != lOther$api) return false;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
final lOther$$__typename = other.$__typename;
|
|
||||||
if (l$$__typename != lOther$$__typename) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UtilityExtension$Query$GetApiVersionQuery
|
|
||||||
on Query$GetApiVersionQuery {
|
|
||||||
CopyWith$Query$GetApiVersionQuery<Query$GetApiVersionQuery> get copyWith =>
|
|
||||||
CopyWith$Query$GetApiVersionQuery(this, (i) => i);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CopyWith$Query$GetApiVersionQuery<TRes> {
|
|
||||||
factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance,
|
|
||||||
TRes Function(Query$GetApiVersionQuery) then) =
|
|
||||||
_CopyWithImpl$Query$GetApiVersionQuery;
|
|
||||||
|
|
||||||
factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) =
|
|
||||||
_CopyWithStubImpl$Query$GetApiVersionQuery;
|
|
||||||
|
|
||||||
TRes call({Query$GetApiVersionQuery$api? api, String? $__typename});
|
|
||||||
CopyWith$Query$GetApiVersionQuery$api<TRes> get api;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithImpl$Query$GetApiVersionQuery<TRes>
|
|
||||||
implements CopyWith$Query$GetApiVersionQuery<TRes> {
|
|
||||||
_CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then);
|
|
||||||
|
|
||||||
final Query$GetApiVersionQuery _instance;
|
|
||||||
|
|
||||||
final TRes Function(Query$GetApiVersionQuery) _then;
|
|
||||||
|
|
||||||
static const _undefined = {};
|
|
||||||
|
|
||||||
TRes call({Object? api = _undefined, Object? $__typename = _undefined}) =>
|
|
||||||
_then(Query$GetApiVersionQuery(
|
|
||||||
api: api == _undefined || api == null
|
|
||||||
? _instance.api
|
|
||||||
: (api as Query$GetApiVersionQuery$api),
|
|
||||||
$__typename: $__typename == _undefined || $__typename == null
|
|
||||||
? _instance.$__typename
|
|
||||||
: ($__typename as String)));
|
|
||||||
CopyWith$Query$GetApiVersionQuery$api<TRes> get api {
|
|
||||||
final local$api = _instance.api;
|
|
||||||
return CopyWith$Query$GetApiVersionQuery$api(
|
|
||||||
local$api, (e) => call(api: e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithStubImpl$Query$GetApiVersionQuery<TRes>
|
|
||||||
implements CopyWith$Query$GetApiVersionQuery<TRes> {
|
|
||||||
_CopyWithStubImpl$Query$GetApiVersionQuery(this._res);
|
|
||||||
|
|
||||||
TRes _res;
|
|
||||||
|
|
||||||
call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res;
|
|
||||||
CopyWith$Query$GetApiVersionQuery$api<TRes> get api =>
|
|
||||||
CopyWith$Query$GetApiVersionQuery$api.stub(_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [
|
|
||||||
OperationDefinitionNode(
|
|
||||||
type: OperationType.query,
|
|
||||||
name: NameNode(value: 'GetApiVersionQuery'),
|
|
||||||
variableDefinitions: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: SelectionSetNode(selections: [
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'api'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: SelectionSetNode(selections: [
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'version'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: '__typename'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null)
|
|
||||||
])),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: '__typename'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null)
|
|
||||||
])),
|
|
||||||
]);
|
|
||||||
Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery(
|
|
||||||
Map<String, dynamic> data) =>
|
|
||||||
Query$GetApiVersionQuery.fromJson(data);
|
|
||||||
|
|
||||||
class Options$Query$GetApiVersionQuery
|
|
||||||
extends graphql.QueryOptions<Query$GetApiVersionQuery> {
|
|
||||||
Options$Query$GetApiVersionQuery(
|
|
||||||
{String? operationName,
|
|
||||||
graphql.FetchPolicy? fetchPolicy,
|
|
||||||
graphql.ErrorPolicy? errorPolicy,
|
|
||||||
graphql.CacheRereadPolicy? cacheRereadPolicy,
|
|
||||||
Object? optimisticResult,
|
|
||||||
Duration? pollInterval,
|
|
||||||
graphql.Context? context})
|
|
||||||
: super(
|
|
||||||
operationName: operationName,
|
|
||||||
fetchPolicy: fetchPolicy,
|
|
||||||
errorPolicy: errorPolicy,
|
|
||||||
cacheRereadPolicy: cacheRereadPolicy,
|
|
||||||
optimisticResult: optimisticResult,
|
|
||||||
pollInterval: pollInterval,
|
|
||||||
context: context,
|
|
||||||
document: documentNodeQueryGetApiVersionQuery,
|
|
||||||
parserFn: _parserFn$Query$GetApiVersionQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
class WatchOptions$Query$GetApiVersionQuery
|
|
||||||
extends graphql.WatchQueryOptions<Query$GetApiVersionQuery> {
|
|
||||||
WatchOptions$Query$GetApiVersionQuery(
|
|
||||||
{String? operationName,
|
|
||||||
graphql.FetchPolicy? fetchPolicy,
|
|
||||||
graphql.ErrorPolicy? errorPolicy,
|
|
||||||
graphql.CacheRereadPolicy? cacheRereadPolicy,
|
|
||||||
Object? optimisticResult,
|
|
||||||
graphql.Context? context,
|
|
||||||
Duration? pollInterval,
|
|
||||||
bool? eagerlyFetchResults,
|
|
||||||
bool carryForwardDataOnException = true,
|
|
||||||
bool fetchResults = false})
|
|
||||||
: super(
|
|
||||||
operationName: operationName,
|
|
||||||
fetchPolicy: fetchPolicy,
|
|
||||||
errorPolicy: errorPolicy,
|
|
||||||
cacheRereadPolicy: cacheRereadPolicy,
|
|
||||||
optimisticResult: optimisticResult,
|
|
||||||
context: context,
|
|
||||||
document: documentNodeQueryGetApiVersionQuery,
|
|
||||||
pollInterval: pollInterval,
|
|
||||||
eagerlyFetchResults: eagerlyFetchResults,
|
|
||||||
carryForwardDataOnException: carryForwardDataOnException,
|
|
||||||
fetchResults: fetchResults,
|
|
||||||
parserFn: _parserFn$Query$GetApiVersionQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
class FetchMoreOptions$Query$GetApiVersionQuery
|
|
||||||
extends graphql.FetchMoreOptions {
|
|
||||||
FetchMoreOptions$Query$GetApiVersionQuery(
|
|
||||||
{required graphql.UpdateQuery updateQuery})
|
|
||||||
: super(
|
|
||||||
updateQuery: updateQuery,
|
|
||||||
document: documentNodeQueryGetApiVersionQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient {
|
|
||||||
Future<graphql.QueryResult<Query$GetApiVersionQuery>>
|
|
||||||
query$GetApiVersionQuery(
|
|
||||||
[Options$Query$GetApiVersionQuery? options]) async =>
|
|
||||||
await this.query(options ?? Options$Query$GetApiVersionQuery());
|
|
||||||
graphql.ObservableQuery<Query$GetApiVersionQuery>
|
|
||||||
watchQuery$GetApiVersionQuery(
|
|
||||||
[WatchOptions$Query$GetApiVersionQuery? options]) =>
|
|
||||||
this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery());
|
|
||||||
void writeQuery$GetApiVersionQuery(
|
|
||||||
{required Query$GetApiVersionQuery data, bool broadcast = true}) =>
|
|
||||||
this.writeQuery(
|
|
||||||
graphql.Request(
|
|
||||||
operation: graphql.Operation(
|
|
||||||
document: documentNodeQueryGetApiVersionQuery)),
|
|
||||||
data: data.toJson(),
|
|
||||||
broadcast: broadcast);
|
|
||||||
Query$GetApiVersionQuery? readQuery$GetApiVersionQuery(
|
|
||||||
{bool optimistic = true}) {
|
|
||||||
final result = this.readQuery(
|
|
||||||
graphql.Request(
|
|
||||||
operation: graphql.Operation(
|
|
||||||
document: documentNodeQueryGetApiVersionQuery)),
|
|
||||||
optimistic: optimistic);
|
|
||||||
return result == null ? null : Query$GetApiVersionQuery.fromJson(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class Query$GetApiVersionQuery$api {
|
|
||||||
Query$GetApiVersionQuery$api(
|
|
||||||
{required this.version, required this.$__typename});
|
|
||||||
|
|
||||||
@override
|
|
||||||
factory Query$GetApiVersionQuery$api.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$Query$GetApiVersionQuery$apiFromJson(json);
|
|
||||||
|
|
||||||
final String version;
|
|
||||||
|
|
||||||
@JsonKey(name: '__typename')
|
|
||||||
final String $__typename;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$Query$GetApiVersionQuery$apiToJson(this);
|
|
||||||
int get hashCode {
|
|
||||||
final l$version = version;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
return Object.hashAll([l$version, l$$__typename]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
if (!(other is Query$GetApiVersionQuery$api) ||
|
|
||||||
runtimeType != other.runtimeType) return false;
|
|
||||||
final l$version = version;
|
|
||||||
final lOther$version = other.version;
|
|
||||||
if (l$version != lOther$version) return false;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
final lOther$$__typename = other.$__typename;
|
|
||||||
if (l$$__typename != lOther$$__typename) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UtilityExtension$Query$GetApiVersionQuery$api
|
|
||||||
on Query$GetApiVersionQuery$api {
|
|
||||||
CopyWith$Query$GetApiVersionQuery$api<Query$GetApiVersionQuery$api>
|
|
||||||
get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CopyWith$Query$GetApiVersionQuery$api<TRes> {
|
|
||||||
factory CopyWith$Query$GetApiVersionQuery$api(
|
|
||||||
Query$GetApiVersionQuery$api instance,
|
|
||||||
TRes Function(Query$GetApiVersionQuery$api) then) =
|
|
||||||
_CopyWithImpl$Query$GetApiVersionQuery$api;
|
|
||||||
|
|
||||||
factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) =
|
|
||||||
_CopyWithStubImpl$Query$GetApiVersionQuery$api;
|
|
||||||
|
|
||||||
TRes call({String? version, String? $__typename});
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithImpl$Query$GetApiVersionQuery$api<TRes>
|
|
||||||
implements CopyWith$Query$GetApiVersionQuery$api<TRes> {
|
|
||||||
_CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then);
|
|
||||||
|
|
||||||
final Query$GetApiVersionQuery$api _instance;
|
|
||||||
|
|
||||||
final TRes Function(Query$GetApiVersionQuery$api) _then;
|
|
||||||
|
|
||||||
static const _undefined = {};
|
|
||||||
|
|
||||||
TRes call({Object? version = _undefined, Object? $__typename = _undefined}) =>
|
|
||||||
_then(Query$GetApiVersionQuery$api(
|
|
||||||
version: version == _undefined || version == null
|
|
||||||
? _instance.version
|
|
||||||
: (version as String),
|
|
||||||
$__typename: $__typename == _undefined || $__typename == null
|
|
||||||
? _instance.$__typename
|
|
||||||
: ($__typename as String)));
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithStubImpl$Query$GetApiVersionQuery$api<TRes>
|
|
||||||
implements CopyWith$Query$GetApiVersionQuery$api<TRes> {
|
|
||||||
_CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res);
|
|
||||||
|
|
||||||
TRes _res;
|
|
||||||
|
|
||||||
call({String? version, String? $__typename}) => _res;
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'get_api_version.graphql.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
Query$GetApiVersionQuery(
|
|
||||||
api: Query$GetApiVersionQuery$api.fromJson(
|
|
||||||
json['api'] as Map<String, dynamic>),
|
|
||||||
$__typename: json['__typename'] as String,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$Query$GetApiVersionQueryToJson(
|
|
||||||
Query$GetApiVersionQuery instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'api': instance.api.toJson(),
|
|
||||||
'__typename': instance.$__typename,
|
|
||||||
};
|
|
||||||
|
|
||||||
Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
Query$GetApiVersionQuery$api(
|
|
||||||
version: json['version'] as String,
|
|
||||||
$__typename: json['__typename'] as String,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$Query$GetApiVersionQuery$apiToJson(
|
|
||||||
Query$GetApiVersionQuery$api instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'version': instance.version,
|
|
||||||
'__typename': instance.$__typename,
|
|
||||||
};
|
|
|
@ -1,11 +0,0 @@
|
||||||
query GetServerDiskVolumesQuery {
|
|
||||||
storage {
|
|
||||||
volumes {
|
|
||||||
freeSpace
|
|
||||||
name
|
|
||||||
root
|
|
||||||
totalSpace
|
|
||||||
usedSpace
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,542 +0,0 @@
|
||||||
import 'package:gql/ast.dart';
|
|
||||||
import 'package:graphql/client.dart' as graphql;
|
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
part 'get_server_disk_volumes.graphql.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class Query$GetServerDiskVolumesQuery {
|
|
||||||
Query$GetServerDiskVolumesQuery(
|
|
||||||
{required this.storage, required this.$__typename});
|
|
||||||
|
|
||||||
@override
|
|
||||||
factory Query$GetServerDiskVolumesQuery.fromJson(Map<String, dynamic> json) =>
|
|
||||||
_$Query$GetServerDiskVolumesQueryFromJson(json);
|
|
||||||
|
|
||||||
final Query$GetServerDiskVolumesQuery$storage storage;
|
|
||||||
|
|
||||||
@JsonKey(name: '__typename')
|
|
||||||
final String $__typename;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() =>
|
|
||||||
_$Query$GetServerDiskVolumesQueryToJson(this);
|
|
||||||
int get hashCode {
|
|
||||||
final l$storage = storage;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
return Object.hashAll([l$storage, l$$__typename]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
if (!(other is Query$GetServerDiskVolumesQuery) ||
|
|
||||||
runtimeType != other.runtimeType) return false;
|
|
||||||
final l$storage = storage;
|
|
||||||
final lOther$storage = other.storage;
|
|
||||||
if (l$storage != lOther$storage) return false;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
final lOther$$__typename = other.$__typename;
|
|
||||||
if (l$$__typename != lOther$$__typename) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UtilityExtension$Query$GetServerDiskVolumesQuery
|
|
||||||
on Query$GetServerDiskVolumesQuery {
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery<Query$GetServerDiskVolumesQuery>
|
|
||||||
get copyWith => CopyWith$Query$GetServerDiskVolumesQuery(this, (i) => i);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CopyWith$Query$GetServerDiskVolumesQuery<TRes> {
|
|
||||||
factory CopyWith$Query$GetServerDiskVolumesQuery(
|
|
||||||
Query$GetServerDiskVolumesQuery instance,
|
|
||||||
TRes Function(Query$GetServerDiskVolumesQuery) then) =
|
|
||||||
_CopyWithImpl$Query$GetServerDiskVolumesQuery;
|
|
||||||
|
|
||||||
factory CopyWith$Query$GetServerDiskVolumesQuery.stub(TRes res) =
|
|
||||||
_CopyWithStubImpl$Query$GetServerDiskVolumesQuery;
|
|
||||||
|
|
||||||
TRes call(
|
|
||||||
{Query$GetServerDiskVolumesQuery$storage? storage, String? $__typename});
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage<TRes> get storage;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithImpl$Query$GetServerDiskVolumesQuery<TRes>
|
|
||||||
implements CopyWith$Query$GetServerDiskVolumesQuery<TRes> {
|
|
||||||
_CopyWithImpl$Query$GetServerDiskVolumesQuery(this._instance, this._then);
|
|
||||||
|
|
||||||
final Query$GetServerDiskVolumesQuery _instance;
|
|
||||||
|
|
||||||
final TRes Function(Query$GetServerDiskVolumesQuery) _then;
|
|
||||||
|
|
||||||
static const _undefined = {};
|
|
||||||
|
|
||||||
TRes call({Object? storage = _undefined, Object? $__typename = _undefined}) =>
|
|
||||||
_then(Query$GetServerDiskVolumesQuery(
|
|
||||||
storage: storage == _undefined || storage == null
|
|
||||||
? _instance.storage
|
|
||||||
: (storage as Query$GetServerDiskVolumesQuery$storage),
|
|
||||||
$__typename: $__typename == _undefined || $__typename == null
|
|
||||||
? _instance.$__typename
|
|
||||||
: ($__typename as String)));
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage<TRes> get storage {
|
|
||||||
final local$storage = _instance.storage;
|
|
||||||
return CopyWith$Query$GetServerDiskVolumesQuery$storage(
|
|
||||||
local$storage, (e) => call(storage: e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery<TRes>
|
|
||||||
implements CopyWith$Query$GetServerDiskVolumesQuery<TRes> {
|
|
||||||
_CopyWithStubImpl$Query$GetServerDiskVolumesQuery(this._res);
|
|
||||||
|
|
||||||
TRes _res;
|
|
||||||
|
|
||||||
call(
|
|
||||||
{Query$GetServerDiskVolumesQuery$storage? storage,
|
|
||||||
String? $__typename}) =>
|
|
||||||
_res;
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage<TRes> get storage =>
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
const documentNodeQueryGetServerDiskVolumesQuery = DocumentNode(definitions: [
|
|
||||||
OperationDefinitionNode(
|
|
||||||
type: OperationType.query,
|
|
||||||
name: NameNode(value: 'GetServerDiskVolumesQuery'),
|
|
||||||
variableDefinitions: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: SelectionSetNode(selections: [
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'storage'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: SelectionSetNode(selections: [
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'volumes'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: SelectionSetNode(selections: [
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'freeSpace'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'name'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'root'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'totalSpace'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: 'usedSpace'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: '__typename'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null)
|
|
||||||
])),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: '__typename'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null)
|
|
||||||
])),
|
|
||||||
FieldNode(
|
|
||||||
name: NameNode(value: '__typename'),
|
|
||||||
alias: null,
|
|
||||||
arguments: [],
|
|
||||||
directives: [],
|
|
||||||
selectionSet: null)
|
|
||||||
])),
|
|
||||||
]);
|
|
||||||
Query$GetServerDiskVolumesQuery _parserFn$Query$GetServerDiskVolumesQuery(
|
|
||||||
Map<String, dynamic> data) =>
|
|
||||||
Query$GetServerDiskVolumesQuery.fromJson(data);
|
|
||||||
|
|
||||||
class Options$Query$GetServerDiskVolumesQuery
|
|
||||||
extends graphql.QueryOptions<Query$GetServerDiskVolumesQuery> {
|
|
||||||
Options$Query$GetServerDiskVolumesQuery(
|
|
||||||
{String? operationName,
|
|
||||||
graphql.FetchPolicy? fetchPolicy,
|
|
||||||
graphql.ErrorPolicy? errorPolicy,
|
|
||||||
graphql.CacheRereadPolicy? cacheRereadPolicy,
|
|
||||||
Object? optimisticResult,
|
|
||||||
Duration? pollInterval,
|
|
||||||
graphql.Context? context})
|
|
||||||
: super(
|
|
||||||
operationName: operationName,
|
|
||||||
fetchPolicy: fetchPolicy,
|
|
||||||
errorPolicy: errorPolicy,
|
|
||||||
cacheRereadPolicy: cacheRereadPolicy,
|
|
||||||
optimisticResult: optimisticResult,
|
|
||||||
pollInterval: pollInterval,
|
|
||||||
context: context,
|
|
||||||
document: documentNodeQueryGetServerDiskVolumesQuery,
|
|
||||||
parserFn: _parserFn$Query$GetServerDiskVolumesQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
class WatchOptions$Query$GetServerDiskVolumesQuery
|
|
||||||
extends graphql.WatchQueryOptions<Query$GetServerDiskVolumesQuery> {
|
|
||||||
WatchOptions$Query$GetServerDiskVolumesQuery(
|
|
||||||
{String? operationName,
|
|
||||||
graphql.FetchPolicy? fetchPolicy,
|
|
||||||
graphql.ErrorPolicy? errorPolicy,
|
|
||||||
graphql.CacheRereadPolicy? cacheRereadPolicy,
|
|
||||||
Object? optimisticResult,
|
|
||||||
graphql.Context? context,
|
|
||||||
Duration? pollInterval,
|
|
||||||
bool? eagerlyFetchResults,
|
|
||||||
bool carryForwardDataOnException = true,
|
|
||||||
bool fetchResults = false})
|
|
||||||
: super(
|
|
||||||
operationName: operationName,
|
|
||||||
fetchPolicy: fetchPolicy,
|
|
||||||
errorPolicy: errorPolicy,
|
|
||||||
cacheRereadPolicy: cacheRereadPolicy,
|
|
||||||
optimisticResult: optimisticResult,
|
|
||||||
context: context,
|
|
||||||
document: documentNodeQueryGetServerDiskVolumesQuery,
|
|
||||||
pollInterval: pollInterval,
|
|
||||||
eagerlyFetchResults: eagerlyFetchResults,
|
|
||||||
carryForwardDataOnException: carryForwardDataOnException,
|
|
||||||
fetchResults: fetchResults,
|
|
||||||
parserFn: _parserFn$Query$GetServerDiskVolumesQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
class FetchMoreOptions$Query$GetServerDiskVolumesQuery
|
|
||||||
extends graphql.FetchMoreOptions {
|
|
||||||
FetchMoreOptions$Query$GetServerDiskVolumesQuery(
|
|
||||||
{required graphql.UpdateQuery updateQuery})
|
|
||||||
: super(
|
|
||||||
updateQuery: updateQuery,
|
|
||||||
document: documentNodeQueryGetServerDiskVolumesQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ClientExtension$Query$GetServerDiskVolumesQuery
|
|
||||||
on graphql.GraphQLClient {
|
|
||||||
Future<graphql.QueryResult<Query$GetServerDiskVolumesQuery>>
|
|
||||||
query$GetServerDiskVolumesQuery(
|
|
||||||
[Options$Query$GetServerDiskVolumesQuery? options]) async =>
|
|
||||||
await this
|
|
||||||
.query(options ?? Options$Query$GetServerDiskVolumesQuery());
|
|
||||||
graphql.ObservableQuery<Query$GetServerDiskVolumesQuery>
|
|
||||||
watchQuery$GetServerDiskVolumesQuery(
|
|
||||||
[WatchOptions$Query$GetServerDiskVolumesQuery? options]) =>
|
|
||||||
this.watchQuery(
|
|
||||||
options ?? WatchOptions$Query$GetServerDiskVolumesQuery());
|
|
||||||
void writeQuery$GetServerDiskVolumesQuery(
|
|
||||||
{required Query$GetServerDiskVolumesQuery data,
|
|
||||||
bool broadcast = true}) =>
|
|
||||||
this.writeQuery(
|
|
||||||
graphql.Request(
|
|
||||||
operation: graphql.Operation(
|
|
||||||
document: documentNodeQueryGetServerDiskVolumesQuery)),
|
|
||||||
data: data.toJson(),
|
|
||||||
broadcast: broadcast);
|
|
||||||
Query$GetServerDiskVolumesQuery? readQuery$GetServerDiskVolumesQuery(
|
|
||||||
{bool optimistic = true}) {
|
|
||||||
final result = this.readQuery(
|
|
||||||
graphql.Request(
|
|
||||||
operation: graphql.Operation(
|
|
||||||
document: documentNodeQueryGetServerDiskVolumesQuery)),
|
|
||||||
optimistic: optimistic);
|
|
||||||
return result == null
|
|
||||||
? null
|
|
||||||
: Query$GetServerDiskVolumesQuery.fromJson(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class Query$GetServerDiskVolumesQuery$storage {
|
|
||||||
Query$GetServerDiskVolumesQuery$storage(
|
|
||||||
{required this.volumes, required this.$__typename});
|
|
||||||
|
|
||||||
@override
|
|
||||||
factory Query$GetServerDiskVolumesQuery$storage.fromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
_$Query$GetServerDiskVolumesQuery$storageFromJson(json);
|
|
||||||
|
|
||||||
final List<Query$GetServerDiskVolumesQuery$storage$volumes> volumes;
|
|
||||||
|
|
||||||
@JsonKey(name: '__typename')
|
|
||||||
final String $__typename;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() =>
|
|
||||||
_$Query$GetServerDiskVolumesQuery$storageToJson(this);
|
|
||||||
int get hashCode {
|
|
||||||
final l$volumes = volumes;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
return Object.hashAll(
|
|
||||||
[Object.hashAll(l$volumes.map((v) => v)), l$$__typename]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
if (!(other is Query$GetServerDiskVolumesQuery$storage) ||
|
|
||||||
runtimeType != other.runtimeType) return false;
|
|
||||||
final l$volumes = volumes;
|
|
||||||
final lOther$volumes = other.volumes;
|
|
||||||
if (l$volumes.length != lOther$volumes.length) return false;
|
|
||||||
for (int i = 0; i < l$volumes.length; i++) {
|
|
||||||
final l$volumes$entry = l$volumes[i];
|
|
||||||
final lOther$volumes$entry = lOther$volumes[i];
|
|
||||||
if (l$volumes$entry != lOther$volumes$entry) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
final lOther$$__typename = other.$__typename;
|
|
||||||
if (l$$__typename != lOther$$__typename) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage
|
|
||||||
on Query$GetServerDiskVolumesQuery$storage {
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage<
|
|
||||||
Query$GetServerDiskVolumesQuery$storage>
|
|
||||||
get copyWith =>
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage(this, (i) => i);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage<TRes> {
|
|
||||||
factory CopyWith$Query$GetServerDiskVolumesQuery$storage(
|
|
||||||
Query$GetServerDiskVolumesQuery$storage instance,
|
|
||||||
TRes Function(Query$GetServerDiskVolumesQuery$storage) then) =
|
|
||||||
_CopyWithImpl$Query$GetServerDiskVolumesQuery$storage;
|
|
||||||
|
|
||||||
factory CopyWith$Query$GetServerDiskVolumesQuery$storage.stub(TRes res) =
|
|
||||||
_CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage;
|
|
||||||
|
|
||||||
TRes call(
|
|
||||||
{List<Query$GetServerDiskVolumesQuery$storage$volumes>? volumes,
|
|
||||||
String? $__typename});
|
|
||||||
TRes volumes(
|
|
||||||
Iterable<Query$GetServerDiskVolumesQuery$storage$volumes> Function(
|
|
||||||
Iterable<
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes<
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes>>)
|
|
||||||
_fn);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage<TRes>
|
|
||||||
implements CopyWith$Query$GetServerDiskVolumesQuery$storage<TRes> {
|
|
||||||
_CopyWithImpl$Query$GetServerDiskVolumesQuery$storage(
|
|
||||||
this._instance, this._then);
|
|
||||||
|
|
||||||
final Query$GetServerDiskVolumesQuery$storage _instance;
|
|
||||||
|
|
||||||
final TRes Function(Query$GetServerDiskVolumesQuery$storage) _then;
|
|
||||||
|
|
||||||
static const _undefined = {};
|
|
||||||
|
|
||||||
TRes call({Object? volumes = _undefined, Object? $__typename = _undefined}) =>
|
|
||||||
_then(Query$GetServerDiskVolumesQuery$storage(
|
|
||||||
volumes: volumes == _undefined || volumes == null
|
|
||||||
? _instance.volumes
|
|
||||||
: (volumes
|
|
||||||
as List<Query$GetServerDiskVolumesQuery$storage$volumes>),
|
|
||||||
$__typename: $__typename == _undefined || $__typename == null
|
|
||||||
? _instance.$__typename
|
|
||||||
: ($__typename as String)));
|
|
||||||
TRes volumes(
|
|
||||||
Iterable<Query$GetServerDiskVolumesQuery$storage$volumes> Function(
|
|
||||||
Iterable<
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes<
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes>>)
|
|
||||||
_fn) =>
|
|
||||||
call(
|
|
||||||
volumes: _fn(_instance.volumes.map((e) =>
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
e, (i) => i))).toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage<TRes>
|
|
||||||
implements CopyWith$Query$GetServerDiskVolumesQuery$storage<TRes> {
|
|
||||||
_CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage(this._res);
|
|
||||||
|
|
||||||
TRes _res;
|
|
||||||
|
|
||||||
call(
|
|
||||||
{List<Query$GetServerDiskVolumesQuery$storage$volumes>? volumes,
|
|
||||||
String? $__typename}) =>
|
|
||||||
_res;
|
|
||||||
volumes(_fn) => _res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class Query$GetServerDiskVolumesQuery$storage$volumes {
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
{required this.freeSpace,
|
|
||||||
required this.name,
|
|
||||||
required this.root,
|
|
||||||
required this.totalSpace,
|
|
||||||
required this.usedSpace,
|
|
||||||
required this.$__typename});
|
|
||||||
|
|
||||||
@override
|
|
||||||
factory Query$GetServerDiskVolumesQuery$storage$volumes.fromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
_$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(json);
|
|
||||||
|
|
||||||
final String freeSpace;
|
|
||||||
|
|
||||||
final String name;
|
|
||||||
|
|
||||||
final bool root;
|
|
||||||
|
|
||||||
final String totalSpace;
|
|
||||||
|
|
||||||
final String usedSpace;
|
|
||||||
|
|
||||||
@JsonKey(name: '__typename')
|
|
||||||
final String $__typename;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() =>
|
|
||||||
_$Query$GetServerDiskVolumesQuery$storage$volumesToJson(this);
|
|
||||||
int get hashCode {
|
|
||||||
final l$freeSpace = freeSpace;
|
|
||||||
final l$name = name;
|
|
||||||
final l$root = root;
|
|
||||||
final l$totalSpace = totalSpace;
|
|
||||||
final l$usedSpace = usedSpace;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
return Object.hashAll([
|
|
||||||
l$freeSpace,
|
|
||||||
l$name,
|
|
||||||
l$root,
|
|
||||||
l$totalSpace,
|
|
||||||
l$usedSpace,
|
|
||||||
l$$__typename
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
if (!(other is Query$GetServerDiskVolumesQuery$storage$volumes) ||
|
|
||||||
runtimeType != other.runtimeType) return false;
|
|
||||||
final l$freeSpace = freeSpace;
|
|
||||||
final lOther$freeSpace = other.freeSpace;
|
|
||||||
if (l$freeSpace != lOther$freeSpace) return false;
|
|
||||||
final l$name = name;
|
|
||||||
final lOther$name = other.name;
|
|
||||||
if (l$name != lOther$name) return false;
|
|
||||||
final l$root = root;
|
|
||||||
final lOther$root = other.root;
|
|
||||||
if (l$root != lOther$root) return false;
|
|
||||||
final l$totalSpace = totalSpace;
|
|
||||||
final lOther$totalSpace = other.totalSpace;
|
|
||||||
if (l$totalSpace != lOther$totalSpace) return false;
|
|
||||||
final l$usedSpace = usedSpace;
|
|
||||||
final lOther$usedSpace = other.usedSpace;
|
|
||||||
if (l$usedSpace != lOther$usedSpace) return false;
|
|
||||||
final l$$__typename = $__typename;
|
|
||||||
final lOther$$__typename = other.$__typename;
|
|
||||||
if (l$$__typename != lOther$$__typename) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UtilityExtension$Query$GetServerDiskVolumesQuery$storage$volumes
|
|
||||||
on Query$GetServerDiskVolumesQuery$storage$volumes {
|
|
||||||
CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes<
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes>
|
|
||||||
get copyWith => CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
this, (i) => i);
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes<TRes> {
|
|
||||||
factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes instance,
|
|
||||||
TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) then) =
|
|
||||||
_CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes;
|
|
||||||
|
|
||||||
factory CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes.stub(
|
|
||||||
TRes res) =
|
|
||||||
_CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes;
|
|
||||||
|
|
||||||
TRes call(
|
|
||||||
{String? freeSpace,
|
|
||||||
String? name,
|
|
||||||
bool? root,
|
|
||||||
String? totalSpace,
|
|
||||||
String? usedSpace,
|
|
||||||
String? $__typename});
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes<TRes>
|
|
||||||
implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes<TRes> {
|
|
||||||
_CopyWithImpl$Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
this._instance, this._then);
|
|
||||||
|
|
||||||
final Query$GetServerDiskVolumesQuery$storage$volumes _instance;
|
|
||||||
|
|
||||||
final TRes Function(Query$GetServerDiskVolumesQuery$storage$volumes) _then;
|
|
||||||
|
|
||||||
static const _undefined = {};
|
|
||||||
|
|
||||||
TRes call(
|
|
||||||
{Object? freeSpace = _undefined,
|
|
||||||
Object? name = _undefined,
|
|
||||||
Object? root = _undefined,
|
|
||||||
Object? totalSpace = _undefined,
|
|
||||||
Object? usedSpace = _undefined,
|
|
||||||
Object? $__typename = _undefined}) =>
|
|
||||||
_then(Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
freeSpace: freeSpace == _undefined || freeSpace == null
|
|
||||||
? _instance.freeSpace
|
|
||||||
: (freeSpace as String),
|
|
||||||
name: name == _undefined || name == null
|
|
||||||
? _instance.name
|
|
||||||
: (name as String),
|
|
||||||
root: root == _undefined || root == null
|
|
||||||
? _instance.root
|
|
||||||
: (root as bool),
|
|
||||||
totalSpace: totalSpace == _undefined || totalSpace == null
|
|
||||||
? _instance.totalSpace
|
|
||||||
: (totalSpace as String),
|
|
||||||
usedSpace: usedSpace == _undefined || usedSpace == null
|
|
||||||
? _instance.usedSpace
|
|
||||||
: (usedSpace as String),
|
|
||||||
$__typename: $__typename == _undefined || $__typename == null
|
|
||||||
? _instance.$__typename
|
|
||||||
: ($__typename as String)));
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes<TRes>
|
|
||||||
implements CopyWith$Query$GetServerDiskVolumesQuery$storage$volumes<TRes> {
|
|
||||||
_CopyWithStubImpl$Query$GetServerDiskVolumesQuery$storage$volumes(this._res);
|
|
||||||
|
|
||||||
TRes _res;
|
|
||||||
|
|
||||||
call(
|
|
||||||
{String? freeSpace,
|
|
||||||
String? name,
|
|
||||||
bool? root,
|
|
||||||
String? totalSpace,
|
|
||||||
String? usedSpace,
|
|
||||||
String? $__typename}) =>
|
|
||||||
_res;
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'get_server_disk_volumes.graphql.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
Query$GetServerDiskVolumesQuery _$Query$GetServerDiskVolumesQueryFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
Query$GetServerDiskVolumesQuery(
|
|
||||||
storage: Query$GetServerDiskVolumesQuery$storage.fromJson(
|
|
||||||
json['storage'] as Map<String, dynamic>),
|
|
||||||
$__typename: json['__typename'] as String,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$Query$GetServerDiskVolumesQueryToJson(
|
|
||||||
Query$GetServerDiskVolumesQuery instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'storage': instance.storage.toJson(),
|
|
||||||
'__typename': instance.$__typename,
|
|
||||||
};
|
|
||||||
|
|
||||||
Query$GetServerDiskVolumesQuery$storage
|
|
||||||
_$Query$GetServerDiskVolumesQuery$storageFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
Query$GetServerDiskVolumesQuery$storage(
|
|
||||||
volumes: (json['volumes'] as List<dynamic>)
|
|
||||||
.map((e) =>
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes.fromJson(
|
|
||||||
e as Map<String, dynamic>))
|
|
||||||
.toList(),
|
|
||||||
$__typename: json['__typename'] as String,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$Query$GetServerDiskVolumesQuery$storageToJson(
|
|
||||||
Query$GetServerDiskVolumesQuery$storage instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'volumes': instance.volumes.map((e) => e.toJson()).toList(),
|
|
||||||
'__typename': instance.$__typename,
|
|
||||||
};
|
|
||||||
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes
|
|
||||||
_$Query$GetServerDiskVolumesQuery$storage$volumesFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes(
|
|
||||||
freeSpace: json['freeSpace'] as String,
|
|
||||||
name: json['name'] as String,
|
|
||||||
root: json['root'] as bool,
|
|
||||||
totalSpace: json['totalSpace'] as String,
|
|
||||||
usedSpace: json['usedSpace'] as String,
|
|
||||||
$__typename: json['__typename'] as String,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$Query$GetServerDiskVolumesQuery$storage$volumesToJson(
|
|
||||||
Query$GetServerDiskVolumesQuery$storage$volumes instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'freeSpace': instance.freeSpace,
|
|
||||||
'name': instance.name,
|
|
||||||
'root': instance.root,
|
|
||||||
'totalSpace': instance.totalSpace,
|
|
||||||
'usedSpace': instance.usedSpace,
|
|
||||||
'__typename': instance.$__typename,
|
|
||||||
};
|
|
|
@ -7,18 +7,21 @@ type Alert {
|
||||||
timestamp: DateTime
|
timestamp: DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
type Storage {
|
|
||||||
volumes: [StorageVolume!]!
|
|
||||||
}
|
|
||||||
|
|
||||||
type StorageVolume {
|
type StorageVolume {
|
||||||
freeSpace: String!
|
freeSpace: String!
|
||||||
|
model: String!
|
||||||
name: String!
|
name: String!
|
||||||
root: Boolean!
|
root: Boolean!
|
||||||
|
serial: String!
|
||||||
totalSpace: String!
|
totalSpace: String!
|
||||||
|
type: String!
|
||||||
usedSpace: String!
|
usedSpace: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Storage {
|
||||||
|
volumes: [StorageVolume!]!
|
||||||
|
}
|
||||||
|
|
||||||
type Api {
|
type Api {
|
||||||
version: String!
|
version: String!
|
||||||
devices: [ApiDevice!]!
|
devices: [ApiDevice!]!
|
||||||
|
@ -84,6 +87,9 @@ type Mutation {
|
||||||
getNewDeviceApiKey: ApiKeyMutationReturn!
|
getNewDeviceApiKey: ApiKeyMutationReturn!
|
||||||
invalidateNewDeviceApiKey: GenericMutationReturn!
|
invalidateNewDeviceApiKey: GenericMutationReturn!
|
||||||
authorizeWithNewDeviceApiKey(input: UseNewDeviceKeyInput!): DeviceApiTokenMutationReturn!
|
authorizeWithNewDeviceApiKey(input: UseNewDeviceKeyInput!): DeviceApiTokenMutationReturn!
|
||||||
|
resizeVolume(name: String!): GenericMutationReturn!
|
||||||
|
unmountVolume(name: String!): GenericMutationReturn!
|
||||||
|
mountVolume(name: String!): GenericMutationReturn!
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MutationReturnInterface {
|
interface MutationReturnInterface {
|
||||||
|
@ -161,4 +167,4 @@ input UseNewDeviceKeyInput {
|
||||||
input UseRecoveryKeyInput {
|
input UseRecoveryKeyInput {
|
||||||
key: String!
|
key: String!
|
||||||
deviceName: String!
|
deviceName: String!
|
||||||
}
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
import 'package:graphql/client.dart';
|
import 'package:graphql/client.dart';
|
||||||
import 'package:selfprivacy/config/get_it_config.dart';
|
import 'package:selfprivacy/config/get_it_config.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart';
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/api_map.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_tokens.graphql.dart';
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_api_version.graphql.dart';
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/get_server_disk_volumes.graphql.dart';
|
|
||||||
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
|
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
|
||||||
import 'package:selfprivacy/logic/models/json/api_token.dart';
|
import 'package:selfprivacy/logic/models/json/api_token.dart';
|
||||||
import 'package:selfprivacy/logic/models/json/server_disk_volume.dart';
|
import 'package:selfprivacy/logic/models/json/server_disk_volume.dart';
|
||||||
|
@ -12,7 +11,7 @@ class ServerApi extends ApiMap {
|
||||||
ServerApi({
|
ServerApi({
|
||||||
this.hasLogger = false,
|
this.hasLogger = false,
|
||||||
this.isWithToken = true,
|
this.isWithToken = true,
|
||||||
this.authToken = '',
|
this.customToken = '',
|
||||||
}) {
|
}) {
|
||||||
final ServerDomain? serverDomain = getIt<ApiConfigModel>().serverDomain;
|
final ServerDomain? serverDomain = getIt<ApiConfigModel>().serverDomain;
|
||||||
rootAddress = serverDomain?.domainName ?? '';
|
rootAddress = serverDomain?.domainName ?? '';
|
||||||
|
@ -22,7 +21,7 @@ class ServerApi extends ApiMap {
|
||||||
@override
|
@override
|
||||||
bool isWithToken;
|
bool isWithToken;
|
||||||
@override
|
@override
|
||||||
String authToken;
|
String customToken;
|
||||||
@override
|
@override
|
||||||
String? rootAddress;
|
String? rootAddress;
|
||||||
|
|
||||||
|
@ -73,4 +72,43 @@ class ServerApi extends ApiMap {
|
||||||
|
|
||||||
return volumes;
|
return volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> mountVolume(final String volumeName) async {
|
||||||
|
try {
|
||||||
|
final GraphQLClient client = await getClient();
|
||||||
|
final variables =
|
||||||
|
Variables$Mutation$MountVolumeMutation(name: volumeName);
|
||||||
|
final mountVolumeMutation =
|
||||||
|
Options$Mutation$MountVolumeMutation(variables: variables);
|
||||||
|
await client.mutate$MountVolumeMutation(mountVolumeMutation);
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> unmountVolume(final String volumeName) async {
|
||||||
|
try {
|
||||||
|
final GraphQLClient client = await getClient();
|
||||||
|
final variables =
|
||||||
|
Variables$Mutation$UnmountVolumeMutation(name: volumeName);
|
||||||
|
final unmountVolumeMutation =
|
||||||
|
Options$Mutation$UnmountVolumeMutation(variables: variables);
|
||||||
|
await client.mutate$UnmountVolumeMutation(unmountVolumeMutation);
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> resizeVolume(final String volumeName) async {
|
||||||
|
try {
|
||||||
|
final GraphQLClient client = await getClient();
|
||||||
|
final variables =
|
||||||
|
Variables$Mutation$ResizeVolumeMutation(name: volumeName);
|
||||||
|
final resizeVolumeMutation =
|
||||||
|
Options$Mutation$ResizeVolumeMutation(variables: variables);
|
||||||
|
await client.mutate$ResizeVolumeMutation(resizeVolumeMutation);
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,10 @@ query GetApiTokensQuery {
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query GetApiVersionQuery {
|
||||||
|
api {
|
||||||
|
version
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ import 'package:gql/ast.dart';
|
||||||
import 'package:graphql/client.dart' as graphql;
|
import 'package:graphql/client.dart' as graphql;
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
import 'package:selfprivacy/utils/scalars.dart';
|
import 'package:selfprivacy/utils/scalars.dart';
|
||||||
part 'get_api_tokens.graphql.g.dart';
|
part 'server_api.graphql.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
class Query$GetApiTokensQuery {
|
class Query$GetApiTokensQuery {
|
||||||
|
@ -472,3 +472,300 @@ class _CopyWithStubImpl$Query$GetApiTokensQuery$api$devices<TRes>
|
||||||
String? $__typename}) =>
|
String? $__typename}) =>
|
||||||
_res;
|
_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
class Query$GetApiVersionQuery {
|
||||||
|
Query$GetApiVersionQuery({required this.api, required this.$__typename});
|
||||||
|
|
||||||
|
@override
|
||||||
|
factory Query$GetApiVersionQuery.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$Query$GetApiVersionQueryFromJson(json);
|
||||||
|
|
||||||
|
final Query$GetApiVersionQuery$api api;
|
||||||
|
|
||||||
|
@JsonKey(name: '__typename')
|
||||||
|
final String $__typename;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$Query$GetApiVersionQueryToJson(this);
|
||||||
|
int get hashCode {
|
||||||
|
final l$api = api;
|
||||||
|
final l$$__typename = $__typename;
|
||||||
|
return Object.hashAll([l$api, l$$__typename]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
if (!(other is Query$GetApiVersionQuery) ||
|
||||||
|
runtimeType != other.runtimeType) return false;
|
||||||
|
final l$api = api;
|
||||||
|
final lOther$api = other.api;
|
||||||
|
if (l$api != lOther$api) return false;
|
||||||
|
final l$$__typename = $__typename;
|
||||||
|
final lOther$$__typename = other.$__typename;
|
||||||
|
if (l$$__typename != lOther$$__typename) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UtilityExtension$Query$GetApiVersionQuery
|
||||||
|
on Query$GetApiVersionQuery {
|
||||||
|
CopyWith$Query$GetApiVersionQuery<Query$GetApiVersionQuery> get copyWith =>
|
||||||
|
CopyWith$Query$GetApiVersionQuery(this, (i) => i);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class CopyWith$Query$GetApiVersionQuery<TRes> {
|
||||||
|
factory CopyWith$Query$GetApiVersionQuery(Query$GetApiVersionQuery instance,
|
||||||
|
TRes Function(Query$GetApiVersionQuery) then) =
|
||||||
|
_CopyWithImpl$Query$GetApiVersionQuery;
|
||||||
|
|
||||||
|
factory CopyWith$Query$GetApiVersionQuery.stub(TRes res) =
|
||||||
|
_CopyWithStubImpl$Query$GetApiVersionQuery;
|
||||||
|
|
||||||
|
TRes call({Query$GetApiVersionQuery$api? api, String? $__typename});
|
||||||
|
CopyWith$Query$GetApiVersionQuery$api<TRes> get api;
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CopyWithImpl$Query$GetApiVersionQuery<TRes>
|
||||||
|
implements CopyWith$Query$GetApiVersionQuery<TRes> {
|
||||||
|
_CopyWithImpl$Query$GetApiVersionQuery(this._instance, this._then);
|
||||||
|
|
||||||
|
final Query$GetApiVersionQuery _instance;
|
||||||
|
|
||||||
|
final TRes Function(Query$GetApiVersionQuery) _then;
|
||||||
|
|
||||||
|
static const _undefined = {};
|
||||||
|
|
||||||
|
TRes call({Object? api = _undefined, Object? $__typename = _undefined}) =>
|
||||||
|
_then(Query$GetApiVersionQuery(
|
||||||
|
api: api == _undefined || api == null
|
||||||
|
? _instance.api
|
||||||
|
: (api as Query$GetApiVersionQuery$api),
|
||||||
|
$__typename: $__typename == _undefined || $__typename == null
|
||||||
|
? _instance.$__typename
|
||||||
|
: ($__typename as String)));
|
||||||
|
CopyWith$Query$GetApiVersionQuery$api<TRes> get api {
|
||||||
|
final local$api = _instance.api;
|
||||||
|
return CopyWith$Query$GetApiVersionQuery$api(
|
||||||
|
local$api, (e) => call(api: e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CopyWithStubImpl$Query$GetApiVersionQuery<TRes>
|
||||||
|
implements CopyWith$Query$GetApiVersionQuery<TRes> {
|
||||||
|
_CopyWithStubImpl$Query$GetApiVersionQuery(this._res);
|
||||||
|
|
||||||
|
TRes _res;
|
||||||
|
|
||||||
|
call({Query$GetApiVersionQuery$api? api, String? $__typename}) => _res;
|
||||||
|
CopyWith$Query$GetApiVersionQuery$api<TRes> get api =>
|
||||||
|
CopyWith$Query$GetApiVersionQuery$api.stub(_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
const documentNodeQueryGetApiVersionQuery = DocumentNode(definitions: [
|
||||||
|
OperationDefinitionNode(
|
||||||
|
type: OperationType.query,
|
||||||
|
name: NameNode(value: 'GetApiVersionQuery'),
|
||||||
|
variableDefinitions: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: SelectionSetNode(selections: [
|
||||||
|
FieldNode(
|
||||||
|
name: NameNode(value: 'api'),
|
||||||
|
alias: null,
|
||||||
|
arguments: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: SelectionSetNode(selections: [
|
||||||
|
FieldNode(
|
||||||
|
name: NameNode(value: 'version'),
|
||||||
|
alias: null,
|
||||||
|
arguments: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: null),
|
||||||
|
FieldNode(
|
||||||
|
name: NameNode(value: '__typename'),
|
||||||
|
alias: null,
|
||||||
|
arguments: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: null)
|
||||||
|
])),
|
||||||
|
FieldNode(
|
||||||
|
name: NameNode(value: '__typename'),
|
||||||
|
alias: null,
|
||||||
|
arguments: [],
|
||||||
|
directives: [],
|
||||||
|
selectionSet: null)
|
||||||
|
])),
|
||||||
|
]);
|
||||||
|
Query$GetApiVersionQuery _parserFn$Query$GetApiVersionQuery(
|
||||||
|
Map<String, dynamic> data) =>
|
||||||
|
Query$GetApiVersionQuery.fromJson(data);
|
||||||
|
|
||||||
|
class Options$Query$GetApiVersionQuery
|
||||||
|
extends graphql.QueryOptions<Query$GetApiVersionQuery> {
|
||||||
|
Options$Query$GetApiVersionQuery(
|
||||||
|
{String? operationName,
|
||||||
|
graphql.FetchPolicy? fetchPolicy,
|
||||||
|
graphql.ErrorPolicy? errorPolicy,
|
||||||
|
graphql.CacheRereadPolicy? cacheRereadPolicy,
|
||||||
|
Object? optimisticResult,
|
||||||
|
Duration? pollInterval,
|
||||||
|
graphql.Context? context})
|
||||||
|
: super(
|
||||||
|
operationName: operationName,
|
||||||
|
fetchPolicy: fetchPolicy,
|
||||||
|
errorPolicy: errorPolicy,
|
||||||
|
cacheRereadPolicy: cacheRereadPolicy,
|
||||||
|
optimisticResult: optimisticResult,
|
||||||
|
pollInterval: pollInterval,
|
||||||
|
context: context,
|
||||||
|
document: documentNodeQueryGetApiVersionQuery,
|
||||||
|
parserFn: _parserFn$Query$GetApiVersionQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
class WatchOptions$Query$GetApiVersionQuery
|
||||||
|
extends graphql.WatchQueryOptions<Query$GetApiVersionQuery> {
|
||||||
|
WatchOptions$Query$GetApiVersionQuery(
|
||||||
|
{String? operationName,
|
||||||
|
graphql.FetchPolicy? fetchPolicy,
|
||||||
|
graphql.ErrorPolicy? errorPolicy,
|
||||||
|
graphql.CacheRereadPolicy? cacheRereadPolicy,
|
||||||
|
Object? optimisticResult,
|
||||||
|
graphql.Context? context,
|
||||||
|
Duration? pollInterval,
|
||||||
|
bool? eagerlyFetchResults,
|
||||||
|
bool carryForwardDataOnException = true,
|
||||||
|
bool fetchResults = false})
|
||||||
|
: super(
|
||||||
|
operationName: operationName,
|
||||||
|
fetchPolicy: fetchPolicy,
|
||||||
|
errorPolicy: errorPolicy,
|
||||||
|
cacheRereadPolicy: cacheRereadPolicy,
|
||||||
|
optimisticResult: optimisticResult,
|
||||||
|
context: context,
|
||||||
|
document: documentNodeQueryGetApiVersionQuery,
|
||||||
|
pollInterval: pollInterval,
|
||||||
|
eagerlyFetchResults: eagerlyFetchResults,
|
||||||
|
carryForwardDataOnException: carryForwardDataOnException,
|
||||||
|
fetchResults: fetchResults,
|
||||||
|
parserFn: _parserFn$Query$GetApiVersionQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
class FetchMoreOptions$Query$GetApiVersionQuery
|
||||||
|
extends graphql.FetchMoreOptions {
|
||||||
|
FetchMoreOptions$Query$GetApiVersionQuery(
|
||||||
|
{required graphql.UpdateQuery updateQuery})
|
||||||
|
: super(
|
||||||
|
updateQuery: updateQuery,
|
||||||
|
document: documentNodeQueryGetApiVersionQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ClientExtension$Query$GetApiVersionQuery on graphql.GraphQLClient {
|
||||||
|
Future<graphql.QueryResult<Query$GetApiVersionQuery>>
|
||||||
|
query$GetApiVersionQuery(
|
||||||
|
[Options$Query$GetApiVersionQuery? options]) async =>
|
||||||
|
await this.query(options ?? Options$Query$GetApiVersionQuery());
|
||||||
|
graphql.ObservableQuery<Query$GetApiVersionQuery>
|
||||||
|
watchQuery$GetApiVersionQuery(
|
||||||
|
[WatchOptions$Query$GetApiVersionQuery? options]) =>
|
||||||
|
this.watchQuery(options ?? WatchOptions$Query$GetApiVersionQuery());
|
||||||
|
void writeQuery$GetApiVersionQuery(
|
||||||
|
{required Query$GetApiVersionQuery data, bool broadcast = true}) =>
|
||||||
|
this.writeQuery(
|
||||||
|
graphql.Request(
|
||||||
|
operation: graphql.Operation(
|
||||||
|
document: documentNodeQueryGetApiVersionQuery)),
|
||||||
|
data: data.toJson(),
|
||||||
|
broadcast: broadcast);
|
||||||
|
Query$GetApiVersionQuery? readQuery$GetApiVersionQuery(
|
||||||
|
{bool optimistic = true}) {
|
||||||
|
final result = this.readQuery(
|
||||||
|
graphql.Request(
|
||||||
|
operation: graphql.Operation(
|
||||||
|
document: documentNodeQueryGetApiVersionQuery)),
|
||||||
|
optimistic: optimistic);
|
||||||
|
return result == null ? null : Query$GetApiVersionQuery.fromJson(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
class Query$GetApiVersionQuery$api {
|
||||||
|
Query$GetApiVersionQuery$api(
|
||||||
|
{required this.version, required this.$__typename});
|
||||||
|
|
||||||
|
@override
|
||||||
|
factory Query$GetApiVersionQuery$api.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$Query$GetApiVersionQuery$apiFromJson(json);
|
||||||
|
|
||||||
|
final String version;
|
||||||
|
|
||||||
|
@JsonKey(name: '__typename')
|
||||||
|
final String $__typename;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$Query$GetApiVersionQuery$apiToJson(this);
|
||||||
|
int get hashCode {
|
||||||
|
final l$version = version;
|
||||||
|
final l$$__typename = $__typename;
|
||||||
|
return Object.hashAll([l$version, l$$__typename]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
if (!(other is Query$GetApiVersionQuery$api) ||
|
||||||
|
runtimeType != other.runtimeType) return false;
|
||||||
|
final l$version = version;
|
||||||
|
final lOther$version = other.version;
|
||||||
|
if (l$version != lOther$version) return false;
|
||||||
|
final l$$__typename = $__typename;
|
||||||
|
final lOther$$__typename = other.$__typename;
|
||||||
|
if (l$$__typename != lOther$$__typename) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UtilityExtension$Query$GetApiVersionQuery$api
|
||||||
|
on Query$GetApiVersionQuery$api {
|
||||||
|
CopyWith$Query$GetApiVersionQuery$api<Query$GetApiVersionQuery$api>
|
||||||
|
get copyWith => CopyWith$Query$GetApiVersionQuery$api(this, (i) => i);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class CopyWith$Query$GetApiVersionQuery$api<TRes> {
|
||||||
|
factory CopyWith$Query$GetApiVersionQuery$api(
|
||||||
|
Query$GetApiVersionQuery$api instance,
|
||||||
|
TRes Function(Query$GetApiVersionQuery$api) then) =
|
||||||
|
_CopyWithImpl$Query$GetApiVersionQuery$api;
|
||||||
|
|
||||||
|
factory CopyWith$Query$GetApiVersionQuery$api.stub(TRes res) =
|
||||||
|
_CopyWithStubImpl$Query$GetApiVersionQuery$api;
|
||||||
|
|
||||||
|
TRes call({String? version, String? $__typename});
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CopyWithImpl$Query$GetApiVersionQuery$api<TRes>
|
||||||
|
implements CopyWith$Query$GetApiVersionQuery$api<TRes> {
|
||||||
|
_CopyWithImpl$Query$GetApiVersionQuery$api(this._instance, this._then);
|
||||||
|
|
||||||
|
final Query$GetApiVersionQuery$api _instance;
|
||||||
|
|
||||||
|
final TRes Function(Query$GetApiVersionQuery$api) _then;
|
||||||
|
|
||||||
|
static const _undefined = {};
|
||||||
|
|
||||||
|
TRes call({Object? version = _undefined, Object? $__typename = _undefined}) =>
|
||||||
|
_then(Query$GetApiVersionQuery$api(
|
||||||
|
version: version == _undefined || version == null
|
||||||
|
? _instance.version
|
||||||
|
: (version as String),
|
||||||
|
$__typename: $__typename == _undefined || $__typename == null
|
||||||
|
? _instance.$__typename
|
||||||
|
: ($__typename as String)));
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CopyWithStubImpl$Query$GetApiVersionQuery$api<TRes>
|
||||||
|
implements CopyWith$Query$GetApiVersionQuery$api<TRes> {
|
||||||
|
_CopyWithStubImpl$Query$GetApiVersionQuery$api(this._res);
|
||||||
|
|
||||||
|
TRes _res;
|
||||||
|
|
||||||
|
call({String? version, String? $__typename}) => _res;
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
part of 'get_api_tokens.graphql.dart';
|
part of 'server_api.graphql.dart';
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
|
@ -55,3 +55,32 @@ Map<String, dynamic> _$Query$GetApiTokensQuery$api$devicesToJson(
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'__typename': instance.$__typename,
|
'__typename': instance.$__typename,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Query$GetApiVersionQuery _$Query$GetApiVersionQueryFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Query$GetApiVersionQuery(
|
||||||
|
api: Query$GetApiVersionQuery$api.fromJson(
|
||||||
|
json['api'] as Map<String, dynamic>),
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Query$GetApiVersionQueryToJson(
|
||||||
|
Query$GetApiVersionQuery instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'api': instance.api.toJson(),
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
||||||
|
|
||||||
|
Query$GetApiVersionQuery$api _$Query$GetApiVersionQuery$apiFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
Query$GetApiVersionQuery$api(
|
||||||
|
version: json['version'] as String,
|
||||||
|
$__typename: json['__typename'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$Query$GetApiVersionQuery$apiToJson(
|
||||||
|
Query$GetApiVersionQuery$api instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'version': instance.version,
|
||||||
|
'__typename': instance.$__typename,
|
||||||
|
};
|
|
@ -96,11 +96,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
final dbSize = dbCreateResponse.data['volume']['size'];
|
final dbSize = dbCreateResponse.data['volume']['size'];
|
||||||
final dbServer = dbCreateResponse.data['volume']['server'];
|
final dbServer = dbCreateResponse.data['volume']['server'];
|
||||||
final dbName = dbCreateResponse.data['volume']['name'];
|
final dbName = dbCreateResponse.data['volume']['name'];
|
||||||
|
final dbDevice = dbCreateResponse.data['volume']['linux_device'];
|
||||||
volume = ServerVolume(
|
volume = ServerVolume(
|
||||||
id: dbId,
|
id: dbId,
|
||||||
name: dbName,
|
name: dbName,
|
||||||
sizeByte: dbSize,
|
sizeByte: dbSize,
|
||||||
serverId: dbServer,
|
serverId: dbServer,
|
||||||
|
linuxDevice: dbDevice,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
@ -130,11 +132,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
final int dbSize = rawVolume['size'];
|
final int dbSize = rawVolume['size'];
|
||||||
final dbServer = rawVolume['server'];
|
final dbServer = rawVolume['server'];
|
||||||
final String dbName = rawVolume['name'];
|
final String dbName = rawVolume['name'];
|
||||||
|
final dbDevice = rawVolume['linux_device'];
|
||||||
final volume = ServerVolume(
|
final volume = ServerVolume(
|
||||||
id: dbId,
|
id: dbId,
|
||||||
name: dbName,
|
name: dbName,
|
||||||
sizeByte: dbSize,
|
sizeByte: dbSize,
|
||||||
serverId: dbServer,
|
serverId: dbServer,
|
||||||
|
linuxDevice: dbDevice,
|
||||||
);
|
);
|
||||||
volumes.add(volume);
|
volumes.add(volume);
|
||||||
}
|
}
|
||||||
|
@ -159,11 +163,13 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
final int dbSize = dbGetResponse.data['volume']['size'];
|
final int dbSize = dbGetResponse.data['volume']['size'];
|
||||||
final int dbServer = dbGetResponse.data['volume']['server'];
|
final int dbServer = dbGetResponse.data['volume']['server'];
|
||||||
final String dbName = dbGetResponse.data['volume']['name'];
|
final String dbName = dbGetResponse.data['volume']['name'];
|
||||||
|
final dbDevice = dbGetResponse.data['volume']['linux_device'];
|
||||||
volume = ServerVolume(
|
volume = ServerVolume(
|
||||||
id: dbId,
|
id: dbId,
|
||||||
name: dbName,
|
name: dbName,
|
||||||
sizeByte: dbSize,
|
sizeByte: dbSize,
|
||||||
serverId: dbServer,
|
serverId: dbServer,
|
||||||
|
linuxDevice: dbDevice,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
|
@ -541,6 +541,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
||||||
name: 'recovered_volume',
|
name: 'recovered_volume',
|
||||||
sizeByte: 0,
|
sizeByte: 0,
|
||||||
serverId: server.id,
|
serverId: server.id,
|
||||||
|
linuxDevice: '',
|
||||||
),
|
),
|
||||||
apiToken: dataState.serverDetails!.apiToken,
|
apiToken: dataState.serverDetails!.apiToken,
|
||||||
provider: ServerProvider.hetzner,
|
provider: ServerProvider.hetzner,
|
||||||
|
@ -556,8 +557,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<ServerDiskVolume>> getServerDiskVolumes() async =>
|
Future<List<ServerDiskVolume>> getServerDiskVolumes() async =>
|
||||||
ServerApi(authToken: 'HARDCODE OUR BEARER HERE FOR NOW')
|
ServerApi().getServerDiskVolumes();
|
||||||
.getServerDiskVolumes();
|
|
||||||
|
|
||||||
Future<void> setAndValidateCloudflareToken(final String token) async {
|
Future<void> setAndValidateCloudflareToken(final String token) async {
|
||||||
final ServerInstallationRecovery dataState =
|
final ServerInstallationRecovery dataState =
|
||||||
|
|
|
@ -475,6 +475,7 @@ class ServerInstallationRepository {
|
||||||
name: '',
|
name: '',
|
||||||
sizeByte: 0,
|
sizeByte: 0,
|
||||||
serverId: 0,
|
serverId: 0,
|
||||||
|
linuxDevice: '',
|
||||||
),
|
),
|
||||||
provider: ServerProvider.unknown,
|
provider: ServerProvider.unknown,
|
||||||
id: 0,
|
id: 0,
|
||||||
|
@ -511,6 +512,7 @@ class ServerInstallationRepository {
|
||||||
name: '',
|
name: '',
|
||||||
sizeByte: 0,
|
sizeByte: 0,
|
||||||
serverId: 0,
|
serverId: 0,
|
||||||
|
linuxDevice: '',
|
||||||
),
|
),
|
||||||
provider: ServerProvider.unknown,
|
provider: ServerProvider.unknown,
|
||||||
id: 0,
|
id: 0,
|
||||||
|
@ -547,6 +549,7 @@ class ServerInstallationRepository {
|
||||||
name: '',
|
name: '',
|
||||||
serverId: 0,
|
serverId: 0,
|
||||||
sizeByte: 0,
|
sizeByte: 0,
|
||||||
|
linuxDevice: '',
|
||||||
),
|
),
|
||||||
provider: ServerProvider.unknown,
|
provider: ServerProvider.unknown,
|
||||||
id: 0,
|
id: 0,
|
||||||
|
@ -574,6 +577,7 @@ class ServerInstallationRepository {
|
||||||
name: '',
|
name: '',
|
||||||
sizeByte: 0,
|
sizeByte: 0,
|
||||||
serverId: 0,
|
serverId: 0,
|
||||||
|
linuxDevice: '',
|
||||||
),
|
),
|
||||||
provider: ServerProvider.unknown,
|
provider: ServerProvider.unknown,
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import 'package:selfprivacy/config/get_it_config.dart';
|
import 'package:selfprivacy/config/get_it_config.dart';
|
||||||
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart';
|
import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart';
|
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart';
|
||||||
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
||||||
|
import 'package:selfprivacy/logic/models/json/server_disk_volume.dart';
|
||||||
|
|
||||||
part 'volumes_state.dart';
|
part 'volumes_state.dart';
|
||||||
|
|
||||||
|
@ -18,18 +20,18 @@ class ApiVolumesCubit
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void load() async {
|
Future<void> load() async {
|
||||||
if (serverInstallationCubit.state is ServerInstallationFinished) {
|
if (serverInstallationCubit.state is ServerInstallationFinished) {
|
||||||
_refetch();
|
_refetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh() async {
|
Future<void> refresh() async {
|
||||||
emit(const ApiVolumesState([], LoadingStatus.refreshing));
|
emit(const ApiVolumesState([], LoadingStatus.refreshing));
|
||||||
_refetch();
|
_refetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _refetch() async {
|
Future<void> _refetch() async {
|
||||||
final List<ServerVolume> volumes =
|
final List<ServerVolume> volumes =
|
||||||
await providerApi.getVolumeProvider().getVolumes();
|
await providerApi.getVolumeProvider().getVolumes();
|
||||||
if (volumes.isNotEmpty) {
|
if (volumes.isNotEmpty) {
|
||||||
|
@ -39,31 +41,51 @@ class ApiVolumesCubit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void attachVolume(final ServerVolume volume) async {
|
Future<void> attachVolume(final ServerVolume volume) async {
|
||||||
final ServerHostingDetails server = getIt<ApiConfigModel>().serverDetails!;
|
final ServerHostingDetails server = getIt<ApiConfigModel>().serverDetails!;
|
||||||
await providerApi.getVolumeProvider().attachVolume(volume.id, server.id);
|
await providerApi.getVolumeProvider().attachVolume(volume.id, server.id);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void detachVolume(final ServerVolume volume) async {
|
Future<void> detachVolume(final ServerVolume volume) async {
|
||||||
await providerApi.getVolumeProvider().detachVolume(volume.id);
|
await providerApi.getVolumeProvider().detachVolume(volume.id);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void resizeVolume(final ServerVolume volume, final int newSizeGb) async {
|
Future<bool> resizeVolume(
|
||||||
//if (volume.sizeByte < newSizeGb) {
|
final ServerDiskVolume volume,
|
||||||
await providerApi.getVolumeProvider().resizeVolume(volume.id, newSizeGb);
|
final int newSizeGb,
|
||||||
|
) async {
|
||||||
|
final ServerVolume? providerVolume = await fetchProdiverVolume(volume);
|
||||||
|
final bool resized = await providerApi.getVolumeProvider().resizeVolume(
|
||||||
|
providerVolume!.id,
|
||||||
|
newSizeGb,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!resized) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
await ServerApi().resizeVolume(volume.name);
|
||||||
refresh();
|
refresh();
|
||||||
//}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createVolume() async {
|
Future<void> createVolume() async {
|
||||||
await providerApi.getVolumeProvider().createVolume();
|
final ServerVolume? volume =
|
||||||
|
await providerApi.getVolumeProvider().createVolume();
|
||||||
|
await attachVolume(volume!);
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(seconds: 10));
|
||||||
|
|
||||||
|
final ServerDiskVolume? diskVolume = await fetchServerDiskVolume(volume);
|
||||||
|
await ServerApi().mountVolume(diskVolume!.name);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteVolume(final ServerVolume volume) async {
|
Future<void> deleteVolume(final ServerDiskVolume volume) async {
|
||||||
await providerApi.getVolumeProvider().deleteVolume(volume.id);
|
final ServerVolume? providerVolume = await fetchProdiverVolume(volume);
|
||||||
|
await providerApi.getVolumeProvider().deleteVolume(providerVolume!.id);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,4 +93,54 @@ class ApiVolumesCubit
|
||||||
void clear() {
|
void clear() {
|
||||||
emit(const ApiVolumesState.initial());
|
emit(const ApiVolumesState.initial());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<ServerVolume?> fetchProdiverVolume(
|
||||||
|
final ServerDiskVolume volume,
|
||||||
|
) async {
|
||||||
|
ServerVolume? fetchedVolume;
|
||||||
|
final List<ServerVolume> volumes =
|
||||||
|
await providerApi.getVolumeProvider().getVolumes();
|
||||||
|
|
||||||
|
for (final ServerVolume providerVolume in volumes) {
|
||||||
|
if (providerVolume.linuxDevice == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String deviceId = providerVolume.linuxDevice!.split('/').last;
|
||||||
|
if (deviceId.contains(volume.model!) &&
|
||||||
|
deviceId.contains(volume.serial!)) {
|
||||||
|
fetchedVolume = providerVolume;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetchedVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ServerDiskVolume?> fetchServerDiskVolume(
|
||||||
|
final ServerVolume volume,
|
||||||
|
) async {
|
||||||
|
ServerDiskVolume? fetchedVolume;
|
||||||
|
if (volume.linuxDevice == null) {
|
||||||
|
return fetchedVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<ServerDiskVolume> volumes =
|
||||||
|
await ServerApi().getServerDiskVolumes();
|
||||||
|
|
||||||
|
for (final ServerDiskVolume serverDiskVolumes in volumes) {
|
||||||
|
if (serverDiskVolumes.model == null || serverDiskVolumes.serial == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String deviceId = volume.linuxDevice!.split('/').last;
|
||||||
|
if (deviceId.contains(serverDiskVolumes.model!) &&
|
||||||
|
deviceId.contains(serverDiskVolumes.serial!)) {
|
||||||
|
fetchedVolume = serverDiskVolumes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetchedVolume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ class ServerVolume {
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.sizeByte,
|
required this.sizeByte,
|
||||||
required this.serverId,
|
required this.serverId,
|
||||||
|
required this.linuxDevice,
|
||||||
});
|
});
|
||||||
|
|
||||||
@HiveField(1)
|
@HiveField(1)
|
||||||
|
@ -67,6 +68,8 @@ class ServerVolume {
|
||||||
int sizeByte;
|
int sizeByte;
|
||||||
@HiveField(4, defaultValue: null)
|
@HiveField(4, defaultValue: null)
|
||||||
int? serverId;
|
int? serverId;
|
||||||
|
@HiveField(5, defaultValue: null)
|
||||||
|
String? linuxDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HiveType(typeId: 101)
|
@HiveType(typeId: 101)
|
||||||
|
|
|
@ -75,13 +75,14 @@ class ServerVolumeAdapter extends TypeAdapter<ServerVolume> {
|
||||||
name: fields[2] as String,
|
name: fields[2] as String,
|
||||||
sizeByte: fields[3] == null ? 10737418240 : fields[3] as int,
|
sizeByte: fields[3] == null ? 10737418240 : fields[3] as int,
|
||||||
serverId: fields[4] as int?,
|
serverId: fields[4] as int?,
|
||||||
|
linuxDevice: fields[5] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, ServerVolume obj) {
|
void write(BinaryWriter writer, ServerVolume obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(4)
|
..writeByte(5)
|
||||||
..writeByte(1)
|
..writeByte(1)
|
||||||
..write(obj.id)
|
..write(obj.id)
|
||||||
..writeByte(2)
|
..writeByte(2)
|
||||||
|
@ -89,7 +90,9 @@ class ServerVolumeAdapter extends TypeAdapter<ServerVolume> {
|
||||||
..writeByte(3)
|
..writeByte(3)
|
||||||
..write(obj.sizeByte)
|
..write(obj.sizeByte)
|
||||||
..writeByte(4)
|
..writeByte(4)
|
||||||
..write(obj.serverId);
|
..write(obj.serverId)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.linuxDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -8,15 +8,21 @@ class ServerDiskVolume {
|
||||||
_$ServerDiskVolumeFromJson(json);
|
_$ServerDiskVolumeFromJson(json);
|
||||||
ServerDiskVolume({
|
ServerDiskVolume({
|
||||||
required this.freeSpace,
|
required this.freeSpace,
|
||||||
|
required this.model,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.root,
|
required this.root,
|
||||||
|
required this.serial,
|
||||||
required this.totalSpace,
|
required this.totalSpace,
|
||||||
|
required this.type,
|
||||||
required this.usedSpace,
|
required this.usedSpace,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String freeSpace;
|
final String freeSpace;
|
||||||
|
final String? model;
|
||||||
final String name;
|
final String name;
|
||||||
final bool root;
|
final bool root;
|
||||||
|
final String? serial;
|
||||||
final String totalSpace;
|
final String totalSpace;
|
||||||
|
final String type;
|
||||||
final String usedSpace;
|
final String usedSpace;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,17 +9,23 @@ part of 'server_disk_volume.dart';
|
||||||
ServerDiskVolume _$ServerDiskVolumeFromJson(Map<String, dynamic> json) =>
|
ServerDiskVolume _$ServerDiskVolumeFromJson(Map<String, dynamic> json) =>
|
||||||
ServerDiskVolume(
|
ServerDiskVolume(
|
||||||
freeSpace: json['freeSpace'] as String,
|
freeSpace: json['freeSpace'] as String,
|
||||||
|
model: json['model'] as String?,
|
||||||
name: json['name'] as String,
|
name: json['name'] as String,
|
||||||
root: json['root'] as bool,
|
root: json['root'] as bool,
|
||||||
|
serial: json['serial'] as String?,
|
||||||
totalSpace: json['totalSpace'] as String,
|
totalSpace: json['totalSpace'] as String,
|
||||||
|
type: json['type'] as String,
|
||||||
usedSpace: json['usedSpace'] as String,
|
usedSpace: json['usedSpace'] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ServerDiskVolumeToJson(ServerDiskVolume instance) =>
|
Map<String, dynamic> _$ServerDiskVolumeToJson(ServerDiskVolume instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'freeSpace': instance.freeSpace,
|
'freeSpace': instance.freeSpace,
|
||||||
|
'model': instance.model,
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'root': instance.root,
|
'root': instance.root,
|
||||||
|
'serial': instance.serial,
|
||||||
'totalSpace': instance.totalSpace,
|
'totalSpace': instance.totalSpace,
|
||||||
|
'type': instance.type,
|
||||||
'usedSpace': instance.usedSpace,
|
'usedSpace': instance.usedSpace,
|
||||||
};
|
};
|
||||||
|
|
|
@ -122,9 +122,6 @@ class _Card extends StatelessWidget {
|
||||||
final ServerInstallationState appConfig =
|
final ServerInstallationState appConfig =
|
||||||
context.watch<ServerInstallationCubit>().state;
|
context.watch<ServerInstallationCubit>().state;
|
||||||
|
|
||||||
final String domainName =
|
|
||||||
appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : '';
|
|
||||||
|
|
||||||
switch (provider.type) {
|
switch (provider.type) {
|
||||||
case ProviderType.server:
|
case ProviderType.server:
|
||||||
title = 'providers.server.card_title'.tr();
|
title = 'providers.server.card_title'.tr();
|
||||||
|
@ -140,7 +137,8 @@ class _Card extends StatelessWidget {
|
||||||
break;
|
break;
|
||||||
case ProviderType.domain:
|
case ProviderType.domain:
|
||||||
title = 'providers.domain.screen_title'.tr();
|
title = 'providers.domain.screen_title'.tr();
|
||||||
message = domainName;
|
message =
|
||||||
|
appConfig.isDomainFilled ? appConfig.serverDomain!.domainName : '';
|
||||||
stableText = 'providers.domain.status'.tr();
|
stableText = 'providers.domain.status'.tr();
|
||||||
|
|
||||||
onTap = () => Navigator.of(context).push(
|
onTap = () => Navigator.of(context).push(
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart';
|
||||||
|
@ -7,21 +5,9 @@ import 'package:selfprivacy/logic/models/json/server_disk_volume.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart';
|
import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart';
|
import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart';
|
||||||
import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart';
|
import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart';
|
||||||
|
import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart';
|
||||||
class DiskVolume {
|
import 'package:selfprivacy/ui/pages/server_storage/server_storage.dart';
|
||||||
int gbUsed = 0;
|
import 'package:selfprivacy/utils/route_transitions/basic.dart';
|
||||||
int gbTotal = 0;
|
|
||||||
String name = '';
|
|
||||||
bool root = false;
|
|
||||||
|
|
||||||
/// from 0.0 to 1.0
|
|
||||||
double percentage = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DiskStatus {
|
|
||||||
bool isDiskOkay = false;
|
|
||||||
List<DiskVolume> diskVolumes = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
class StorageCard extends StatelessWidget {
|
class StorageCard extends StatelessWidget {
|
||||||
const StorageCard({required this.volumes, final super.key});
|
const StorageCard({required this.volumes, final super.key});
|
||||||
|
@ -29,9 +15,7 @@ class StorageCard extends StatelessWidget {
|
||||||
final List<ServerDiskVolume> volumes;
|
final List<ServerDiskVolume> volumes;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(
|
Widget build(final BuildContext context) {
|
||||||
final BuildContext context,
|
|
||||||
) {
|
|
||||||
final DiskStatus diskStatus = toDiskStatus(volumes);
|
final DiskStatus diskStatus = toDiskStatus(volumes);
|
||||||
|
|
||||||
final List<Widget> sections = [];
|
final List<Widget> sections = [];
|
||||||
|
@ -41,7 +25,11 @@ class StorageCard extends StatelessWidget {
|
||||||
);
|
);
|
||||||
sections.add(
|
sections.add(
|
||||||
Text(
|
Text(
|
||||||
'providers.storage.disk_usage'.tr(args: [volume.gbUsed.toString()]),
|
'providers.storage.disk_usage'.tr(
|
||||||
|
args: [
|
||||||
|
volume.gbUsed.toString(),
|
||||||
|
],
|
||||||
|
),
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -63,17 +51,25 @@ class StorageCard extends StatelessWidget {
|
||||||
);
|
);
|
||||||
sections.add(
|
sections.add(
|
||||||
Text(
|
Text(
|
||||||
'providers.storage.disk_total'.tr(args: [
|
'providers.storage.disk_total'.tr(
|
||||||
volume.gbTotal.toString(),
|
args: [
|
||||||
volume.name,
|
volume.gbTotal.toString(),
|
||||||
]),
|
volume.name,
|
||||||
|
],
|
||||||
|
),
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: null,
|
onTap: () => Navigator.of(context).push(
|
||||||
|
materialRoute(
|
||||||
|
ServerStoragePage(
|
||||||
|
diskStatus: diskStatus,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: BrandCards.big(
|
child: BrandCards.big(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
class DiskVolume {
|
||||||
|
int gbUsed = 0;
|
||||||
|
int gbTotal = 0;
|
||||||
|
String name = '';
|
||||||
|
bool root = false;
|
||||||
|
|
||||||
|
/// from 0.0 to 1.0
|
||||||
|
double percentage = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DiskStatus {
|
||||||
|
bool isDiskOkay = false;
|
||||||
|
List<DiskVolume> diskVolumes = [];
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||||
|
import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart';
|
||||||
|
import 'package:selfprivacy/ui/components/brand_linear_indicator/brand_linear_indicator.dart';
|
||||||
|
import 'package:selfprivacy/ui/pages/server_storage/disk_status.dart';
|
||||||
|
|
||||||
|
class ServerStoragePage extends StatefulWidget {
|
||||||
|
const ServerStoragePage({required this.diskStatus, final super.key});
|
||||||
|
|
||||||
|
final DiskStatus diskStatus;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ServerStoragePage> createState() => _ServerStoragePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ServerStoragePageState extends State<ServerStoragePage> {
|
||||||
|
@override
|
||||||
|
Widget build(final BuildContext context) {
|
||||||
|
final bool isReady = context.watch<ServerInstallationCubit>().state
|
||||||
|
is ServerInstallationFinished;
|
||||||
|
|
||||||
|
if (!isReady) {
|
||||||
|
return BrandHeroScreen(
|
||||||
|
hasBackButton: true,
|
||||||
|
heroTitle: 'providers.storage.card_title'.tr(),
|
||||||
|
children: const [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Widget> sections = [];
|
||||||
|
for (final DiskVolume volume in widget.diskStatus.diskVolumes) {
|
||||||
|
sections.add(
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
);
|
||||||
|
sections.add(
|
||||||
|
Text(
|
||||||
|
'providers.storage.disk_usage'.tr(
|
||||||
|
args: [
|
||||||
|
volume.gbUsed.toString(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
sections.add(
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
);
|
||||||
|
sections.add(
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.storage_outlined,
|
||||||
|
size: 24,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: BrandLinearIndicator(
|
||||||
|
value: volume.percentage,
|
||||||
|
color: volume.root
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context).colorScheme.secondary,
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||||
|
height: 14.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
sections.add(
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
);
|
||||||
|
sections.add(
|
||||||
|
Text(
|
||||||
|
'providers.storage.disk_total'.tr(
|
||||||
|
args: [
|
||||||
|
volume.gbTotal.toString(),
|
||||||
|
volume.name,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return BrandHeroScreen(
|
||||||
|
hasBackButton: true,
|
||||||
|
heroTitle: 'providers.storage.card_title'.tr(),
|
||||||
|
children: [
|
||||||
|
...sections,
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue