updated ka attach to work with fd app
This commit is contained in:
parent
c8e9c1c66f
commit
9296a4ec4e
@ -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.
@ -2,18 +2,28 @@
|
||||
"lints": [
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"severity": 1,
|
||||
"value": "app\\scripts\\app.js::87: Expected rejection to be handled.",
|
||||
"type": "custom-js-lint"
|
||||
"value": "app\\scripts\\app.js::18: Too many nested callbacks (5). Maximum allowed is 4.",
|
||||
"type": "lint"
|
||||
}
|
||||
],
|
||||
"coverage": {
|
||||
@ -26,48 +36,108 @@
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"line": 31,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"line": 4,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 38
|
||||
}
|
||||
},
|
||||
"3": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"line": 30,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"2": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"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
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"line": 31,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
@ -100,87 +170,168 @@
|
||||
"name": "(anonymous_1)",
|
||||
"decl": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 27
|
||||
"line": 5,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 28
|
||||
"line": 5,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 45
|
||||
"line": 5,
|
||||
"column": 32
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 5
|
||||
"line": 26,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"line": 2
|
||||
"line": 5
|
||||
},
|
||||
"2": {
|
||||
"name": "(anonymous_2)",
|
||||
"decl": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 75
|
||||
"line": 9,
|
||||
"column": 79
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 76
|
||||
"line": 9,
|
||||
"column": 80
|
||||
}
|
||||
},
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 86
|
||||
"line": 9,
|
||||
"column": 90
|
||||
},
|
||||
"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
|
||||
}
|
||||
},
|
||||
"line": 5
|
||||
"line": 27
|
||||
}
|
||||
},
|
||||
"branchMap": {},
|
||||
"s": {
|
||||
"0": 12,
|
||||
"1": 12,
|
||||
"2": 6,
|
||||
"3": 6,
|
||||
"4": 1
|
||||
"0": 2,
|
||||
"1": 2,
|
||||
"2": 2,
|
||||
"3": 2,
|
||||
"4": 2,
|
||||
"5": 1,
|
||||
"6": 1,
|
||||
"7": 1,
|
||||
"8": 0,
|
||||
"9": 0,
|
||||
"10": 0
|
||||
},
|
||||
"f": {
|
||||
"0": 12,
|
||||
"1": 6,
|
||||
"2": 1
|
||||
"0": 2,
|
||||
"1": 2,
|
||||
"2": 1,
|
||||
"3": 1,
|
||||
"4": 0,
|
||||
"5": 0
|
||||
},
|
||||
"b": {},
|
||||
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
|
||||
"hash": "18566891b473df9f163282f1310c6fc8160a5fe6"
|
||||
"hash": "be7a4d54242fcac22528119b05a9a5cae58c3b78"
|
||||
}
|
||||
},
|
||||
"coverageSummary": {
|
||||
"lines": {
|
||||
"total": 5,
|
||||
"covered": 5,
|
||||
"total": 11,
|
||||
"covered": 8,
|
||||
"skipped": 0,
|
||||
"pct": 100
|
||||
"pct": 72.72
|
||||
},
|
||||
"statements": {
|
||||
"total": 5,
|
||||
"covered": 5,
|
||||
"total": 11,
|
||||
"covered": 8,
|
||||
"skipped": 0,
|
||||
"pct": 100
|
||||
"pct": 72.72
|
||||
},
|
||||
"functions": {
|
||||
"total": 3,
|
||||
"covered": 3,
|
||||
"total": 6,
|
||||
"covered": 4,
|
||||
"skipped": 0,
|
||||
"pct": 100
|
||||
"pct": 66.66
|
||||
},
|
||||
"branches": {
|
||||
"total": 0,
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<iframe
|
||||
id="kb-iframe"
|
||||
src="http://localhost:5173"
|
||||
src="https://kb.jv.com"
|
||||
frameborder="0"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
@ -1,10 +1,51 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
app.initialized().then(function (client) {
|
||||
console.log('KB initialized');
|
||||
|
||||
document.getElementById('insert-ka-btn').addEventListener('click', function() {
|
||||
alert('Insert KA# - to be implemented');
|
||||
});
|
||||
|
||||
let currentKA = null;
|
||||
|
||||
// Listen for messages from the KB iframe
|
||||
window.addEventListener('message', function(event) {
|
||||
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>';
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user