Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/68573 correct picoscope upload #307

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/app/assets/localization/de-DE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ noAuthorization:
forms:
submit: "Hochladen"
optional: "optional"
mandatory: "mandatorisch"
validation:
enterText: "Bitte geben Sie einen Text ein"
enterNumber: "Bitte geben Sie eine Nummer ein"
Expand Down Expand Up @@ -239,6 +240,7 @@ forms:
labelD: "Komponente D"
label: "Label"
hint: "Komponente eingeben"
required: "Komponente A und Label A erforderlich"
timeseries:
label: "Label"
component:
Expand Down
2 changes: 2 additions & 0 deletions frontend/app/assets/localization/en-GB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ noAuthorization:
forms:
submit: "Submit"
optional: "optional"
mandatory: "mandatory"
validation:
enterText: "Please enter some text"
enterNumber: "Please enter a number"
Expand Down Expand Up @@ -240,6 +241,7 @@ forms:
labelD: "Component D"
label: "Label"
hint: "Enter a Component"
required: "Component A und Label A required"
timeseries:
label: "Label"
component:
Expand Down
13 changes: 11 additions & 2 deletions frontend/app/lib/forms/upload_picoscope_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _UploadPicoscopeFormState extends State<UploadPicoscopeForm> {
labelText: tr("forms.picoscope.component.labelA"),
hintText: tr("forms.picoscope.component.hint"),
border: const OutlineInputBorder(),
suffixText: tr("forms.optional"),
suffixText: tr("forms.mandatory"),
),
),
),
Expand All @@ -68,7 +68,7 @@ class _UploadPicoscopeFormState extends State<UploadPicoscopeForm> {
child: DropdownMenu<PicoscopeLabel>(
controller: _labelAController,
label: Text(tr("forms.picoscope.component.label")),
hintText: tr("forms.optional"),
hintText: tr("forms.mandatory"),
onSelected: (PicoscopeLabel? picoscopeLabel) {
setState(() {
selectedLabelA = picoscopeLabel;
Expand Down Expand Up @@ -245,6 +245,15 @@ class _UploadPicoscopeFormState extends State<UploadPicoscopeForm> {
final PicoscopeLabel? labelD =
EnumToString.fromString(PicoscopeLabel.values, _labelDController.text);

if (componentA == "" || labelA == null) {
messengerState.showSnackBar(
SnackBar(
content: Text(tr("forms.picoscope.component.required")),
),
);
return;
}

final bool result = await provider.uploadPicoscopeData(
widget.caseId,
file,
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/lib/views/case_detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,20 @@ class _DesktopCaseDetailViewState extends State<DesktopCaseDetailView> {

TableRow buildDataRow(DataModel model) {
Text textWidget = const Text("");
DatasetType datasetType = DatasetType.unknown;
switch (model.runtimeType) {
case ObdDataModel:
textWidget = Text(tr("general.obd"));
datasetType = DatasetType.obd;
break;
case TimeseriesDataModel:
final timeseriesDataModel = model as TimeseriesDataModel;
textWidget = Text(timeseriesDataModel.type?.name.capitalize() ?? "");
datasetType = DatasetType.timeseries;
break;
case SymptomModel:
textWidget = Text(tr("general.symptom"));
datasetType = DatasetType.symptom;
break;
}

Expand Down Expand Up @@ -425,7 +429,7 @@ class _DesktopCaseDetailViewState extends State<DesktopCaseDetailView> {
deleteButton(
colorScheme,
model.dataId,
DatasetType.obd,
datasetType,
),
],
);
Expand Down
Loading