Commit f244a7bd authored by Bertrand PINEL's avatar Bertrand PINEL

Big cleanup removing fake entities...

parent 57c25b6a
import Controller from '@ember/controller';
export default Controller.extend({
entities: [
],
entity: '',
actions: {
selectEntity(entity) {
this.set('entity', entity);
this.transitionToRoute('entity-factory.'+entity);
}
}
});
\ No newline at end of file
<div class="container">
Available entities :
<select class="ember-select" onchange={{action "selectEntity" value="target.value"}}>
{{#each entities as |entityChoice|}}
<option value={{entityChoice}} selected={{eq entity entityChoice}}>{{entityChoice}}</option>
{{/each}}
</select>
</div>
{{outlet}}
\ No newline at end of file
export { default } from 'ember-aws-ehipster/controllers/entity-factory';
......@@ -7,6 +7,9 @@ const Router = EmberRouter.extend({
});
Router.map(function() {
this.route('entity-factory/tag');
this.route('entity-factory/entry');
this.route('entity-factory/blog');
});
export default Router;
export { default } from 'ember-aws-ehipster/templates/entity-factory';
{{outlet}}
<div class="container-fluid">
<h2>List of <%=singularEntityName%> Entities</h2>
<h3>List of <%=singularEntityName%> entities</h3>
{{#models-table data=<%=singularEntityName%>TableContent columns=<%=singularEntityName%>TableColumns delete="deleteRecord" as |mt|}}
{{mt.global-filter}}
......
......@@ -108,7 +108,12 @@ module.exports = {
if (type === 'boolean') {
buttonType = "checkbox";
}
form.push('{{form.element controlType="'+buttonType+'" label="'+camelizedName+'" value='+camelizedName+' onChange=(action (mut '+camelizedName+')) placeholder="'+camelizedName+'"}}');
if (type === 'date') {
form.push('<div class="row form-group"><label class="col-form-label col-md-4">'+camelizedName+
'</label>{{pikaday-input useUTC=true format="DD/MM/YYYY" onSelection=(action (mut '+camelizedName+'))}}</div>');
} else {
form.push('{{form.element controlType="'+buttonType+'" label="'+camelizedName+'" value='+camelizedName+' onChange=(action (mut '+camelizedName+')) placeholder="'+camelizedName+'"}}');
}
ctrlVars.push(camelizedName+': null,');
toCreateEntity.push(camelizedName+": this."+camelizedName);
}
......@@ -182,6 +187,11 @@ module.exports = {
let routerPath = (options.dummy) ? "tests/dummy/app/router.js" : "app/router.js";
let routeName = '\tthis.route\(\''+blueprintName+'/'+entityName+'\'\);';
addLineToFile(this, routerPath, /Router\.map\(function\(\) {/, routeName);
// Add Entity select entry in the entity controller file
let entityIndexPath = (options.dummy) ? "tests/dummy/app/controllers/entity-factory.js" : "app/controllers/entity-factory.js";
let entityIndexEntry= "'"+entityName+"'";
addLineToFile(this, entityIndexPath, /entities: \[/, entityIndexEntry);
}
};
......
......@@ -53,6 +53,10 @@ module.exports = {
entity.options.push(property.name+':number');
break;
case 'Boolean':
entity.options.push(property.name+':number');
break;
default:
this.ui.writeLine("Huston, we have a problem with unknow type "+property.name);
break;
......@@ -101,7 +105,7 @@ module.exports = {
if (options.dummy) {
cmd += ' --dummy';
}
//console.log(cmd);
console.log(cmd);
shelljs.exec(cmd);
}
......
entity User {
login String required,
passwordHash String,
firstName String,
lastName String,
email String,
imageUrl String,
activated Boolean,
langKey String,
activationKey String,
resetKey String,
createdBy String,
createdDate Date,
lastModifiedBy String
lastModifiedDate String
}
entity Authority {
name String required
}
relationship ManyToMany {
User{user(id)} to Authority{authorityName}
}
import ENV from './../config/environment';
export default function() {
this.namespace = '';
if (!ENV.APP.proxy) {
this.get('/tags');
this.get('/tags/:id');
this.delete('/tags/:id');
this.patch('/tags/:id');
this.post('/tags');
this.get('/entries');
this.get('/entries/:id');
this.delete('/entries/:id');
this.patch('/entries/:id');
this.post('/entries');
this.get('/blogs');
this.get('/blogs/:id');
this.delete('/blogs/:id');
this.patch('/blogs/:id');
this.post('/blogs');
} else {
this.passthrough();
}
}
export default function(server) {
server.createList('tag', 8);
server.createList('entry', 8);
server.createList('blog', 8);
}
To be sure that the directory exists...
\ No newline at end of file
import { JSONAPISerializer } from 'ember-cli-mirage';
export default JSONAPISerializer.extend({
});
To be sure that the directory exists...
\ No newline at end of file
{
"name": "ember-aws-ehipster",
"version": "0.2.1",
"version": "0.2.7",
"description": "The default blueprint for ember-cli addons.",
"keywords": [
"ember-addon"
......@@ -28,6 +28,8 @@
"ember-cli-mirage": "^0.4.9",
"ember-data": "^3.5.0",
"ember-models-table": "^2.7.0",
"ember-truth-helpers": "^2.1.0",
"ember-pikaday": "^2.3.0",
"jhipster-core": "^3.4.0",
"shelljs": "^0.8.2"
},
......@@ -40,6 +42,7 @@
"ember-cli-eslint": "^4.2.1",
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-moment-shim": "^3.7.1",
"ember-cli-qunit": "^4.1.1",
"ember-cli-shims": "^1.2.0",
"ember-cli-sri": "^2.1.0",
......
import Controller from '@ember/controller';
export default Controller.extend({
totoTableColumns: Ember.computed(function() {
var col = Ember.A([
Ember.Object.create({
propertyName: "title",
title: "title"
}),
Ember.Object.create({
propertyName: "description",
title: "description"
}),
Ember.Object.create({
propertyName: "number",
title: "number"
}),
Ember.Object.create({
propertyName: "isVisible",
title: "isVisible"
}),
]);
return col;
}),
totoTableContent: Ember.computed(function() {
return this.get("model");
})
});
\ No newline at end of file
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
description: DS.attr('string'),
number: DS.attr('number'),
isVisible: DS.attr('boolean')
});
\ No newline at end of file
......@@ -7,8 +7,7 @@ const Router = EmberRouter.extend({
});
Router.map(function() {
this.route('entity-factory/toto');
this.route('entity-factory/toto');
});
export default Router;
import Route from '@ember/routing/route';
export default Route.extend({
model() {
return this.store.findAll('toto');
}
});
\ No newline at end of file
<h2 id="title">Welcome to Ember</h2>
<h2 id="title">A Guinea Pig in the Cloud</h2>
{{outlet}}
\ No newline at end of file
<h2>List of toto</h2>
{{models-table
data=totoTableContent
columns=totoTableColumns}}
{{outlet}}
\ No newline at end of file
export default function() {
this.namespace = '';
this.get('/totos', 'totos');
}
import {
Factory,
faker
} from 'ember-cli-mirage';
export default Factory.extend({
//default generated factory
title () {
return faker.name.findName()
},
description () {
return faker.name.findName()
},
number () {
return faker.random.number({min: 0,max: 10000})
},
isVisible () {
return faker.random.boolean()
}
})
\ No newline at end of file
import {
Model
} from 'ember-cli-mirage';
export default Model.extend({
});
\ No newline at end of file
export default function(server) {
server.createList('toto', 10);
}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | entity-factory', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:entity-factory');
assert.ok(controller);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment