diff --git a/frontend/lib/models/environment_issue.dart b/frontend/lib/models/environment_issue.dart index 04fcf5fe..93c89e8a 100644 --- a/frontend/lib/models/environment_issue.dart +++ b/frontend/lib/models/environment_issue.dart @@ -9,7 +9,7 @@ class EnvironmentIssue with _$EnvironmentIssue { required int id, @JsonKey(name: 'environment_name') required String environmentName, required String description, - required String? url, + required Uri? url, @JsonKey(name: 'is_confirmed') required bool isConfirmed, }) = _EnvironmentIssue; diff --git a/frontend/lib/ui/artefact_page/environment_issues/environment_issue_form.dart b/frontend/lib/ui/artefact_page/environment_issues/environment_issue_form.dart index f6e9f021..1f81f7cf 100644 --- a/frontend/lib/ui/artefact_page/environment_issues/environment_issue_form.dart +++ b/frontend/lib/ui/artefact_page/environment_issues/environment_issue_form.dart @@ -45,18 +45,20 @@ class _EnvironmentIssueUpdateForm extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return _EnvironmentIssueForm( - initialUrl: issue.url ?? '', + initialUrl: issue.url?.toString() ?? '', initialDescription: issue.description, initialIsConfirmed: issue.isConfirmed, formSubtitle: 'On all environments with name: ${issue.environmentName}', - onSubmit: (url, description, isConfirmed) => - ref.read(environmentsIssuesProvider.notifier).updateIssue( - issue.copyWith( - url: url, - description: description, - isConfirmed: isConfirmed, - ), + onSubmit: (url, description, isConfirmed) { + final parsedUrl = Uri.tryParse(url); + ref.read(environmentsIssuesProvider.notifier).updateIssue( + issue.copyWith( + url: (parsedUrl?.isAbsolute == true) ? parsedUrl : null, + description: description, + isConfirmed: isConfirmed, ), + ); + }, onDelete: () => showDialog( context: context, builder: (_) => _DeleteEnvironmentIssueConfirmationDialog( diff --git a/frontend/lib/ui/artefact_page/environment_issues/environment_issue_list_item.dart b/frontend/lib/ui/artefact_page/environment_issues/environment_issue_list_item.dart index cb9ad8c7..0a53ac7b 100644 --- a/frontend/lib/ui/artefact_page/environment_issues/environment_issue_list_item.dart +++ b/frontend/lib/ui/artefact_page/environment_issues/environment_issue_list_item.dart @@ -39,7 +39,7 @@ class EnvironmentIssueListItem extends StatelessWidget { const SizedBox(width: Spacing.level4), if (issueUrl != null) InlineUrlText( - url: issueUrl, + url: issueUrl.toString(), urlText: 'URL', fontStyle: Theme.of(context).textTheme.bodyMedium, ),