namespace App\Http\Controllers;
+use App\Jobs\GenerateAosSeed;
use App\Models\AosSeed;
use Illuminate\Http\Request;
return $seed->toJson();
}
+ public function retry($hash) {
+ $seed = AosSeed::where('hash', '=', $hash)->firstOrFail();
+
+ if ($seed->status == 'error') {
+ $seed->status = 'pending';
+ $seed->save();
+ GenerateAosSeed::dispatch($seed)->onConnection('database');
+ }
+
+ return $seed->toJson();
+ }
+
}
}
};
-const Seed = ({ patch, seed }) => {
+const Seed = ({ onRetry, patch, seed }) => {
const { rom } = useAosBaseRom();
return <Container>
<strong>{i18n.t(`aosSeeds.statuses.${seed.status}`)}</strong>
</p>
}
+ {seed.status === 'error' ?
+ <p>
+ <Button
+ onClick={onRetry}
+ variant="secondary"
+ >
+ {i18n.t('button.retry')}
+ </Button>
+ </p>
+ : null}
</Col>
</Row>
<h2 className="mt-5">{i18n.t('aosSeeds.generator')}</h2>
};
Seed.propTypes = {
+ onRetry: PropTypes.func,
patch: PropTypes.instanceOf(ArrayBuffer),
seed: PropTypes.shape({
generator: PropTypes.string,
};
}, [hash, seed]);
+ const retry = useCallback(async () => {
+ await axios.post(`/api/aos-seed/${hash}/retry`);
+ setSeed(seed => ({ ...seed, status: 'pending' }));
+ });
+
if (loading) {
return <Loading />;
}
}
return <ErrorBoundary>
- <Seed patch={patch} seed={seed} />
+ <Seed onRetry={retry} patch={patch} seed={seed} />
</ErrorBoundary>;
};
logout: 'Logout',
new: 'Neu',
protocol: 'Protokoll',
+ retry: 'Neu versuchen',
save: 'Speichern',
search: 'Suche',
settings: 'Einstellungen',
logout: 'Logout',
new: 'New',
protocol: 'Protocol',
+ retry: 'Retry',
save: 'Save',
search: 'Search',
settings: 'Settings',
});
Route::get('aos-seed/{hash}', 'App\Http\Controllers\AosSeedController@byHash');
+Route::post('aos-seed/{hash}/retry', 'App\Http\Controllers\AosSeedController@retry');
Route::post('application/{application}/accept', 'App\Http\Controllers\ApplicationController@accept');
Route::post('application/{application}/reject', 'App\Http\Controllers\ApplicationController@reject');