Skip to content

Commit

Permalink
Merge pull request #8 from JBartscher/feature/restructure_headings
Browse files Browse the repository at this point in the history
Feature/restructure headings
  • Loading branch information
Joshua Sprey authored May 17, 2021
2 parents ee452f9 + 2ee54ab commit 5297023
Show file tree
Hide file tree
Showing 9 changed files with 22,843 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Each goal can be used as parameter for the gulp command.

* *clean*: removes the dist folder
* *lint*: checks css and javascript files for common errors
* *serve*: starts an webserver to test the widget
* *serve*: starts an webserver to test the widgets in local development. To provide the widgets with test data, "https://builds.apache.org/" is stored as the URL in `jenkins.js` by default. For local development, a [CORS plugin](https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf) must be used in the browser.

## Usage

Expand Down
18 changes: 9 additions & 9 deletions dist/adf-widget-jenkins.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
(function(window, undefined) {'use strict';


var jenkinsWidget = angular.module('adf.widget.jenkins', ['adf.provider', 'chart.js', 'ui.bootstrap'])
.constant("jenkinsEndpoint", {
"url": "http://builds.apache.org"
})
.config(registerWidget);

function registerWidget(dashboardProvider) {
var category = 'Jenkins';
const category = 'Jenkins';

dashboardProvider
.widget('jenkinsBuildReport', {
Expand Down Expand Up @@ -59,10 +53,16 @@ function registerWidget(dashboardProvider) {
}
registerWidget.$inject = ["dashboardProvider"];

const jenkinsWidget = angular.module('adf.widget.jenkins', ['adf.provider', 'chart.js', 'ui.bootstrap'])
.constant("jenkinsEndpoint", {
"url": "https://builds.apache.org/"
})
.config(registerWidget);

angular.module("adf.widget.jenkins").run(["$templateCache", function($templateCache) {$templateCache.put("{widgetsPath}/jenkins/src/edit.html","<form role=form><div class=form-group><label ng-if=!vm.url>Connection Setup</label><p ng-if=!vm.url><input class=form-control id=apiUrl ng-model=config.apiUrl placeholder=\"Enter Api-Url\" type=text ng-change=vm.updateProjectList(config.apiUrl)></p><label>Project</label> <input type=text ng-model=config.project uib-typeahead=\"project.name for project in vm.projects | filter:$viewValue | limitTo:10\" class=form-control></div></form>");
$templateCache.put("{widgetsPath}/jenkins/src/view.html","<style type=text/css>\n .statusImg {\n max-width: 100px;\n }\n .break-word {\n word-wrap: break-word\n }\n</style><div><div class=content><div class=\"alert alert-info\" ng-if=!vm.data>Please configure a project</div><div ng-if=vm.data><div class=\"col-md-7 col-xs-7\"><a href={{vm.data.url}} target=_blank class=break-word><h4>{{vm.data.projectFullName}}</h4></a><p><b>Last Commit:</b> {{vm.data.lastCommitMsg}}</p><p><b>Author:</b> {{vm.data.lastCommitBy}}</p></div><div ng-if=vm.data.imgSource class=\"col-md-5 col-xs-5 pull-right\"><img ng-src={{vm.data.imgSource}} class=\"statusImg pull-right\"></div></div></div></div>");
$templateCache.put("{widgetsPath}/jenkins/src/view.html","<style type=text/css>\n .statusImg {\n max-width: 100px;\n }\n .break-word {\n word-wrap: break-word\n }\n a > h3 {\n font-size: 18px;\n margin-top: 10px;\n margin-bottom: 10px;\n ;\n }\n</style><div><div class=content><div class=\"alert alert-info\" ng-if=!vm.data>Please configure a project</div><div ng-if=vm.data><div class=\"col-md-7 col-xs-7\"><a href={{vm.data.url}} target=_blank class=break-word><h3>{{vm.data.projectFullName}}</h3></a><p><b>Last Commit:</b> {{vm.data.lastCommitMsg}}</p><p><b>Author:</b> {{vm.data.lastCommitBy}}</p></div><div ng-if=vm.data.imgSource class=\"col-md-5 col-xs-5 pull-right\"><img ng-src={{vm.data.imgSource}} class=\"statusImg pull-right\"></div></div></div></div>");
$templateCache.put("{widgetsPath}/jenkins/src/charts/edit.html","<form role=form><div ng-if=!vm.url class=form-group><label>Connection Setup</label><p><input class=form-control id=apiUrl ng-model=config.apiUrl placeholder=\"Enter Api-Url\" type=text></p></div></form>");
$templateCache.put("{widgetsPath}/jenkins/src/charts/view.html","<style type=text/css>\n #stable{\n background-color: #B5CA00;\n }\n #failed{\n background-color: #E43B53;\n }\n #unstable{\n background-color: #DD7800;\n }\n #disabled{\n background-color: #777777;\n }\n .content>.counter>h1{\n color:white;\n }\n .content>.counter {\n outline: 2px solid #ddd;\n height: 100px;\n color: white;\n }\n #doughnut.center{\n margin: 0 auto;\n }\n</style><div><div class=content><canvas id=doughnut class=\"chart chart-doughnut center\" chart-data=jc.chartValues chart-labels=jc.chartLabels chart-colors=jc.chartColors></canvas><div class=\"counter col-md-6\" id=stable><h1>{{jc.data.stable || 0}}</h1>stable builds</div><div class=\"counter col-md-6\" id=unstable><h1>{{jc.data.unstable || 0}}</h1>unstable builds</div><div class=\"counter col-md-6\" id=failed><h1>{{jc.data.fail || 0}}</h1>failed builds</div><div class=\"counter col-md-6\" id=disabled><h1>{{jc.data.aborted+jc.data.disabled || 0}}</h1>disabled builds</div></div></div>");}]);
$templateCache.put("{widgetsPath}/jenkins/src/charts/view.html","<style type=text/css>\n #stable{\n background-color: #B5CA00;\n }\n #failed{\n background-color: #E43B53;\n }\n #unstable{\n background-color: #DD7800;\n }\n #disabled{\n background-color: #777777;\n }\n .content>.counter>p{\n color:white;\n margin: 20px 0 10px;\n font-size: xx-large;\n }\n .content>.counter {\n outline: 2px solid #ddd;\n height: 100px;\n color: white;\n }\n #doughnut.center{\n margin: 0 auto;\n }\n</style><div><div class=content><canvas id=doughnut class=\"chart chart-doughnut center\" chart-data=jc.chartValues chart-labels=jc.chartLabels chart-colors=jc.chartColors></canvas><div class=\"counter col-md-6\" id=stable><p>{{jc.data.stable || 0}}</p>stable builds</div><div class=\"counter col-md-6\" id=unstable><p>{{jc.data.unstable || 0}}</p>unstable builds</div><div class=\"counter col-md-6\" id=failed><p>{{jc.data.fail || 0}}</p>failed builds</div><div class=\"counter col-md-6\" id=disabled><p>{{jc.data.aborted+jc.data.disabled || 0}}</p>disabled builds</div></div></div>");}]);
'use strict'

jenkinsWidget.controller('jenkinsChart', ["data", function(data) {
Expand Down
2 changes: 1 addition & 1 deletion dist/adf-widget-jenkins.min.js

Large diffs are not rendered by default.

136 changes: 71 additions & 65 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,108 +1,114 @@
var gulp = require('gulp');
var connect = require('gulp-connect');
var wiredep = require('wiredep').stream;
var $ = require('gulp-load-plugins')();
var del = require('del');
var jsReporter = require('jshint-stylish');
var annotateAdfPlugin = require('ng-annotate-adf-plugin');
var pkg = require('./package.json');
const imagemin = require('gulp-imagemin');

var annotateOptions = {
'use strict';

const gulp = require('gulp');
const connect = require('gulp-connect');
const wiredep = require('wiredep').stream;
const $ = require('gulp-load-plugins')();
const inject = require('gulp-inject');
const del = require('del');
const jsReporter = require('jshint-stylish');
const annotateAdfPlugin = require('ng-annotate-adf-plugin');
const pkg = require('./package.json');

const annotateOptions = {
plugin: [
annotateAdfPlugin
]
};

var templateOptions = {
const templateOptions = {
root: '{widgetsPath}/jenkins/src',
module: 'adf.widget.jenkins'
};

/** lint **/

gulp.task('csslint', function(){
gulp.task('csslint', (done) => {
gulp.src('src/**/*.css')
.pipe($.csslint())
.pipe($.csslint.reporter());
.pipe($.csslint())
.pipe($.csslint.reporter());
done();
});

gulp.task('jslint', function(){
gulp.task('jslint', (done) => {
gulp.src('src/**/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter(jsReporter));
.pipe($.jshint())
.pipe($.jshint.reporter(jsReporter));
done();
});

gulp.task('lint', ['csslint', 'jslint']);
gulp.task('lint', gulp.series('csslint', 'jslint'));

/** serve **/

gulp.task('templates', function(){
return gulp.src('src/**/*.html')
.pipe($.angularTemplatecache('templates.tpl.js', templateOptions))
.pipe(gulp.dest('.tmp/dist'));
gulp.task('templates', (done) => {
gulp.src('src/**/*.html')
.pipe($.angularTemplatecache('templates.tpl.js', templateOptions))
.pipe(gulp.dest('.tmp/dist'));
done();
});

gulp.task('sample', ['templates'], function(){
var files = gulp.src(['src/**/*.js', 'src/**/*.css', 'src/**/*.less', '.tmp/dist/*.js'])
.pipe($.if('*.js', $.angularFilesort()));

gulp.src(['sample/index.html'])
.pipe(wiredep({
directory: './components/',
bowerJson: require('./bower.json'),
devDependencies: true,
dependencies: true
}))
.pipe($.inject(files))
.pipe(gulp.dest('.tmp/dist'))
.pipe(connect.reload());
gulp.task('sample', (done) => {
let files = gulp.src(['src/**/*.js', 'src/**/*.css', 'src/**/*.less', '.tmp/dist/*.js'])
.pipe($.if('*.js', $.angularFilesort()));

gulp.src('sample/index.html')
.pipe(wiredep({
directory: './components/',
bowerJson: require('./bower.json'),
devDependencies: true,
dependencies: true
}))
.pipe(inject(files))
.pipe(gulp.dest('.tmp/dist'));
// .pipe(connect.reload());
done();
});


gulp.task('watch', function(){
gulp.watch(['src/**'], ['sample']);
gulp.task('watch', function (done) {
gulp.watch(['src/**'], gulp.series('sample'));
done();
});

gulp.task('serve', ['watch', 'sample'], function(){
gulp.task('serve', gulp.series('templates', 'sample', 'watch', function () {
connect.server({
root: ['.tmp/dist', '.'],
livereload: true,
port: 9002
});
});
}));

/** build **/

gulp.task('css', function(){
gulp.src(['src/**/*.css', 'src/**/*.less'])
.pipe($.if('*.less', $.less()))
.pipe($.concat(pkg.name + '.css'))
.pipe(gulp.dest('dist'))
.pipe($.rename(pkg.name + '.min.css'))
.pipe($.minifyCss())
.pipe(gulp.dest('dist'));
gulp.task('css', function () {
return gulp.src(['src/**/*.css', 'src/**/*.less'])
.pipe($.if('*.less', $.less()))
.pipe($.concat(pkg.name + '.css'))
.pipe(gulp.dest('dist'))
.pipe($.rename(pkg.name + '.min.css'))
.pipe($.minifyCss())
.pipe(gulp.dest('dist'));
});

gulp.task('js', function() {
gulp.src(['src/**/*.js', 'src/**/*.html'])
.pipe($.if('*.html', $.minifyHtml()))
.pipe($.if('*.html', $.angularTemplatecache(pkg.name + '.tpl.js', templateOptions)))
.pipe($.angularFilesort())
.pipe($.if('*.js', $.replace(/'use strict';/g, '')))
.pipe($.concat(pkg.name + '.js'))
.pipe($.headerfooter('(function(window, undefined) {\'use strict\';\n', '})(window);'))
.pipe($.ngAnnotate(annotateOptions))
.pipe(gulp.dest('dist'))
.pipe($.rename(pkg.name + '.min.js'))
.pipe($.uglify())
.pipe(gulp.dest('dist'));
gulp.task('js', function () {
return gulp.src(['src/**/*.js', 'src/**/*.html'])
.pipe($.if('*.html', $.minifyHtml()))
.pipe($.if('*.html', $.angularTemplatecache(pkg.name + '.tpl.js', templateOptions)))
.pipe($.angularFilesort())
.pipe($.if('*.js', $.replace(/'use strict';/g, '')))
.pipe($.concat(pkg.name + '.js'))
.pipe($.headerfooter('(function(window, undefined) {\'use strict\';\n', '})(window);'))
.pipe($.ngAnnotate(annotateOptions))
.pipe(gulp.dest('dist'))
.pipe($.rename(pkg.name + '.min.js'))
.pipe($.uglify())
.pipe(gulp.dest('dist'));
});

/** clean **/

gulp.task('clean', function(cb){
gulp.task('clean', function (cb) {
del(['dist', '.tmp'], cb);
});

gulp.task('default',['css', 'js']);
gulp.task('default', gulp.series('css', 'js'));
Loading

0 comments on commit 5297023

Please sign in to comment.