-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create empty artefact dialog * Return required fields from backend * Fetch artefact builds from backend in frontend * Progress through artefact dialog UI * Fix backend tests * fix dart analyze * fix backend tests * Add c3 and jenkins links * Add count of test execution statuses * Use interspersed * bug fix * Add some spacing * Show all statuses on dashboard header * Small changes * Show stage on expanded artefact * Add other stage names in expanded artefact * Make text selectable in expanded view of artefact * Fix analyzer * Better match figma design * Capitalize stage titles * Better match figma design with stages * Small UI changes * Remove unused imports * Small UI improvement * Small UI improvement * Remove default switch case when not necessary * Remove unnecessary .toList calls * Add more specific error messages
- Loading branch information
Showing
17 changed files
with
628 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
# Nadzeya Hutsko <[email protected]> | ||
from pydantic import BaseModel | ||
|
||
from test_observer.data_access.models_enums import TestExecutionStatus | ||
|
||
|
||
class EnvironmentDTO(BaseModel): | ||
id: int | ||
|
@@ -34,13 +36,15 @@ class TestExecutionDTO(BaseModel): | |
jenkins_link: str | None | ||
c3_link: str | None | ||
environment: EnvironmentDTO | ||
status: TestExecutionStatus | ||
|
||
class Config: | ||
orm_mode = True | ||
|
||
|
||
class ArtefactBuildDTO(BaseModel): | ||
id: int | ||
architecture: str | ||
revision: int | None | ||
test_executions: list[TestExecutionDTO] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
import 'test_execution.dart'; | ||
|
||
part 'artefact_build.freezed.dart'; | ||
part 'artefact_build.g.dart'; | ||
|
||
@freezed | ||
class ArtefactBuild with _$ArtefactBuild { | ||
const ArtefactBuild._(); | ||
|
||
const factory ArtefactBuild({ | ||
required int id, | ||
required String architecture, | ||
required int? revision, | ||
@JsonKey(name: 'test_executions') | ||
required List<TestExecution> testExecutions, | ||
}) = _ArtefactBuild; | ||
|
||
factory ArtefactBuild.fromJson(Map<String, Object?> json) => | ||
_$ArtefactBuildFromJson(json); | ||
|
||
Map<TestExecutionStatus, int> get testExecutionStatusCounts { | ||
final counts = {for (final status in TestExecutionStatus.values) status: 0}; | ||
|
||
for (final testExecution in testExecutions) { | ||
final status = testExecution.status; | ||
counts[status] = (counts[status] ?? 0) + 1; | ||
} | ||
|
||
return counts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'environment.freezed.dart'; | ||
part 'environment.g.dart'; | ||
|
||
@freezed | ||
class Environment with _$Environment { | ||
const factory Environment({ | ||
required int id, | ||
required String name, | ||
required String architecture, | ||
}) = _Environment; | ||
|
||
factory Environment.fromJson(Map<String, Object?> json) => | ||
_$EnvironmentFromJson(json); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
import 'package:yaru_icons/yaru_icons.dart'; | ||
|
||
import 'environment.dart'; | ||
|
||
part 'test_execution.freezed.dart'; | ||
part 'test_execution.g.dart'; | ||
|
||
@freezed | ||
class TestExecution with _$TestExecution { | ||
const factory TestExecution({ | ||
required int id, | ||
@JsonKey(name: 'jenkins_link') required String? jenkinsLink, | ||
@JsonKey(name: 'c3_link') required String? c3Link, | ||
required TestExecutionStatus status, | ||
required Environment environment, | ||
}) = _TestExecution; | ||
|
||
factory TestExecution.fromJson(Map<String, Object?> json) => | ||
_$TestExecutionFromJson(json); | ||
} | ||
|
||
enum TestExecutionStatus { | ||
@JsonValue('FAILED') | ||
failed, | ||
@JsonValue('NOT_STARTED') | ||
notStarted, | ||
@JsonValue('NOT_TESTED') | ||
notTested, | ||
@JsonValue('IN_PROGRESS') | ||
inProgress, | ||
@JsonValue('PASSED') | ||
passed; | ||
|
||
String get name { | ||
switch (this) { | ||
case notStarted: | ||
return 'Not Started'; | ||
case inProgress: | ||
return 'In Progress'; | ||
case passed: | ||
return 'Passed'; | ||
case failed: | ||
return 'Failed'; | ||
case notTested: | ||
return 'Not Tested'; | ||
} | ||
} | ||
|
||
Icon get icon { | ||
const size = 20.0; | ||
switch (this) { | ||
case notStarted: | ||
return const Icon(YaruIcons.media_play, size: size); | ||
case inProgress: | ||
return const Icon(YaruIcons.refresh, size: size); | ||
case passed: | ||
return const Icon(YaruIcons.ok, color: YaruColors.success, size: size); | ||
case failed: | ||
return const Icon(YaruIcons.error, color: YaruColors.red, size: size); | ||
case notTested: | ||
return const Icon(YaruIcons.information, size: size); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
import '../models/artefact_build.dart'; | ||
import 'dio.dart'; | ||
|
||
part 'artefact_builds.g.dart'; | ||
|
||
@riverpod | ||
Future<List<ArtefactBuild>> artefactBuilds( | ||
ArtefactBuildsRef ref, | ||
int artefactId, | ||
) async { | ||
final dio = ref.watch(dioProvider); | ||
|
||
final response = await dio.get('/v1/artefacts/$artefactId/builds'); | ||
final List artefactBuildsJson = response.data; | ||
final artefactBuilds = | ||
artefactBuildsJson.map((json) => ArtefactBuild.fromJson(json)).toList(); | ||
return artefactBuilds; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'name_of_selected_stage.g.dart'; | ||
|
||
@riverpod | ||
String nameOfSelectedStage(NameOfSelectedStageRef ref) { | ||
throw Exception( | ||
'Name of selected stage not set yet, need to override provider', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'names_of_stages.g.dart'; | ||
|
||
@riverpod | ||
List<String> namesOfStages(NamesOfStagesRef ref) { | ||
throw Exception('Names of stages not set yet, need to override provider'); | ||
} |
Oops, something went wrong.