1
0
forked from baron/baron-sso

접속이력 테이블 배치 작업

This commit is contained in:
2026-04-07 14:05:35 +09:00
parent c95105f018
commit 2fb7bae5f6

View File

@@ -40,6 +40,13 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
static const double _historySessionMinWidth = 92; static const double _historySessionMinWidth = 92;
static const double _historyOtherColumnsBaselineWidth = 780; static const double _historyOtherColumnsBaselineWidth = 780;
static const int _historySessionMinVisibleChars = 8; static const int _historySessionMinVisibleChars = 8;
static const double _historyDateColumnWidth = 132;
static const double _historyAppColumnWidth = 132;
static const double _historyIpColumnWidth = 118;
static const double _historyDeviceColumnWidth = 128;
static const double _historyBrowserColumnWidth = 112;
static const double _historyAuthMethodColumnWidth = 108;
static const double _historyResultColumnWidth = 88;
static const double _historyStatusColumnWidth = 92; static const double _historyStatusColumnWidth = 92;
static const double _historyActionColumnWidth = 108; static const double _historyActionColumnWidth = 108;
@@ -499,6 +506,17 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
return SelectableText(text, style: style); return SelectableText(text, style: style);
} }
Widget _singleLineText(String text, {TextStyle? style}) {
return Text(
text,
style: style,
maxLines: 1,
softWrap: false,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
);
}
String _authMethodLabel() { String _authMethodLabel() {
if (AuthTokenStore.usesCookie()) { if (AuthTokenStore.usesCookie()) {
return tr('ui.userfront.auth_method.ory'); return tr('ui.userfront.auth_method.ory');
@@ -1704,7 +1722,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
Widget _buildHistorySessionActionCell(UserSessionSummary? session) { Widget _buildHistorySessionActionCell(UserSessionSummary? session) {
if (session == null) { if (session == null) {
return _selectableText(tr('ui.common.hyphen', fallback: '-')); return SizedBox(
width: _historyActionColumnWidth,
child: Center(
child: _selectableText(tr('ui.common.hyphen', fallback: '-')),
),
);
} }
final isCurrent = session.isCurrent; final isCurrent = session.isCurrent;
final canRevoke = final canRevoke =
@@ -1756,6 +1779,20 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
crossAxisCount; crossAxisCount;
} }
Widget _buildCenteredHistoryHeader(String label, {double? width}) {
return SizedBox(
width: width,
child: Center(child: Text(label, textAlign: TextAlign.center)),
);
}
Widget _buildCenteredHistoryCell(Widget child, {double? width}) {
return SizedBox(
width: width,
child: Center(child: child),
);
}
Widget _buildHistoryTable( Widget _buildHistoryTable(
AuthTimelineState state, AuthTimelineState state,
List<AuditLogEntry> items, List<AuditLogEntry> items,
@@ -1780,53 +1817,66 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
horizontalMargin: 12, horizontalMargin: 12,
columns: [ columns: [
DataColumn( DataColumn(
label: SizedBox( label: _buildCenteredHistoryHeader(
tr(
'ui.userfront.audit.table.session_id',
fallback: 'Session ID',
),
width: sessionColumnWidth, width: sessionColumnWidth,
child: Text(
tr(
'ui.userfront.audit.table.session_id',
fallback: 'Session ID',
),
),
), ),
), ),
DataColumn( DataColumn(
label: Text(tr('ui.userfront.audit.table.date')), label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.date'),
width: _historyDateColumnWidth,
),
), ),
DataColumn( DataColumn(
label: Text(tr('ui.userfront.audit.table.app')), label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.app'),
width: _historyAppColumnWidth,
),
), ),
DataColumn( DataColumn(
label: Text( label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.ip', fallback: 'IP'), tr('ui.userfront.audit.table.ip', fallback: 'IP'),
width: _historyIpColumnWidth,
), ),
), ),
DataColumn( DataColumn(
label: Text(tr('ui.userfront.audit.table.device')), label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.device'),
width: _historyDeviceColumnWidth,
),
), ),
DataColumn( DataColumn(
label: Text(tr('ui.userfront.audit.table.browser')), label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.browser'),
width: _historyBrowserColumnWidth,
),
), ),
DataColumn( DataColumn(
label: Text(tr('ui.userfront.audit.table.auth_method')), label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.auth_method'),
width: _historyAuthMethodColumnWidth,
),
), ),
DataColumn( DataColumn(
label: Text(tr('ui.userfront.audit.table.result')), label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.result'),
width: _historyResultColumnWidth,
),
), ),
DataColumn( DataColumn(
label: SizedBox( label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.status'),
width: _historyStatusColumnWidth, width: _historyStatusColumnWidth,
child: Center(
child: Text(tr('ui.userfront.audit.table.status')),
),
), ),
), ),
DataColumn( DataColumn(
label: SizedBox( label: _buildCenteredHistoryHeader(
tr('ui.userfront.audit.table.action'),
width: _historyActionColumnWidth, width: _historyActionColumnWidth,
child: Center(
child: Text(tr('ui.userfront.audit.table.action')),
),
), ),
), ),
], ],
@@ -1852,48 +1902,83 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
return DataRow( return DataRow(
cells: [ cells: [
DataCell( DataCell(
SizedBox( _buildCenteredHistoryCell(
width: sessionColumnWidth, _buildHistorySessionIdCell(
child: _buildHistorySessionIdCell(
log.sessionId.isEmpty log.sessionId.isEmpty
? tr('ui.common.hyphen', fallback: '-') ? tr('ui.common.hyphen', fallback: '-')
: log.sessionId, : log.sessionId,
sessionColumnWidth, sessionColumnWidth,
), ),
width: sessionColumnWidth,
), ),
), ),
DataCell( DataCell(
_selectableText(_formatDateTime(log.timestamp)), _buildCenteredHistoryCell(
), _selectableText(_formatDateTime(log.timestamp)),
DataCell(_buildAppCell(log)), width: _historyDateColumnWidth,
DataCell(
_selectableText(
log.ipAddress.isEmpty
? tr('ui.common.hyphen', fallback: '-')
: log.ipAddress,
), ),
), ),
DataCell(_selectableText(deviceLabel)),
DataCell( DataCell(
_selectableText( _buildCenteredHistoryCell(
browserLabel.isEmpty _buildAppCell(log),
? tr('ui.common.hyphen', fallback: '-') width: _historyAppColumnWidth,
: browserLabel,
), ),
), ),
DataCell(_buildAuthMethodCell(log, authMethod)),
DataCell( DataCell(
_selectableText( _buildCenteredHistoryCell(
statusLabel, _selectableText(
style: TextStyle( log.ipAddress.isEmpty
color: statusColor, ? tr('ui.common.hyphen', fallback: '-')
fontWeight: FontWeight.w600, : log.ipAddress,
), ),
width: _historyIpColumnWidth,
), ),
), ),
DataCell(_buildHistoryStatusBadge(sessionStatus)),
DataCell( DataCell(
_buildHistorySessionActionCell(matchedSession), _buildCenteredHistoryCell(
_singleLineText(deviceLabel),
width: _historyDeviceColumnWidth,
),
),
DataCell(
_buildCenteredHistoryCell(
_selectableText(
browserLabel.isEmpty
? tr('ui.common.hyphen', fallback: '-')
: browserLabel,
),
width: _historyBrowserColumnWidth,
),
),
DataCell(
_buildCenteredHistoryCell(
_buildAuthMethodCell(log, authMethod),
width: _historyAuthMethodColumnWidth,
),
),
DataCell(
_buildCenteredHistoryCell(
_selectableText(
statusLabel,
style: TextStyle(
color: statusColor,
fontWeight: FontWeight.w600,
),
),
width: _historyResultColumnWidth,
),
),
DataCell(
_buildCenteredHistoryCell(
_buildHistoryStatusBadge(sessionStatus),
width: _historyStatusColumnWidth,
),
),
DataCell(
_buildCenteredHistoryCell(
_buildHistorySessionActionCell(matchedSession),
width: _historyActionColumnWidth,
),
), ),
], ],
); );
@@ -1920,6 +2005,10 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
} }
String _compactSessionId(String sessionId) { String _compactSessionId(String sessionId) {
final parts = sessionId.split('-');
if (parts.length >= 4) {
return '${parts.take(3).join('-')}-...';
}
if (sessionId.length <= _historySessionMinVisibleChars) { if (sessionId.length <= _historySessionMinVisibleChars) {
return sessionId; return sessionId;
} }
@@ -1927,16 +2016,16 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
} }
Widget _buildHistorySessionIdCell(String sessionId, double columnWidth) { Widget _buildHistorySessionIdCell(String sessionId, double columnWidth) {
final compactMode = columnWidth <= _historySessionMinWidth + 0.5; final displayText = _compactSessionId(sessionId);
final displayText = compactMode ? _compactSessionId(sessionId) : sessionId;
final textWidget = Text( final textWidget = Text(
displayText, displayText,
maxLines: 1, maxLines: 1,
softWrap: false, softWrap: false,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
); );
if (displayText == sessionId) { if (displayText == sessionId || sessionId.isEmpty) {
return textWidget; return textWidget;
} }
return Tooltip(message: sessionId, child: textWidget); return Tooltip(message: sessionId, child: textWidget);