...
 
Commits (2)
{
"name": "Feelback",
"fields": [
{
"fieldName": "generalMood",
"fieldType": "Mood",
"fieldValues": "SAD,SOSO,GOOD,AWESOME"
},
{
"fieldName": "ipponMood",
"fieldType": "Mood",
"fieldValues": "SAD,SOSO,GOOD,AWESOME"
},
{
"fieldName": "missionMood",
"fieldType": "Mood",
"fieldValues": "SAD,SOSO,GOOD,AWESOME"
},
{
"fieldName": "date",
"fieldType": "LocalDate"
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"relationshipName": "mission",
"otherEntityName": "mission",
"otherEntityField": "id"
},
{
"relationshipType": "many-to-one",
"relationshipName": "employee",
"otherEntityName": "user",
"otherEntityField": "id"
}
],
"changelogDate": "20181129125404",
"entityTableName": "feelback",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
{
"name": "Mission",
"fields": [
{
"fieldName": "client",
"fieldType": "String"
},
{
"fieldName": "missionName",
"fieldType": "String"
},
{
"fieldName": "location",
"fieldType": "String"
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"relationshipName": "salesperson",
"otherEntityName": "user",
"otherEntityField": "id"
}
],
"changelogDate": "20181129125405",
"entityTableName": "mission",
"dto": "no",
"pagination": "no",
"service": "no",
"jpaMetamodelFiltering": false,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}
\ No newline at end of file
......@@ -34,6 +34,8 @@
"languages": [
"en",
"fr"
]
],
"herokuAppName": "feelback",
"herokuDeployType": "git"
}
}
\ No newline at end of file
web: java $JAVA_OPTS -Xmx256m -jar target/*.war --spring.profiles.active=prod,heroku,no-liquibase --server.port=$PORT
release: cp -R src/main/resources/config config && ./mvnw liquibase:update -Pheroku
entity Feelback {
generalMood Mood,
ipponMood Mood,
missionMood Mood,
date LocalDate
}
entity Mission {
client String,
missionName String,
location String
}
enum Mood {
SAD, SOSO, GOOD, AWESOME
}
relationship ManyToOne {
Feelback{mission} to Mission,
Feelback{employee} to User,
Mission{salesperson} to User
}
......@@ -352,6 +352,14 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-data</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-localconfig-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-heroku-connector</artifactId>
</dependency>
<!-- jhipster-needle-maven-add-dependency -->
</dependencies>
......@@ -1100,6 +1108,59 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>heroku</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<configuration combine.self="override">
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver></driver>
<url>${env.JDBC_DATABASE_URL}</url>
<defaultSchemaName></defaultSchemaName>
<username>${env.JDBC_DATABASE_USERNAME}</username>
<password>${env.JDBC_DATABASE_PASSWORD}</password>
<referenceUrl>hibernate:spring:fr.ippon.feelback.domain?dialect=org.hibernate.dialect.PostgreSQL82Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
<executions>
<execution>
<id>clean-artifacts</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>target</directory>
<excludes>
<exclude>*.war</exclude>
</excludes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>node_modules</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- jhipster-needle-maven-add-profile -->
</profiles>
</project>
......@@ -38,6 +38,8 @@ public class CacheConfiguration {
cm.createCache(fr.ippon.feelback.domain.User.class.getName(), jcacheConfiguration);
cm.createCache(fr.ippon.feelback.domain.Authority.class.getName(), jcacheConfiguration);
cm.createCache(fr.ippon.feelback.domain.User.class.getName() + ".authorities", jcacheConfiguration);
cm.createCache(fr.ippon.feelback.domain.Feelback.class.getName(), jcacheConfiguration);
cm.createCache(fr.ippon.feelback.domain.Mission.class.getName(), jcacheConfiguration);
// jhipster-needle-ehcache-add-entry
};
}
......
package fr.ippon.feelback.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
import fr.ippon.feelback.domain.enumeration.Mood;
/**
* A Feelback.
*/
@Entity
@Table(name = "feelback")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Feelback implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@Enumerated(EnumType.STRING)
@Column(name = "general_mood")
private Mood generalMood;
@Enumerated(EnumType.STRING)
@Column(name = "ippon_mood")
private Mood ipponMood;
@Enumerated(EnumType.STRING)
@Column(name = "mission_mood")
private Mood missionMood;
@Column(name = "jhi_date")
private LocalDate date;
@ManyToOne
@JsonIgnoreProperties("")
private Mission mission;
@ManyToOne
@JsonIgnoreProperties("")
private User employee;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Mood getGeneralMood() {
return generalMood;
}
public Feelback generalMood(Mood generalMood) {
this.generalMood = generalMood;
return this;
}
public void setGeneralMood(Mood generalMood) {
this.generalMood = generalMood;
}
public Mood getIpponMood() {
return ipponMood;
}
public Feelback ipponMood(Mood ipponMood) {
this.ipponMood = ipponMood;
return this;
}
public void setIpponMood(Mood ipponMood) {
this.ipponMood = ipponMood;
}
public Mood getMissionMood() {
return missionMood;
}
public Feelback missionMood(Mood missionMood) {
this.missionMood = missionMood;
return this;
}
public void setMissionMood(Mood missionMood) {
this.missionMood = missionMood;
}
public LocalDate getDate() {
return date;
}
public Feelback date(LocalDate date) {
this.date = date;
return this;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Mission getMission() {
return mission;
}
public Feelback mission(Mission mission) {
this.mission = mission;
return this;
}
public void setMission(Mission mission) {
this.mission = mission;
}
public User getEmployee() {
return employee;
}
public Feelback employee(User user) {
this.employee = user;
return this;
}
public void setEmployee(User user) {
this.employee = user;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Feelback feelback = (Feelback) o;
if (feelback.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), feelback.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Feelback{" +
"id=" + getId() +
", generalMood='" + getGeneralMood() + "'" +
", ipponMood='" + getIpponMood() + "'" +
", missionMood='" + getMissionMood() + "'" +
", date='" + getDate() + "'" +
"}";
}
}
package fr.ippon.feelback.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A Mission.
*/
@Entity
@Table(name = "mission")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Mission implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@Column(name = "client")
private String client;
@Column(name = "mission_name")
private String missionName;
@Column(name = "location")
private String location;
@ManyToOne
@JsonIgnoreProperties("")
private User salesperson;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getClient() {
return client;
}
public Mission client(String client) {
this.client = client;
return this;
}
public void setClient(String client) {
this.client = client;
}
public String getMissionName() {
return missionName;
}
public Mission missionName(String missionName) {
this.missionName = missionName;
return this;
}
public void setMissionName(String missionName) {
this.missionName = missionName;
}
public String getLocation() {
return location;
}
public Mission location(String location) {
this.location = location;
return this;
}
public void setLocation(String location) {
this.location = location;
}
public User getSalesperson() {
return salesperson;
}
public Mission salesperson(User user) {
this.salesperson = user;
return this;
}
public void setSalesperson(User user) {
this.salesperson = user;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Mission mission = (Mission) o;
if (mission.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), mission.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Mission{" +
"id=" + getId() +
", client='" + getClient() + "'" +
", missionName='" + getMissionName() + "'" +
", location='" + getLocation() + "'" +
"}";
}
}
package fr.ippon.feelback.domain.enumeration;
/**
* The Mood enumeration.
*/
public enum Mood {
SAD, SOSO, GOOD, AWESOME
}
package fr.ippon.feelback.repository;
import fr.ippon.feelback.domain.Feelback;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Spring Data repository for the Feelback entity.
*/
@SuppressWarnings("unused")
@Repository
public interface FeelbackRepository extends JpaRepository<Feelback, Long> {
@Query("select feelback from Feelback feelback where feelback.employee.login = ?#{principal.username}")
List<Feelback> findByEmployeeIsCurrentUser();
}
package fr.ippon.feelback.repository;
import fr.ippon.feelback.domain.Mission;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Spring Data repository for the Mission entity.
*/
@SuppressWarnings("unused")
@Repository
public interface MissionRepository extends JpaRepository<Mission, Long> {
@Query("select mission from Mission mission where mission.salesperson.login = ?#{principal.username}")
List<Mission> findBySalespersonIsCurrentUser();
}
package fr.ippon.feelback.web.rest;
import com.codahale.metrics.annotation.Timed;
import fr.ippon.feelback.domain.Feelback;
import fr.ippon.feelback.repository.FeelbackRepository;
import fr.ippon.feelback.repository.UserRepository;
import fr.ippon.feelback.security.SecurityUtils;
import fr.ippon.feelback.web.rest.errors.BadRequestAlertException;
import fr.ippon.feelback.web.rest.util.HeaderUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Feelback.
*/
@RestController
@RequestMapping("/api")
public class FeelbackResource {
private final Logger log = LoggerFactory.getLogger(FeelbackResource.class);
private static final String ENTITY_NAME = "feelback";
private final FeelbackRepository feelbackRepository;
private final UserRepository userRepository;
public FeelbackResource(FeelbackRepository feelbackRepository, UserRepository userRepository) {
this.feelbackRepository = feelbackRepository;
this.userRepository = userRepository;
}
/**
* POST /feelbacks : Create a new feelback.
*
* @param feelback the feelback to create
* @return the ResponseEntity with status 201 (Created) and with body the new feelback, or with status 400 (Bad Request) if the feelback has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/feelbacks")
@Timed
public ResponseEntity<Feelback> createFeelback(@RequestBody Feelback feelback) throws URISyntaxException {
log.debug("REST request to save Feelback : {}", feelback);
if (feelback.getId() != null) {
throw new BadRequestAlertException("A new feelback cannot already have an ID", ENTITY_NAME, "idexists");
}
feelback.date(LocalDate.now());
String currentUserLogin = SecurityUtils.getCurrentUserLogin().orElse(null);
feelback.employee(userRepository.findOneByLogin(currentUserLogin).orElse(null));
if(feelback.getEmployee() == null)
return ResponseEntity.badRequest().body(null);
Feelback result = feelbackRepository.save(feelback);
return ResponseEntity.created(new URI("/api/feelbacks/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /feelbacks : Updates an existing feelback.
*
* @param feelback the feelback to update
* @return the ResponseEntity with status 200 (OK) and with body the updated feelback,
* or with status 400 (Bad Request) if the feelback is not valid,
* or with status 500 (Internal Server Error) if the feelback couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/feelbacks")
@Timed
public ResponseEntity<Feelback> updateFeelback(@RequestBody Feelback feelback) throws URISyntaxException {
log.debug("REST request to update Feelback : {}", feelback);
if (feelback.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
Feelback result = feelbackRepository.save(feelback);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, feelback.getId().toString()))
.body(result);
}
/**
* GET /feelbacks : get all the feelbacks.
*
* @return the ResponseEntity with status 200 (OK) and the list of feelbacks in body
*/
@GetMapping("/feelbacks")
@Timed
public List<Feelback> getAllFeelbacks() {
log.debug("REST request to get all Feelbacks");
return feelbackRepository.findAll();
}
/**
* GET /feelbacks/:id : get the "id" feelback.
*
* @param id the id of the feelback to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the feelback, or with status 404 (Not Found)
*/
@GetMapping("/feelbacks/{id}")
@Timed
public ResponseEntity<Feelback> getFeelback(@PathVariable Long id) {
log.debug("REST request to get Feelback : {}", id);
Optional<Feelback> feelback = feelbackRepository.findById(id);
return ResponseUtil.wrapOrNotFound(feelback);
}
@GetMapping("/feelbacks/user")
@Timed
public List<Feelback> getFeelbacksByUser() {
return feelbackRepository.findByEmployeeIsCurrentUser();
}
/**
* DELETE /feelbacks/:id : delete the "id" feelback.
*
* @param id the id of the feelback to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/feelbacks/{id}")
@Timed
public ResponseEntity<Void> deleteFeelback(@PathVariable Long id) {
log.debug("REST request to delete Feelback : {}", id);
feelbackRepository.deleteById(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
package fr.ippon.feelback.web.rest;
import com.codahale.metrics.annotation.Timed;
import fr.ippon.feelback.domain.Mission;
import fr.ippon.feelback.repository.MissionRepository;
import fr.ippon.feelback.web.rest.errors.BadRequestAlertException;
import fr.ippon.feelback.web.rest.util.HeaderUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Mission.
*/
@RestController
@RequestMapping("/api")
public class MissionResource {
private final Logger log = LoggerFactory.getLogger(MissionResource.class);
private static final String ENTITY_NAME = "mission";
private final MissionRepository missionRepository;
public MissionResource(MissionRepository missionRepository) {
this.missionRepository = missionRepository;
}
/**
* POST /missions : Create a new mission.
*
* @param mission the mission to create
* @return the ResponseEntity with status 201 (Created) and with body the new mission, or with status 400 (Bad Request) if the mission has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/missions")
@Timed
public ResponseEntity<Mission> createMission(@RequestBody Mission mission) throws URISyntaxException {
log.debug("REST request to save Mission : {}", mission);
if (mission.getId() != null) {
throw new BadRequestAlertException("A new mission cannot already have an ID", ENTITY_NAME, "idexists");
}
Mission result = missionRepository.save(mission);
return ResponseEntity.created(new URI("/api/missions/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /missions : Updates an existing mission.
*
* @param mission the mission to update
* @return the ResponseEntity with status 200 (OK) and with body the updated mission,
* or with status 400 (Bad Request) if the mission is not valid,
* or with status 500 (Internal Server Error) if the mission couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/missions")
@Timed
public ResponseEntity<Mission> updateMission(@RequestBody Mission mission) throws URISyntaxException {
log.debug("REST request to update Mission : {}", mission);
if (mission.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
Mission result = missionRepository.save(mission);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, mission.getId().toString()))
.body(result);
}
/**
* GET /missions : get all the missions.
*
* @return the ResponseEntity with status 200 (OK) and the list of missions in body
*/
@GetMapping("/missions")
@Timed
public List<Mission> getAllMissions() {
log.debug("REST request to get all Missions");
return missionRepository.findAll();
}
/**
* GET /missions/:id : get the "id" mission.
*
* @param id the id of the mission to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the mission, or with status 404 (Not Found)
*/
@GetMapping("/missions/{id}")
@Timed
public ResponseEntity<Mission> getMission(@PathVariable Long id) {
log.debug("REST request to get Mission : {}", id);
Optional<Mission> mission = missionRepository.findById(id);
return ResponseUtil.wrapOrNotFound(mission);
}
/**
* DELETE /missions/:id : delete the "id" mission.
*
* @param id the id of the mission to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/missions/{id}")
@Timed
public ResponseEntity<Void> deleteMission(@PathVariable Long id) {
log.debug("REST request to delete Mission : {}", id);
missionRepository.deleteById(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
# ===================================================================
# Spring Boot configuration for the "heroku" profile.
#
# This configuration overrides the application.yml file.
# ===================================================================
# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
eureka:
instance:
hostname: feelback.herokuapp.com
non-secure-port: 80
prefer-ip-address: false
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: ${JDBC_DATABASE_URL}
username: ${JDBC_DATABASE_USERNAME}
password: ${JDBC_DATABASE_PASSWORD}
hikari:
maximumPoolSize: 8
# ===================================================================
# Spring Cloud Config bootstrap configuration for the "heroku" profile
# ===================================================================
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity Feelback.
-->
<changeSet id="20181129125404-1" author="jhipster">
<createTable tableName="feelback">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="general_mood" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="ippon_mood" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="mission_mood" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="jhi_date" type="date">
<constraints nullable="true" />
</column>
<column name="mission_id" type="bigint">
<constraints nullable="true" />
</column>
<column name="employee_id" type="bigint">
<constraints nullable="true" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<!--
Added the constraints for entity Feelback.
-->
<changeSet id="20181129125404-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="mission_id"
baseTableName="feelback"
constraintName="fk_feelback_mission_id"
referencedColumnNames="id"
referencedTableName="mission"/>
<addForeignKeyConstraint baseColumnNames="employee_id"
baseTableName="feelback"
constraintName="fk_feelback_employee_id"
referencedColumnNames="id"
referencedTableName="jhi_user"/>
</changeSet>
</databaseChangeLog>
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity Mission.
-->
<changeSet id="20181129125405-1" author="jhipster">
<createTable tableName="mission">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="client" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="mission_name" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="location" type="varchar(255)">
<constraints nullable="true" />
</column>
<column name="salesperson_id" type="bigint">
<constraints nullable="true" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<!--
Added the constraints for entity Mission.
-->
<changeSet id="20181129125405-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="salesperson_id"
baseTableName="mission"
constraintName="fk_mission_salesperson_id"
referencedColumnNames="id"
referencedTableName="jhi_user"/>
</changeSet>
</databaseChangeLog>
......@@ -5,6 +5,10 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20181129125404_added_entity_Feelback.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20181129125405_added_entity_Mission.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
<include file="config/liquibase/changelog/20181129125404_added_entity_constraints_Feelback.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20181129125405_added_entity_constraints_Mission.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
</databaseChangeLog>
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FeelbackFeelbackModule } from './feelback/feelback.module';
import { FeelbackMissionModule } from './mission/mission.module';
/* jhipster-needle-add-entity-module-import - JHipster will add entity modules imports here */
@NgModule({
// prettier-ignore
imports: [
FeelbackFeelbackModule,
FeelbackMissionModule,
/* jhipster-needle-add-entity-module - JHipster will add entity modules here */
],
declarations: [],
......
<form name="deleteForm" (ngSubmit)="confirmDelete(feelback.id)">
<div class="modal-header">
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="clear()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p id="jhi-delete-feelback-heading" jhiTranslate="feelbackApp.feelback.delete.question" translateValues="{id: '{{feelback.id}}'}">Are you sure you want to delete this Feelback?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-feelback" type="submit" class="btn btn-danger">
<fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { IFeelback } from 'app/shared/model/feelback.model';
import { FeelbackService } from './feelback.service';
@Component({
selector: 'jhi-feelback-delete-dialog',
templateUrl: './feelback-delete-dialog.component.html'
})
export class FeelbackDeleteDialogComponent {
feelback: IFeelback;
constructor(private feelbackService: FeelbackService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {}
clear() {
this.activeModal.dismiss('cancel');
}
confirmDelete(id: number) {
this.feelbackService.delete(id).subscribe(response => {
this.eventManager.broadcast({
name: 'feelbackListModification',
content: 'Deleted an feelback'
});
this.activeModal.dismiss(true);
});
}
}
@Component({
selector: 'jhi-feelback-delete-popup',
template: ''
})
export class FeelbackDeletePopupComponent implements OnInit, OnDestroy {
private ngbModalRef: NgbModalRef;
constructor(private activatedRoute: ActivatedRoute, private router: Router, private modalService: NgbModal) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ feelback }) => {
setTimeout(() => {
this.ngbModalRef = this.modalService.open(FeelbackDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
this.ngbModalRef.componentInstance.feelback = feelback;
this.ngbModalRef.result.then(
result => {
this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
this.ngbModalRef = null;
},
reason => {
this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
this.ngbModalRef = null;
}
);
}, 0);
});
}
ngOnDestroy() {
this.ngbModalRef = null;
}
}
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="feelback">
<h2><span jhiTranslate="feelbackApp.feelback.detail.title">Feelback</span> {{feelback.id}}</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="feelbackApp.feelback.generalMood">General Mood</span></dt>
<dd>
<span jhiTranslate="{{'feelbackApp.Mood.' + feelback.generalMood}}">{{feelback.generalMood}}</span>
</dd>
<dt><span jhiTranslate="feelbackApp.feelback.ipponMood">Ippon Mood</span></dt>
<dd>
<span jhiTranslate="{{'feelbackApp.Mood.' + feelback.ipponMood}}">{{feelback.ipponMood}}</span>
</dd>
<dt><span jhiTranslate="feelbackApp.feelback.missionMood">Mission Mood</span></dt>
<dd>
<span jhiTranslate="{{'feelbackApp.Mood.' + feelback.missionMood}}">{{feelback.missionMood}}</span>
</dd>
<dt><span jhiTranslate="feelbackApp.feelback.date">Date</span></dt>
<dd>
<span>{{feelback.date}}</span>
</dd>
<dt><span jhiTranslate="feelbackApp.feelback.mission">Mission</span></dt>
<dd>
<div *ngIf="feelback.mission">
<a [routerLink]="['/mission', feelback.mission?.id, 'view']">{{feelback.mission?.id}}</a>
</div>
</dd>
<dt><span jhiTranslate="feelbackApp.feelback.employee">Employee</span></dt>
<dd>
{{feelback.employee?.id}}
</dd>
</dl>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
</button>
<button type="button"
[routerLink]="['/feelback', feelback.id, 'edit']"
class="btn btn-primary">
<fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
</button>
</div>
</div>
</div>
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IFeelback } from 'app/shared/model/feelback.model';
@Component({
selector: 'jhi-feelback-detail',
templateUrl: './feelback-detail.component.html'
})
export class FeelbackDetailComponent implements OnInit {
feelback: IFeelback;
constructor(private activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ feelback }) => {
this.feelback = feelback;
});
}
previousState() {
window.history.back();
}
}
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h2 id="jhi-feelback-heading" jhiTranslate="feelbackApp.feelback.home.createOrEditLabel">Create or edit a Feelback</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="!feelback.id">
<label for="id" jhiTranslate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id"
[(ngModel)]="feelback.id" readonly />
</div>
<!--<div class="form-group">-->
<!--<label class="form-control-label" jhiTranslate="feelbackApp.feelback.generalMood" for="field_generalMood">General Mood</label>-->
<!--<select class="form-control" name="generalMood" [(ngModel)]="feelback.generalMood" id="field_generalMood" >-->
<!--<option value="SAD">{{'feelbackApp.Mood.SAD' | translate}}</option>-->
<!--<option value="SOSO">{{'feelbackApp.Mood.SOSO' | translate}}</option>-->
<!--<option value="GOOD">{{'feelbackApp.Mood.GOOD' | translate}}</option>-->
<!--<option value="AWESOME">{{'feelbackApp.Mood.AWESOME' | translate}}</option>-->
<!--</select>-->
<!--</div>-->
<div class="form-group">
<label class="form-control-label" jhiTranslate="feelbackApp.feelback.generalMood">General Mood</label>
<div class="row">
<div class="col-3">
<img src="../../../content/images/sad.png" class="moodimage"/>
<input type="radio" required value="SAD" name="generalMood" [(ngModel)]="feelback.generalMood" />
</div>
<div class="col-3">
<img src="../../../content/images/soso.png" class="moodimage"/>
<input type="radio" required value="SOSO" name="generalMood" [(ngModel)]="feelback.generalMood" />
</div>
<div class="col-3">
<img src="../../../content/images/good.png" class="moodimage"/>
<input type="radio" required value="GOOD" name="generalMood" [(ngModel)]="feelback.generalMood" />
</div>
<div class="col-3">
<img src="../../../content/images/awesome.png" class="moodimage" />
<input type="radio" required value="AWESOME" name="generalMood" [(ngModel)]="feelback.generalMood" />
</div>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="feelbackApp.feelback.ipponMood">Ippon Mood</label>
<div class="row">
<div class="col-3">
<img src="../../../content/images/sad.png" class="moodimage"/>
<input type="radio" required value="SAD" name="ipponMood" [(ngModel)]="feelback.ipponMood" />
</div>
<div class="col-3">
<img src="../../../content/images/soso.png" class="moodimage"/>
<input type="radio" required value="SOSO" name="ipponMood" [(ngModel)]="feelback.ipponMood" />
</div>
<div class="col-3">
<img src="../../../content/images/good.png" class="moodimage"/>
<input type="radio" required value="GOOD" name="ipponMood" [(ngModel)]="feelback.ipponMood" />
</div>
<div class="col-3">
<img src="../../../content/images/awesome.png" class="moodimage"/>
<input type="radio" required value="AWESOME" name="ipponMood" [(ngModel)]="feelback.ipponMood" />
</div>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="feelbackApp.feelback.missionMood">Mission Mood</label>
<div class="row">
<div class="col-3">
<img src="../../../content/images/sad.png" class="moodimage"/>
<input type="radio" required value="SAD" name="missionMood" [(ngModel)]="feelback.missionMood" />
</div>
<div class="col-3">
<img src="../../../content/images/soso.png" class="moodimage"/>
<input type="radio" required value="SOSO" name="missionMood" [(ngModel)]="feelback.missionMood" />
</div>
<div class="col-3">
<img src="../../../content/images/good.png" class="moodimage"/>
<input type="radio" required value="GOOD" name="missionMood" [(ngModel)]="feelback.missionMood" />
</div>
<div class="col-3">
<img src="../../../content/images/awesome.png" class="moodimage"/>
<input type="radio" required value="AWESOME" name="missionMood" [(ngModel)]="feelback.missionMood" />
</div>
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="form-control-label" jhiTranslate="feelbackApp.feelback.date" for="field_date">Date</label>-->
<!--<div class="input-group">-->
<!--<input id="field_date" type="text" class="form-control" name="date" ngbDatepicker #dateDp="ngbDatepicker" [(ngModel)]="feelback.date"-->
<!--/>-->
<!--<span class="input-group-append">-->
<!--<button type="button" class="btn btn-secondary" (click)="dateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>-->
<!--</span>-->
<!--</div>-->
<!--</div>-->
<div class="form-group">
<label class="form-control-label" jhiTranslate="feelbackApp.feelback.mission" for="field_mission">Mission</label>
<select class="form-control" id="field_mission" name="mission" [(ngModel)]="feelback.mission" >
<option [ngValue]="null"></option>
<option [ngValue]="missionOption.id === feelback.mission?.id ? feelback.mission : missionOption" *ngFor="let missionOption of missions; trackBy: trackMissionById">{{missionOption.missionName}}</option>
</select>
</div>
<!--<div class="form-group">-->
<!--<label class="form-control-label" jhiTranslate="feelbackApp.feelback.employee" for="field_employee">Employee</label>-->
<!--<select class="form-control" id="field_employee" name="employee" [(ngModel)]="feelback.employee" >-->
<!--<option [ngValue]="null"></option>-->
<!--<option [ngValue]="userOption.id === feelback.employee?.id ? feelback.employee : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.id}}</option>-->
<!--</select>-->
<!--</div>-->
</div>
<div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
<fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div>
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import * as moment from 'moment';
import { JhiAlertService } from 'ng-jhipster';
import { IFeelback } from 'app/shared/model/feelback.model';
import { FeelbackService } from './feelback.service';
import { IMission } from 'app/shared/model/mission.model';
import { MissionService } from 'app/entities/mission';
import { IUser, UserService } from 'app/core';
@Component({
selector: 'jhi-feelback-update',
templateUrl: './feelback-update.component.html',
styleUrls: ['./feelback-update.component.scss']
})
export class FeelbackUpdateComponent implements OnInit {
feelback: IFeelback;
isSaving: boolean;
missions: IMission[];
users: IUser[];
dateDp: any;
constructor(
private jhiAlertService: JhiAlertService,
private feelbackService: FeelbackService,
private missionService: MissionService,
private userService: UserService,
private activatedRoute: ActivatedRoute,
private router: Router
) {}
ngOnInit() {
this.isSaving = false;
this.activatedRoute.data.subscribe(({ feelback }) => {
this.feelback = feelback;
});
this.missionService.query().subscribe(
(res: HttpResponse<IMission[]>) => {
this.missions = res.body;
},
(res: HttpErrorResponse) => this.onError(res.message)
);
this.userService.query().subscribe(
(res: HttpResponse<IUser[]>) => {
this.users = res.body;
},
(res: HttpErrorResponse) => this.onError(res.message)
);
}
previousState() {
this.router.navigate(['/feelback']);
}
save() {
this.isSaving = true;
if (this.feelback.id !== undefined) {
this.subscribeToSaveResponse(this.feelbackService.update(this.feelback));
} else {
this.subscribeToSaveResponse(this.feelbackService.create(this.feelback));
}
}
private subscribeToSaveResponse(result: Observable<HttpResponse<IFeelback>>) {
result.subscribe((res: HttpResponse<IFeelback>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
}
private onSaveSuccess() {
this.isSaving = false;
this.previousState();
}
private onSaveError() {
this.isSaving = false;
}
private onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
trackMissionById(index: number, item: IMission) {
return item.id;
}
trackUserById(index: number, item: IUser) {
return item.id;
}
}
<div>
<h2 id="page-heading">
<span jhiTranslate="feelbackApp.feelback.home.title">Feelbacks</span>
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-feelback" [routerLink]="['/feelback/new']">
<fa-icon [icon]="'plus'"></fa-icon>
<span jhiTranslate="feelbackApp.feelback.home.createLabel">
Create new Feelback
</span>
</button>
</h2>
<jhi-alert></jhi-alert>
<br/>
<div class="table-responsive" *ngIf="feelbacks">
<table class="table table-striped">
<thead>
<tr>
<th><span jhiTranslate="feelbackApp.feelback.date">Date</span></th>
<th><span jhiTranslate="feelbackApp.feelback.generalMood">General Mood</span></th>
<th><span jhiTranslate="feelbackApp.feelback.ipponMood">Ippon Mood</span></th>
<th><span jhiTranslate="feelbackApp.feelback.missionMood">Mission Mood</span></th>
<th><span jhiTranslate="feelbackApp.feelback.mission">Mission</span></th>
<th><span jhiTranslate="feelbackApp.feelback.employee">Employee</span></th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let feelback of feelbacks ;trackBy: trackId">
<td>{{feelback.date | date:'mediumDate'}}</td>
<td><img [src]="getImageFromMood(feelback.generalMood)" class="moodimage"/></td>
<td><img [src]="getImageFromMood(feelback.ipponMood)" class="moodimage"/></td>
<td><img [src]="getImageFromMood(feelback.missionMood)" class="moodimage"/></td>
<td>
<div *ngIf="feelback.mission">
<a [routerLink]="['../mission', feelback.mission?.id, 'view' ]" >{{feelback.mission?.missionName}}</a>
</div>
</td>
<td>
{{feelback.employee?.firstName}} {{feelback.employee?.lastName}}
</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
[routerLink]="['/', { outlets: { popup: 'feelback/'+ feelback.id + '/delete'} }]"
replaceUrl="true"