Fixed UI tests
diff --git a/views/ngXosViews/sampleView/bower.json b/views/ngXosViews/sampleView/bower.json
index bb1b04d..a940676 100644
--- a/views/ngXosViews/sampleView/bower.json
+++ b/views/ngXosViews/sampleView/bower.json
@@ -20,9 +20,9 @@
"jquery": "2.1.4",
"angular-mocks": "1.4.7",
"angular": "1.4.7",
- "angular-animate": "1.4.7",
"angular-ui-router": "0.2.15",
"angular-cookies": "1.4.7",
+ "angular-animate": "1.4.7",
"angular-resource": "1.4.7",
"lodash": "~4.11.1",
"bootstrap-css": "3.3.6"
diff --git a/views/ngXosViews/sampleView/env/default.js b/views/ngXosViews/sampleView/env/default.js
index aa5ad1e..6343727 100644
--- a/views/ngXosViews/sampleView/env/default.js
+++ b/views/ngXosViews/sampleView/env/default.js
@@ -8,6 +8,6 @@
module.exports = {
host: 'http://xos.dev:9999/',
- xoscsrftoken: '7LIg5beILzsfLGW0AiZwHnhnNiNmv4Ll',
- xossessionid: '3zxm9cmkrxqlmpch5t4clrmvs2rxo7ng'
+ xoscsrftoken: '6OdNq1P7Aydyut3KjWBZoXLPJhb4DcuQ',
+ xossessionid: 'fpyv5s71bj779wmguxtg8wori16kiyrz'
};
diff --git a/views/ngXosViews/sampleView/gulp/server.js b/views/ngXosViews/sampleView/gulp/server.js
index bc8e9c0..c0678d9 100644
--- a/views/ngXosViews/sampleView/gulp/server.js
+++ b/views/ngXosViews/sampleView/gulp/server.js
@@ -3,7 +3,6 @@
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var inject = require('gulp-inject');
-var es = require('event-stream');
var runSequence = require('run-sequence');
var angularFilesort = require('gulp-angular-filesort');
var babel = require('gulp-babel');
@@ -11,7 +10,6 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
-var debug = require('gulp-debug');
const environment = process.env.NODE_ENV;
@@ -36,13 +34,9 @@
});
module.exports = function(options){
- // open in browser with sync and proxy to 0.0.0.0
+
gulp.task('browser', function() {
- console.log(options.helpers);
browserSync.init({
- // reloadDelay: 500,
- // logLevel: 'debug',
- // logConnections: true,
startPath: '#/',
snippetOptions: {
rule: {
@@ -52,12 +46,12 @@
server: {
baseDir: options.src,
routes: {
- // '/xosHelpers/src': options.helpers,
'/xos/core/xoslib/static/js/vendor': options.helpers,
'/xos/core/static': options.static + '../../static/'
},
middleware: function(req, res, next){
if(
+ // to be removed, deprecated API
// req.url.indexOf('/xos/') !== -1 ||
// req.url.indexOf('/xoslib/') !== -1 ||
// req.url.indexOf('/hpcapi/') !== -1 ||
@@ -86,6 +80,9 @@
gulp.watch(options.css + '**/*.css', function(){
browserSync.reload();
});
+ gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
+ browserSync.reload();
+ });
gulp.watch([
options.helpers + 'ngXosHelpers.js',
@@ -93,10 +90,6 @@
], function(){
browserSync.reload();
});
-
- gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
- browserSync.reload();
- });
});
// compile sass
@@ -113,40 +106,16 @@
.pipe(gulp.dest(options.tmp));
});
- // // inject sourceMap
- // gulp.task('injectMaps', function(){
- // return gulp.src(options.src + 'index.html')
- // .pipe(
- // inject(
- // gulp.src([
- // options.helpersSourceMaps + '**/*.js.map'
- // ], {read: false}).pipe(debug()),
- // {
- // starttag: '<!-- inject:maps -->',
- // // ignorePath: [options.src, '/../../ngXosLib']
- // }
- // )
- // )
- // .pipe(gulp.dest(options.src));
- // });
-
// inject scripts
gulp.task('injectScript', ['cleanTmp', 'babel'], function(){
-
- var appScripts = gulp.src([
- options.tmp + '**/*.js',
- options.helpers + 'ngXosHelpers.js'
- ])
- .pipe(angularFilesort()).pipe(debug());
-
- var helpersSourceMaps = gulp.src([
- options.helpersSourceMaps + '**/*.js.map'
- ]).pipe(debug());
-
return gulp.src(options.src + 'index.html')
.pipe(
inject(
- es.merge(appScripts, helpersSourceMaps),
+ gulp.src([
+ options.tmp + '**/*.js',
+ options.helpers + 'ngXosHelpers.js'
+ ])
+ .pipe(angularFilesort()),
{
ignorePath: [options.src, '/../../ngXosLib']
}
diff --git a/views/ngXosViews/sampleView/gulpfile.js b/views/ngXosViews/sampleView/gulpfile.js
index 8b50345..08df554 100644
--- a/views/ngXosViews/sampleView/gulpfile.js
+++ b/views/ngXosViews/sampleView/gulpfile.js
@@ -12,7 +12,6 @@
dist: 'dist/',
api: '../../ngXosLib/api/',
helpers: '../../../xos/core/xoslib/static/js/vendor/',
- helpersSourceMaps: '../../ngXosLib/xosHelpers/.tmp/maps/',
static: '../../../xos/core/xoslib/static/', // this is the django static folder
dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
};
diff --git a/views/ngXosViews/sampleView/package.json b/views/ngXosViews/sampleView/package.json
index e92f937..0ffe32c 100644
--- a/views/ngXosViews/sampleView/package.json
+++ b/views/ngXosViews/sampleView/package.json
@@ -28,14 +28,12 @@
"easy-mocker": "^1.2.0",
"eslint": "^1.8.0",
"eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
- "event-stream": "^3.3.2",
"gulp": "^3.9.0",
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-templatecache": "^1.8.0",
"gulp-babel": "^5.3.0",
"gulp-concat": "^2.6.0",
"gulp-concat-util": "^0.5.5",
- "gulp-debug": "^2.1.2",
"gulp-eslint": "^1.0.0",
"gulp-inject": "^3.0.0",
"gulp-minify-html": "^1.0.4",
diff --git a/views/ngXosViews/sampleView/spec/sample.test.js b/views/ngXosViews/sampleView/spec/sample.test.js
index 6005af7..f0db699 100644
--- a/views/ngXosViews/sampleView/spec/sample.test.js
+++ b/views/ngXosViews/sampleView/spec/sample.test.js
@@ -15,7 +15,7 @@
{
email: 'teo@onlab.us',
firstname: 'Matteo',
- lastname: 'Scandolo'
+ lastname: 'Scandolo'
}
]);
diff --git a/views/ngXosViews/sampleView/src/css/main.css b/views/ngXosViews/sampleView/src/css/main.css
index 6120f18..e69de29 100644
--- a/views/ngXosViews/sampleView/src/css/main.css
+++ b/views/ngXosViews/sampleView/src/css/main.css
@@ -1,2 +0,0 @@
-#xosSampleView {
- max-width: 100%; }
diff --git a/views/ngXosViews/sampleView/src/index.html b/views/ngXosViews/sampleView/src/index.html
index 593e982..d9905a4 100644
--- a/views/ngXosViews/sampleView/src/index.html
+++ b/views/ngXosViews/sampleView/src/index.html
@@ -1,31 +1,105 @@
<!-- browserSync -->
<!-- bower:css -->
<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.min.css" />
-<!-- endbower --><!-- endcss -->
+<!-- endbower -->
+<!-- endcss -->
<!-- inject:css -->
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/../../../xos/core/static/xosNgLib.css">
<!-- endinject -->
-<div ng-cloak ng-app="xos.sampleView" id="xosSampleView" class="container-fluid">
- <div ui-view></div>
+<div ng-app="xos.sampleView" id="xosSampleView" class="container-fluid">
+ <div class="row">
+ <div class="col-xs-12">
+ <h1>Hi Matteo!</h1>
+ <h3>Welcome to you development environment.</h3>
+ <p>
+ We provided this environment to help you creating a custom view.
+ </p>
+ <p>
+ When the environment is running you will have an
+ <code>auto-reload</code>
+ feature enabled, so any time you update one of your files, the browser will be reloaded.
+ </p>
+ <p> <i>Note that is environment is already functional and that it is loading information from the XOS APIs and presenting them using the
+ <code>xos-table</code>
+ component.</i>
+ </p>
+ <h3>Development notes:</h3>
+ <p>
+ This views are designed using
+ <a href="https://angularjs.org/" target="_blank">Angular Js</a>
+ version 1.4.7 and
+ <a href="http://getbootstrap.com/" target="_blank">Bootstrap</a>
+ 3.3.6 is included.
+ </p>
+ <p>
+ We just want to remind you that this development environment provide you three helper command:
+ <ul>
+ <li>
+ <code>npm start</code>
+ - will start your setup (you should already be familiar with it)
+ </li>
+ <li>
+ <code>npm test</code>
+ - will execute your unit tests defined with
+ <a href="https://karma-runner.github.io/0.13/index.html" target="_blank">Karma</a>
+ and
+ <a href="jasmine.github.io" target="_blank">Jasmine</a>
+ . You can check the
+ <code>spec/</code>
+ folder to see an example of your first test.
+ </li>
+ <li>
+ <code>npm run build</code>
+ - will build your dashboard and make it available to XOS
+ </li>
+ </ul>
+ </p>
+ <h3>Helpers:</h3>
+ <p>
+ We provide a set of helpers that you can leverage in your dashboard:
+ <ul>
+ <li>
+ <code>xos.helpers</code>
+ - A set of
+ <a href="https://docs.angularjs.org/guide/services" target="_blank">Angular Services</a>
+ </li>
+ <li>
+ <code>xos.uiComponents</code>
+ - A set of
+ <a href="https://docs.angularjs.org/guide/directive" target="_blank">Angular Directives</a>
+ </li>
+ <li>
+ <code>xos.rest</code>
+ - A set of
+ <a href="https://docs.angularjs.org/api/ngResource/service/$resource" target="_blank">Angular $resources</a>
+ </li>
+ </ul>
+ To know more about this helpers you can naviate to
+ <code>/views/ngXosLib/</code>
+ and generate the documentation with
+ <code>npm run doc</code>
+ </p>
+ <h3>Example:</h3>
+ </div>
+ </div>
+ <div ui-view></div>
</div>
<!-- bower:js -->
<script src="vendor/jquery/dist/jquery.js"></script>
<script src="vendor/angular/angular.js"></script>
<script src="vendor/angular-mocks/angular-mocks.js"></script>
-<script src="vendor/angular-animate/angular-animate.js"></script>
<script src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
<script src="vendor/angular-cookies/angular-cookies.js"></script>
+<script src="vendor/angular-animate/angular-animate.js"></script>
<script src="vendor/angular-resource/angular-resource.js"></script>
<script src="vendor/lodash/lodash.js"></script>
<script src="vendor/bootstrap-css/js/bootstrap.min.js"></script>
-<!-- endbower --><!-- endjs -->
+<!-- endbower -->
+<!-- endjs -->
<!-- inject:js -->
<script src="/../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js"></script>
<script src="/.tmp/main.js"></script>
-<!-- endinject -->
-
-<!-- inject:map -->
<!-- endinject -->
\ No newline at end of file
diff --git a/views/ngXosViews/sampleView/src/js/main.js b/views/ngXosViews/sampleView/src/js/main.js
index 3dc24a6..b22e0ab 100644
--- a/views/ngXosViews/sampleView/src/js/main.js
+++ b/views/ngXosViews/sampleView/src/js/main.js
@@ -23,115 +23,16 @@
bindToController: true,
controllerAs: 'vm',
templateUrl: 'templates/users-list.tpl.html',
- controller: function(Users, _){
+ controller: function(Users){
this.tableConfig = {
- columns: [
- {
- label: 'E-Mail',
- prop: 'email'
- },
- {
- label: 'First Name',
- prop: 'firstname'
- },
- {
- label: 'Last Name',
- prop: 'lastname'
- },
- {
- label: 'Created',
- prop: 'created'
- },
- {
- label: 'is_admin',
- prop: 'is_admin'
- }
- ],
- classes: 'table table-striped table-condensed',
- actions: [
- {
- label: 'delete',
- icon: 'remove',
- cb: (user) => {
- console.log(user);
- // _.remove(this.users, {id: user.id});
- },
- color: 'red'
- }
- ],
- filter: 'field',
- order: true,
- pagination: {
- pageSize: 10
- }
+ resource: 'Users'
};
-
- this.smartTableConfig = {
- resource: 'Users',
- hiddenFields: [
- 'email',
- 'username',
- // 'created',
- 'updated',
- 'last_login',
- 'is_active',
- 'is_admin',
- 'is_staff',
- 'is_readonly',
- 'is_registering',
- 'is_appuser',
- 'timezone'
- ]
- }
-
- this.alertConfig = {
- type: 'danger',
- closeBtn: true
- }
-
- this.formConfig = {
- exclude: ['password'],
- formName: 'myForm',
- fields: {
- firstname: {
- validators: {
- minlength: 10
- }
- },
- lastname: {
- validators: {
- maxlength: 3
- }
- },
- user_url: {
- validators: {
- required: true
- }
- }
- },
- actions: [
- {
- label: 'Save',
- icon: 'ok', // refers to bootstraps glyphicon
- cb: (user) => { // receive the model
- console.log(user);
- },
- class: 'success'
- }
- ]
- };
-
- this.errors = {
- email: false
- }
-
- console.log('aaa')
-
+
// retrieving user list
Users.query().$promise
.then((users) => {
- this.users = users.concat(users).concat(users).concat(users);
+ this.users = users;
})
.catch((e) => {
throw new Error(e);
diff --git a/views/ngXosViews/sampleView/src/sass/main.scss b/views/ngXosViews/sampleView/src/sass/main.scss
index ce33ceb..76ed61e 100644
--- a/views/ngXosViews/sampleView/src/sass/main.scss
+++ b/views/ngXosViews/sampleView/src/sass/main.scss
@@ -1,5 +1,5 @@
@import '../../../../style/sass/lib/_variables.scss';
#xosSampleView {
- max-width: 100%;
+
}
\ No newline at end of file
diff --git a/views/ngXosViews/sampleView/src/templates/users-list.tpl.html b/views/ngXosViews/sampleView/src/templates/users-list.tpl.html
index 4c2554c..0641dd9 100644
--- a/views/ngXosViews/sampleView/src/templates/users-list.tpl.html
+++ b/views/ngXosViews/sampleView/src/templates/users-list.tpl.html
@@ -1,24 +1 @@
-<div class="row">
- <div class="col-xs-12">
- <h1>Users List</h1>
- <p>This is only an example view.</p>
- </div>
-</div>
-
-<div class="row">
- <div class="col-xs-12">
- <!-- <xos-form ng-model="vm.users[0]" config="vm.formConfig"></xos-form> -->
- <!-- <xos-alert config="vm.alertConfig">Random alert</xos-alert>
- <a class="btn" ng-click="vm.errors.email = !vm.errors.email" ng-class="{'btn-default': !vm.errors.email, 'btn-success': vm.errors.email}">
- Email
- </a> -->
- <!-- <xos-validation errors="vm.errors"></xos-validation> -->
- </div>
-</div>
-
-<div class="row">
- <div class="col-xs-12">
- <!-- <xos-table config="vm.tableConfig" data="vm.users"></xos-table> -->
- <xos-smart-table config="vm.smartTableConfig"></xos-smart-table>
- </div>
-</div>
\ No newline at end of file
+<xos-smart-table config="vm.tableConfig"></xos-smart-table>
\ No newline at end of file