Commit all workspace changes from current session

This commit is contained in:
JC Beasley
2026-07-05 12:50:33 -07:00
parent 93b21a8164
commit 3d855cfd11
74 changed files with 2204 additions and 2491 deletions
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env node
const axios = require('axios');
async function fix() {
// Get vault token
const vaultResp = await axios.post('https://beavault.beawit.net:8200/v1/auth/approle/login', {
role_id: '75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e',
secret_id: '6202b465-2f25-547c-ec07-f47cfc4dda3e'
}, { httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false }) });
const vaultToken = vaultResp.data.auth.client_token;
// Get nocodb token
const infraResp = await axios.get('https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure', {
headers: { 'X-Vault-Token': vaultToken },
httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false })
});
const nocodbToken = infraResp.data.data.data['nocodb-token'];
// Get table metadata
console.log('Getting table metadata...');
const table = await axios.get('http://192.168.25.5:8080/api/v2/meta/tables/mx149yctebfwvys', {
headers: { 'xc-token': nocodbToken }
});
console.log('Columns:', table.data.columns?.map(c => c.column_name) || 'No columns in response');
// Find and update columns
const columns = table.data.columns || [];
for (const col of columns) {
if (col.column_name === 'type') {
console.log('Updating type column...');
await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${col.id}`,
{ dtxp: 'correction,preference,episode,decision,validation' },
{ headers: { 'xc-token': nocodbToken, 'Content-Type': 'application/json' }}
);
console.log('✅ Type updated');
}
if (col.column_name === 'severity') {
console.log('Updating severity column...');
await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${col.id}`,
{ dtxp: 'error,warning,auto-correct' },
{ headers: { 'xc-token': nocodbToken, 'Content-Type': 'application/json' }}
);
console.log('✅ Severity updated');
}
if (col.column_name === 'status') {
console.log('Updating status column...');
await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${col.id}`,
{ dtxp: 'active,reversed,deprecated' },
{ headers: { 'xc-token': nocodbToken, 'Content-Type': 'application/json' }}
);
console.log('✅ Status updated');
}
}
}
fix().catch(err => {
console.error('Error:', err.response?.data || err.message);
});
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
echo "Fixing SingleSelect columns in NocoDB..."
VAULT_TOKEN=$(curl -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=$(curl -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Got NocoDB token"
# Get column IDs
echo "Fetching column IDs..."
COLS=$(curl -s "http://192.168.25.5:8080/api/v2/meta/tables/mx149yctebfwvys" -H "xc-token: $NOCODB_TOKEN")
TYPE_ID=$(echo "$COLS" | jq -r '.columns[] | select(.title=="type") | .id')
SEVERITY_ID=$(echo "$COLS" | jq -r '.columns[] | select(.title=="severity") | .id')
STATUS_ID=$(echo "$COLS" | jq -r '.columns[] | select(.title=="status") | .id')
echo "type column ID: $TYPE_ID"
echo "severity column ID: $SEVERITY_ID"
echo "status column ID: $STATUS_ID"
# Fix type column
echo ""
echo "Fixing type column..."
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/$TYPE_ID" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"dtxp": "'"'"'correction'"'"','"'"'preference'"'"','"'"'episode'"'"','"'"'decision'"'"','"'"'validation'"'"'"}' | jq -r '.columns[] | select(.title=="type") | .dtxp'
# Fix severity column
echo ""
echo "Fixing severity column..."
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/$SEVERITY_ID" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"dtxp": "'"'"'error'"'"','"'"'warning'"'"','"'"'auto-correct'"'"'"}' | jq -r '.columns[] | select(.title=="severity") | .dtxp'
# Fix status column
echo ""
echo "Fixing status column..."
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/$STATUS_ID" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"dtxp": "'"'"'active'"'"','"'"'reversed'"'"','"'"'deprecated'"'"'"}' | jq -r '.columns[] | select(.title=="status") | .dtxp'
echo ""
echo "Done!"
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Get tokens
VAULT_TOKEN=$(curl -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=$(curl -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Updating severity column..."
# Update severity column (ID: cv1al80v3ejvij0)
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/cv1al80v3ejvij0" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dtxp": "error,warning,auto-correct",
"meta": {
"options": [
{"title": "error", "color": "#FF0000"},
{"title": "warning", "color": "#FFA500"},
{"title": "auto-correct", "color": "#FFFF00"}
]
}
}'
echo ""
echo "Updating status column..."
# Update status column (ID: cxbxnyh03nkvd0a)
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/cxbxnyh03nkvd0a" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dtxp": "active,reversed,deprecated",
"meta": {
"options": [
{"title": "active", "color": "#00FF00"},
{"title": "reversed", "color": "#FFA500"},
{"title": "deprecated", "color": "#808080"}
]
}
}'
echo ""
echo "Done!"
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env node
const axios = require('axios');
async function fixColumns() {
const nocodbToken = 'owuYNodz0RcnDtUqnj5DK4Qeyp3ASQkDYkrdfGtw';
console.log('Fetching columns...');
// Get all columns first
const cols = await axios.get('http://192.168.25.5:8080/api/v2/meta/tables/mx149yctebfwvys/columns', {
headers: { 'xc-token': nocodbToken }
});
const typeCol = cols.data.columns.find(c => c.title === 'type');
const severityCol = cols.data.columns.find(c => c.title === 'severity');
const statusCol = cols.data.columns.find(c => c.title === 'status');
console.log('Found columns:');
console.log('type ID:', typeCol?.id, 'dtxp:', typeCol?.dtxp);
console.log('severity ID:', severityCol?.id, 'dtxp:', severityCol?.dtxp);
console.log('status ID:', statusCol?.id, 'dtxp:', statusCol?.dtxp);
// Fix type column
if (typeCol) {
console.log('\nFixing type column...');
const resp = await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${typeCol.id}`,
{ dtxp: "'correction','preference','episode','decision','validation'" },
{ headers: { 'xc-token': nocodbToken, 'Content-Type': 'application/json' }}
);
const updated = resp.data.columns.find(c => c.title === 'type');
console.log('type dtxp now:', updated?.dtxp);
}
// Fix severity column
if (severityCol) {
console.log('\nFixing severity column...');
const resp = await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${severityCol.id}`,
{ dtxp: "'error','warning','auto-correct'" },
{ headers: { 'xc-token': nocodbToken, 'Content-Type': 'application/json' }}
);
const updated = resp.data.columns.find(c => c.title === 'severity');
console.log('severity dtxp now:', updated?.dtxp);
}
// Fix status column
if (statusCol) {
console.log('\nFixing status column...');
const resp = await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${statusCol.id}`,
{ dtxp: "'active','reversed','deprecated'" },
{ headers: { 'xc-token': nocodbToken, 'Content-Type': 'application/json' }}
);
const updated = resp.data.columns.find(c => c.title === 'status');
console.log('status dtxp now:', updated?.dtxp);
}
console.log('\nDone!');
}
fixColumns().catch(err => {
console.error('Error:', err.response?.data || err.message);
process.exit(1);
});
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
VAULT_TOKEN=$(curl -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=$(curl -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Updating status column..."
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/cxbxnyh03nkvd0a" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"dtxp":"active,reversed,deprecated","meta":{"options":[{"title":"active","color":"#00FF00"},{"title":"reversed","color":"#FFA500"},{"title":"deprecated","color":"#808080"}]}}'
echo ""
echo "Done!"
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Get tokens
VAULT_TOKEN=*** -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=*** -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Updating status column (ID: cxbxnyh03nkvd0a)..."
# Update status column with proper options
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/cxbxnyh03nkvd0a" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dtxp": "active,reversed,deprecated",
"meta": {
"options": [
{"title": "active", "color": "#00FF00"},
{"title": "reversed", "color": "#FFA500"},
{"title": "deprecated", "color": "#808080"}
]
}
}' | jq -c '{id: .id, title: .title, meta: .meta}'
echo ""
echo "Done!"
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
VAULT_TOKEN=$(curl -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=$(curl -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Fixing type column options (ID: ctkqqemeblx80cc)..."
# Update type column with proper dtxp format
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/ctkqqemeblx80cc" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dtxp": "correction,preference,episode,decision,validation"
}'
echo ""
echo "Done!"
+91
View File
@@ -0,0 +1,91 @@
#!/usr/bin/env node
const axios = require('axios');
async function fix() {
// Get vault token
const vaultResp = await axios.post('https://beavault.beawit.net:8200/v1/auth/approle/login', {
role_id: '75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e',
secret_id: '6202b465-2f25-547c-ec07-f47cfc4dda3e'
}, { httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false }) });
const vaultToken = vaultResp.data.auth.client_token;
// Get nocodb token
const infraResp = await axios.get('https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure', {
headers: { 'X-Vault-Token': vaultToken },
httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false })
});
const nocodbToken = infraResp.data.data.data['nocodb-token'];
// Get columns to find type column ID
console.log('Getting columns...');
const cols = await axios.get('http://192.168.25.5:8080/api/v2/meta/tables/mx149yctebfwvys/columns', {
headers: { 'xc-token': nocodbToken }
});
const typeCol = cols.data.list.find(c => c.title === 'type');
console.log('Type column:', typeCol?.id, typeCol?.title);
if (typeCol) {
// Update column with options
console.log('Updating type column with options...');
await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${typeCol.id}`,
{
dtxp: 'correction,preference,episode,decision,validation'
},
{
headers: {
'xc-token': nocodbToken,
'Content-Type': 'application/json'
}
}
);
console.log('✅ Updated type column');
}
// Also fix severity column
const severityCol = cols.data.list.find(c => c.title === 'severity');
if (severityCol) {
console.log('Updating severity column with options...');
await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${severityCol.id}`,
{
dtxp: 'error,warning,auto-correct'
},
{
headers: {
'xc-token': nocodbToken,
'Content-Type': 'application/json'
}
}
);
console.log('✅ Updated severity column');
}
// Fix status column
const statusCol = cols.data.list.find(c => c.title === 'status');
if (statusCol) {
console.log('Updating status column with options...');
await axios.patch(
`http://192.168.25.5:8080/api/v2/meta/columns/${statusCol.id}`,
{
dtxp: 'active,reversed,deprecated'
},
{
headers: {
'xc-token': nocodbToken,
'Content-Type': 'application/json'
}
}
);
console.log('✅ Updated status column');
}
console.log('\n=== Done ===');
}
fix().catch(err => {
console.error('Error:', err.response?.data || err.message);
});
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
VAULT_TOKEN=$(curl -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=$(curl -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Getting current column config..."
# Get current column
curl -s "http://192.168.25.5:8080/api/v2/meta/columns/ctkqqemeblx80cc" \
-H "xc-token: $NOCODB_TOKEN" | jq '.colOptions'
echo ""
echo "Updating colOptions for type column..."
# Update colOptions via the options endpoint
curl -s -X POST "http://192.168.25.5:8080/api/v2/meta/columns/ctkqqemeblx80cc/colOptions/options" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"options": [
{"title": "correction", "color": "#FF0000"},
{"title": "preference", "color": "#00FF00"},
{"title": "episode", "color": "#0000FF"},
{"title": "decision", "color": "#FFFF00"},
{"title": "validation", "color": "#FF00FF"}
]
}'
echo ""
echo "Done!"
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
VAULT_TOKEN=$(curl -sk -X POST -d '{"role_id":"75d2dcfb-9c65-7f60-59b4-eee8c7f8dc0e","secret_id":"6202b465-2f25-547c-ec07-f47cfc4dda3e"}' https://beavault.beawit.net:8200/v1/auth/approle/login | jq -r '.auth.client_token')
NOCODB_TOKEN=$(curl -sk -H "X-Vault-Token: $VAULT_TOKEN" https://beavault.beawit.net:8200/v1/kv/data/api/infrastructure | jq -r '.data.data["nocodb-token"]')
echo "Patching type column with dtxp..."
# Patch the column with proper enum values in dtxp
curl -s -X PATCH "http://192.168.25.5:8080/api/v2/meta/columns/ctkqqemeblx80cc" \
-H "xc-token: $NOCODB_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dtxp": "'"'"'correction'"'"','"'"'preference'"'"','"'"'episode'"'"','"'"'decision'"'"','"'"'validation'"'"'"
}'
echo ""
echo "Done!"