mirror of
				https://github.com/ohwgiles/laminar.git
				synced 2025-06-13 12:54:29 +00:00 
			
		
		
		
	resolves #82: implement /latest endpoint
for run page on webui and archive (via symlink)
This commit is contained in:
		
							parent
							
								
									137f35bdd7
								
							
						
					
					
						commit
						b15166e83b
					
				@ -865,6 +865,8 @@ void Laminar::runFinished(Run * r) {
 | 
				
			|||||||
        fsHome->remove(d);
 | 
					        fsHome->remove(d);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fsHome->symlink(kj::Path{"archive", r->name, "latest"}, std::to_string(r->build), kj::WriteMode::CREATE|kj::WriteMode::MODIFY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // in case we freed up an executor, check the queue
 | 
					    // in case we freed up an executor, check the queue
 | 
				
			||||||
    assignNewJobs();
 | 
					    assignNewJobs();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -700,6 +700,14 @@ const Run = function() {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
      status: function(data) {
 | 
					      status: function(data) {
 | 
				
			||||||
 | 
					        // Check for the /latest endpoint. An intuitive check might be
 | 
				
			||||||
 | 
					        //  if(this.$route.params.number == 'latest'), but unfortunately
 | 
				
			||||||
 | 
					        // after calling $router.replace, we re-enter status() before
 | 
				
			||||||
 | 
					        // $route.params is updated. Instead, assume that if there is
 | 
				
			||||||
 | 
					        // no 'started' field, we should redirect to the latest number
 | 
				
			||||||
 | 
					        if(!('started' in data) && 'latestNum' in data)
 | 
				
			||||||
 | 
					          return this.$router.replace('/jobs/' + this.$route.params.name + '/' + data.latestNum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        state.jobsRunning = [];
 | 
					        state.jobsRunning = [];
 | 
				
			||||||
        state.job = data;
 | 
					        state.job = data;
 | 
				
			||||||
        state.latestNum = data.latestNum;
 | 
					        state.latestNum = data.latestNum;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user