issue-pane 2.4.10-47ba5f95 → 2.4.10-5e2ce57c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "root": true,
3
2
  "env": {
4
3
  "browser": true,
5
4
  "es6": true,
6
5
  "node": true
7
6
  },
7
+ "extends": "standard",
8
8
  "globals": {
9
9
  "Atomics": "readonly",
10
10
  "SharedArrayBuffer": "readonly"
@@ -14,6 +14,5 @@
14
14
  "argsIgnorePattern": "^_",
15
15
  "varsIgnorePattern": "^_"
16
16
  }]
17
- },
18
- "extends": ["eslint:recommended", "plugin:import/recommended"]
17
+ }
19
18
  }
package/board.js CHANGED
@@ -10,10 +10,9 @@
10
10
  * @returns dom:Element
11
11
  */
12
12
 
13
- import * as UI from 'solid-ui'
13
+ import { ns, rdf, utils, widgets } from 'solid-ui'
14
14
  import { store } from 'solid-logic'
15
- const ns = UI.ns
16
- const $rdf = UI.rdf
15
+ const $rdf = rdf
17
16
 
18
17
  export function board (dom, columnValues, renderItem, options) {
19
18
  const board = dom.createElement('div')
@@ -27,7 +26,7 @@ export function board (dom, columnValues, renderItem, options) {
27
26
  const mainRow = table.appendChild(dom.createElement('tr'))
28
27
  columnValues.forEach(x => {
29
28
  const cell = headerRow.appendChild(dom.createElement('th'))
30
- cell.textContent = UI.utils.label(x, true) // Initial capital
29
+ cell.textContent = utils.label(x, true) // Initial capital
31
30
  cell.subject = x
32
31
  cell.style = 'margin: 0.3em; padding: 0.5em 1em; font-treatment: bold; font-size: 120%;'
33
32
 
@@ -44,7 +43,7 @@ export function board (dom, columnValues, renderItem, options) {
44
43
  }
45
44
 
46
45
  if (options.columnDropHandler) {
47
- UI.widgets.makeDropTarget(column, droppedURIHandler)
46
+ widgets.makeDropTarget(column, droppedURIHandler)
48
47
  }
49
48
  })
50
49
 
@@ -57,7 +56,7 @@ export function board (dom, columnValues, renderItem, options) {
57
56
  const classes = store.each(item, ns.rdf('type'))
58
57
  const catColors = classes.map(cat => store.any(cat, ns.ui('backgroundColor'))).filter(c => c)
59
58
 
60
- table.appendChild(UI.widgets.personTR(dom, null, item))
59
+ table.appendChild(widgets.personTR(dom, null, item))
61
60
  table.subject = item
62
61
  table.style = 'margin: 1em;' // @@ use style.js
63
62
  const backgroundColor = catColors[0] || store.any(category, ns.ui('backgroundColor'))
@@ -76,7 +75,7 @@ export function board (dom, columnValues, renderItem, options) {
76
75
  const actualRenderItem = renderItem || options.renderItem || defaultRenderItem
77
76
  function localRenderItem (subject) {
78
77
  const ele = actualRenderItem(subject)
79
- UI.widgets.makeDraggable(ele, subject)
78
+ widgets.makeDraggable(ele, subject)
80
79
  ele.subject = subject
81
80
  return ele
82
81
  }
@@ -88,7 +87,7 @@ export function board (dom, columnValues, renderItem, options) {
88
87
  items = items.filter(options.filter)
89
88
  }
90
89
  const sortedItems = sortedBy(items, sortBy, now, true)
91
- UI.utils.syncTableToArrayReOrdered(col, sortedItems, localRenderItem)
90
+ utils.syncTableToArrayReOrdered(col, sortedItems, localRenderItem)
92
91
  }
93
92
  }
94
93
 
package/issue.js CHANGED
@@ -5,6 +5,7 @@ import { authn, store } from 'solid-logic'
5
5
  import { newIssueForm } from './newIssue'
6
6
 
7
7
  const $rdf = rdf
8
+ const kb = store
8
9
 
9
10
  const SET_MODIFIED_DATES = false
10
11
 
@@ -18,7 +19,7 @@ function complain (message, context) {
18
19
  }
19
20
 
20
21
  export function isOpen (issue) {
21
- const types = store.findTypeURIs(issue)
22
+ const types = kb.findTypeURIs(issue)
22
23
  return !!types[ns.wf('Open').uri]
23
24
  }
24
25
 
@@ -26,13 +27,13 @@ export function iconForIssue (issue) {
26
27
  return isOpen(issue) ? TASK_ICON : CLOSED_TASK_ICON
27
28
  }
28
29
  export function getState (issue, classification) {
29
- const tracker = store.the(issue, ns.wf('tracker'), null, issue.doc())
30
- const states = store.any(tracker, ns.wf('issueClass'))
30
+ const tracker = kb.the(issue, ns.wf('tracker'), null, issue.doc())
31
+ const states = kb.any(tracker, ns.wf('issueClass'))
31
32
  classification = classification || states
32
- const types = store.each(issue, ns.rdf('type'))
33
- .filter(ty => store.holds(ty, ns.rdfs('subClassOf'), classification))
33
+ const types = kb.each(issue, ns.rdf('type'))
34
+ .filter(ty => kb.holds(ty, ns.rdfs('subClassOf'), classification))
34
35
  if (types.length !== 1) {
35
- // const initialState = store.any(tracker, ns.wf('initialState')) No do NOT default
36
+ // const initialState = kb.any(tracker, ns.wf('initialState')) No do NOT default
36
37
  // if (initialState) return initialState
37
38
  throw new Error('Issue must have one type as state: ' + types.length)
38
39
  }
@@ -40,8 +41,8 @@ export function getState (issue, classification) {
40
41
  }
41
42
 
42
43
  export function getBackgroundColorFromTypes (issue) {
43
- const classes = store.each(issue, ns.rdf('type')) // @@ pick cats in order then state
44
- const catColors = classes.map(cat => store.any(cat, ns.ui('backgroundColor'))).filter(c => !!c)
44
+ const classes = kb.each(issue, ns.rdf('type')) // @@ pick cats in order then state
45
+ const catColors = classes.map(cat => kb.any(cat, ns.ui('backgroundColor'))).filter(c => !!c)
45
46
 
46
47
  if (catColors.length) return catColors[0].value // pick first one
47
48
  return null
@@ -79,7 +80,7 @@ export function renderIssueCard (issue, context) {
79
80
  if (uncategorized) {
80
81
  const deleteButton = widgets.deleteButtonWithCheck(dom, buttonsCell, 'issue', async function () { // noun?
81
82
  try {
82
- await store.updater.update(store.connectedStatements(issue))
83
+ await kb.updater.update(kb.connectedStatements(issue))
83
84
  } catch (err) {
84
85
  complain(`Unable to delete issue: ${err}`, context)
85
86
  }
@@ -122,15 +123,15 @@ function renderSpacer (dom, backgroundColor) {
122
123
 
123
124
  export function renderIssue (issue, context) {
124
125
  // Don't bother changing the last modified dates of things: save time
125
- function setModifiedDate (subj, store, doc) {
126
+ function setModifiedDate (subj, kb, doc) {
126
127
  if (SET_MODIFIED_DATES) {
127
128
  if (!getOption(tracker, 'trackLastModified')) return
128
- const deletions = store.statementsMatching(issue, ns.dct('modified'))
129
- .concat(store.statementsMatching(issue, ns.wf('modifiedBy'))
129
+ const deletions = kb.statementsMatching(issue, ns.dct('modified'))
130
+ .concat(kb.statementsMatching(issue, ns.wf('modifiedBy'))
130
131
  )
131
132
  const insertions = [$rdf.st(issue, ns.dct('modified'), new Date(), doc)]
132
133
  if (me) insertions.push($rdf.st(issue, ns.wf('modifiedBy'), me, doc))
133
- store.updater.update(deletions, insertions, function (_uri, _ok, _body) {})
134
+ kb.updater.update(deletions, insertions, function (_uri, _ok, _body) {})
134
135
  }
135
136
  }
136
137
 
@@ -163,7 +164,7 @@ export function renderIssue (issue, context) {
163
164
  }
164
165
  function getOption (tracker, option) {
165
166
  // eg 'allowSubIssues'
166
- const opt = store.any(tracker, ns.ui(option))
167
+ const opt = kb.any(tracker, ns.ui(option))
167
168
  return !!(opt && opt.value)
168
169
  }
169
170
 
@@ -179,10 +180,10 @@ export function renderIssue (issue, context) {
179
180
 
180
181
  const dom = context.dom
181
182
  // eslint-disable-next-line no-use-before-define
182
- const tracker = store.the(issue, ns.wf('tracker'), null, issue.doc())
183
+ const tracker = kb.the(issue, ns.wf('tracker'), null, issue.doc())
183
184
  if (!tracker) throw new Error('No tracker')
184
185
  // eslint-disable-next-line no-use-before-define
185
- const stateStore = store.any(tracker, ns.wf('stateStore'))
186
+ const stateStore = kb.any(tracker, ns.wf('stateStore'))
186
187
  const store = issue.doc()
187
188
 
188
189
  const issueDiv = dom.createElement('div')
@@ -196,17 +197,17 @@ export function renderIssue (issue, context) {
196
197
  const iconButton = issueDiv.appendChild(widgets.button(dom, iconForIssue(issue)))
197
198
  widgets.makeDraggable(iconButton, issue) // Drag me wherever you need to do stuff with this issue
198
199
 
199
- const states = store.any(tracker, ns.wf('issueClass'))
200
+ const states = kb.any(tracker, ns.wf('issueClass'))
200
201
  if (!states) { throw new Error('This tracker ' + tracker + ' has no issueClass') }
201
202
  const select = widgets.makeSelectForCategory(
202
203
  dom,
203
- store,
204
+ kb,
204
205
  issue,
205
206
  states,
206
207
  stateStore,
207
208
  function (ok, body) {
208
209
  if (ok) {
209
- setModifiedDate(store, store, store)
210
+ setModifiedDate(store, kb, store)
210
211
  widgets.refreshTree(issueDiv)
211
212
  } else {
212
213
  console.log('Failed to change state:\n' + body)
@@ -215,18 +216,18 @@ export function renderIssue (issue, context) {
215
216
  )
216
217
  issueDiv.appendChild(select)
217
218
 
218
- const cats = store.each(tracker, ns.wf('issueCategory')) // zero or more
219
+ const cats = kb.each(tracker, ns.wf('issueCategory')) // zero or more
219
220
  for (const cat of cats) {
220
221
  issueDiv.appendChild(
221
222
  widgets.makeSelectForCategory(
222
223
  dom,
223
- store,
224
+ kb,
224
225
  issue,
225
226
  cat,
226
227
  stateStore,
227
228
  function (ok, body) {
228
229
  if (ok) {
229
- setModifiedDate(store, store, store)
230
+ setModifiedDate(store, kb, store)
230
231
  widgets.refreshTree(issueDiv)
231
232
  } else {
232
233
  console.log('Failed to change category:\n' + body)
@@ -270,7 +271,7 @@ export function renderIssue (issue, context) {
270
271
  wf:Task :creationForm core:coreIsueForm .
271
272
  `
272
273
  const CORE_ISSUE_FORM = ns.wf('coreIsueForm')
273
- $rdf.parse(coreIssueFormText, store, CORE_ISSUE_FORM.doc().uri, 'text/turtle')
274
+ $rdf.parse(coreIssueFormText, kb, CORE_ISSUE_FORM.doc().uri, 'text/turtle')
274
275
  const form = widgets.appendForm(
275
276
  dom,
276
277
  null, // was: container
@@ -285,11 +286,11 @@ export function renderIssue (issue, context) {
285
286
 
286
287
  // Assigned to whom?
287
288
 
288
- const assignments = store.statementsMatching(issue, ns.wf('assignee'))
289
+ const assignments = kb.statementsMatching(issue, ns.wf('assignee'))
289
290
  if (assignments.length > 1) {
290
291
  say('Weird, was assigned to more than one person. Fixing ..')
291
292
  const deletions = assignments.slice(1)
292
- store.updater.update(deletions, [], function (uri, ok, body) {
293
+ kb.updater.update(deletions, [], function (uri, ok, body) {
293
294
  if (ok) {
294
295
  say('Now fixed.')
295
296
  } else {
@@ -302,15 +303,15 @@ export function renderIssue (issue, context) {
302
303
  // Anyone assigned to any issue we know about
303
304
 
304
305
  async function getPossibleAssignees () {
305
- const devGroups = store.each(issue, ns.wf('assigneeGroup'))
306
- await store.fetcher.load(devGroups) // Load them all
307
- const groupDevs = devGroups.map(group => store.each(group, ns.vcard('member'), null, group.doc())).flat()
306
+ const devGroups = kb.each(issue, ns.wf('assigneeGroup'))
307
+ await kb.fetcher.load(devGroups) // Load them all
308
+ const groupDevs = devGroups.map(group => kb.each(group, ns.vcard('member'), null, group.doc())).flat()
308
309
  // Anyone who is a developer of any project which uses this tracker
309
- const proj = store.any(null, ns.doap('bug-database'), tracker) // What project?
310
+ const proj = kb.any(null, ns.doap('bug-database'), tracker) // What project?
310
311
  if (proj) {
311
- await store.fetcher.load(proj)
312
+ await kb.fetcher.load(proj)
312
313
  }
313
- const projectDevs = proj ? store.each(proj, ns.doap('developer')) : []
314
+ const projectDevs = proj ? kb.each(proj, ns.doap('developer')) : []
314
315
  return groupDevs.concat(projectDevs)
315
316
  }
316
317
 
@@ -323,7 +324,7 @@ export function renderIssue (issue, context) {
323
324
  getPossibleAssignees().then(devs => {
324
325
  if (devs.length) {
325
326
  devs.forEach(function (person) {
326
- store.fetcher.lookUpThing(person)
327
+ kb.fetcher.lookUpThing(person)
327
328
  }) // best effort async for names etc
328
329
  const opts = {
329
330
  // 'mint': '** Add new person **',
@@ -338,14 +339,14 @@ export function renderIssue (issue, context) {
338
339
  issueDiv.appendChild(
339
340
  widgets.makeSelectForOptions(
340
341
  dom,
341
- store,
342
+ kb,
342
343
  issue,
343
344
  ns.wf('assignee'),
344
345
  devs,
345
346
  opts,
346
347
  store,
347
348
  function (ok, body) {
348
- if (ok) setModifiedDate(store, store, store)
349
+ if (ok) setModifiedDate(store, kb, store)
349
350
  else console.log('Failed to change assignee:\n' + body)
350
351
  }
351
352
  )
@@ -357,7 +358,7 @@ export function renderIssue (issue, context) {
357
358
  */
358
359
  function supersOver (issue, stack) {
359
360
  stack = stack || []
360
- const sup = store.any(null, ns.wf('dependent'), issue, issue.doc())
361
+ const sup = kb.any(null, ns.wf('dependent'), issue, issue.doc())
361
362
  if (sup) return supersOver(sup, [sup].concat(stack))
362
363
  return stack
363
364
  }
@@ -369,7 +370,7 @@ export function renderIssue (issue, context) {
369
370
  const listOfSupers = subIssuePanel.appendChild(dom.createElement('div'))
370
371
  listOfSupers.style.display = 'flex'
371
372
  listOfSupers.refresh = function () {
372
- // const supers = store.each(null, ns.wf('dependent'), issue, issue.doc())
373
+ // const supers = kb.each(null, ns.wf('dependent'), issue, issue.doc())
373
374
  const supers = supersOver(issue)
374
375
  utils.syncTableToArrayReOrdered(listOfSupers, supers, renderSubIssue)
375
376
  }
@@ -381,7 +382,7 @@ export function renderIssue (issue, context) {
381
382
  listOfSubs.style.display = 'flex'
382
383
  listOfSubs.style.flexDirection = 'reverse' // Or center
383
384
  listOfSubs.refresh = function () {
384
- const subs = store.each(issue, ns.wf('dependent'), null, issue.doc())
385
+ const subs = kb.each(issue, ns.wf('dependent'), null, issue.doc())
385
386
  utils.syncTableToArrayReOrdered(listOfSubs, subs, renderSubIssue)
386
387
  }
387
388
  listOfSubs.refresh()
@@ -395,7 +396,7 @@ export function renderIssue (issue, context) {
395
396
  b.addEventListener(
396
397
  'click',
397
398
  function (_event) {
398
- subIssuePanel.insertBefore(newIssueForm(dom, store, tracker, issue, listOfSubs.refresh), b.nextSibling) // Pop form just after button
399
+ subIssuePanel.insertBefore(newIssueForm(dom, kb, tracker, issue, listOfSubs.refresh), b.nextSibling) // Pop form just after button
399
400
  },
400
401
  false
401
402
  )
@@ -404,7 +405,7 @@ export function renderIssue (issue, context) {
404
405
  issueDiv.appendChild(dom.createElement('br'))
405
406
 
406
407
  // Extras are stored centrally to the tracker
407
- const extrasForm = store.any(tracker, ns.wf('extrasEntryForm'))
408
+ const extrasForm = kb.any(tracker, ns.wf('extrasEntryForm'))
408
409
  if (extrasForm) {
409
410
  widgets.appendForm(
410
411
  dom,
@@ -422,31 +423,31 @@ export function renderIssue (issue, context) {
422
423
 
423
424
  const spacer = issueDiv.appendChild(renderSpacer(dom, backgroundColor))
424
425
 
425
- const template = store.anyValue(tracker, ns.wf('issueURITemplate'))
426
+ const template = kb.anyValue(tracker, ns.wf('issueURITemplate'))
426
427
  /*
427
- var chatDocURITemplate = store.anyValue(tracker, ns.wf('chatDocURITemplate')) // relaive to issue
428
+ var chatDocURITemplate = kb.anyValue(tracker, ns.wf('chatDocURITemplate')) // relaive to issue
428
429
  var chat
429
430
  if (chatDocURITemplate) {
430
431
  let template = $rdf.uri.join(chatDocURITemplate, issue.uri) // Template is relative to issue
431
- chat = store.sym(expandTemplate(template))
432
+ chat = kb.sym(expandTemplate(template))
432
433
  } else
433
434
  */
434
435
  let messageStore
435
436
  if (template) {
436
437
  messageStore = issue.doc() // for now. Could go deeper
437
438
  } else {
438
- messageStore = store.any(tracker, ns.wf('messageStore'))
439
- if (!messageStore) messageStore = store.any(tracker, ns.wf('stateStore'))
440
- store.sym(messageStore.uri + '#' + 'Chat' + timestring()) // var chat =
439
+ messageStore = kb.any(tracker, ns.wf('messageStore'))
440
+ if (!messageStore) messageStore = kb.any(tracker, ns.wf('stateStore'))
441
+ kb.sym(messageStore.uri + '#' + 'Chat' + timestring()) // var chat =
441
442
  }
442
443
 
443
- store.fetcher.nowOrWhenFetched(messageStore, function (ok, body, _xhr) {
444
+ kb.fetcher.nowOrWhenFetched(messageStore, function (ok, body, _xhr) {
444
445
  if (!ok) {
445
446
  const er = dom.createElement('p')
446
447
  er.textContent = body // @@ use nice error message
447
448
  issueDiv.insertBefore(er, spacer)
448
449
  } else {
449
- const discussion = messageArea(dom, store, issue, messageStore)
450
+ const discussion = messageArea(dom, kb, issue, messageStore)
450
451
  issueDiv.insertBefore(discussion, spacer)
451
452
  issueDiv.insertBefore(renderSpacer(dom, backgroundColor), discussion)
452
453
  } // Not sure why e stuck this in upwards rather than downwards
@@ -465,14 +466,14 @@ export function renderIssue (issue, context) {
465
466
  widgets.attachmentList(dom, issue, issueDiv, {
466
467
  doc: stateStore,
467
468
  promptIcon: icons.iconBase + 'noun_25830.svg',
468
- uploadFolder: store.sym(uploadFolderURI), // Allow local files to be uploaded
469
+ uploadFolder: kb.sym(uploadFolderURI), // Allow local files to be uploaded
469
470
  predicate: ns.wf('attachment')
470
471
  })
471
472
 
472
473
  // Delete button to delete the issue
473
474
  const deleteButton = widgets.deleteButtonWithCheck(dom, issueDiv, 'issue', async function () {
474
475
  try {
475
- await store.updater.update(store.connectedStatements(issue))
476
+ await kb.updater.update(kb.connectedStatements(issue))
476
477
  } catch (err) {
477
478
  complain(`Unable to delete issue: ${err}`, context)
478
479
  }
@@ -490,7 +491,7 @@ export function renderIssue (issue, context) {
490
491
  'click',
491
492
  async function (_event) {
492
493
  try {
493
- await store.fetcher.load(messageStore, { force: true, clearPreviousData: true })
494
+ await kb.fetcher.load(messageStore, { force: true, clearPreviousData: true })
494
495
  } catch (err) {
495
496
  alert(err)
496
497
  return
package/issuePane.js CHANGED
@@ -5,7 +5,7 @@
5
5
  **
6
6
  */
7
7
 
8
- import * as UI from 'solid-ui'
8
+ import { create, login, ns, icons, rdf, tabs, table, utils, widgets } from 'solid-ui'
9
9
  import { store, authn } from 'solid-logic'
10
10
  import { board } from './board' // @@ will later be in solid-UI
11
11
  import { renderIssue, renderIssueCard, getState, exposeOverlay } from './issue'
@@ -14,9 +14,7 @@ import { newIssueForm } from './newIssue'
14
14
  import { trackerSettingsFormText } from './trackerSettingsForm.js'
15
15
  // import { trackerInstancesFormText } from './trackerInstancesForm.js'
16
16
 
17
- const $rdf = UI.rdf
18
- const ns = UI.ns
19
- const widgets = UI.widgets
17
+ const $rdf = rdf
20
18
 
21
19
  // const MY_TRACKERS_ICON = UI.icons.iconBase + 'noun_Document_998605.svg'
22
20
  // const TRACKER_ICON = UI.icons.iconBase + 'noun_list_638112'
@@ -24,7 +22,7 @@ const widgets = UI.widgets
24
22
 
25
23
  const OVERFLOW_STYLE = 'position: fixed; z-index: 100; top: 1.51em; right: 2em; left: 2em; bottom:1.5em; border: 0.1em grey; overflow: scroll;'
26
24
  export default {
27
- icon: UI.icons.iconBase + 'noun_122196.svg', // was: js/panes/issue/tbl-bug-22.png
25
+ icon: icons.iconBase + 'noun_122196.svg', // was: js/panes/issue/tbl-bug-22.png
28
26
  // noun_list_638112 is a checklist document
29
27
  // noun_Document_998605.svg is a stack of twpo checklists
30
28
  // noun_97839.svg is a ladybug
@@ -39,7 +37,7 @@ export default {
39
37
  const t = store.findTypeURIs(subject)
40
38
  if (
41
39
  t['http://www.w3.org/2005/01/wf/flow#Task'] ||
42
- store.holds(subject, UI.ns.wf('tracker'))
40
+ store.holds(subject, ns.wf('tracker'))
43
41
  ) { return 'issue' } // in case ontology not available
44
42
  if (t['http://www.w3.org/2005/01/wf/flow#Tracker']) return 'tracker'
45
43
  // Later: Person. For a list of things assigned to them,
@@ -56,51 +54,50 @@ export default {
56
54
  const docs = deletions.concat(insertions).map(st => st.why)
57
55
  const uniqueDocs = Array.from(new Set(docs))
58
56
  const updates = uniqueDocs.map(doc =>
59
- kb.updater.update(deletions.filter(st => st.why.sameTerm(doc)),
57
+ store.updater.update(deletions.filter(st => st.why.sameTerm(doc)),
60
58
  insertions.filter(st => st.why.sameTerm(doc))))
61
59
  return Promise.all(updates)
62
60
  }
63
61
 
64
- const kb = context.session.store
65
- const ns = UI.ns
62
+ const store = context.session.store
66
63
  let stateStore
67
64
  if (options.newInstance) {
68
- stateStore = kb.sym(options.newInstance.doc().uri + '_state.ttl')
65
+ stateStore = store.sym(options.newInstance.doc().uri + '_state.ttl')
69
66
  } else {
70
- options.newInstance = kb.sym(options.newBase + 'index.ttl#this')
71
- stateStore = kb.sym(options.newBase + 'state.ttl')
67
+ options.newInstance = store.sym(options.newBase + 'index.ttl#this')
68
+ stateStore = store.sym(options.newBase + 'state.ttl')
72
69
  }
73
70
  const tracker = options.newInstance
74
71
  const appDoc = tracker.doc()
75
72
 
76
73
  const me = authn.currentUser()
77
74
  if (me) {
78
- kb.add(tracker, ns.dc('author'), me, appDoc)
75
+ store.add(tracker, ns.dc('author'), me, appDoc)
79
76
  }
80
77
 
81
- kb.add(tracker, ns.rdf('type'), ns.wf('Tracker'), appDoc)
82
- kb.add(tracker, ns.dc('created'), new Date(), appDoc)
78
+ store.add(tracker, ns.rdf('type'), ns.wf('Tracker'), appDoc)
79
+ store.add(tracker, ns.dc('created'), new Date(), appDoc)
83
80
 
84
81
  // @@ to do --- adk user what sort of tracker they want
85
82
 
86
- kb.add(tracker, ns.wf('issueClass'), ns.wf('Task'), appDoc) // @@ ask user
87
- kb.add(tracker, ns.wf('initialState'), ns.wf('Open'), appDoc)
88
- kb.add(tracker, ns.wf('stateStore'), stateStore, appDoc)
89
- kb.add(tracker, ns.wf('assigneeClass'), ns.foaf('Person'), appDoc) // @@ set to people in the meeting?
83
+ store.add(tracker, ns.wf('issueClass'), ns.wf('Task'), appDoc) // @@ ask user
84
+ store.add(tracker, ns.wf('initialState'), ns.wf('Open'), appDoc)
85
+ store.add(tracker, ns.wf('stateStore'), stateStore, appDoc)
86
+ store.add(tracker, ns.wf('assigneeClass'), ns.foaf('Person'), appDoc) // @@ set to people in the meeting?
90
87
 
91
- kb.add(tracker, ns.wf('stateStore'), stateStore, stateStore) // Back Link
88
+ store.add(tracker, ns.wf('stateStore'), stateStore, stateStore) // Back Link
92
89
 
93
- const ins = kb.statementsMatching(undefined, undefined, undefined, appDoc).concat(kb.statementsMatching(undefined, undefined, undefined, stateStore))
90
+ const ins = store.statementsMatching(undefined, undefined, undefined, appDoc).concat(store.statementsMatching(undefined, undefined, undefined, stateStore))
94
91
  try {
95
92
  await updateMany([], ins)
96
93
  } catch (err) {
97
- return UI.widgets.complain(context, 'Error writing tracker configuration: ' + err)
94
+ return widgets.complain(context, 'Error writing tracker configuration: ' + err)
98
95
  }
99
96
  /*
100
97
  try {
101
- await kb.updater.updateMany([], kb.statementsMatching(undefined, undefined, undefined, stateStore))
98
+ await store.updater.updateMany([], store.statementsMatching(undefined, undefined, undefined, stateStore))
102
99
  } catch (err) {
103
- return UI.widgets.complain(context, 'Error writing tracker state file: ' + err)
100
+ return widgets.complain(context, 'Error writing tracker state file: ' + err)
104
101
  }
105
102
  */
106
103
  const dom = context.dom
@@ -126,7 +123,7 @@ export default {
126
123
 
127
124
  function complain (message) {
128
125
  console.warn(message)
129
- paneDiv.appendChild(UI.widgets.errorMessageBlock(dom, message))
126
+ paneDiv.appendChild(widgets.errorMessageBlock(dom, message))
130
127
  }
131
128
 
132
129
  function complainIfBad (ok, message) {
@@ -140,37 +137,24 @@ export default {
140
137
  ** This is would not be needed if our quey language
141
138
  ** allowed is to query ardf Collection membership.
142
139
  */
143
- async function fixSubClasses (kb, tracker) { // 20220228
140
+ async function fixSubClasses (store, tracker) { // 20220228
144
141
  async function checkOneSuperclass (klass) {
145
- const collection = kb.any(klass, ns.owl('disjointUnionOf'), null, doc)
142
+ const collection = store.any(klass, ns.owl('disjointUnionOf'), null, doc)
146
143
  if (!collection) throw new Error(`Classification ${klass} has no disjointUnionOf`)
147
144
  if (!collection.elements) throw new Error(`Classification ${klass} has no array`)
148
145
  const needed = new Set(collection.elements.map(x => x.uri))
146
+ const existing = new Set(store.each(null, ns.rdfs('subClassOf'), klass, doc).map(x => x.uri))
149
147
 
150
- const existing = new Set(kb.each(null, ns.rdfs('subClassOf'), klass, doc).map(x => x.uri))
151
- const superfluous = existing.filter(sub => !needed.has(sub))
152
- const deleteActions = superfluous.map(sub => { return { action: 'delete', st: $rdf.st(kb.sym(sub), ns.rdfs('subClassOf'), klass, doc) } })
153
- /*
154
- for (const sub of existing) {
155
- if (!needed.has(sub)) {
156
- deletables.push($rdf.st(kb.sym(sub), ns.rdfs('subClassOf'), klass, doc))
157
- }
158
- }
159
- */
160
- const missing = needed.filter(sub => !existing.has(sub))
161
- const insertActions = missing.ma(sub => { return { action: 'insert', st: $rdf.st(kb.sym(sub), ns.rdfs('subClassOf'), klass, doc) } })
162
- /*
163
- for (const sub of needed) {
164
- if (!existing.has(sub)) {
165
- insertables.push($rdf.st(kb.sym(sub), ns.rdfs('subClassOf'), klass, doc))
166
- }
167
- }
168
- */
148
+ const superfluous = [...existing].filter(sub => !needed.has(sub))
149
+ const deleteActions = superfluous.map(sub => { return { action: 'delete', st: $rdf.st(store.sym(sub), ns.rdfs('subClassOf'), klass, doc) } })
150
+
151
+ const missing = [...needed].filter(sub => !existing.has(sub))
152
+ const insertActions = missing.map(sub => { return { action: 'insert', st: $rdf.st(store.sym(sub), ns.rdfs('subClassOf'), klass, doc) } })
169
153
  return deleteActions.concat(insertActions)
170
154
  }
171
155
  const doc = tracker.doc()
172
- const states = kb.any(tracker, ns.wf('issueClass'))
173
- const cats = kb.each(tracker, ns.wf('issueCategory')).concat([states])
156
+ const states = store.any(tracker, ns.wf('issueClass'))
157
+ const cats = store.each(tracker, ns.wf('issueCategory')).concat([states])
174
158
  let damage = [] // to make totally functionaly need to deal with map over async.
175
159
  for (const klass of cats) {
176
160
  damage = damage.concat(await checkOneSuperclass(klass))
@@ -181,7 +165,7 @@ export default {
181
165
  // alert(`Internal error: s${damage} subclasses inconsistences!`)
182
166
  console.log('Damage:', damage)
183
167
  if (confirm(`Fix ${damage} inconsistent subclasses in tracker config?`)) {
184
- await kb.updater.update(deletables, insertables)
168
+ await store.updater.update(deletables, insertables)
185
169
  }
186
170
  }
187
171
  }
@@ -210,7 +194,7 @@ export default {
210
194
  const stateStore = store.any(tracker, ns.wf('stateStore'))
211
195
 
212
196
  if (newState.sameTerm(currentState)) {
213
- // alert('Same state ' + UI.utils.label(currentState)) // @@ remove
197
+ // alert('Same state ' + utils.label(currentState)) // @@ remove
214
198
  return
215
199
  }
216
200
  try {
@@ -218,7 +202,7 @@ export default {
218
202
  [$rdf.st(issue, ns.rdf('type'), currentState, stateStore)],
219
203
  [$rdf.st(issue, ns.rdf('type'), newState, stateStore)])
220
204
  } catch (err) {
221
- UI.widgets.complain(context, 'Unable to change issue state: ' + err)
205
+ widgets.complain(context, 'Unable to change issue state: ' + err)
222
206
  }
223
207
  boardDiv.refresh() // reorganize board to match the new reality
224
208
  }
@@ -242,7 +226,7 @@ export default {
242
226
  /** ////////////// Table
243
227
  */
244
228
  function tableRefreshButton (stateStore, tableDiv) {
245
- const refreshButton = widgets.button(dom, UI.icons.iconBase + 'noun_479395.svg',
229
+ const refreshButton = widgets.button(dom, icons.iconBase + 'noun_479395.svg',
246
230
  'refresh table', async _event => {
247
231
  try {
248
232
  await store.fetcher.load(stateStore, { force: true, clearPreviousData: true })
@@ -250,7 +234,7 @@ export default {
250
234
  alert(err)
251
235
  return
252
236
  }
253
- UI.widgets.refreshTree(tableDiv)
237
+ widgets.refreshTree(tableDiv)
254
238
  })
255
239
  return refreshButton
256
240
  }
@@ -264,7 +248,7 @@ export default {
264
248
  const states = store.any(subject, ns.wf('issueClass'))
265
249
  const cats = store.each(tracker, ns.wf('issueCategory')) // zero or more
266
250
  const vars = ['issue', 'state', 'created']
267
- const query = new $rdf.Query(UI.utils.label(subject))
251
+ const query = new $rdf.Query(utils.label(subject))
268
252
  for (let i = 0; i < cats.length; i++) {
269
253
  vars.push('_cat_' + i)
270
254
  }
@@ -318,7 +302,7 @@ export default {
318
302
  exposeOverlay(subject, context)
319
303
  }
320
304
 
321
- const tableDiv = UI.table(dom, {
305
+ const tableDiv = table(dom, {
322
306
  query: query,
323
307
  keyVariable: '?issue', // Charactersic of row
324
308
  sortBy: '?created', // By default, sort by date
@@ -349,19 +333,19 @@ export default {
349
333
  }
350
334
  const issuePane = context.session.paneRegistry.byName('issue')
351
335
  const relevantPanes = [issuePane]
352
- UI.create.newThingUI(creationContext, context, relevantPanes) // Have to pass panes down newUI
336
+ create.newThingUI(creationContext, context, relevantPanes) // Have to pass panes down newUI
353
337
  return creationDiv
354
338
  }
355
339
 
356
340
  function renderInstances (theClass) {
357
341
  const instancesDiv = dom.createElement('div')
358
342
  const context = { dom, div: instancesDiv, noun: 'tracker' }
359
- UI.login.registrationList(context, { public: true, private: true, type: theClass }).then(_context2 => {
343
+ login.registrationList(context, { public: true, private: true, type: theClass }).then(_context2 => {
360
344
  instancesDiv.appendChild(renderCreationControl(instancesDiv))
361
345
  /* // keep this code in case we need a form
362
346
  const InstancesForm = ns.wf('TrackerInstancesForm')
363
347
  const text = trackerInstancesFormText
364
- $rdf.parse(text, kb, InstancesForm.doc().uri, 'text/turtle')
348
+ $rdf.parse(text, store, InstancesForm.doc().uri, 'text/turtle')
365
349
  widgets.appendForm(dom, instancesDiv, {}, tracker, InstancesForm,
366
350
  tracker.doc(), complainIfBad)
367
351
  */
@@ -370,9 +354,18 @@ export default {
370
354
  }
371
355
  function renderSettings (tracker) {
372
356
  const settingsDiv = dom.createElement('div')
357
+ const states = store.any(tracker, ns.wf('issueClass'))
358
+ const views = [tableView, states] // Possible default views
359
+ .concat(store.each(tracker, ns.wf('issueCategory')))
360
+ const box = settingsDiv.appendChild(dom.createElement('div'))
361
+ const lhs = widgets.renderNameValuePair(dom, store, box, null, 'Default view') // @@ use a predicate?
362
+ lhs.appendChild(widgets.makeSelectForOptions(dom, store, tracker,
363
+ ns.wf('defaultView'),
364
+ views, {}, tracker.doc()))
365
+
373
366
  // A registration control allows the to record this tracker in their type index
374
367
  const context = { dom, div: settingsDiv, noun: 'tracker' }
375
- UI.login.registrationControl(context, tracker, ns.wf('Tracker')).then(_context2 => {
368
+ login.registrationControl(context, tracker, ns.wf('Tracker')).then(_context2 => {
376
369
  const settingsForm = ns.wf('TrackerSettingsForm')
377
370
  const text = trackerSettingsFormText
378
371
  $rdf.parse(text, store, settingsForm.doc().uri, 'text/turtle')
@@ -404,7 +397,7 @@ export default {
404
397
  const items = [instancesView, tableView, states]
405
398
  .concat(store.each(tracker, ns.wf('issueCategory')))
406
399
  items.push(settingsView)
407
- const selectedTab = tableView.uri
400
+ const selectedTab = store.any(tracker, ns.wf('defaultView'), null, tracker.doc()) || tableView
408
401
  const options = { renderMain, items, selectedTab }
409
402
 
410
403
  // Add stuff to the ontologies which we believe but they don't say
@@ -413,15 +406,42 @@ export default {
413
406
  store.add(settingsView, ns.rdfs('label'), 'Settings', doc) // @@ squatting on wf ns
414
407
  store.add(states, ns.rdfs('label'), 'By State', doc) // @@ squatting on wf ns
415
408
 
416
- const tabs = UI.tabs.tabWidget(options)
417
- return tabs
409
+ const myTabs = tabs.tabWidget(options)
410
+ return myTabs
411
+ }
412
+
413
+ async function renderSingleIssue () {
414
+ tracker = store.any(subject, ns.wf('tracker'))
415
+ if (!tracker) throw new Error('This issue ' + subject + 'has no tracker')
416
+
417
+ // Much data is in the tracker instance, so wait for the data from it
418
+ try {
419
+ const _xhrs = await context.session.store.fetcher.load(tracker.doc())
420
+ } catch (err) {
421
+ const msg = 'Failed to load tracker config ' + tracker.doc() + ': ' + err
422
+ return complain(msg)
423
+ }
424
+
425
+ const stateStore = store.any(tracker, ns.wf('stateStore'))
426
+ if (!stateStore) {
427
+ return complain('Tracker has no state store: ' + tracker)
428
+ }
429
+ try {
430
+ await context.session.store.fetcher.load(subject)
431
+ } catch (err) {
432
+ return complain('Failed to load issue state ' + stateStore + ': ' + err)
433
+ }
434
+ paneDiv.appendChild(renderIssue(subject, context))
435
+ updater.addDownstreamChangeListener(stateStore, function () {
436
+ widgets.refreshTree(paneDiv)
437
+ }) // Live update
418
438
  }
419
439
 
420
440
  async function renderTracker () {
421
441
  function showNewIssue (issue) {
422
- UI.widgets.refreshTree(paneDiv)
442
+ widgets.refreshTree(paneDiv)
423
443
  exposeOverlay(issue, context)
424
- b.disabled = false // https://stackoverflow.com/questions/41176582/enable-disable-a-button-in-pure-javascript
444
+ newIssueButton.disabled = false // https://stackoverflow.com/questions/41176582/enable-disable-a-button-in-pure-javascript
425
445
  }
426
446
  tracker = subject
427
447
 
@@ -436,32 +456,32 @@ export default {
436
456
  const stateStore = store.any(subject, ns.wf('stateStore'))
437
457
  if (!stateStore) throw new Error('This tracker has no stateStore')
438
458
 
439
- authn.checkUser() // kick off async operation
459
+ // const me = await authn.currentUser()
440
460
 
441
461
  const h = dom.createElement('h2')
442
462
  h.setAttribute('style', 'font-size: 150%')
443
463
  paneDiv.appendChild(h)
444
- const classLabel = UI.utils.label(states)
464
+ const classLabel = utils.label(states)
445
465
  h.appendChild(dom.createTextNode(classLabel + ' list')) // Use class label @@I18n
446
466
 
447
467
  // New Issue button
448
- const b = dom.createElement('button')
468
+ const newIssueButton = dom.createElement('button')
449
469
  const container = dom.createElement('div')
450
- b.setAttribute('type', 'button')
451
- b.setAttribute('style', 'padding: 0.3em; font-size: 100%; margin: 0.5em; display: flex; align-items: center;')
452
- container.appendChild(b)
470
+ newIssueButton.setAttribute('type', 'button')
471
+ newIssueButton.setAttribute('style', 'padding: 0.3em; font-size: 100%; margin: 0.5em;')
472
+ container.appendChild(newIssueButton)
453
473
  paneDiv.appendChild(container)
454
474
  const img = dom.createElement('img')
455
- img.setAttribute('src', UI.icons.iconBase + 'noun_19460_green.svg')
475
+ img.setAttribute('src', icons.iconBase + 'noun_19460_green.svg')
456
476
  img.setAttribute('style', 'width: 1em; height: 1em; margin: 0.2em;')
457
- b.appendChild(img)
477
+ newIssueButton.appendChild(img)
458
478
  const span = dom.createElement('span')
459
479
  span.innerHTML = 'New ' + classLabel
460
- b.appendChild(span)
461
- b.addEventListener(
480
+ newIssueButton.appendChild(span)
481
+ newIssueButton.addEventListener(
462
482
  'click',
463
483
  function (_event) {
464
- b.disabled = true
484
+ newIssueButton.disabled = true
465
485
  container.appendChild(newIssueForm(dom, store, tracker, null, showNewIssue))
466
486
  },
467
487
  false
@@ -482,7 +502,7 @@ export default {
482
502
  } else {
483
503
  console.log('No table refresh function?!')
484
504
  }
485
- paneDiv.appendChild(newTrackerButton(subject))
505
+ paneDiv.appendChild(newTrackerButton(subject, context))
486
506
  updater.addDownstreamChangeListener(stateStore, tableDiv.refresh) // Live update
487
507
  })
488
508
  .catch(function (err) {
@@ -503,12 +523,12 @@ export default {
503
523
  let tracker
504
524
 
505
525
  // Whatever we are rendering, lets load the ontology
506
- const flowOntology = UI.ns.wf('').doc()
526
+ const flowOntology = ns.wf('').doc()
507
527
  if (!store.holds(undefined, undefined, undefined, flowOntology)) {
508
528
  // If not loaded already
509
529
  $rdf.parse(require('./wf.js'), store, flowOntology.uri, 'text/turtle') // Load ontology directly
510
530
  }
511
- const userInterfaceOntology = UI.ns.ui('').doc()
531
+ const userInterfaceOntology = ns.ui('').doc()
512
532
  if (!store.holds(undefined, undefined, undefined, userInterfaceOntology)) {
513
533
  // If not loaded already
514
534
  $rdf.parse(require('./ui.js'), store, userInterfaceOntology.uri, 'text/turtle') // Load ontology directly
@@ -517,54 +537,11 @@ export default {
517
537
  // Render a single issue
518
538
  if (
519
539
  t['http://www.w3.org/2005/01/wf/flow#Task'] ||
520
- store.holds(subject, UI.ns.wf('tracker'))
540
+ store.holds(subject, ns.wf('tracker'))
521
541
  ) {
522
- tracker = store.any(subject, ns.wf('tracker'))
523
- if (!tracker) throw new Error('This issue ' + subject + 'has no tracker')
524
-
525
- // Much data is in the tracker instance, so wait for the data from it
526
-
527
- context.session.store.fetcher
528
- .load(tracker.doc())
529
- .then(function (_xhrs) {
530
- const stateStore = store.any(tracker, ns.wf('stateStore'))
531
- context.session.store.fetcher.nowOrWhenFetched(
532
- stateStore,
533
- subject,
534
- function drawIssuePane2 (ok, body) {
535
- if (!ok) {
536
- return console.log(
537
- 'Failed to load state ' + stateStore + ' ' + body
538
- )
539
- }
540
- paneDiv.appendChild(renderIssue(subject, context))
541
- updater.addDownstreamChangeListener(stateStore, function () {
542
- UI.widgets.refreshTree(paneDiv)
543
- }) // Live update
544
- }
545
- )
546
- })
547
- .catch(err => {
548
- const msg = 'Failed to load config ' + tracker.doc() + ' ' + err
549
- return complain(msg)
550
- })
551
- context.session.store.fetcher.nowOrWhenFetched(
552
- tracker.doc(),
553
- subject,
554
- function drawIssuePane1 (ok, body) {
555
- if (!ok) {
556
- return console.log(
557
- 'Failed to load config ' + tracker.doc() + ' ' + body
558
- )
559
- }
560
- }
561
- ) // End nowOrWhenFetched tracker
562
-
563
- // /////////////////////////////////////////////////////////
564
- //
565
- // Render a Tracker instance
566
- //
542
+ renderSingleIssue().then(() => console.log('Single issue rendered'))
567
543
  } else if (t['http://www.w3.org/2005/01/wf/flow#Tracker']) {
544
+ // Render a Tracker instance
568
545
  renderTracker().then(() => console.log('Tracker rendered'))
569
546
  } else {
570
547
  console.log(
@@ -588,7 +565,7 @@ export default {
588
565
  return
589
566
  }
590
567
 
591
- loginOutButton = UI.login.loginStatusBox(dom, webIdUri => {
568
+ loginOutButton = authn.loginStatusBox(dom, webIdUri => {
592
569
  if (webIdUri) {
593
570
  context.me = store.sym(webIdUri)
594
571
  console.log('Web ID set from login button: ' + webIdUri)
package/newIssue.js CHANGED
@@ -1,9 +1,8 @@
1
1
  // Form to collect data about a New Issue
2
2
  //
3
- import * as UI from 'solid-ui'
3
+ import { ns, rdf, utils } from 'solid-ui'
4
4
 
5
- const $rdf = UI.rdf
6
- const ns = UI.ns
5
+ const $rdf = rdf
7
6
 
8
7
  export function newIssueForm (dom, kb, tracker, superIssue, showNewIssue) {
9
8
  const form = dom.createElement('div') // form is broken as HTML behaviour can resurface on js error
@@ -87,7 +86,7 @@ export function newIssueForm (dom, kb, tracker, superIssue, showNewIssue) {
87
86
  }
88
87
 
89
88
  const states = kb.any(tracker, ns.wf('issueClass'))
90
- const classLabel = UI.utils.label(states)
89
+ const classLabel = utils.label(states)
91
90
  form.innerHTML =
92
91
  '<h2>Add new ' +
93
92
  (superIssue ? 'sub ' : '') +
package/newTracker.js CHANGED
@@ -28,7 +28,6 @@ export function newTrackerButton (thisTracker, context) {
28
28
  if (u === stateStore.uri) return newStore // special case
29
29
  if (u.slice(0, oldBase.length) === oldBase) {
30
30
  u = base + u.slice(oldBase.length)
31
- $rdf.log.debug(' Map ' + x.uri + ' to ' + u)
32
31
  }
33
32
  return store.sym(u)
34
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "issue-pane",
3
- "version": "2.4.10-47ba5f95",
3
+ "version": "2.4.10-5e2ce57c",
4
4
  "description": "Solid-compatible Panes: issue editor",
5
5
  "main": "./issuePane.js",
6
6
  "scripts": {
@@ -35,15 +35,15 @@
35
35
  "homepage": "https://github.com/solid/issue-pane",
36
36
  "dependencies": {
37
37
  "pane-registry": "^2.4.7",
38
- "rdflib": "^2.2.18",
38
+ "rdflib": "^2.2.17",
39
39
  "solid-logic": "^1.3.14",
40
40
  "solid-ui": "^2.4.19"
41
41
  },
42
42
  "devDependencies": {
43
- "eslint": "^8.11.0",
44
- "eslint-plugin-import": "^2.25.4",
43
+ "eslint": "^7.32.0",
45
44
  "husky": "^7.0.4",
46
- "lint-staged": "^12.3.7"
45
+ "lint-staged": "^11.2.6",
46
+ "standard": "^16.0.4"
47
47
  },
48
48
  "husky": {
49
49
  "hooks": {