refactor: rename internal Fai* design system + fai_ helpers to chain
Some checks failed
Security / Security check (push) Failing after 2s
Some checks failed
Security / Security check (push) Failing after 2s
The Studio design system, widgets and helpers carried a Fai* / fai_ prefix (FaiSpace, FaiColors, FaiTheme, FaiLog, 17 fai_*.dart files, the faiBinary* l10n keys). Studio is the Ch∆In product, so rename them to Chain* / chain_ — carefully preserving English fail/failure/failed. Also fix stale references: the 'fai' binary in l10n strings -> 'chain', FAI_* env vars (FAI_BIN/DATA_DIR/MODULES_DIR/TODAY/BOOTSTRAP_TOKEN) -> CHAIN_*, fai_platform -> fai_chain, fai_hub -> chain_hub. Vendor security-hook tooling (FAI_BANNED_TERMS_FILE) + the .fai bundle ext left. flutter analyze + test: clean (20 passed). Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
68d23ab7dd
commit
891acd2ba2
52 changed files with 1225 additions and 1225 deletions
|
|
@ -1,95 +0,0 @@
|
|||
// Recovery affordance shown when Studio cannot locate the `fai`
|
||||
// binary on the machine. Replaces the old CLI-jargon dead-end
|
||||
// ("set FAI_BIN to its full path") with two acts a non-CLI
|
||||
// operator can actually take:
|
||||
//
|
||||
// 1. Locate the binary with a native file picker, persisting
|
||||
// the choice via SystemActions.setFaiBinaryPath.
|
||||
// 2. Open the install guide in the OS browser.
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/system_actions.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../theme/tokens.dart';
|
||||
|
||||
class FaiBinaryRecovery extends StatelessWidget {
|
||||
/// Fired after the operator successfully picks a `fai` binary,
|
||||
/// so the host can retry whatever action hit the missing
|
||||
/// binary (e.g. re-run the daemon start / status probe).
|
||||
final VoidCallback? onLocated;
|
||||
|
||||
const FaiBinaryRecovery({super.key, this.onLocated});
|
||||
|
||||
Future<void> _locate(BuildContext context) async {
|
||||
final l = AppLocalizations.of(context)!;
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final picked = await FilePicker.pickFiles(
|
||||
dialogTitle: l.faiBinaryPickerTitle,
|
||||
);
|
||||
final path = picked?.files.single.path;
|
||||
if (path == null) return;
|
||||
final ok = await SystemActions.setFaiBinaryPath(path);
|
||||
messenger.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(ok ? l.faiBinarySetOk(path) : l.faiBinaryNotFound),
|
||||
),
|
||||
);
|
||||
if (ok) onLocated?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l = AppLocalizations.of(context)!;
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(FaiSpace.md),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.errorContainer.withValues(alpha: 0.4),
|
||||
borderRadius: BorderRadius.circular(FaiRadius.sm),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.error.withValues(alpha: 0.4),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l.faiBinaryNotFound,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: FaiSpace.xs),
|
||||
Text(
|
||||
l.faiBinaryNotFoundHint,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: FaiSpace.md),
|
||||
Wrap(
|
||||
spacing: FaiSpace.sm,
|
||||
runSpacing: FaiSpace.sm,
|
||||
children: [
|
||||
FilledButton.tonalIcon(
|
||||
onPressed: () => _locate(context),
|
||||
icon: const Icon(Icons.folder_open, size: 16),
|
||||
label: Text(l.faiBinaryLocateButton),
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () =>
|
||||
SystemActions.openInOs(kFaiInstallDocsUrl),
|
||||
icon: const Icon(Icons.open_in_new, size: 16),
|
||||
label: Text(l.faiBinaryInstallDocsButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue