chore(scaffolder): fixing the no templates view with link to readme

This commit is contained in:
blam
2020-07-16 12:04:49 +02:00
parent 738a378358
commit 512ef406c6
2 changed files with 19 additions and 11 deletions
@@ -62,16 +62,14 @@ export const runDockerContainer = async ({
dockerClient,
createOptions = {},
}: RunDockerContainerOptions) => {
await new Promise((resolve, reject) =>
dockerClient.pull(imageName, {}, (err, res) => {
console.warn(err, res);
if (err) {
reject(err);
} else {
resolve(res);
}
}),
);
await new Promise((resolve, reject) => {
dockerClient.pull(imageName, {}, (err, stream) => {
if (err) return reject(err);
stream.pipe(logStream);
stream.on('end', () => resolve());
stream.on('error', (error: Error) => reject(error));
});
});
const [{ Error: error, StatusCode: statusCode }] = await dockerClient.run(
imageName,
args,
@@ -102,10 +102,20 @@ export const ScaffolderPage: React.FC<{}> = () => {
</Link>
.
</Typography>
{templates && !templates.length && (
<Typography variant="body2">
Shoot! Looks like you don't have any templates. Check out the
documentation{' '}
<Link href="docs/backstage/features/software-templates/adding-templates">
here!
</Link>
</Typography>
)}
{!templates && isValidating && <LinearProgress />}
<Grid container>
{templates &&
templates.map(template => {
templates?.length > 0 &&
templates!.map(template => {
return (
<Grid item xs={12} sm={6} md={3}>
<TemplateCard {...getTemplateCardProps(template)} />