Skip to content

Commit

Permalink
💄 : add nice ui
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Jun 4, 2019
1 parent b947483 commit 9b18891
Show file tree
Hide file tree
Showing 14 changed files with 6,689 additions and 74 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
<artifactId>vue</artifactId>
<version>2.5.16</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>5.8.2</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
28 changes: 18 additions & 10 deletions src/main/java/io/codeka/gaia/Gaia.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.codeka.gaia.bo.TerraformModule;
import io.codeka.gaia.bo.TerraformVariable;
import io.codeka.gaia.repository.TerraformModuleRepository;
import io.codeka.gaia.repository.TerraformStateRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
Expand All @@ -21,25 +22,32 @@ public static void main(String[] args) {
}

@Bean
CommandLineRunner cli(@Autowired TerraformModuleRepository repository){
@Autowired
CommandLineRunner cli(TerraformModuleRepository repository, TerraformStateRepository terraformStateRepository){
return args -> {
repository.deleteAll();
terraformStateRepository.deleteAll();

// create dummy module for tests
var module = new TerraformModule();
module.setId("e01f9925-a559-45a2-8a55-f93dc434c676");
module.setName("test 1");
module.setDescription("a dummy module");
module.setGitRepositoryUrl("https://github.com/dummy");
module.setDirectory("dummy");
module.setName("terraform-docker-mongo");
module.setDescription("A sample terraform \uD83C\uDF0D module for running a mongodb \uD83C\uDF43 database inside a docker \uD83D\uDC33 container");
module.setGitRepositoryUrl("https://github.com/juwit/terraform-docker-mongo.git");
module.setDirectory("");
module.setGitBranch("master");

var tvar = new TerraformVariable();
tvar.setName("dummy_var");
tvar.setDescription("a dummy var description");
tvar.setDefaultValue("a dummy value");
tvar.setName("mongo_container_name");
tvar.setDescription("the name of the docker container");

module.setVariables(List.of(tvar));
var tvar2 = new TerraformVariable();
tvar2.setName("mongo_exposed_port");
tvar2.setDescription("the exposed port of the mongo container");
tvar2.setDefaultValue("27017");

module.setVariables(List.of(tvar, tvar2));

repository.deleteAll();
repository.saveAll(List.of(module));
};
}
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/io/codeka/gaia/controller/IndexController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.codeka.gaia.controller;

import io.codeka.gaia.repository.TerraformModuleRepository;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {

private TerraformModuleRepository moduleRepository;

public IndexController(TerraformModuleRepository moduleRepository) {
this.moduleRepository = moduleRepository;
}

@GetMapping("/")
String index(Model model){
var moduleCount = this.moduleRepository.count();
model.addAttribute("moduleCount", moduleCount);
return "index";
}

}
Loading

0 comments on commit 9b18891

Please sign in to comment.