This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
631 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,7 @@ out | |
.settings | ||
|
||
demo/snapshot/plugins/ | ||
|
||
node | ||
node_modules | ||
generates-adjuncts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// See https://github.com/tfennelly/jenkins-js-builder | ||
// | ||
var builder = require('jenkins-js-builder'); | ||
|
||
// | ||
// Bundle the modules. | ||
// See https://github.com/tfennelly/jenkins-js-builder#bundling | ||
// | ||
builder.bundle('src/main/js/workflow-editor.js') | ||
.withExternalModuleMapping('jquery-detached', 'jquery-detached:jquery2') | ||
.inDir('target/generated-adjuncts/org/jenkinsci/plugins/workflow/cps'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "workflow-ui", | ||
"version": "1.0.0", | ||
"description": "Jenkins Workflow UI", | ||
"author": "Tom Fennelly <tom.fennelly@gmail.com> (https://github.com/tfennelly)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"gulp": "^3.9.0", | ||
"jenkins-js-builder": "0.0.26", | ||
"jenkins-js-test": "0.0.15" | ||
}, | ||
"dependencies": { | ||
"jenkins-js-modules": "1.3.0", | ||
"jquery-detached": "^2.1.4-v2", | ||
"window-handle": "0.0.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
var samples = []; | ||
|
||
exports.addSamplesWidget = function(editor) { | ||
var $ = require('jquery-detached').getJQuery(); | ||
var $aceEditor = $('#workflow-editor'); | ||
var sampleSelect = $('<select></select>'); | ||
|
||
sampleSelect.append('<option >try sample workflow...</option>'); | ||
for (var i = 0; i < samples.length; i++) { | ||
sampleSelect.append('<option value="' + samples[i].name + '">' + samples[i].title + '</option>'); | ||
} | ||
|
||
var samplesDiv = $('<div class="samples"></div>'); | ||
samplesDiv.append(sampleSelect); | ||
|
||
samplesDiv.insertBefore($aceEditor); | ||
samplesDiv.css({ | ||
'position': 'absolute', | ||
'right': '1px', | ||
'z-index': 100, | ||
'top': '1px' | ||
}); | ||
|
||
sampleSelect.change(function() { | ||
var theSample = getSample(sampleSelect.val()); | ||
editor.setValue(theSample, 1); | ||
}); | ||
}; | ||
|
||
function getSample(sampleName) { | ||
for (var i = 0; i < samples.length; i++) { | ||
if (samples[i].name === sampleName) { | ||
return samples[i].script; | ||
} | ||
} | ||
return ''; | ||
} | ||
|
||
samples.push({ | ||
name: 'hello', | ||
title: 'Hello World', | ||
script: "node {\n" + | ||
" stage 'Stage 1'\n" + | ||
" echo 'Hello World 1'\n" + | ||
" stage 'Stage 2'\n" + | ||
" echo 'Hello World 2'\n" + | ||
"}" | ||
}); | ||
|
||
samples.push({ | ||
name: 'github-maven', | ||
title: 'GitHub + Maven', | ||
script: "node {\n" + | ||
" // Mark the code checkout 'stage'....\n" + | ||
" stage 'Checkout'\n" + | ||
"\n" + | ||
" // Get some code from a GitHub repository\n" + | ||
" git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'\n" + | ||
"\n" + | ||
" // Get the maven tool.\n" + | ||
" // ** NOTE: This 'M3' maven tool must be configured\n" + | ||
" // ** in the global configuration. \n" + | ||
" def mvnHome = tool 'M3'\n" + | ||
"\n" + | ||
" // Mark the code build 'stage'....\n" + | ||
" stage 'Build'\n" + | ||
" // Run the maven build\n" + | ||
" sh \"${mvnHome}/bin/mvn clean install\"\n" + | ||
"}" | ||
}); |
Oops, something went wrong.