Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tsa 475 #3450

Merged
merged 3 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
*/
mxCell.prototype.getCsetAttribute = function (name)
{

console.log('wrapper object (trying to find '+name+'):')
console.log(this.value)
if (typeof this.value != 'UserObject')// | typeof this.value != 'object')
//if (typeof this.value != 'object')
// 'object' is for old diagrams that haven't been updated yet
if (typeof this.value != 'UserObject' && typeof this.value != 'object')
{
return null;
}
Expand All @@ -30,13 +27,20 @@ mxCell.prototype.getCsetAttribute = function (name)
mxCell.prototype.setCsetAttribute = function (attributeName, attributeValue)
{
var obj = null;
console.log('in setCsetAttribute:')
console.log(attributeName)
console.log(attributeValue)
if (!!this.value && typeof this.value == 'UserObject')
if (!!this.value && (typeof this.value == 'UserObject' || this.value.tagName == 'UserObject'))
//if (!!this.value && typeof this.value == 'object')
{
obj = this.value;

obj.setAttribute(attributeName, attributeValue);
// set an internal label as well. Something to concatenate with the SAL for the display label.
if (attributeName === 'label') {

obj.setAttribute('internalLabel', attributeValue || '');
}
//if (!this.value || typeof this.value != 'UserObject' && obj.style) {
// this.value = obj;
//}
}
else
{
Expand All @@ -45,6 +49,19 @@ mxCell.prototype.setCsetAttribute = function (attributeName, attributeValue)
{
var doc = mxUtils.createXmlDocument();
obj = doc.createElement('UserObject');
obj.setAttribute(attributeName, attributeValue);

// set an internal label as well. Something to concatenate with the SAL for the display label.
if (attributeName === 'label') {
obj.setAttribute('internalLabel', attributeValue || '');
}

// 'object' is for old diagrams that haven't been updated yet
if (!this.value || (typeof this.value != 'UserObject' && typeof this.value != 'object') && (obj.style || this.value.style)) {
this.value = obj;
}


//obj = doc.createElement('object');
}
catch (e)
Expand All @@ -53,6 +70,7 @@ mxCell.prototype.setCsetAttribute = function (attributeName, attributeValue)
}
}

/*
obj.setAttribute(attributeName, attributeValue);
console.log('obj:')
console.log(obj)
Expand All @@ -61,7 +79,11 @@ mxCell.prototype.setCsetAttribute = function (attributeName, attributeValue)
{
obj.setAttribute('internalLabel', attributeValue || '');
}

if (!this.value || typeof this.value != 'UserObject' && obj.style)
{
this.value = obj;
}
*/
//this.value = obj;
}

Expand Down Expand Up @@ -227,12 +249,14 @@ mxCell.prototype.autoNameComponent = function ()
{
return;
}

// ignore items already labeled
if (!!this.getCsetAttribute('label'))
{
return;
}
if (!!this.getAttribute('label')) {
return;
}

// determine new number
var num = parseInt(sessionStorage.getItem("last.number"), 10) + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ CsetUtils.LoadFileFromCSET = async function (app) {
for (var element of app.toolbar.container.childNodes) {
if (element.title == 'Analyze Network Diagram') {
element.click();
console.log('in analysis toggle')
break;
}
}
Expand All @@ -239,8 +238,6 @@ CsetUtils.LoadFileFromCSET = async function (app) {
CsetUtils.edgesToTop = function (graph, edit) {
const model = graph.getModel();
const changes = edit && edit.changes || [];
console.log("changes in edgesToTop:")
console.log(changes)
for (const change of changes) {
if (change instanceof mxChildChange && model.isVertex(change.child)) {
const edges = CsetUtils.getAllChildEdges(change.child);
Expand Down Expand Up @@ -297,12 +294,6 @@ CsetUtils.PersistDataToCSET = async function (editor, xml, revision) {

//may need to add this in to the save
//editor.menubarContainer;
console.log('PersistDataToCset editor, xml, revision:')
console.log(editor)

console.log(xml)
console.log(revision)

await CsetUtils.saveDiagram(req);
}

Expand Down Expand Up @@ -476,11 +467,8 @@ CsetUtils.handleZoneChanges = function (edit) {
changes.forEach(change => {
if (change instanceof mxValueChange && change.cell.isZone()) {
const c = change.cell;
console.log('cell in handleZoneChanges:')
console.log(change)
// if they just changed the label, update the internal label
if (change.value.attributes.label.value !== change.previous.attributes.label.value) {
console.log('changes in zone')
c.setAttribute('internalLabel', change.value.attributes.label.value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,6 @@ Actions.prototype.init = function()
{
this.analyzeToggled = !this.analyzeToggled;
editor.analyzeDiagram = !editor.analyzeDiagram;
console.log('action:')
console.log(action)
if (action.onToggle)
{
action.onToggle(this.analyzeToggled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,11 @@ Editor = function (chromeless, themes, model, graph, editable) {
}

if (haschanges) {
console.log('in has changes, "this" before:')
console.log(this)
CsetUtils.adjustConnectability(edit);
CsetUtils.edgesToTop(this.graph, edit);
CsetUtils.handleZoneChanges(edit);
//console.log('after a lot of stuff but before refresh')

//console.log(this)
this.graph.refresh();
console.log('after refresh: ---------------------')
console.log(this)
CsetUtils.PersistGraphToCSET(this);
console.log('after persistGraphToCset')
console.log(this)
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,6 @@ Sidebar.prototype.createDropHandler = function (cells, allowSplit, allowCellsIns
select = clones;
}
else if (cells.length > 0) {
console.log('importing cells?')
select = graph.importCells(cells, x, y, target);

if (graph.model.isVertex(sourceCell) && select.length == 1 &&
Expand Down
Loading
Loading