- Control Plane API 데이터 바인딩 마일스톤 문서 업데이트 - core_connection_client 및 oto_client_app 수정 - oto_console 런너.surface 모듈 추가 - 관련 테스트 파일 업데이트
181 lines
4.4 KiB
Dart
181 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'oto_console_models.dart';
|
|
|
|
export 'oto_console_models.dart';
|
|
|
|
class OtoConsoleConfig {
|
|
final String serverHttpUrl;
|
|
final String serverWireUrl;
|
|
final String? authTokenReference;
|
|
|
|
const OtoConsoleConfig({
|
|
required this.serverHttpUrl,
|
|
required this.serverWireUrl,
|
|
this.authTokenReference,
|
|
});
|
|
}
|
|
|
|
class OtoConsoleThemeAdapter {
|
|
final Color primaryColor;
|
|
final Color accentColor;
|
|
final Color backgroundColor;
|
|
final Color railBackgroundColor;
|
|
final Color borderColor;
|
|
final Color textColor;
|
|
final Color textSecondaryColor;
|
|
|
|
const OtoConsoleThemeAdapter({
|
|
this.primaryColor = const Color(0xFF22D3EE),
|
|
this.accentColor = const Color(0xFFF59E0B),
|
|
this.backgroundColor = const Color(0xFF111318),
|
|
this.railBackgroundColor = const Color(0xFF181B22),
|
|
this.borderColor = const Color(0xFF2A2F3A),
|
|
this.textColor = Colors.white,
|
|
this.textSecondaryColor = Colors.white60,
|
|
});
|
|
}
|
|
|
|
typedef OtoConsoleNavigationCallback = void Function(OtoConsoleSection section);
|
|
|
|
class OtoConsoleNavigation {
|
|
final OtoConsoleNavigationCallback? onNavigate;
|
|
|
|
const OtoConsoleNavigation({this.onNavigate});
|
|
}
|
|
|
|
class OtoCapability {
|
|
final String name;
|
|
final String description;
|
|
final IconData? icon;
|
|
|
|
const OtoCapability({
|
|
required this.name,
|
|
required this.description,
|
|
this.icon,
|
|
});
|
|
}
|
|
|
|
class OtoCapabilityPack {
|
|
final List<OtoCapability> capabilities;
|
|
|
|
const OtoCapabilityPack({required this.capabilities});
|
|
}
|
|
|
|
enum OtoCoreConnectionState { checking, online, degraded, offline }
|
|
|
|
class OtoCoreEndpointStatus {
|
|
final String label;
|
|
final String path;
|
|
final OtoCoreConnectionState state;
|
|
final int? statusCode;
|
|
final String message;
|
|
|
|
const OtoCoreEndpointStatus({
|
|
required this.label,
|
|
required this.path,
|
|
required this.state,
|
|
this.statusCode,
|
|
required this.message,
|
|
});
|
|
|
|
const OtoCoreEndpointStatus.checking({
|
|
required this.label,
|
|
required this.path,
|
|
}) : state = OtoCoreConnectionState.checking,
|
|
statusCode = null,
|
|
message = 'Checking';
|
|
|
|
bool get ok => state == OtoCoreConnectionState.online;
|
|
}
|
|
|
|
class OtoCoreConnectionSnapshot {
|
|
final OtoCoreConnectionState state;
|
|
final OtoCoreEndpointStatus health;
|
|
final OtoCoreEndpointStatus readiness;
|
|
final DateTime? checkedAt;
|
|
final String policyNote;
|
|
|
|
const OtoCoreConnectionSnapshot({
|
|
required this.state,
|
|
required this.health,
|
|
required this.readiness,
|
|
this.checkedAt,
|
|
this.policyNote = '',
|
|
});
|
|
|
|
const OtoCoreConnectionSnapshot.checking()
|
|
: state = OtoCoreConnectionState.checking,
|
|
health = const OtoCoreEndpointStatus.checking(
|
|
label: 'Health',
|
|
path: '/healthz',
|
|
),
|
|
readiness = const OtoCoreEndpointStatus.checking(
|
|
label: 'Readiness',
|
|
path: '/readyz',
|
|
),
|
|
checkedAt = null,
|
|
policyNote = '';
|
|
|
|
bool get connected => state == OtoCoreConnectionState.online;
|
|
|
|
String get label {
|
|
return switch (state) {
|
|
OtoCoreConnectionState.checking => 'Checking Core',
|
|
OtoCoreConnectionState.online => 'Core online',
|
|
OtoCoreConnectionState.degraded => 'Core degraded',
|
|
OtoCoreConnectionState.offline => 'Core offline',
|
|
};
|
|
}
|
|
}
|
|
|
|
abstract class OtoCoreConnectionClient {
|
|
Future<OtoCoreConnectionSnapshot> check(OtoConsoleConfig config);
|
|
}
|
|
|
|
enum OtoSurfaceLoadState { loading, empty, error, data }
|
|
|
|
class OtoSurfaceSnapshot<T> {
|
|
final OtoSurfaceLoadState state;
|
|
final T? data;
|
|
final String? errorMessage;
|
|
|
|
const OtoSurfaceSnapshot({required this.state, this.data, this.errorMessage});
|
|
|
|
const OtoSurfaceSnapshot.loading()
|
|
: state = OtoSurfaceLoadState.loading,
|
|
data = null,
|
|
errorMessage = null;
|
|
|
|
const OtoSurfaceSnapshot.empty()
|
|
: state = OtoSurfaceLoadState.empty,
|
|
data = null,
|
|
errorMessage = null;
|
|
|
|
const OtoSurfaceSnapshot.error(String message)
|
|
: state = OtoSurfaceLoadState.error,
|
|
data = null,
|
|
errorMessage = message;
|
|
|
|
const OtoSurfaceSnapshot.data(this.data)
|
|
: state = OtoSurfaceLoadState.data,
|
|
errorMessage = null;
|
|
}
|
|
|
|
class OtoRunnerViewModel {
|
|
final String runnerID;
|
|
final String alias;
|
|
final String status;
|
|
final String currentJobID;
|
|
final String currentExecutionID;
|
|
final String message;
|
|
|
|
const OtoRunnerViewModel({
|
|
required this.runnerID,
|
|
required this.alias,
|
|
required this.status,
|
|
required this.currentJobID,
|
|
required this.currentExecutionID,
|
|
required this.message,
|
|
});
|
|
}
|