extend list of allowed project templates (#5601)

In cloud we want to allow users to create new project from the template. List of templates is a bit outdated and doesn't contain all from the https://github.com/enso-org/project-templates. This PR simply adds missing ones
This commit is contained in:
Paweł Buchowski 2023-02-13 14:03:51 +01:00 committed by GitHub
parent 6967fb7d02
commit 95c66baa3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 0 deletions

View File

@ -46,6 +46,13 @@ pub async fn download_project_templates(client: reqwest::Client, enso_root: Path
("Orders", vec!["data/store_data.xlsx", "src/Main.enso"]),
("Restaurants", vec!["data/la_districts.csv", "data/restaurants.csv", "src/Main.enso"]),
("Stargazers", vec!["src/Main.enso"]),
("Colorado_COVID", vec![
"data/CDPHE_COVID19_County_Status_Metrics.csv",
"data/ColoradoGeoData.db",
"src/Main.enso",
]),
("KMeans", vec!["src/Main.enso"]),
("NASDAQReturns", vec!["src/Main.enso"]),
];
let mut futures = Vec::<BoxFuture<'static, Result>>::new();

View File

@ -334,6 +334,49 @@ class PackageManager[F](implicit val fileSystem: FileSystem[F]) {
pkg.sourceDir.getChild(Package.mainFileName)
)
case Template.ColoradoCovid =>
val metricsDataPath = new URI(
"/colorado_covid/data/CDPHE_COVID19_County_Status_Metrics.csv"
)
val geoDataPath = new URI("/colorado_covid/data/ColoradoGeoData.db")
val mainEnsoPath = new URI(
s"/colorado_covid/src/${Package.mainFileName}"
)
pkg.root.getChild("data").createDirectories()
copyResource(
metricsDataPath,
pkg.root
.getChild("data")
.getChild("CDPHE_COVID19_County_Status_Metrics.csv")
)
copyResource(
geoDataPath,
pkg.root.getChild("data").getChild("ColoradoGeoData.db")
)
copyResource(
mainEnsoPath,
pkg.sourceDir.getChild(Package.mainFileName)
)
case Template.Kmeans =>
val mainEnsoPath = new URI(s"/kmeans/src/${Package.mainFileName}")
copyResource(
mainEnsoPath,
pkg.sourceDir.getChild(Package.mainFileName)
)
case Template.NasdaqReturns =>
val mainEnsoPath = new URI(
s"/nasdaqreturns/src/${Package.mainFileName}"
)
copyResource(
mainEnsoPath,
pkg.sourceDir.getChild(Package.mainFileName)
)
case Template.Orders =>
val storeDataPath = new URI("/orders/data/store_data.xlsx")
val mainEnsoPath = new URI(s"/orders/src/${Package.mainFileName}")

View File

@ -21,6 +21,18 @@ object Template {
override val name = "default"
}
case object ColoradoCovid extends Template {
override val name = "colorado_covid"
}
case object Kmeans extends Template {
override val name = "kmeans"
}
case object NasdaqReturns extends Template {
override val name = "nasdaqreturns"
}
case object Orders extends Template {
override val name = "orders"
}