Skip to content

Commit

Permalink
Fix deploy to CWS error (had trouble fetching process name), update CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
wcgunter committed Feb 16, 2024
1 parent 1460986 commit ebf7d7a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
19 changes: 11 additions & 8 deletions cws-ui/src/main/webapp/js/modeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -69021,9 +69021,9 @@ ___CSS_LOADER_EXPORT___.push([module.id, `/**

--feelers-select-color: var(--color-blue-205-100-85);

--text-size-base: 14px;
--text-size-small: 13px;
--text-size-smallest: 12px;
--text-size-base: 16px;
--text-size-small: 14px;
--text-size-smallest: 13px;
--text-line-height: 21px;
--line-height-condensed: 17px;

Expand Down Expand Up @@ -71794,7 +71794,7 @@ html {
margin: 0;
}
#js-properties-panel {
width: 400px;
width: 500px;
}
a:link {
text-decoration: none;
Expand Down Expand Up @@ -174432,29 +174432,32 @@ jquery__WEBPACK_IMPORTED_MODULE_5___default()(function() {
}

var exportArtifacts = (0,min_dash__WEBPACK_IMPORTED_MODULE_12__.debounce)(async function() {

const { xml } = await bpmnModeler.saveXML();
var name = xml.substring(xml.indexOf('name="') + 6, xml.indexOf('"', xml.indexOf('name="') + 6));

try {

const { svg } = await bpmnModeler.saveSVG();

setEncoded(downloadSvgLink, jquery__WEBPACK_IMPORTED_MODULE_5___default()( "#js-canvas > div > div > svg" ).attr("data-element-id") + ".svg", svg);
setEncoded(downloadSvgLink, name + ".svg", svg);
} catch (err) {

console.error('Error happened saving SVG: ', err);

setEncoded(downloadSvgLink, jquery__WEBPACK_IMPORTED_MODULE_5___default()( "#js-canvas > div > div > svg" ).attr("data-element-id") + ".svg", svg);
setEncoded(downloadSvgLink, name + ".svg", svg);
}

try {

const { xml } = await bpmnModeler.saveXML({ format: true });

setEncoded(downloadLink, jquery__WEBPACK_IMPORTED_MODULE_5___default()( "#js-canvas > div > div > svg" ).attr("data-element-id") + ".bpmn", xml);
setEncoded(downloadLink, name + ".bpmn", xml);
} catch (err) {

console.log('Error happened saving XML: ', err);

setEncoded(downloadLink, jquery__WEBPACK_IMPORTED_MODULE_5___default()( "#js-canvas > div > div > svg" ).attr("data-element-id") + ".bpmn", xml);
setEncoded(downloadLink, name + ".bpmn", xml);
}

// ******** New code here ********
Expand Down
37 changes: 22 additions & 15 deletions install/cws-ui/modeler.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
}
}
});
let procDefName =
$( window ).load(function() {
console.log( "window loaded" );
Expand Down Expand Up @@ -101,26 +103,31 @@

<script>
function deployHandler() {
bpmnModeler.saveXML({ format: true }, function (err, xml) {
$.ajax({
type: "POST",
url: "/${base}/rest/deployments/deployModelerFile",
data: {
filename: $( ".bio-properties-panel-header-label" ).attr("title"),
xmlData: xml
}
})
.done(function( msg ) {
$('#modal-title').html("<h1>Deployment Status: " + $( ".bio-properties-panel-header-label" ).attr("title") + ".bpmn</h1>");
$('#modal-body').html("<h2>"+msg+"</h2>");
if ($("#modal-body:contains('ERROR:')").length >= 1) {
bpmnModeler.saveXML({ format: true }).then((xml) => {
console.log(xml);
//the name of the process is in this xml. We need to extract it.
//the line starts with bpmn:process id=" but we need to get everything between name=" and "
var name = xml.xml.substring(xml.xml.indexOf('name="') + 6, xml.xml.indexOf('"', xml.xml.indexOf('name="') + 6));
console.log(name);
$.ajax({
type: "POST",
url: "/${base}/rest/deployments/deployModelerFile",
data: {
filename: name,
xmlData: xml.xml
}
})
.done(function( msg ) {
$('#modal-title').html("<h1>Deployment Status: " + name + ".bpmn</h1>");
$('#modal-body').html("<h2>"+msg+"</h2>");
if ($("#modal-body:contains('ERROR:')").length >= 1) {
$("#modal-body").css( "color", "red" );
}
else {
$("#modal-body").css( "color", "green" );
}
$('#modal-window').show();
});
$('#modal-window').show();
});
});
}
function hideModal() {
Expand Down

0 comments on commit ebf7d7a

Please sign in to comment.