|
6 | 6 | <a href="https://opensource.mindsphere.io/docs/node-red-contrib-mindconnect/index.html" target="_new" class="headerLink" title="Documentation">
|
7 | 7 | <i class="fa fa-globe"></i> MindConnect Node-RED Agent
|
8 | 8 | </a>
|
9 |
| - </span> <span style="color:#aaaaaa !important">v3.9.0</span> |
| 9 | + </span> <span style="color:#aaaaaa !important">v3.9.1</span> |
10 | 10 | </div>
|
11 | 11 |
|
12 | 12 | <div class="form-row">
|
|
680 | 680 | },
|
681 | 681 |
|
682 | 682 | oneditprepare: function () {
|
| 683 | + |
| 684 | + const copyToClipboard = str => { |
| 685 | + |
| 686 | + const textarea = document.createElement('textarea'); |
| 687 | + textarea.textContent = str; |
| 688 | + textarea.setAttribute('readonly', ''); |
| 689 | + textarea.style.position = 'absolute'; |
| 690 | + textarea.style.left = '-9999px'; |
| 691 | + |
| 692 | + document.body.appendChild(textarea); |
| 693 | + var selection = document.getSelection(); |
| 694 | + var range = document.createRange(); |
| 695 | + range.selectNode(textarea); |
| 696 | + selection.removeAllRanges(); |
| 697 | + selection.addRange(range); |
| 698 | + |
| 699 | + const success = document.execCommand('copy'); |
| 700 | + selection.removeAllRanges(); |
| 701 | + document.body.removeChild(textarea); |
| 702 | + return success; |
| 703 | + }; |
| 704 | + |
683 | 705 | function copyLink(dataSourceConfig, option) {
|
684 | 706 | if (option === "BULK" || option === "TIMESERIES") {
|
685 | 707 | const values = [];
|
|
703 | 725 | null,
|
704 | 726 | 2
|
705 | 727 | )};\nmsg.payload=bulkValues;\nreturn msg;`;
|
706 |
| - navigator.clipboard.writeText(option === "BULK" ? bulkTemplate : functionTemplate); |
| 728 | + const success = copyToClipboard(option === "BULK" ? bulkTemplate : functionTemplate); |
707 | 729 | $("#mindconnect-infoDialog-output").text(
|
708 |
| - `Copied ${ |
| 730 | + success ? `Copied ${ |
709 | 731 | option === "BULK" ? "Bulk" : ""
|
710 |
| - } TimeSeries Template Data to Clipboard. (Paste this template to a function node)` |
| 732 | + } TimeSeries Template Data to Clipboard. (Paste this template to a function node)` : |
| 733 | + "Couldn't copy the text to clipboard" |
711 | 734 | );
|
712 | 735 | });
|
713 | 736 | } else {
|
|
746 | 769 | msg.payload=fileInfo;
|
747 | 770 | return msg;`;
|
748 | 771 |
|
749 |
| - navigator.clipboard.writeText(option === "EVENT" ? eventTemplate : fileTemplate); |
| 772 | + const success = copyToClipboard(option === "EVENT" ? eventTemplate : fileTemplate); |
750 | 773 | $("#mindconnect-infoDialog-output").text(
|
751 |
| - `Copied ${ |
| 774 | + success ? `Copied ${ |
752 | 775 | option === "EVENT" ? "Event" : "File"
|
753 |
| - } Template Data to Clipboard. (Paste this template to a function node.)` |
| 776 | + } Template Data to Clipboard. (Paste this template to a function node.)` : |
| 777 | + "Couldn't copy the text to clipboard" |
754 | 778 | );
|
755 | 779 | }
|
756 | 780 | return false;
|
|
835 | 859 | const url = `<a class="ghostLink diagLink" href="${urlTemplate}${mapping.entityId}/details" target="_new" title="Open Asset in MindSphere Asset Manager"><i class="fa fa-external-link"></i> `;
|
836 | 860 | mappingList.append(
|
837 | 861 | `<li>${
|
838 |
| - mapping?.validity?.status === "VALID" |
| 862 | + (mapping && mapping.validity && mapping.validity.status && (mapping.validity.status === "VALID")) |
839 | 863 | ? "<i class='fa fa-check-circle' style='color:#65C728' title='VALID'></i>"
|
840 | 864 | : "<i class='fa fa-exclamation-triangle' style='color:#F62447' title='NOT VALID'></i>"
|
841 | 865 | } <span style="color:#354C80">${
|
|
0 commit comments