14
14
import com .vaadin .flow .component .orderedlayout .HorizontalLayout ;
15
15
import com .vaadin .flow .component .tabs .TabSheet ;
16
16
import com .vaadin .flow .component .textfield .TextField ;
17
+ import com .vaadin .flow .router .RouteConfiguration ;
18
+ import com .vaadin .flow .router .RouteParam ;
19
+ import com .vaadin .flow .router .RouteParameters ;
17
20
import com .vaadin .flow .spring .annotation .SpringComponent ;
18
21
import com .vaadin .flow .spring .annotation .UIScope ;
19
22
import com .vaadin .flow .theme .lumo .LumoIcon ;
28
31
import life .qbic .application .commons .ApplicationException .ErrorCode ;
29
32
import life .qbic .application .commons .ApplicationException .ErrorParameters ;
30
33
import life .qbic .application .commons .Result ;
31
- import life .qbic .datamanager .views .AppRoutes .Projects ;
32
34
import life .qbic .datamanager .views .Context ;
33
35
import life .qbic .datamanager .views .general .ConfirmEvent ;
34
36
import life .qbic .datamanager .views .general .Disclaimer ;
45
47
import life .qbic .datamanager .views .projects .project .experiments .experiment .update .ExperimentUpdateDialog ;
46
48
import life .qbic .datamanager .views .projects .project .experiments .experiment .update .ExperimentUpdateDialog .ExperimentDraft ;
47
49
import life .qbic .datamanager .views .projects .project .experiments .experiment .update .ExperimentUpdateDialog .ExperimentUpdateEvent ;
50
+ import life .qbic .datamanager .views .projects .project .samples .SampleInformationMain ;
48
51
import life .qbic .projectmanagement .application .DeletionService ;
49
52
import life .qbic .projectmanagement .application .ExperimentInformationService ;
50
53
import life .qbic .projectmanagement .application .ExperimentInformationService .ExperimentalGroupDTO ;
58
61
import life .qbic .projectmanagement .domain .model .experiment .ExperimentalVariable ;
59
62
import life .qbic .projectmanagement .domain .model .experiment .VariableLevel ;
60
63
import life .qbic .projectmanagement .domain .model .project .Project ;
61
- import life .qbic .projectmanagement .domain .model .project .ProjectId ;
62
64
import org .springframework .beans .factory .annotation .Autowired ;
63
65
64
66
/**
@@ -82,7 +84,6 @@ public class ExperimentDetailsComponent extends PageArea {
82
84
private final Span title = new Span ();
83
85
private final Span buttonBar = new Span ();
84
86
private final Div tagCollection = new Div ();
85
-
86
87
private final Span sampleSourceComponent = new Span ();
87
88
private final TabSheet experimentSheet = new TabSheet ();
88
89
private final Div experimentalGroups = new Div ();
@@ -95,6 +96,8 @@ public class ExperimentDetailsComponent extends PageArea {
95
96
private Context context ;
96
97
private final DeletionService deletionService ;
97
98
private int experimentalGroupCount ;
99
+ public static final String PROJECT_ID_ROUTE_PARAMETER = "projectId" ;
100
+ public static final String EXPERIMENT_ID_ROUTE_PARAMETER = "experimentId" ;
98
101
99
102
100
103
public ExperimentDetailsComponent (
@@ -114,10 +117,15 @@ public ExperimentDetailsComponent(
114
117
configureComponent ();
115
118
}
116
119
117
- private Notification createSampleRegistrationPossibleNotification (String projectId ) {
120
+ private Notification createSampleRegistrationPossibleNotification () {
118
121
Notification notification = new Notification ();
119
122
120
- String samplesUrl = Projects .SAMPLES .formatted (projectId );
123
+ RouteParam projectRouteParam = new RouteParam (PROJECT_ID_ROUTE_PARAMETER ,
124
+ context .projectId ().orElseThrow ().value ());
125
+ RouteParam experimentRouteParam = new RouteParam (EXPERIMENT_ID_ROUTE_PARAMETER ,
126
+ context .experimentId ().orElseThrow ().value ());
127
+ String samplesUrl = RouteConfiguration .forSessionScope ().getUrl (SampleInformationMain .class ,
128
+ new RouteParameters (projectRouteParam , experimentRouteParam ));
121
129
Div text = new Div (new Text ("You can now register sample batches. " ),
122
130
new Anchor (samplesUrl , new Button ("Go to Samples" , event -> notification .close ())));
123
131
@@ -478,8 +486,7 @@ private ExperimentalGroupContent toContent(ExperimentalGroupDTO experimentalGrou
478
486
}
479
487
480
488
private void showSampleRegistrationPossibleNotification () {
481
- String projectId = this .context .projectId ().map (ProjectId ::value ).orElseThrow ();
482
- Notification notification = createSampleRegistrationPossibleNotification (projectId );
489
+ Notification notification = createSampleRegistrationPossibleNotification ();
483
490
notification .open ();
484
491
}
485
492
0 commit comments