Skip to content

Commit

Permalink
Updated to oec-next
Browse files Browse the repository at this point in the history
  • Loading branch information
vamsee committed Feb 19, 2019
1 parent 8ec45f7 commit f7a4653
Show file tree
Hide file tree
Showing 62 changed files with 1,465 additions and 1,613 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ jspm_packages
bower_components

# IDE
.vscode
.vscode

package-lock.json
55 changes: 33 additions & 22 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,68 @@ module.exports = class extends Generator {
}

prompting() {
return this.prompt([{
return this.prompt([
{
type: 'list',
name: 'oeCloud',
message: 'which oeCloud version you want to use?',
default: '2.0',
choices: ['1.0', '2.0']
}, {
type: 'input',
name: 'version',
message: 'version',
message: 'Your application version?',
default: '1.0.0'
}, {
type: 'input',
name: 'description',
message: 'description',
message: 'Your application description?',
default: 'A sample oecloud based application'
}, {
type: 'input',
name: 'author',
message: 'author',
default: this.options.author
},
{
type: 'confirm',
name: 'bowerinstall',
message: 'Do you want to install ui-components(bower)?',
default: false
}
]).then((answers) => {
this.options.author = answers.author || this.options.author;
this.options.version = answers.version;
this.options.description = answers.description;
this.options.bowerinstall = answers.bowerinstall;
this.options.oeCloud = answers.oeCloud;
this.options.bowerInstall = answers.oeCloud === '1.0' ? true : false;
});
}

writing() {
var version = this.options.oeCloud;
this.fs.copyTpl(
this.templatePath(version + '/common'),
this.destinationPath('common')
);
this.fs.copy(
this.templatePath('client'),
this.templatePath('1.0/client'),
this.destinationPath('client')
);
this.fs.copyTpl(
this.templatePath('server'),
this.templatePath(version + '/server'),
this.destinationPath('server')
);
if (this.options.oeCloud === '2.0') {
this.fs.copyTpl(
this.templatePath(version + '/test'),
this.destinationPath('test')
);
this.fs.copyTpl(
this.templatePath(version + '/lib'),
this.destinationPath('lib')
);
}
this.fs.copyTpl(
this.templatePath('.bowerrc'),
this.destinationPath('.bowerrc')
);
this.fs.copyTpl(
this.templatePath('bower.json'),
this.destinationPath('bower.json'), {
appName: this.options.appName
}
this.templatePath(version + '/settings'),
this.destinationPath('./')
);
this.fs.copyTpl(
this.templatePath('package.json'),
this.templatePath(version + '/package.json'),
this.destinationPath('package.json'), {
appName: this.options.appName,
description: this.options.description,
Expand All @@ -84,7 +95,7 @@ module.exports = class extends Generator {
npm: {
'no-optional': true
},
bower: this.options.bowerinstall,
bower: this.options.bowerInstall,
yarn: false
});
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,8 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>oeCloud app</title>
<script>
function loginAndBrowse() {
var loginFailedDivId = document.getElementById('login-failed-div');
loginFailedDivId.style.display = "none";
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", function (event) {
var response = (event.target.response);
response = JSON.parse(response);
if (response && response.access_token) {
localStorage.swagger_accessToken = response.access_token;
window.location.href = "/explorer";
} else {
loginFailedDivId.style.display = "block";
}
});
oReq.open("POST", "/auth/local");
oReq.setRequestHeader("Content-type", "application/json");
var payload = {
"username": "admin",
"password": "admin"
};
oReq.send(JSON.stringify(payload));
}
</script>
<link rel="icon" href="favicon.ico">
<style>
@font-face {
font-family: 'Rubik-Regular';
src: url('./fonts/Rubik-Regular.ttf');
}

@font-face {
font-family: 'Rubik-Bold';
src: url('./fonts/Rubik-Bold.ttf');
}

@font-face {
font-family: 'Rubik-Light';
src: url('./fonts/Rubik-Light.ttf');
}

@font-face {
font-family: 'Rubik-Medium';
src: url('./fonts/Rubik-Medium.ttf');
}

body {
margin: 0;
font-family: sans-serif;
Expand Down Expand Up @@ -83,7 +39,6 @@
}

a {
font-family: rubik-medium;
font-size: 14px;
text-decoration: none;
color: #1724BA;
Expand Down Expand Up @@ -115,14 +70,12 @@
.main-text {
font-size: 36px;
line-height: 1.2;
font-family: 'Rubik-Light';
}

.sub-text {
margin-bottom: 24px;
font-size: 16px;
line-height: 24px;
font-family: Rubik-Regular
}

.container {
Expand All @@ -133,7 +86,6 @@

.features-heading {
font-size: 24px!important;
font-family: Rubik-Light;
}

.feature {
Expand All @@ -150,13 +102,11 @@

.feature-content {
font-size: 16px!important;
font-family: Rubik-Regular;
}

.coming-soon {
font-size: 14px!important;
color: #666;
font-family: Rubik-Light
}

.code-style {
Expand All @@ -177,36 +127,6 @@
</div>
</div>

</section>
<section class="small">
<div class="main-text">
<div>Login as admin and continue to oecloud.io API Explorer</div>
<div class="sub-text">
<br>
<button onclick="loginAndBrowse()">Browse APIs as Admin</button>
</div>
<div id="login-failed-div" class="sub-text" style="display: none">
<p>Seems default admin user is not created, Follow below Steps
<ul>
<li>Stop Server</li>
<li>set CREATE_ADMIN environment variable to true
<br>
<code class="code-style">
$ export CREATE_ADMIN=true
</code>
</li>
<li>Start Server
<br>
<code class="code-style">
$ node .
</code>
</li>
</ul>
</p>

</div>
</div>

</section>
<section class="small">
<div class="container">
Expand Down
File renamed without changes
19 changes: 19 additions & 0 deletions app/templates/1.0/common/models/SampleModel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "SampleModel",
"base": "BaseEntity",
"idInjection": true,
"properties": {
"name": {
"type": "string",
"unique" : true
},
"age": {
"type": "number"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "<%=appName%>",
"name": "App",
"private": true,
"dependencies": {
"polymer": "^1.9.1",
Expand Down
27 changes: 27 additions & 0 deletions app/templates/2.0/common/mixins/skeleton-mixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const utils = require('../../lib/utils.js');
const log = require('oe-logger')('Skeleton-Mixin');

// var ModelDefinition;
log.info('Skeleton Mixin Loaded.');

module.exports = Model => {
// ModelDefinition = Model;
if ((Model.settings.overridingMixins && !Model.settings.overridingMixins.SkeletonMixin) || !Model.definition.settings.mixins.SkeletonMixin) {
Model.evRemoveObserver('access', beforeAccess);
} else {
Model.evObserve('access', beforeAccess);
}
};

function beforeAccess(ctx, next) {
const modelSettings = ctx.Model.definition.settings;
if (modelSettings.mixins.SkeletonMixin === false) {
return next();
}
var x = utils.addNumbers(3, 4);
if ( x !== 7 ) {
return next(new Error('Addition not good'));
}
return next();
}

19 changes: 19 additions & 0 deletions app/templates/2.0/common/models/Skeleton.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Skeleton",
"base": "BaseEntity",
"idInjection": true,
"properties": {
"name": {
"type": "string",
"unique" : true
},
"age": {
"type": "number"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}

11 changes: 11 additions & 0 deletions app/templates/2.0/lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
*
* ©2018-2019 EdgeVerve Systems Limited (a fully owned Infosys subsidiary),
* Bangalore, India. All Rights Reserved.
*
*/

function _addNumbers(a, b) {
return (a + b);
}
module.exports.addNumbers = _addNumbers;
4 changes: 4 additions & 0 deletions app/templates/2.0/lib/wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const log = require('oe-logger')('oe-skeleton');
module.exports = function (app) {
log.info('oe-skeleton is loaded : ');
};
52 changes: 52 additions & 0 deletions app/templates/2.0/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "<%=appName%>",
"version": "<%=version%>",
"description": "<%=description%>",
"author":"<%=author%>",
"engines": {
"node": ">=6"
},
"main": "index.js",
"scripts": {
"pretest": "npm install --no-optional",
"test": "mocha test/test.js",
"lint": "eslint .",
"fix-lint": "eslint --fix .",
"grunt-cover": "grunt test-with-coverage"
},
"dependencies": {
"async": "^2.5.0",
"oe-logger": "^1.0.0",
"camelcase": "^3.0.0",
"lodash": "4.17.10",
"loopback-connector-mongodb": "^3.9.2",
"oe-cloud": "git+http://evgit/oecloud.io/oe-cloud.git#master"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"chai": "^3.4.1",
"chai-datetime": "^1.4.0",
"chai-things": "^0.2.0",
"chalk": "^1.1.1",
"eslint": "^4.10.0",
"grunt": "^0.4.5",
"grunt-banner": "^0.6.0",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^0.7.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-jsbeautifier": "^0.2.12",
"grunt-mkdir": "^1.0.0",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-mocha-test": "^0.13.2",
"istanbul": "0.4.1",
"mocha": "^3.4.2",
"superagent-defaults": "^0.1.14",
"supertest": "^1.1.0",
"loopback-connector-postgresql": "git+http://evgit/oecloud.io/loopback-connector-postgresql.git#master"
},
"repository": {
"type": "git",
"url": "git@evgit:oecloud.io/oe-skeleton.git"
},
"license": "MIT"
}
Loading

0 comments on commit f7a4653

Please sign in to comment.