updated ka attach to work with fd app

This commit is contained in:
MattLeo 2025-12-09 15:40:39 -06:00
parent c8e9c1c66f
commit 9296a4ec4e
5 changed files with 266 additions and 74 deletions

View File

@ -1 +1 @@
{"fd_cli_101_101_migrate_oauth_status":true,"report_hash":"ac127cdfb4fd074868d43aef801f187105d36d777c033140b5e2dc170c0e87c8"} {"fd_cli_101_101_migrate_oauth_status":true,"report_hash":"5571c4887009834af23ecf361d2dbf3ff79c7c7c74499711c1b923a147e0bdc2"}

Binary file not shown.

View File

@ -2,18 +2,28 @@
"lints": [ "lints": [
{ {
"severity": 1, "severity": 1,
"value": "app\\scripts\\app.js::2: Expected rejection to be handled.", "value": "app\\scripts\\app.js::6: 'fdClient' declared and assigned in different scopes. Possible asynchronous race condition.",
"type": "custom-js-lint" "type": "custom-js-lint"
}, },
{ {
"severity": 1, "severity": 1,
"value": "app\\scripts\\app.js::72: 'isExpanded' declared and assigned in different scopes. Possible asynchronous race condition.", "value": "app\\scripts\\app.js::11: Expected rejection to be handled.",
"type": "custom-js-lint"
},
{
"severity": 2,
"value": "app\\scripts\\app.js::12: 'ticketData' is defined but never used.",
"type": "lint"
},
{
"severity": 1,
"value": "app\\scripts\\app.js::17: Expected rejection to be handled.",
"type": "custom-js-lint" "type": "custom-js-lint"
}, },
{ {
"severity": 1, "severity": 1,
"value": "app\\scripts\\app.js::87: Expected rejection to be handled.", "value": "app\\scripts\\app.js::18: Too many nested callbacks (5). Maximum allowed is 4.",
"type": "custom-js-lint" "type": "lint"
} }
], ],
"coverage": { "coverage": {
@ -26,48 +36,108 @@
"column": 0 "column": 0
}, },
"end": { "end": {
"line": 10, "line": 31,
"column": 3 "column": 3
} }
}, },
"1": { "1": {
"start": { "start": {
"line": 2, "line": 4,
"column": 4 "column": 4
}, },
"end": { "end": {
"line": 9, "line": 30,
"column": 7
}
},
"2": {
"start": {
"line": 3,
"column": 8
},
"end": {
"line": 3,
"column": 38
}
},
"3": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 7,
"column": 11 "column": 11
} }
}, },
"4": { "2": {
"start": { "start": {
"line": 6, "line": 6,
"column": 12 "column": 12
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 52 "column": 30
}
},
"3": {
"start": {
"line": 7,
"column": 12
},
"end": {
"line": 7,
"column": 42
}
},
"4": {
"start": {
"line": 9,
"column": 12
},
"end": {
"line": 25,
"column": 15
}
},
"5": {
"start": {
"line": 11,
"column": 16
},
"end": {
"line": 24,
"column": 23
}
},
"6": {
"start": {
"line": 14,
"column": 41
},
"end": {
"line": 14,
"column": 48
}
},
"7": {
"start": {
"line": 17,
"column": 24
},
"end": {
"line": 23,
"column": 31
}
},
"8": {
"start": {
"line": 19,
"column": 32
},
"end": {
"line": 22,
"column": 35
}
},
"9": {
"start": {
"line": 28,
"column": 12
},
"end": {
"line": 28,
"column": 62
}
},
"10": {
"start": {
"line": 29,
"column": 12
},
"end": {
"line": 29,
"column": 83
} }
} }
}, },
@ -90,7 +160,7 @@
"column": 58 "column": 58
}, },
"end": { "end": {
"line": 10, "line": 31,
"column": 1 "column": 1
} }
}, },
@ -100,87 +170,168 @@
"name": "(anonymous_1)", "name": "(anonymous_1)",
"decl": { "decl": {
"start": { "start": {
"line": 2, "line": 5,
"column": 27 "column": 14
}, },
"end": { "end": {
"line": 2, "line": 5,
"column": 28 "column": 15
} }
}, },
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 5,
"column": 45 "column": 32
}, },
"end": { "end": {
"line": 9, "line": 26,
"column": 5 "column": 9
} }
}, },
"line": 2 "line": 5
}, },
"2": { "2": {
"name": "(anonymous_2)", "name": "(anonymous_2)",
"decl": { "decl": {
"start": { "start": {
"line": 5, "line": 9,
"column": 75 "column": 79
}, },
"end": { "end": {
"line": 5, "line": 9,
"column": 76 "column": 80
} }
}, },
"loc": { "loc": {
"start": { "start": {
"line": 5, "line": 9,
"column": 86 "column": 90
}, },
"end": { "end": {
"line": 7, "line": 25,
"column": 13
}
},
"line": 9
},
"3": {
"name": "(anonymous_3)",
"decl": {
"start": {
"line": 12,
"column": 26
},
"end": {
"line": 12,
"column": 27
}
},
"loc": {
"start": {
"line": 12,
"column": 47
},
"end": {
"line": 24,
"column": 21
}
},
"line": 12
},
"4": {
"name": "(anonymous_4)",
"decl": {
"start": {
"line": 18,
"column": 34
},
"end": {
"line": 18,
"column": 35
}
},
"loc": {
"start": {
"line": 18,
"column": 45
},
"end": {
"line": 23,
"column": 29
}
},
"line": 18
},
"5": {
"name": "(anonymous_5)",
"decl": {
"start": {
"line": 27,
"column": 15
},
"end": {
"line": 27,
"column": 16
}
},
"loc": {
"start": {
"line": 27,
"column": 31
},
"end": {
"line": 30,
"column": 9 "column": 9
} }
}, },
"line": 5 "line": 27
} }
}, },
"branchMap": {}, "branchMap": {},
"s": { "s": {
"0": 12, "0": 2,
"1": 12, "1": 2,
"2": 6, "2": 2,
"3": 6, "3": 2,
"4": 1 "4": 2,
"5": 1,
"6": 1,
"7": 1,
"8": 0,
"9": 0,
"10": 0
}, },
"f": { "f": {
"0": 12, "0": 2,
"1": 6, "1": 2,
"2": 1 "2": 1,
"3": 1,
"4": 0,
"5": 0
}, },
"b": {}, "b": {},
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9", "_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
"hash": "18566891b473df9f163282f1310c6fc8160a5fe6" "hash": "be7a4d54242fcac22528119b05a9a5cae58c3b78"
} }
}, },
"coverageSummary": { "coverageSummary": {
"lines": { "lines": {
"total": 5, "total": 11,
"covered": 5, "covered": 8,
"skipped": 0, "skipped": 0,
"pct": 100 "pct": 72.72
}, },
"statements": { "statements": {
"total": 5, "total": 11,
"covered": 5, "covered": 8,
"skipped": 0, "skipped": 0,
"pct": 100 "pct": 72.72
}, },
"functions": { "functions": {
"total": 3, "total": 6,
"covered": 3, "covered": 4,
"skipped": 0, "skipped": 0,
"pct": 100 "pct": 66.66
}, },
"branches": { "branches": {
"total": 0, "total": 0,

View File

@ -12,7 +12,7 @@
</div> </div>
<iframe <iframe
id="kb-iframe" id="kb-iframe"
src="http://localhost:5173" src="https://kb.jv.com"
frameborder="0" frameborder="0"
></iframe> ></iframe>
</div> </div>

View File

@ -1,10 +1,51 @@
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
app.initialized().then(function (client) { let currentKA = null;
console.log('KB initialized');
// Listen for messages from the KB iframe
document.getElementById('insert-ka-btn').addEventListener('click', function() { window.addEventListener('message', function(event) {
alert('Insert KA# - to be implemented'); if (event.origin !== 'https://kb.jv.com') {
}); return;
}
if (event.data.type === 'ka-viewed') {
currentKA = event.data.kaNumber;
console.log('Current KA:', currentKA);
}
}); });
app.initialized()
.then(function (client) {
console.log('KB initialized');
document.getElementById('insert-ka-btn').addEventListener('click', function() {
if (!currentKA) {
client.interface.trigger('showNotify', {
type: 'warning',
message: 'No article selected. Please view an article first.'
});
return;
}
client.interface.trigger("setValue", {
id: "cf_ka_number",
value: currentKA
})
.then(function(data) {
return client.interface.trigger('showNotify', {
type: 'success',
message: currentKA + ' attached to ticket'
});
})
.catch(function(error) {
client.interface.trigger('showNotify', {
type: 'error',
message: 'Failed to attach KA#: ' + error.message
});
});
});
})
.catch(function(error) {
console.error('Failed to initialize app:', error);
document.body.innerHTML = '<p>Failed to load app. Please refresh.</p>';
});
}); });