Fix Confluence integration and add sortable columns
- Fixed Confluence API authentication using Basic auth with email - Added /wiki path to API URL for proper endpoint - Improved HTML parsing with cheerio for better table extraction - Made all table columns sortable (previously only 4 were clickable) - Removed fallback to mock data - now always uses real Confluence data - Only color Boja column instead of entire rows for cleaner look - Added proper error handling and logging
This commit is contained in:
39
test-confluence.js
Normal file
39
test-confluence.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const CONFLUENCE_API_URL = 'https://demirix.atlassian.net';
|
||||
const CONFLUENCE_TOKEN = 'ATATT3xFfGF0Ujrimil6qoikSmF8n87EuHQXoc9xcum811bWy3mOjqajAee8D42qRvry9X_oIk8qIumAMa1KO8GPRLcFMuzmBnFf5Y-Ft54tXGMNipd2xRWFB7jHblAsRN42teClNgTKl1iO0liPAxcHIndc2EnZX9mG5N22dODuoOD0PYkEZZI=2788126C';
|
||||
const CONFLUENCE_PAGE_ID = '173768714';
|
||||
|
||||
async function testConfluence() {
|
||||
try {
|
||||
console.log('Testing Confluence API...');
|
||||
const auth = Buffer.from(`dax@demirix.com:${CONFLUENCE_TOKEN}`).toString('base64');
|
||||
|
||||
const response = await axios.get(
|
||||
`${CONFLUENCE_API_URL}/wiki/rest/api/content/${CONFLUENCE_PAGE_ID}?expand=body.storage`,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': `Basic ${auth}`,
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
console.log('Response status:', response.status);
|
||||
console.log('Page title:', response.data.title);
|
||||
console.log('Content length:', response.data.body?.storage?.value?.length || 0);
|
||||
|
||||
// Check if there are tables
|
||||
const content = response.data.body?.storage?.value || '';
|
||||
const tableCount = (content.match(/<table/g) || []).length;
|
||||
console.log('Number of tables:', tableCount);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error.response?.status || error.message);
|
||||
if (error.response) {
|
||||
console.error('Response data:', error.response.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testConfluence();
|
||||
Reference in New Issue
Block a user