- execution surface 및 preview smoke 테스트 문서 업데이트 - client 앱 및 oto_console UI surface (artifacts, executions, jobs) 추가 - 관련 테스트 및 계약 문서 업데이트 - archive 구조 정리
216 lines
6.7 KiB
Dart
216 lines
6.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'oto_console_contract.dart';
|
|
|
|
class OtoArtifactsSurface extends StatelessWidget {
|
|
final OtoSurfaceSnapshot<List<OtoArtifactViewModel>> snapshot;
|
|
final OtoConsoleThemeAdapter? themeAdapter;
|
|
|
|
const OtoArtifactsSurface({
|
|
super.key,
|
|
required this.snapshot,
|
|
this.themeAdapter,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = themeAdapter ?? const OtoConsoleThemeAdapter();
|
|
return Container(
|
|
color: theme.backgroundColor,
|
|
padding: const EdgeInsets.all(24),
|
|
child: Center(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 820),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.inventory_2_outlined,
|
|
color: theme.primaryColor,
|
|
size: 24,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(
|
|
'Artifacts',
|
|
style: TextStyle(
|
|
color: theme.textColor,
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 20),
|
|
Expanded(child: _buildContent(context, theme)),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildContent(BuildContext context, OtoConsoleThemeAdapter theme) {
|
|
switch (snapshot.state) {
|
|
case OtoSurfaceLoadState.loading:
|
|
return const Center(child: CircularProgressIndicator());
|
|
case OtoSurfaceLoadState.empty:
|
|
return _buildEmptyState(theme);
|
|
case OtoSurfaceLoadState.error:
|
|
return _buildErrorState(theme);
|
|
case OtoSurfaceLoadState.data:
|
|
final artifacts = snapshot.data ?? [];
|
|
if (artifacts.isEmpty) {
|
|
return _buildEmptyState(theme);
|
|
}
|
|
return _buildArtifactsList(context, theme, artifacts);
|
|
}
|
|
}
|
|
|
|
Widget _buildEmptyState(OtoConsoleThemeAdapter theme) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: theme.railBackgroundColor,
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(color: theme.borderColor),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.inventory_2_outlined,
|
|
color: theme.primaryColor,
|
|
size: 32,
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'No artifacts',
|
|
style: TextStyle(
|
|
color: theme.textColor,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
'Artifact events are empty.',
|
|
style: TextStyle(color: theme.textSecondaryColor),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildErrorState(OtoConsoleThemeAdapter theme) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: Colors.red.withValues(alpha: 0.1),
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(color: Colors.red.withValues(alpha: 0.5)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Icon(Icons.error_outline, color: Colors.red, size: 32),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Error loading artifacts',
|
|
style: TextStyle(
|
|
color: theme.textColor,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
snapshot.errorMessage ?? 'An unknown error occurred.',
|
|
style: TextStyle(color: theme.textSecondaryColor),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildArtifactsList(
|
|
BuildContext context,
|
|
OtoConsoleThemeAdapter theme,
|
|
List<OtoArtifactViewModel> artifacts,
|
|
) {
|
|
return ListView.separated(
|
|
itemCount: artifacts.length,
|
|
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
|
itemBuilder: (context, index) {
|
|
final artifact = artifacts[index];
|
|
return Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: theme.railBackgroundColor,
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(color: theme.borderColor),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.insert_drive_file_outlined,
|
|
color: theme.primaryColor,
|
|
size: 24,
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
artifact.name,
|
|
style: TextStyle(
|
|
color: theme.textColor,
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
'Path: ${artifact.path}',
|
|
style: TextStyle(
|
|
color: theme.textSecondaryColor,
|
|
fontSize: 12,
|
|
),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|