Commit 37a4ecfc authored by abirembaut's avatar abirembaut Committed by GitHub

fix (task list) make tasklist available as custom page in community ed

- add task list custom page to community edition
- add webdriver-manager update pree2e

Covers [BPO-6](https://bonitasoft.atlassian.net/browse/BPO-6)
parent 2c62dd12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.bonitasoft.web.pages</groupId>
<artifactId>custom-pages</artifactId>
<version>7.10.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>user-tasks-list</module>
</modules>
<dependencies>
<dependency>
<groupId>org.bonitasoft.web</groupId>
<artifactId>bonita-portal-js</artifactId>
<version>${project.version}</version>
<classifier>app</classifier>
<type>zip</type>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<nodeVersion>v6.9.4</nodeVersion>
<npmVersion>2.15.1</npmVersion>
<installDirectory>${session.executionRootDirectory}</installDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
# Build explanations
This project is built from bonita-portal-js sources. At the end of the build you will get a .zip file in the target file
The build process starts by several maven tasks. First, the maven build process install node.js, npm and nodes_modules.
In a second time the build continues with gulp tasks. In this phase, the build will execute the following tasks:
- delete the directory named dist
- copy files which are in the src directory to the dist directory
- install portal js bower dependencies
- compile templates html files of the task list directory into a templates.js file
- compile less files used in the task list to task-list.css
- inject needed css and js into index.html
- inject task list html code in destination index.html
After of gulp tasks, a maven assembly will package the task list in a .zip file named bonita-task-list-page-[VERSION].zip
<assembly>
<id>page-package</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/dist</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
'use strict';
var gulp = require('gulp');
var bower = require('gulp-bower');
var inject = require('gulp-inject');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var less = require('gulp-less');
var replace = require('gulp-replace');
var stripCssComments = require('gulp-strip-css-comments');
var LessPluginCSScomb = require('less-plugin-csscomb');
var html2js = require('gulp-ng-html2js');
var paths = require('./conf').paths;
/**
* Main build task
*/
gulp.task('build', ['bower', 'copy', 'compile', 'inject']);
/**
* Fetch bower dependencies from portal js
*/
gulp.task('bower', () => bower({cwd: paths.community}));
/**
* Copy sources files
*/
gulp.task('copy', ['copy:src', 'copy:font', 'copy:css', 'copy:vendors', 'copy:js']);
gulp.task('copy:src', () => {
return gulp.src(paths.src + '/**/*.*')
.pipe(gulp.dest(paths.dist));
});
gulp.task('copy:font', ['bower'], () => {
return gulp.src(paths.fonts)
.pipe(gulp.dest(paths.dest.fonts));
});
gulp.task('copy:css', ['bower'], () => {
return gulp.src(paths.css)
.pipe(gulp.dest(paths.dest.css));
});
gulp.task('copy:vendors', ['bower'], () => {
return gulp.src(paths.vendors)
.pipe(gulp.dest(paths.dest.vendors));
});
gulp.task('copy:js', () => {
return gulp.src(paths.js, { base: `${paths.community}/main` })
.pipe(gulp.dest(paths.dest.js));
});
/**
* Compile what needs to be compiled
*/
gulp.task('compile', ['compile:less', 'compile:templates']);
gulp.task('replace:less', ['bower'], () => {
return gulp.src(paths.less)
.pipe(replace('@{skinFontPath}', '../fonts/'))
.pipe(gulp.dest(paths.dest.less));
});
gulp.task('compile:less', ['bower', 'replace:less'], () => {
return gulp.src(`${paths.dest.less}/main.less`)
.pipe(stripCssComments({all: true}))
.pipe(less({plugins: [new LessPluginCSScomb('zen')]}))
.pipe(rename('task-list.css'))
.pipe(gulp.dest(paths.dest.css));
});
gulp.task('compile:templates', ['bower'], () => {
return gulp.src(paths.html)
.pipe(html2js({
moduleName: 'org.bonitasoft.portalTemplates',
prefix: 'portalTemplates/user/tasks/'
}))
.pipe(concat('templates.js'))
.pipe(gulp.dest(paths.dest.js));
});
/**
* Inject js and css files in index.html
*/
gulp.task('inject', ['copy:js', 'copy:vendors', 'compile:templates', 'compile:less', 'copy:css'], () => {
return gulp.src(`${paths.dest.resources}/index.html`)
.pipe(inject(gulp.src([
`${paths.dest.vendors}/angular.min.js`,
`${paths.dest.vendors}/*.js`,
`${paths.dest.js }/**/*.module.js`,
`${paths.dest.js }/**/*.js`,
`${paths.dest.css}/*.css`
], {read: false}), {
ignorePath: paths.dest.resources,
relative: true
}))
.pipe(gulp.dest(paths.dest.resources));
});
var community = '../..';
var bowerComponents = `${community}/main/assets`;
var dist = 'dist';
var temp = '.tmp';
var resources = `${dist}/resources`;
module.exports = {
paths: {
src: 'src',
dist: dist,
community: community,
vendors: [
'angular/angular.min.js',
'angular-animate/angular-animate.min.js',
'angular-bootstrap/ui-bootstrap-tpls.min.js',
'angular-cookies/angular-cookies.min.js',
'ngstorage/ngStorage.min.js',
'angular-resource/angular-resource.min.js',
'angular-sanitize/angular-sanitize.min.js',
'angular-gettext/dist/angular-gettext.min.js',
'angular-touch/angular-touch.min.js',
'angular-ui-router/release/angular-ui-router.min.js',
'ng-sortable/dist/ng-sortable.min.js',
'bonita-js-components/dist/bonita-lib-tpl.min.js',
'ngtoast/dist/ngToast.min.js',
'angular-growl-2/build/angular-growl.min.js',
'keymaster/keymaster.js',
'moment/min/moment-with-locales.js'
].map((path) => `${bowerComponents}/${path}`),
js: [
`${community}/main/*.config.js`,
`${community}/main/common/resources/*.js`,
`${community}/main/common/moment/*.js`,
`${community}/main/common/i18n/*.js`,
`${community}/main/features/user/tasks/**/*.js`,
`!${community}/main/features/user/tasks/**/*.routes.js`
],
css: [
'bootstrap/dist/css/bootstrap.min.css',
'bonita-js-components/dist/bonita-lib.min.css',
'ngtoast/dist/ngToast.min.css',
'ng-sortable/dist/ng-sortable.min.css'
].map((path) => `${bowerComponents}/${path}`),
less: [
`${community}/main/styles/tasks/*`
],
fonts: [
`${bowerComponents}/bootstrap/fonts/*`,
`${community}/main/styles/fonts/*`,
`!${community}/main/styles/fonts/src`
],
html: [
`${community}/main/features/user/tasks/**/*.html`
],
dest: {
resources: resources,
less: `${temp}/less`,
fonts: `${resources}/fonts`,
vendors: `${resources}/js/vendor`,
js: `${resources}/js/app`,
css: `${resources}/css`
}
},
protractor: {
port: process.env.PROTRACTOR_PORT || 9002
}
};
'use strict';
var gulp = require('gulp');
var protractor = require('gulp-protractor');
var connect = require('connect');
var http = require('http');
var serveStatic = require('serve-static');
var config = require('./conf');
var mockMiddleware = require('../../../test/dev/server-mock.js');
function serveE2e() {
var app = connect();
app.use(serveStatic('dist/resources', {
index: 'index.html'
}));
app.use(mockMiddleware);
var server = http.createServer(app);
server.listen(config.protractor.port);
console.log('Server started http://localhost:' + config.protractor.port);
return server;
}
function runProtractor (done) {
var server = serveE2e();
gulp.src([config.paths.community + '/test/e2e/features/user/tasks/*.js'])
.pipe(protractor.protractor({
configFile: config.paths.community + '/test/protractor.conf.js',
args: [
'--baseUrl', 'http://127.0.0.1:' + config.protractor.port,
'--params.urls.userTaskList=/#'
]
}))
.on('error', (err) => {throw err;})
.on('end', () => {
server.close();
done();
});
}
gulp.task('e2e', ['build'], runProtractor);
/* jshint node:true */
'use strict';
var gulp = require('gulp');
var rimraf = require('rimraf');
var wrench = require('wrench');
var config = require('./gulp/conf');
/**
* This will load all js files in the gulp directory
* in order to load all gulp tasks
*/
wrench.readdirSyncRecursive('./gulp').filter((file) => {
return (/\.(js)$/i).test(file);
}).map((file) => {
require('./gulp/' + file);
});
gulp.task('clean', function(cb) {
rimraf(config.paths.dist, cb);
});
gulp.task('default', ['clean'], () => {
gulp.start('build');
});
{
"name": "user-task-list-custom-page",
"engines": {
"node": ">=4.2.0"
},
"devDependencies": {
"connect": "3.4.1",
"cross-env": "^5.1.4",
"gulp": "3.9.0",
"gulp-bower": "0.0.11",
"gulp-concat": "2.4.1",
"gulp-inject": "3.0.0",
"gulp-less": "3.0.5",
"gulp-ng-html2js": "0.1.8",
"gulp-protractor": "4.1.0",
"gulp-rename": "1.2.2",
"gulp-replace": "0.5.0",
"gulp-strip-css-comments": "1.2.0",
"less-plugin-csscomb": "0.0.2",
"rimraf": "2.5.2",
"serve-static": "1.10.2",
"wrench": "1.5.8",
"webdriver-manager": "12.0.6"
},
"scripts": {
"build": "gulp",
"pree2e": "webdriver-manager update --versions.standalone=3.11.0 --versions.chrome=2.38",
"e2e": "gulp e2e",
"e2e:headless": "cross-env HEADLESS=true npm run e2e"
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.bonitasoft.web.pages</groupId>
<artifactId>custom-pages</artifactId>
<version>7.10.0-SNAPSHOT</version>
</parent>
<artifactId>user-tasks-list</artifactId>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>npm build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>page-content</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<inherited>false</inherited>
<configuration>
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>e2e</id>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>npm e2e</id>
<goals>
<goal>npm</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<arguments>run e2e:headless</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
# Developper Documentation
#Task list
The tasklist app (taskApp) is composed of 3 main pieces
- the task filters (directive)
- the task lists (directive)
- the task details (directive)
These 3 directives are gathered in the taskApp directive.
# App layout
The app allows user to switch between 2 layout. Each layout have is own set of default visible columns (task list properties).
- the full list layout open task context or forms within a popup
- the list + context layout, allow to see both the task list and its context, side by side.
There is also a third mobile view, dédicated to mobile, which display the task filter, tasklist and the task context in stacked way.
This layout are managed by the taskApp directive.
## TaskApp directive
The taskApp directive gather several logic pieces,
- A store (resources/js/tasks/list/common/store.js) which maintains the app state and performs requests on the API.
- A preference (resources/js/tasks/list/common/js/common/preference.js), which handle the user preference handle data persistence inside a cookie (the visible columns, the current tab )
- A screen service, which monitors screen width and updates columns settings in tasklist
- A postMessage spy(resources/js/tasks/list/common/directive/bonita-form-spy.js) to handle communication from bonita forms.
The taskApp is reponsible of injecting data and handler to the taskfilters, taskList and taskDetails directives.
## TaskFilters directive (resources/js/tasks/list/task-filters.js)
The taskfilters directive is a small component that display which kind of tasks are displayed (all, my tasks, unassigned taks or done task).
## TaskList directive (resources/js/tasks/list/taskList.js)
The tasklist component displays the list of tasks. TaskList rely on an external lib (src/js/common/keymaster.js) to allow multiple selection against checkbox.
## TaskDetails directive (resources/js/tasks/list/taskDetails.js)
The taskDetail directive display the task context and its associated form.
- The case's data for the selected task
- The case overview (iframe)
- The case history (data gathered from Comment API and archivedDataFlow API)
The current tab is persisted to the preference.
The form's tab display the task form (from bonita portal).
Iframes are displayed using a directive (resources/js/tasks/list/common/directive/bonita-iframe-viewer.js) which resizes automatically according the iframe content.
#The name must start with 'custompage_'
name=custompage_tasklist
displayName=Task List
description=Default user task list made available as a Resource, so you can customize it
resources=[GET|system/session,GET|system/i18ntranslation,GET|bpm/humanTask,GET|bpm/archivedHumanTask,PUT|bpm/humanTask,GET|bpm/process,GET|bpm/case,GET|bpm/archivedCase,GET|form/mapping,GET|bpm/comment,GET|bpm/archivedComment,POST|bpm/comment,GET|API/avatars]
version=1.1.0
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>task list page</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- inject:css -->
<!-- endinject -->
<link rel="stylesheet" href="../theme/theme.css">
</head>
<body ng-app="org.bonitasoft.portal">
<ui-view></ui-view>
<!-- inject:js -->
<!-- endinject -->
</body>
</html>
(function() {
'use strict';
angular.module('org.bonitasoft.portal', [
'org.bonitasoft.features.user.tasks',
'angular-growl'
]);
})();
(function() {
'use strict';
angular
.module('org.bonitasoft.portal')
.config(routes);
function routes($urlRouterProvider) {
// redirect to bonita.userTasks when context is /
$urlRouterProvider.when('', function($state) {
$state.go('bonita.userTasks')
})
}
})();
......@@ -7,6 +7,10 @@
<version>7.10.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>custom-pages</module>
</modules>
<build>
<pluginManagement>
<plugins>
......
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