Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
369aebb
add debug
SharonStrats Mar 25, 2026
5a81d83
error handling
SharonStrats Mar 25, 2026
ca12d09
styles for details sec
SharonStrats Mar 25, 2026
00be28f
attach details sooner
SharonStrats Mar 25, 2026
aa5c206
Update src/issuePane.js
SharonStrats Mar 25, 2026
4fc5a7f
add openmodal function
SharonStrats Mar 25, 2026
cb5ea3d
add missing functions
SharonStrats Mar 25, 2026
1a6642b
csvButton error handling
SharonStrats Mar 25, 2026
baba6e0
board errors
SharonStrats Mar 25, 2026
3624234
new Issue
SharonStrats Mar 25, 2026
ee3e49a
newTracker error handling
SharonStrats Mar 26, 2026
38b0525
missing localUtils functions and css
SharonStrats Mar 26, 2026
49a3e48
fix new tracker
SharonStrats Mar 26, 2026
9f28532
fix issue pane
SharonStrats Mar 26, 2026
1dcb6a6
issue error handling
SharonStrats Mar 26, 2026
86e8428
Merge branch 'refactor/error-handling' of https://github.com/SolidOS/…
SharonStrats Mar 26, 2026
6e39af7
fixed debug error
SharonStrats Mar 26, 2026
24725a2
place the detailsSection below the table
SharonStrats Mar 26, 2026
2fe099b
configuration for debug
SharonStrats Mar 26, 2026
0086bc3
generative ai
SharonStrats Mar 26, 2026
58f0f3f
Merge branch 'refactor/styles-separateCSS' into refactor/error-handling
SharonStrats Mar 26, 2026
c213869
generative ai
SharonStrats Mar 26, 2026
b4d4217
comment local utils
SharonStrats Mar 26, 2026
9e6ccce
generative ai messenging
SharonStrats Mar 26, 2026
37d225a
Merge branch 'refactor/styles-separateCSS' into refactor/error-handling
SharonStrats Mar 26, 2026
58a4916
Update src/csvButton.js
SharonStrats Mar 26, 2026
8a34839
fixed PR review comments
SharonStrats Mar 26, 2026
767350e
Merge branch 'refactor/error-handling' of https://github.com/SolidOS/…
SharonStrats Mar 26, 2026
e8d3340
changed contacts to issue in localUtils
SharonStrats Mar 31, 2026
dffea56
Merge branch 'refactor/styles-separateCSS' into refactor/error-handling
SharonStrats Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ Example:
* Some code was generated by the GPT-5.3-Codex model in GitHub Copilot based on the following prompt:
* can you style my table and make it look nice.
* can you handle the visibility in exposeOverlay with css?
* move details section to be before the newTrackerButton
* Configure debug so that it can be turned on and off
2 changes: 1 addition & 1 deletion src/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function board (dom, columnValues, renderItem, options) {
const table = board.appendChild(dom.createElement('table'))
table.classList.add('trackerBoardTable')

// build table header and columns
const headerRow = table.appendChild(dom.createElement('tr'))
headerRow.classList.add('trackerBoardHeader')
const mainRow = table.appendChild(dom.createElement('tr'))
Expand All @@ -37,7 +38,6 @@ export function board (dom, columnValues, renderItem, options) {

function droppedURIHandler (uris) {
uris.forEach(function (u) {
console.log('Dropped on column: ' + u)
const item = store.sym(u)
options.columnDropHandler(item, x)
})
Expand Down
66 changes: 39 additions & 27 deletions src/csvButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import { icons, ns, utils, widgets } from 'solid-ui'
import { store } from 'solid-logic'
import { alertDialog } from './localUtils'
import * as debug from './debug'

export function quoteString (value) {
// https://www.rfc-editor.org/rfc/rfc4180
Expand All @@ -14,9 +16,11 @@ export function quoteString (value) {
return stripped
} // If contains comma then put in quotes and double up internal quotes
const quoted = '"' + stripped.replaceAll('"', '""') + '"'
console.log('Quoted: >>>' + quoted + '<<<')
const check = quoted.slice(1, -1).replaceAll('""', '')
if (check.includes('"')) throw new Error('CSV inconsistecy')
if (check.includes('"')) {
debug.error(`quoteString failed to quote properly, value: ${value}, quoted: ${quoted}, check: ${check}`)
throw new Error('CSV inconsistency')
}
return quoted
}

Expand All @@ -29,15 +33,15 @@ export function csvText (store, tracker) {
} else if (column.category) {
const types = store.each(task, ns.rdf('type'))
for (const t of types) {
// console.log('@@ checking subclass type: ', t, ' category: ', column.category )
if (store.holds(t, ns.rdfs('subClassOf'), column.category)) {
thing = t
}
}
if (!thing) return '?' + utils.label(column.category) // Missing cat OK
// if (!thing) throw new Error('wot no class of category ', column.category)
} else {
throw new Error('wot no pred or cat', column)
debug.error('column has no predicate or category', column)
throw new Error('Column has no predicate or category.')
}
return utils.label(thing)
}
Expand All @@ -49,7 +53,6 @@ export function csvText (store, tracker) {
}
const stateStore = store.any(tracker, ns.wf('stateStore'))
const tasks = store.each(null, ns.wf('tracker'), tracker, stateStore)
console.log(' CSV: Tasks:', tasks.length)

const columns = [

Expand All @@ -60,69 +63,78 @@ export function csvText (store, tracker) {
*/
]
const states = store.any(tracker, ns.wf('issueClass')) // Main states are subclasses of this class
console.log(' CSV: States - main superclass:', states)
const stateColumn = { label: 'State', category: states } // better than 'task'
console.log(' CSV: found column from state', stateColumn)
columns.push(stateColumn)

const categories = store.each(tracker, ns.wf('issueCategory'))
console.log(' CSV: Categories : ', categories)
console.log(' CSV: Categories : length: ', categories.length)
console.log(' CSV: Categories : first: ', categories[0])

const classifications = categories
for (const c of classifications) {
const column = { label: utils.label(c), category: c }
console.log(' CSV: found column from classifications', column)
columns.push(column) // Classes are different
}

// const propertyList = ns.wf('propertyList')
const form = store.any(tracker, ns.wf('extrasEntryForm'), null, null)
console.log(' CSV: Form : ', form)

if (form) {
const parts = store.any(form, ns.ui('parts'), null, form.doc())
console.log(' CSV: parts : ', parts)

const fields = parts.elements
console.log(' CSV: fields : ', fields)

for (const field of fields) {
const prop = store.any(field, ns.ui('property'))
if (prop) {
const lab = utils.label(prop)
const column = { label: lab, predicate: prop }
console.log(' CSV: found column from form', column)
columns.push(column)
}
}
}
// Put description on the end as it can be long
columns.push({ label: 'Description', predicate: ns.wf('description') })
console.log('Columns: ', columns.length)
const header = columns.map(col => col.label).join(',') + '\n'
console.log('CSV: Header= ', header)
// Order tasks?? By Creation date? By Status?
const body = tasks.map(taskLine).join('')
return header + body
}

export function csvButton (dom, tracker) {
const wrapper = dom.createElement('div')
let pendingCsvCopy = false

wrapper.addEventListener('copy', event => {
if (!pendingCsvCopy) return
pendingCsvCopy = false

let csv
try {
csv = csvText(store, tracker)
} catch (err) {
alertDialog(
`Could not generate CSV. Please check tracker data and try again.\n\nDetails: ${err?.message || String(err)}`,
'CSV export error',
dom
)
event.preventDefault()
return
}

event.preventDefault()
event.clipboardData.setData('text/plain', csv)
event.clipboardData.setData('text/csv', csv)
alertDialog('CSV data copied to clipboard.', 'CSV export', dom)
})

// Add a button
const button = widgets.button(dom, icons.iconBase + 'noun_Document_998605.svg',
'Copy as CSV', async _event => {
const div = button.parentNode.parentNode
console.log('button gparent div', div)
div.addEventListener('copy', event => {
// alert ('Copy caught');
const csv = csvText(store, tracker)
event.clipboardData.setData('text/plain', csv)
event.clipboardData.setData('text/csv', csv)
alert('Copy data: ' + csv)
event.preventDefault()
})
pendingCsvCopy = true
const copied = dom.execCommand('copy')
if (!copied) {
pendingCsvCopy = false
alertDialog('Could not copy CSV to clipboard. Please try again.', 'CSV export error', dom)
}
})

wrapper.appendChild(button)
Expand Down
49 changes: 49 additions & 0 deletions src/debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* Generative AI - Model: GPT-5.3-Codex used for configuration logic */
const LEVELS = {
trace: 10,
log: 20,
warn: 30,
error: 40,
silent: 99
}

let currentLevel = LEVELS.silent

function defaultWriter (level, ...args) {
const c = globalThis && globalThis['console']
if (!c) return
if (level === 'warn' && typeof c.warn === 'function') return c.warn(...args)
if (level === 'error' && typeof c.error === 'function') return c.error(...args)
if (typeof c.log === 'function') return c.log(...args)
}

let sink = defaultWriter

currentLevel = LEVELS.warn

export function configureDebug ({ level = 'warn', writer } = {}) {
currentLevel = LEVELS[level] ?? LEVELS.warn
sink = writer === undefined ? defaultWriter : writer
}

function emit (level, args) {
if (!sink) return
if ((LEVELS[level] ?? LEVELS.silent) < currentLevel) return
sink(level, ...args)
}

export function log (...args) {
emit('log', args)
}

export function warn (...args) {
emit('warn', args)
}

export function error (...args) {
emit('error', args)
}
Comment thread
SharonStrats marked this conversation as resolved.

export function trace (...args) {
emit('trace', args)
}
Loading