issue-pane 2.4.8 → 2.4.9-049826ec

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
File without changes
@@ -0,0 +1,59 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "**"
7
+ pull_request:
8
+ branches:
9
+ - "**"
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ node-version:
18
+ - 12.x
19
+ - 14.x
20
+ - 16.x
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Use Node.js ${{ matrix.node-version }}
24
+ uses: actions/setup-node@v1
25
+ with:
26
+ node-version: ${{ matrix.node-version }}
27
+ - run: npm ci
28
+ - run: npm run lint --if-present
29
+ - run: npm test
30
+ - run: npm run build --if-present
31
+ - name: Save build
32
+ if: matrix.node-version == '14.x'
33
+ uses: actions/upload-artifact@v2
34
+ with:
35
+ name: build
36
+ path: |
37
+ .
38
+ !node_modules
39
+ retention-days: 1
40
+ npm-publish-build:
41
+ needs: build
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/download-artifact@v2
45
+ with:
46
+ name: build
47
+ - uses: actions/setup-node@v1
48
+ with:
49
+ node-version: 14.x
50
+ - uses: rlespinasse/github-slug-action@v3.x
51
+ - name: Append commit hash to package version
52
+ run: 'sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
53
+ - name: Disable pre- and post-publish actions
54
+ run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
55
+ - uses: JS-DevTools/npm-publish@v1
56
+ with:
57
+ token: ${{ secrets.NPM_TOKEN }}
58
+ tag: ${{ env.GITHUB_REF_SLUG }}
59
+
package/.nvmrc CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/LICENSE.md CHANGED
File without changes
package/Makefile CHANGED
File without changes
package/README.md CHANGED
File without changes
package/board.js CHANGED
File without changes
package/issue.js CHANGED
@@ -8,11 +8,23 @@ const kb = store
8
8
 
9
9
  const SET_MODIFIED_DATES = false
10
10
 
11
+ export const TASK_ICON = icons.iconBase + 'noun_17020_gray-tick.svg'
12
+ export const OPEN_TASK_ICON = icons.iconBase + 'noun_17020_sans-tick.svg'
13
+ export const CLOSED_TASK_ICON = icons.iconBase + 'noun_17020.svg'
14
+
11
15
  function complain (message, context) {
12
16
  console.warn(message)
13
17
  context.paneDiv.appendChild(widgets.errorMessageBlock(context.dom, message))
14
18
  }
15
19
 
20
+ export function isOpen (issue) {
21
+ const types = kb.findTypeURIs(issue)
22
+ return !!types[ns.wf('Open').uri]
23
+ }
24
+
25
+ export function iconForIssue (issue) {
26
+ return isOpen(issue) ? TASK_ICON : CLOSED_TASK_ICON
27
+ }
16
28
  export function getState (issue, classification) {
17
29
  const tracker = kb.the(issue, ns.wf('tracker'), null, issue.doc())
18
30
  const states = kb.any(tracker, ns.wf('issueClass'))
@@ -27,26 +39,27 @@ export function getState (issue, classification) {
27
39
  return types[0]
28
40
  }
29
41
 
30
- export function renderIssueCard (issue, context) {
31
- function getBackgroundColor () {
32
- const classes = kb.each(issue, ns.rdf('type')) // @@ pick cats in order then state
33
- const catColors = classes.map(cat => kb.any(cat, ns.ui('backgroundColor'))).filter(c => !!c)
42
+ export function getBackgroundColorFromTypes (issue) {
43
+ const classes = kb.each(issue, ns.rdf('type')) // @@ pick cats in order then state
44
+ const catColors = classes.map(cat => kb.any(cat, ns.ui('backgroundColor'))).filter(c => !!c)
34
45
 
35
- if (catColors.length) return catColors[0].value // pick first one
36
- return null
37
- }
46
+ if (catColors.length) return catColors[0].value // pick first one
47
+ return null
48
+ }
49
+
50
+ export function renderIssueCard (issue, context) {
38
51
  function refresh () {
39
- const backgroundColor = getBackgroundColor() || 'white'
52
+ const backgroundColor = getBackgroundColorFromTypes(issue) || 'white'
40
53
  card.style.backgroundColor = backgroundColor
41
54
  editButton.style.backgroundColor = backgroundColor // Override white from style sheet
42
55
  }
43
56
  const dom = context.dom
44
- const uncategorized = !getBackgroundColor() // This is a suspect issue. Prompt to delete it
57
+ const uncategorized = !getBackgroundColorFromTypes(issue) // This is a suspect issue. Prompt to delete it
45
58
 
46
59
  const card = dom.createElement('div')
47
60
  const table = card.appendChild(dom.createElement('table'))
48
61
  table.style.width = '100%'
49
- const options = { draggable: false } // Let the baord make th ewhole card draggable
62
+ const options = { draggable: false } // Let the baord make the whole card draggable
50
63
  table.appendChild(widgets.personTR(dom, null, issue, options))
51
64
  table.subject = issue
52
65
  card.style = 'border-radius: 0.4em; border: 0.05em solid grey; margin: 0.3em;'
@@ -100,15 +113,21 @@ export function exposeOverlay (subject, context) {
100
113
  overlay.firstChild.style.overflow = 'auto' // was scroll
101
114
  }
102
115
 
116
+ function renderSpacer (dom, backgroundColor) {
117
+ const spacer = dom.createElement('div')
118
+ spacer.setAttribute('style', 'height: 1em; margin: 0.5em;') // spacer and placeHolder
119
+ spacer.style.backgroundColor = backgroundColor // try that
120
+ return spacer
121
+ }
122
+
103
123
  export function renderIssue (issue, context) {
104
124
  // Don't bother changing the last modified dates of things: save time
105
125
  function setModifiedDate (subj, kb, doc) {
106
126
  if (SET_MODIFIED_DATES) {
107
127
  if (!getOption(tracker, 'trackLastModified')) return
108
- let deletions = kb.statementsMatching(issue, ns.dct('modified'))
109
- deletions = deletions.concat(
110
- kb.statementsMatching(issue, ns.wf('modifiedBy'))
111
- )
128
+ const deletions = kb.statementsMatching(issue, ns.dct('modified'))
129
+ .concat(kb.statementsMatching(issue, ns.wf('modifiedBy'))
130
+ )
112
131
  const insertions = [$rdf.st(issue, ns.dct('modified'), new Date(), doc)]
113
132
  if (me) insertions.push($rdf.st(issue, ns.wf('modifiedBy'), me, doc))
114
133
  kb.updater.update(deletions, insertions, function (_uri, _ok, _body) {})
@@ -123,7 +142,7 @@ export function renderIssue (issue, context) {
123
142
  return pre
124
143
  }
125
144
 
126
- const timestring = function () {
145
+ function timestring () {
127
146
  const now = new Date()
128
147
  return '' + now.getTime()
129
148
  // http://www.w3schools.com/jsref/jsref_obj_date.asp
@@ -149,21 +168,15 @@ export function renderIssue (issue, context) {
149
168
  }
150
169
 
151
170
  function setPaneStyle () {
152
- const types = kb.findTypeURIs(issue)
153
- let mystyle = 'padding: 0.5em 1.5em 1em 1.5em; '
154
- let backgroundColor = null
155
- for (const uri in types) {
156
- backgroundColor = kb.any(
157
- kb.sym(uri),
158
- kb.sym('http://www.w3.org/ns/ui#backgroundColor')
159
- )
160
- if (backgroundColor) break
161
- }
162
- backgroundColor = backgroundColor ? backgroundColor.value : '#eee' // default grey
163
- mystyle += 'background-color: ' + backgroundColor + '; '
171
+ const backgroundColor = getBackgroundColorFromTypes(issue) || '#eee' // default grey
172
+ const mystyle0 = 'padding: 0.5em 1.5em 1em 1.5em; border: 0.7em;'
173
+ const mystyle = mystyle0 + 'border-color: ' + backgroundColor + '; '
164
174
  issueDiv.setAttribute('style', mystyle)
175
+ issueDiv.style.backgroundColor = 'white'
165
176
  }
166
177
 
178
+ /// ////////////// Body of renderIssue
179
+
167
180
  const dom = context.dom
168
181
  const tracker = kb.the(issue, ns.wf('tracker'), null, issue.doc())
169
182
  if (!tracker) throw new Error('No tracker')
@@ -171,12 +184,16 @@ export function renderIssue (issue, context) {
171
184
  const store = issue.doc()
172
185
 
173
186
  const issueDiv = dom.createElement('div')
174
- var me = authn.currentUser()
187
+ const me = authn.currentUser()
188
+ const backgroundColor = getBackgroundColorFromTypes(issue) || 'white'
175
189
 
176
190
  setPaneStyle()
177
191
 
178
192
  authn.checkUser() // kick off async operation
179
193
 
194
+ const iconButton = issueDiv.appendChild(widgets.button(dom, iconForIssue(issue)))
195
+ widgets.makeDraggable(iconButton, issue) // Drag me wherever you need to do stuff with this issue
196
+
180
197
  const states = kb.any(tracker, ns.wf('issueClass'))
181
198
  if (!states) { throw new Error('This tracker ' + tracker + ' has no issueClass') }
182
199
  const select = widgets.makeSelectForCategory(
@@ -197,13 +214,13 @@ export function renderIssue (issue, context) {
197
214
  issueDiv.appendChild(select)
198
215
 
199
216
  const cats = kb.each(tracker, ns.wf('issueCategory')) // zero or more
200
- for (let i = 0; i < cats.length; i++) {
217
+ for (const cat of cats) {
201
218
  issueDiv.appendChild(
202
219
  widgets.makeSelectForCategory(
203
220
  dom,
204
221
  kb,
205
222
  issue,
206
- cats[i],
223
+ cat,
207
224
  stateStore,
208
225
  function (ok, body) {
209
226
  if (ok) {
@@ -252,31 +269,17 @@ export function renderIssue (issue, context) {
252
269
  `
253
270
  const CORE_ISSUE_FORM = ns.wf('coreIsueForm')
254
271
  $rdf.parse(coreIssueFormText, kb, CORE_ISSUE_FORM.doc().uri, 'text/turtle')
255
- widgets.appendForm(
272
+ const form = widgets.appendForm(
256
273
  dom,
257
- issueDiv,
274
+ null, // was: container
258
275
  {},
259
276
  issue,
260
277
  CORE_ISSUE_FORM,
261
278
  stateStore,
262
279
  complainIfBad
263
280
  )
264
-
265
- // Descriptions can be long and are stored local to the issue
266
- /*
267
- issueDiv.appendChild(
268
- widgets.makeDescription(
269
- dom,
270
- kb,
271
- issue,
272
- ns.wf('description'),
273
- store,
274
- function (ok, body) {
275
- if (ok) setModifiedDate(store, kb, store)
276
- else console.log('Failed to change description:\n' + body)
277
- }
278
- )
279
- ) */
281
+ issueDiv.appendChild(form)
282
+ form.style.backgroundColor = backgroundColor
280
283
 
281
284
  // Assigned to whom?
282
285
 
@@ -297,20 +300,16 @@ export function renderIssue (issue, context) {
297
300
  // Anyone assigned to any issue we know about
298
301
 
299
302
  async function getPossibleAssignees () {
300
- let devs = []
301
303
  const devGroups = kb.each(issue, ns.wf('assigneeGroup'))
302
- for (let i = 0; i < devGroups.length; i++) {
303
- const group = devGroups[i]
304
- await kb.fetcher.load()
305
- devs = devs.concat(kb.each(group, ns.vcard('member')))
306
- }
304
+ await kb.fetcher.load(devGroups) // Load them all
305
+ const groupDevs = devGroups.map(group => kb.each(group, ns.vcard('member'), null, group.doc())).flat()
307
306
  // Anyone who is a developer of any project which uses this tracker
308
307
  const proj = kb.any(null, ns.doap('bug-database'), tracker) // What project?
309
308
  if (proj) {
310
309
  await kb.fetcher.load(proj)
311
- devs = devs.concat(kb.each(proj, ns.doap('developer')))
312
310
  }
313
- return devs
311
+ const projectDevs = proj ? kb.each(proj, ns.doap('developer')) : []
312
+ return groupDevs.concat(projectDevs)
314
313
  }
315
314
 
316
315
  // Super issues first - like parent directories .. maybe use breadcrums from?? @@
@@ -352,27 +351,36 @@ export function renderIssue (issue, context) {
352
351
  }
353
352
  })
354
353
 
355
- /* The trees of super issues and subissues
354
+ /* The trees of super-issues and sub-issues
356
355
  */
357
- let subIssuePanel
356
+ function supersOver (issue, stack) {
357
+ stack = stack || []
358
+ const sup = kb.any(null, ns.wf('dependent'), issue, issue.doc())
359
+ if (sup) return supersOver(sup, [sup].concat(stack))
360
+ return stack
361
+ }
358
362
  if (getOption(tracker, 'allowSubIssues')) {
359
- if (!subIssuePanel) {
360
- subIssuePanel = issueDiv.appendChild(dom.createElement('div'))
361
- subIssuePanel.style = 'margin: 1em; padding: 1em;'
362
- }
363
+ const subIssuePanel = issueDiv.appendChild(dom.createElement('div'))
364
+ subIssuePanel.style = 'margin: 1em; padding: 1em;'
363
365
 
364
366
  subIssuePanel.appendChild(dom.createElement('h4')).textContent = 'Super Issues'
365
367
  const listOfSupers = subIssuePanel.appendChild(dom.createElement('div'))
368
+ listOfSupers.style.display = 'flex'
366
369
  listOfSupers.refresh = function () {
367
- utils.syncTableToArrayReOrdered(listOfSupers, kb.each(null, ns.wf('dependent'), issue), renderSubIssue)
370
+ // const supers = kb.each(null, ns.wf('dependent'), issue, issue.doc())
371
+ const supers = supersOver(issue)
372
+ utils.syncTableToArrayReOrdered(listOfSupers, supers, renderSubIssue)
368
373
  }
369
374
  listOfSupers.refresh()
370
375
 
371
376
  // Sub issues
372
377
  subIssuePanel.appendChild(dom.createElement('h4')).textContent = 'Sub Issues'
373
378
  const listOfSubs = subIssuePanel.appendChild(dom.createElement('div'))
379
+ listOfSubs.style.display = 'flex'
380
+ listOfSubs.style.flexDirection = 'reverse' // Or center
374
381
  listOfSubs.refresh = function () {
375
- utils.syncTableToArrayReOrdered(listOfSubs, kb.each(issue, ns.wf('dependent')), renderSubIssue)
382
+ const subs = kb.each(issue, ns.wf('dependent'), null, issue.doc())
383
+ utils.syncTableToArrayReOrdered(listOfSubs, subs, renderSubIssue)
376
384
  }
377
385
  listOfSubs.refresh()
378
386
 
@@ -405,12 +413,12 @@ export function renderIssue (issue, context) {
405
413
  stateStore,
406
414
  complainIfBad
407
415
  )
416
+ // issueDiv.appendChild(renderSpacer(backgroundColor))
408
417
  }
409
418
 
410
419
  // Comment/discussion area
411
420
 
412
- const spacer = issueDiv.appendChild(dom.createElement('tr'))
413
- spacer.setAttribute('style', 'height: 1em') // spacer and placeHolder
421
+ const spacer = issueDiv.appendChild(renderSpacer(dom, backgroundColor))
414
422
 
415
423
  const template = kb.anyValue(tracker, ns.wf('issueURITemplate'))
416
424
  /*
@@ -438,7 +446,8 @@ export function renderIssue (issue, context) {
438
446
  } else {
439
447
  const discussion = messageArea(dom, kb, issue, messageStore)
440
448
  issueDiv.insertBefore(discussion, spacer)
441
- }
449
+ issueDiv.insertBefore(renderSpacer(dom, backgroundColor), discussion)
450
+ } // Not sure why e stuck this in upwards rather than downwards
442
451
  })
443
452
 
444
453
  // Draggable attachment list
@@ -446,12 +455,11 @@ export function renderIssue (issue, context) {
446
455
  attachmentHint.innerHTML = `<h4>Attachments</h4>
447
456
  <p>Drag files, emails,
448
457
  web pages onto the paper clip, or click the file upload button.</p>`
449
- let uploadFolderURI
450
- if (issue.uri.endsWith('/index.ttl#this')) { // This has a whole folder to itself
451
- uploadFolderURI = issue.uri.slice(0, 14) + 'Files/' // back to slash
452
- } else { // like state.ttl#Iss1587852322438
453
- uploadFolderURI = issue.dir().uri + 'Files/' + issue.uri.split('#')[1] + '/' // New folder for issue in file with others
454
- }
458
+ const uploadFolderURI =
459
+ issue.uri.endsWith('/index.ttl#this') // This has a whole folder to itself
460
+ ? issue.uri.slice(0, 14) + 'Files/' // back to slash
461
+ : issue.dir().uri + 'Files/' + issue.uri.split('#')[1] + '/' // New folder for issue in file with others
462
+
455
463
  widgets.attachmentList(dom, issue, issueDiv, {
456
464
  doc: stateStore,
457
465
  promptIcon: icons.iconBase + 'noun_25830.svg',
package/issuePane.js CHANGED
@@ -61,7 +61,7 @@ export default {
61
61
  return Promise.all(updates)
62
62
  }
63
63
 
64
- var kb = context.session.store
64
+ const kb = context.session.store
65
65
  const ns = UI.ns
66
66
  let stateStore
67
67
  if (options.newInstance) {
@@ -140,41 +140,49 @@ export default {
140
140
  ** This is would not be needed if our quey language
141
141
  ** allowed is to query ardf Collection membership.
142
142
  */
143
- async function fixSubClasses (kb, tracker) {
143
+ async function fixSubClasses (kb, tracker) { // 20220228
144
144
  async function checkOneSuperclass (klass) {
145
145
  const collection = kb.any(klass, ns.owl('disjointUnionOf'), null, doc)
146
146
  if (!collection) throw new Error(`Classification ${klass} has no disjointUnionOf`)
147
147
  if (!collection.elements) throw new Error(`Classification ${klass} has no array`)
148
148
  const needed = new Set(collection.elements.map(x => x.uri))
149
- const existing = new Set(kb.each(null, ns.rdfs('subClassOf'), klass, doc)
150
- .map(x => x.uri))
149
+
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
+ /*
151
154
  for (const sub of existing) {
152
155
  if (!needed.has(sub)) {
153
156
  deletables.push($rdf.st(kb.sym(sub), ns.rdfs('subClassOf'), klass, doc))
154
157
  }
155
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
+ /*
156
163
  for (const sub of needed) {
157
164
  if (!existing.has(sub)) {
158
165
  insertables.push($rdf.st(kb.sym(sub), ns.rdfs('subClassOf'), klass, doc))
159
166
  }
160
167
  }
168
+ */
169
+ return deleteActions.concat(insertActions)
161
170
  }
162
171
  const doc = tracker.doc()
163
172
  const states = kb.any(tracker, ns.wf('issueClass'))
164
- const cats = kb.each(tracker, ns.wf('issueCategory'))
165
- var insertables = []
166
- var deletables = []
167
- cats.push(states)
173
+ const cats = kb.each(tracker, ns.wf('issueCategory')).concat([states])
174
+ let damage = [] // to make totally functionaly need to deal with map over async.
168
175
  for (const klass of cats) {
169
- await checkOneSuperclass(klass)
176
+ damage = damage.concat(await checkOneSuperclass(klass))
170
177
  }
171
- const damage = insertables.length + deletables.length
172
- if (damage) {
173
- alert(`Internal error: s${damage} subclasses inconsistences!`)
174
- /*
178
+ if (damage.length) {
179
+ const insertables = damage.filter(fix => fix.action === 'insert').map(fix => fix.st)
180
+ const deletables = damage.filter(fix => fix.action === 'delete').map(fix => fix.st)
181
+ // alert(`Internal error: s${damage} subclasses inconsistences!`)
182
+ console.log('Damage:', damage)
175
183
  if (confirm(`Fix ${damage} inconsistent subclasses in tracker config?`)) {
176
184
  await kb.updater.update(deletables, insertables)
177
- */
185
+ }
178
186
  }
179
187
  }
180
188
 
@@ -256,7 +264,7 @@ export default {
256
264
  const states = kb.any(subject, ns.wf('issueClass'))
257
265
  const cats = kb.each(tracker, ns.wf('issueCategory')) // zero or more
258
266
  const vars = ['issue', 'state', 'created']
259
- var query = new $rdf.Query(UI.utils.label(subject))
267
+ const query = new $rdf.Query(UI.utils.label(subject))
260
268
  for (let i = 0; i < cats.length; i++) {
261
269
  vars.push('_cat_' + i)
262
270
  }
@@ -396,7 +404,7 @@ export default {
396
404
  const items = [instancesView, tableView, states]
397
405
  .concat(kb.each(tracker, ns.wf('issueCategory')))
398
406
  items.push(settingsView)
399
- const selectedTab = tableView
407
+ const selectedTab = tableView.uri
400
408
  const options = { renderMain, items, selectedTab }
401
409
 
402
410
  // Add stuff to the ontologies which we believe but they don't say
@@ -437,7 +445,7 @@ export default {
437
445
  h.appendChild(dom.createTextNode(classLabel + ' list')) // Use class label @@I18n
438
446
 
439
447
  // New Issue button
440
- var b = dom.createElement('button')
448
+ const b = dom.createElement('button')
441
449
  const container = dom.createElement('div')
442
450
  b.setAttribute('type', 'button')
443
451
  b.setAttribute('style', 'padding: 0.3em; font-size: 100%; margin: 0.5em;')
@@ -572,8 +580,6 @@ export default {
572
580
  overlay.style = OVERFLOW_STYLE
573
581
  overlay.style.visibility = 'hidden'
574
582
 
575
- // var overlayPane = null // overlay.appendChild(dom.createElement('div')) // avoid stomping on style by pane
576
-
577
583
  UI.authn.checkUser().then(webId => {
578
584
  if (webId) {
579
585
  console.log('Web ID set already: ' + webId)
package/newIssue.js CHANGED
@@ -19,7 +19,6 @@ export function newIssueForm (dom, kb, tracker, superIssue, showNewIssue) {
19
19
  titlefield.setAttribute('class', 'pendingedit')
20
20
  titlefield.disabled = true
21
21
  const sts = []
22
- let issue
23
22
 
24
23
  const expandTemplate = function (template) {
25
24
  const now = new $rdf.Literal(new Date())
@@ -34,34 +33,30 @@ export function newIssueForm (dom, kb, tracker, superIssue, showNewIssue) {
34
33
  .replace('{DD}', DD)
35
34
  }
36
35
  // Where to store the new issue?
37
- let template = kb.anyValue(tracker, ns.wf('issueURITemplate'))
38
- let issueDoc
39
- if (template) {
36
+ const template = kb.anyValue(tracker, ns.wf('issueURITemplate'))
37
+ const issue = template
40
38
  // Does each issue do in its own file?
41
- template = $rdf.uri.join(template, stateStore.uri) // Template is relative
42
- issue = kb.sym(expandTemplate(template))
43
- } else {
44
- issue = kb.sym(stateStore.uri + '#' + 'Iss' + timestring())
45
- }
46
- // eslint-disable-next-line prefer-const
47
- issueDoc = issue.doc()
39
+ ? kb.sym(expandTemplate($rdf.uri.join(template, stateStore.uri)))
40
+ : kb.sym(stateStore.uri + '#' + 'Iss' + timestring())
41
+
42
+ const issueDoc = issue.doc()
48
43
 
49
44
  // Basic 9 core predicates are stored in the main stateStore
50
45
 
51
46
  const title = kb.literal(titlefield.value)
52
47
  sts.push(new $rdf.Statement(issue, ns.wf('tracker'), tracker, stateStore))
53
48
  sts.push(new $rdf.Statement(issue, ns.dc('title'), title, stateStore))
54
- sts.push(
55
- new $rdf.Statement(issue, ns.dct('created'), new Date(), stateStore)
56
- )
57
- const initialStates = kb.each(tracker, ns.wf('initialState'))
58
- if (initialStates.length === 0) { console.log('This tracker has no initialState') }
59
- for (let i = 0; i < initialStates.length; i++) {
49
+ sts.push(new $rdf.Statement(issue, ns.dct('created'), new Date(), stateStore))
50
+ // Copy states from super issue as after all they are subtasks so initially same state same category
51
+ const initialStates = superIssue
52
+ ? kb.each(superIssue, ns.rdf('type'), null, superIssue.doc())
53
+ : kb.each(tracker, ns.wf('initialState'))
54
+ for (const state of initialStates) {
60
55
  sts.push(
61
56
  new $rdf.Statement(
62
57
  issue,
63
58
  ns.rdf('type'),
64
- initialStates[i],
59
+ state,
65
60
  stateStore
66
61
  )
67
62
  )
@@ -100,7 +95,7 @@ export function newIssueForm (dom, kb, tracker, superIssue, showNewIssue) {
100
95
  '</h2><p>Title of new ' +
101
96
  classLabel +
102
97
  ':</p>'
103
- var titlefield = dom.createElement('input')
98
+ const titlefield = dom.createElement('input')
104
99
  titlefield.setAttribute('type', 'text')
105
100
  titlefield.setAttribute(
106
101
  'style',
@@ -119,5 +114,6 @@ export function newIssueForm (dom, kb, tracker, superIssue, showNewIssue) {
119
114
  false
120
115
  )
121
116
  form.appendChild(titlefield)
117
+ titlefield.focus() // we want user cursor here
122
118
  return form
123
119
  }
package/newTracker.js CHANGED
@@ -20,6 +20,19 @@ export function newTrackerButton (thisTracker, context) {
20
20
  ws,
21
21
  base
22
22
  ) {
23
+ function morph (x) {
24
+ // Move any URIs in this space into that space
25
+ if (x.elements !== undefined) return x.elements.map(morph) // Morph within lists
26
+ if (x.uri === undefined) return x
27
+ let u = x.uri
28
+ if (u === stateStore.uri) return newStore // special case
29
+ if (u.slice(0, oldBase.length) === oldBase) {
30
+ u = base + u.slice(oldBase.length)
31
+ $rdf.log.debug(' Map ' + x.uri + ' to ' + u)
32
+ }
33
+ return kb.sym(u)
34
+ }
35
+
23
36
  const appPathSegment = 'issuetracker.w3.org' // how to allocate this string and connect to
24
37
  // console.log("Ready to make new instance at "+ws)
25
38
  const sp = UI.ns.space
@@ -46,18 +59,6 @@ export function newTrackerButton (thisTracker, context) {
46
59
 
47
60
  const oldBase = here.uri.slice(0, here.uri.lastIndexOf('/') + 1)
48
61
 
49
- var morph = function (x) {
50
- // Move any URIs in this space into that space
51
- if (x.elements !== undefined) return x.elements.map(morph) // Morph within lists
52
- if (x.uri === undefined) return x
53
- let u = x.uri
54
- if (u === stateStore.uri) return newStore // special case
55
- if (u.slice(0, oldBase.length) === oldBase) {
56
- u = base + u.slice(oldBase.length)
57
- $rdf.log.debug(' Map ' + x.uri + ' to ' + u)
58
- }
59
- return kb.sym(u)
60
- }
61
62
  const there = morph(here)
62
63
  const newTracker = morph(thisTracker)
63
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "issue-pane",
3
- "version": "2.4.8",
3
+ "version": "2.4.9-049826ec",
4
4
  "description": "Solid-compatible Panes: issue editor",
5
5
  "main": "./issuePane.js",
6
6
  "scripts": {
@@ -8,8 +8,8 @@
8
8
  "lint": "eslint '*.js'",
9
9
  "lint-fix": "eslint '*.js' --fix",
10
10
  "test": "npm run lint",
11
- "prepublishOnly": "npm test",
12
- "postpublish": "git push origin main --follow-tags"
11
+ "ignore:prepublishOnly": "npm test",
12
+ "ignore:postpublish": "git push origin main --follow-tags"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -34,9 +34,9 @@
34
34
  },
35
35
  "homepage": "https://github.com/solid/issue-pane",
36
36
  "dependencies": {
37
- "pane-registry": "^2.4.3",
38
- "rdflib": "^2.2.10",
39
- "solid-ui": "^2.4.11"
37
+ "pane-registry": "^2.4.6",
38
+ "rdflib": "^2.2.17",
39
+ "solid-ui": "^2.4.15"
40
40
  },
41
41
  "devDependencies": {
42
42
  "eslint": "^7.32.0",
package/tbl-bug-22.png CHANGED
File without changes
File without changes
File without changes
package/ui.js CHANGED
File without changes
package/ui.ttl CHANGED
File without changes
package/wf.js CHANGED
File without changes
package/wf.ttl CHANGED
File without changes