(state, message)
| 1878 | }; |
| 1879 | |
| 1880 | const testStatusLabel = (state, message) => { |
| 1881 | if (state === 'testing') return tf('source_test_running', 'Testing...'); |
| 1882 | if (state === 'ok') return tf('source_test_ok', 'Connected'); |
| 1883 | if (state === 'warning') { |
| 1884 | const base = tf('source_test_limited', 'Connected (limited)'); |
| 1885 | const detail = message ? truncateTestMessage(message, 52) : ''; |
| 1886 | if (!detail) return base; |
| 1887 | const lowerDetail = detail.toLowerCase(); |
| 1888 | if (lowerDetail === base.toLowerCase() || lowerDetail === 'connected with permission limitations') { |
| 1889 | return base; |
| 1890 | } |
| 1891 | return detail ? `${base}: ${detail}` : base; |
| 1892 | } |
| 1893 | if (state === 'error') { |
| 1894 | const base = tf('source_test_failed', 'Failed'); |
| 1895 | const detail = message ? truncateTestMessage(message, 60) : ''; |
| 1896 | return detail ? `${base}: ${detail}` : base; |
| 1897 | } |
| 1898 | return tf('source_test_idle', 'Not tested'); |
| 1899 | }; |
| 1900 | |
| 1901 | const capabilityLabelMap = { |
| 1902 | read: tf('source_cap_read', 'Read'), |
no test coverage detected