Compare commits

...

4 Commits

Author SHA1 Message Date
23de275e11 remote mount provider support
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-03-15 22:18:42 -05:00
28cfcc0344 remote mount provider support 2025-03-15 22:01:29 -05:00
30a91e1cb2 remote mount provider support 2025-03-15 21:56:10 -05:00
b2d4baa903 remote mount provider support 2025-03-15 21:52:01 -05:00
4 changed files with 18 additions and 7 deletions

View File

@ -62,7 +62,13 @@ Map<String, dynamic> createDefaultSettings(String mountType) {
'EncryptConfig': {'EncryptionToken': '', 'Path': ''},
};
case 'Remote':
return {'EventLevel': 'info'};
return {
'RemoteConfig': {
'ApiPort': 20000,
'EncryptionToken': '',
'HostNameOrIp': '',
},
};
case 'S3':
return {
'S3Config': {

View File

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:repertory/constants.dart' as constants;
import 'package:repertory/helpers.dart';
import 'package:repertory/models/mount_list.dart';
import 'package:repertory/types/mount_config.dart';
@ -18,6 +17,7 @@ class Mount with ChangeNotifier {
}
String? get bucket => mountConfig.bucket;
String get id => '${type}_$name';
String get name => mountConfig.name;
String get path => mountConfig.path;
IconData? get state => mountConfig.state;

View File

@ -84,9 +84,9 @@ class _AddMountScreenState extends State<AddMountScreen> {
),
),
),
if (_mountType.isNotEmpty)
if (_mountType.isNotEmpty && _mountType != 'Remote')
const SizedBox(height: constants.padding),
if (_mountType.isNotEmpty)
if (_mountType.isNotEmpty && _mountType != 'Remote')
Card(
margin: EdgeInsets.all(0.0),
child: Padding(
@ -181,7 +181,9 @@ class _AddMountScreenState extends State<AddMountScreen> {
await mountList.add(
_mountType,
_mountNameController.text,
_mountType == 'Remote'
? '${_settings[_mountType]!['RemoteConfig']['HostNameOrIp']}_${_settings[_mountType]!['RemoteConfig']['ApiPort']}'
: _mountNameController.text,
_settings[_mountType]!,
);
@ -206,7 +208,9 @@ class _AddMountScreenState extends State<AddMountScreen> {
final changed = _mountType != mountType;
_mountType = mountType;
if (changed) {
if (_mountType == 'Remote') {
_mountNameController.text = 'remote';
} else if (changed) {
_mountNameController.text = mountType == 'Sia' ? 'default' : '';
}

View File

@ -15,6 +15,7 @@ class MountListWidget extends StatelessWidget {
itemBuilder: (context, idx) {
return ChangeNotifierProvider(
create: (context) => mountList.items[idx],
key: ValueKey(mountList.items[idx].id),
child: Padding(
padding: EdgeInsets.only(
bottom:
@ -22,7 +23,7 @@ class MountListWidget extends StatelessWidget {
? 0.0
: constants.padding,
),
child: const MountWidget(),
child: MountWidget(),
),
);
},