| @@ -874,10 +874,25 @@ | ||
| 874 | 874 | $('#mxchat_pinecone_docs_switch_anyway').prop('checked', false); |
| 875 | 875 | } |
| 876 | 876 | $submit.prop('disabled', blocked); |
| 877 | 877 | } |
| 878 | + // 47c61f: the status notice follows the host in the FIELD, the same | |
| 879 | + // comparison the Save gate makes. The server paints it from the saved | |
| 880 | + // host, which is the classic index for the whole length of a copy, so a | |
| 881 | + // checked document host typed here used to sit under "Not checked yet". | |
| 882 | + // Kept out of refreshGate(): a failed Check sets its own text first and | |
| 883 | + // then calls refreshGate(), and that text must survive until the host changes. | |
| 884 | + function refreshStatus() { | |
| 885 | + var typed = hostValue(); | |
| 886 | + if (typed !== '' && typed === verifiedHost) { | |
| 887 | + var dim = parseInt(state.expected_dimension, 10) || 0; | |
| 888 | + setStatus(true, String(state.status_checked || 'Document index checked: %1$s (%2$d dimensions).').replace('%1$s', typed).replace('%2$d', dim)); | |
| 889 | + } else { | |
| 890 | + setStatus(false, String(state.status_unchecked || 'Not checked yet. Create a document index below, or enter its host above and click Check index. The index type only saves once the host has been checked.')); | |
| 891 | + } | |
| 892 | + } | |
| 878 | 893 | $('#mxchat_pinecone_docs_switch_anyway').off('change.pineconeDocs').on('change.pineconeDocs', refreshGate); |
| 879 | - $('#mxchat_pinecone_host').off('input.pineconeDocs change.pineconeDocs').on('input.pineconeDocs change.pineconeDocs', refreshGate); | |
| 894 | + $('#mxchat_pinecone_host').off('input.pineconeDocs change.pineconeDocs').on('input.pineconeDocs change.pineconeDocs', function () { refreshStatus(); refreshGate(); }); | |
| 880 | 895 | |
| 881 | 896 | function post(data) { |
| 882 | 897 | data.nonce = nonce; |
| 883 | 898 | return $.post(ajaxUrl, data); |
| @@ -1025,10 +1040,21 @@ | ||
| 1025 | 1040 | return Math.max(0, total - copied); |
| 1026 | 1041 | } |
| 1027 | 1042 | function otherNamespacesText(st) { |
| 1028 | 1043 | var other = st.other_namespaces || {}; |
| 1044 | + // 47c61f: default namespace first, then by name. The server writes them | |
| 1045 | + // in that order now; this covers states written before it did, and | |
| 1046 | + // namespaces named like numbers, which a JSON object reorders. | |
| 1047 | + var names = []; | |
| 1048 | + $.each(other, function (name) { names.push(String(name)); }); | |
| 1049 | + names.sort(function (a, b) { | |
| 1050 | + if (a === b) { return 0; } | |
| 1051 | + if (a === '__default__') { return -1; } | |
| 1052 | + if (b === '__default__') { return 1; } | |
| 1053 | + return a < b ? -1 : 1; | |
| 1054 | + }); | |
| 1029 | 1055 | var parts = []; |
| 1030 | - $.each(other, function (name, count) { parts.push(name + ' (' + fmt(count) + ')'); }); | |
| 1056 | + $.each(names, function (i, name) { parts.push(name + ' (' + fmt(other[name]) + ')'); }); | |
| 1031 | 1057 | return parts.join(', '); |
| 1032 | 1058 | } |
| 1033 | 1059 | function otherNamespacesSummary(st) { |
| 1034 | 1060 | var records = 0, n = 0; |