issue-pane 2.4.9 → 2.4.10
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/.github/workflows/ci.yml +31 -2
- package/board.js +7 -7
- package/issue.js +54 -52
- package/issuePane.js +46 -46
- package/newTracker.js +14 -14
- package/package.json +4 -3
package/.github/workflows/ci.yml
CHANGED
|
@@ -24,7 +24,36 @@ jobs:
|
|
|
24
24
|
uses: actions/setup-node@v1
|
|
25
25
|
with:
|
|
26
26
|
node-version: ${{ matrix.node-version }}
|
|
27
|
-
- run: npm install -g npm # for issues with executables on npm 7
|
|
28
27
|
- run: npm ci
|
|
28
|
+
- run: npm run lint --if-present
|
|
29
29
|
- run: npm test
|
|
30
|
-
- run: npm run build
|
|
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/board.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import * as UI from 'solid-ui'
|
|
14
|
-
|
|
14
|
+
import { store } from 'solid-logic'
|
|
15
15
|
const ns = UI.ns
|
|
16
16
|
const $rdf = UI.rdf
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ export function board (dom, columnValues, renderItem, options) {
|
|
|
38
38
|
function droppedURIHandler (uris) {
|
|
39
39
|
uris.forEach(function (u) {
|
|
40
40
|
console.log('Dropped on column: ' + u)
|
|
41
|
-
const item =
|
|
41
|
+
const item = store.sym(u)
|
|
42
42
|
options.columnDropHandler(item, x)
|
|
43
43
|
})
|
|
44
44
|
}
|
|
@@ -54,19 +54,19 @@ export function board (dom, columnValues, renderItem, options) {
|
|
|
54
54
|
function defaultRenderItem (item, category) {
|
|
55
55
|
const card = dom.createElement('div')
|
|
56
56
|
const table = card.appendChild(dom.createElement('table'))
|
|
57
|
-
const classes =
|
|
58
|
-
const catColors = classes.map(cat =>
|
|
57
|
+
const classes = store.each(item, ns.rdf('type'))
|
|
58
|
+
const catColors = classes.map(cat => store.any(cat, ns.ui('backgroundColor'))).filter(c => c)
|
|
59
59
|
|
|
60
60
|
table.appendChild(UI.widgets.personTR(dom, null, item))
|
|
61
61
|
table.subject = item
|
|
62
62
|
table.style = 'margin: 1em;' // @@ use style.js
|
|
63
|
-
const backgroundColor = catColors[0] ||
|
|
63
|
+
const backgroundColor = catColors[0] || store.any(category, ns.ui('backgroundColor'))
|
|
64
64
|
card.style.backgroundColor = backgroundColor ? backgroundColor.value : '#fff'
|
|
65
65
|
return card
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function sortedBy (values, predicate, defaultSortValue, reverse) {
|
|
69
|
-
const toBeSorted = values.map(x => [
|
|
69
|
+
const toBeSorted = values.map(x => [store.any(x, predicate) || defaultSortValue, x])
|
|
70
70
|
toBeSorted.sort()
|
|
71
71
|
if (reverse) toBeSorted.reverse() // @@ check
|
|
72
72
|
return toBeSorted.map(pair => pair[1])
|
|
@@ -82,7 +82,7 @@ export function board (dom, columnValues, renderItem, options) {
|
|
|
82
82
|
}
|
|
83
83
|
for (let col = mainRow.firstChild; col; col = col.nextSibling) {
|
|
84
84
|
const category = col.subject
|
|
85
|
-
let items =
|
|
85
|
+
let items = store.each(null, ns.rdf('type'), category)
|
|
86
86
|
const sortBy = options.sortBy || ns.dct('created')
|
|
87
87
|
if (options.filter) {
|
|
88
88
|
items = items.filter(options.filter)
|
package/issue.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// All the UI for a single issue, without store load or listening for changes
|
|
2
2
|
//
|
|
3
|
-
import {
|
|
3
|
+
import { icons, messageArea, ns, rdf, style, utils, widgets } from 'solid-ui'
|
|
4
|
+
import { authn, store } from 'solid-logic'
|
|
4
5
|
import { newIssueForm } from './newIssue'
|
|
5
6
|
|
|
6
7
|
const $rdf = rdf
|
|
7
|
-
const kb = store
|
|
8
8
|
|
|
9
9
|
const SET_MODIFIED_DATES = false
|
|
10
10
|
|
|
@@ -14,11 +14,11 @@ function complain (message, context) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function getState (issue, classification) {
|
|
17
|
-
const tracker =
|
|
18
|
-
const states =
|
|
17
|
+
const tracker = store.the(issue, ns.wf('tracker'), null, issue.doc())
|
|
18
|
+
const states = store.any(tracker, ns.wf('issueClass'))
|
|
19
19
|
classification = classification || states
|
|
20
|
-
const types =
|
|
21
|
-
.filter(ty =>
|
|
20
|
+
const types = store.each(issue, ns.rdf('type'))
|
|
21
|
+
.filter(ty => store.holds(ty, ns.rdfs('subClassOf'), classification))
|
|
22
22
|
if (types.length !== 1) {
|
|
23
23
|
// const initialState = kb.any(tracker, ns.wf('initialState')) No do NOT default
|
|
24
24
|
// if (initialState) return initialState
|
|
@@ -29,8 +29,8 @@ export function getState (issue, classification) {
|
|
|
29
29
|
|
|
30
30
|
export function renderIssueCard (issue, context) {
|
|
31
31
|
function getBackgroundColor () {
|
|
32
|
-
const classes =
|
|
33
|
-
const catColors = classes.map(cat =>
|
|
32
|
+
const classes = store.each(issue, ns.rdf('type')) // @@ pick cats in order then state
|
|
33
|
+
const catColors = classes.map(cat => store.any(cat, ns.ui('backgroundColor'))).filter(c => !!c)
|
|
34
34
|
|
|
35
35
|
if (catColors.length) return catColors[0].value // pick first one
|
|
36
36
|
return null
|
|
@@ -66,7 +66,7 @@ export function renderIssueCard (issue, context) {
|
|
|
66
66
|
if (uncategorized) {
|
|
67
67
|
const deleteButton = widgets.deleteButtonWithCheck(dom, buttonsCell, 'issue', async function () { // noun?
|
|
68
68
|
try {
|
|
69
|
-
await
|
|
69
|
+
await store.updater.update(store.connectedStatements(issue))
|
|
70
70
|
} catch (err) {
|
|
71
71
|
complain(`Unable to delete issue: ${err}`, context)
|
|
72
72
|
}
|
|
@@ -102,16 +102,16 @@ export function exposeOverlay (subject, context) {
|
|
|
102
102
|
|
|
103
103
|
export function renderIssue (issue, context) {
|
|
104
104
|
// Don't bother changing the last modified dates of things: save time
|
|
105
|
-
function setModifiedDate (subj,
|
|
105
|
+
function setModifiedDate (subj, store, doc) {
|
|
106
106
|
if (SET_MODIFIED_DATES) {
|
|
107
107
|
if (!getOption(tracker, 'trackLastModified')) return
|
|
108
|
-
let deletions =
|
|
108
|
+
let deletions = store.statementsMatching(issue, ns.dct('modified'))
|
|
109
109
|
deletions = deletions.concat(
|
|
110
|
-
|
|
110
|
+
store.statementsMatching(issue, ns.wf('modifiedBy'))
|
|
111
111
|
)
|
|
112
112
|
const insertions = [$rdf.st(issue, ns.dct('modified'), new Date(), doc)]
|
|
113
113
|
if (me) insertions.push($rdf.st(issue, ns.wf('modifiedBy'), me, doc))
|
|
114
|
-
|
|
114
|
+
store.updater.update(deletions, insertions, function (_uri, _ok, _body) {})
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -144,18 +144,18 @@ export function renderIssue (issue, context) {
|
|
|
144
144
|
}
|
|
145
145
|
function getOption (tracker, option) {
|
|
146
146
|
// eg 'allowSubIssues'
|
|
147
|
-
const opt =
|
|
147
|
+
const opt = store.any(tracker, ns.ui(option))
|
|
148
148
|
return !!(opt && opt.value)
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
function setPaneStyle () {
|
|
152
|
-
const types =
|
|
152
|
+
const types = store.findTypeURIs(issue)
|
|
153
153
|
let mystyle = 'padding: 0.5em 1.5em 1em 1.5em; '
|
|
154
154
|
let backgroundColor = null
|
|
155
155
|
for (const uri in types) {
|
|
156
|
-
backgroundColor =
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
backgroundColor = store.any(
|
|
157
|
+
store.sym(uri),
|
|
158
|
+
store.sym('http://www.w3.org/ns/ui#backgroundColor')
|
|
159
159
|
)
|
|
160
160
|
if (backgroundColor) break
|
|
161
161
|
}
|
|
@@ -165,29 +165,31 @@ export function renderIssue (issue, context) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
const dom = context.dom
|
|
168
|
-
|
|
168
|
+
// eslint-disable-next-line no-use-before-define
|
|
169
|
+
const tracker = store.the(issue, ns.wf('tracker'), null, issue.doc())
|
|
169
170
|
if (!tracker) throw new Error('No tracker')
|
|
170
|
-
|
|
171
|
+
// eslint-disable-next-line no-use-before-define
|
|
172
|
+
const stateStore = store.any(tracker, ns.wf('stateStore'))
|
|
171
173
|
const store = issue.doc()
|
|
172
174
|
|
|
173
175
|
const issueDiv = dom.createElement('div')
|
|
174
|
-
|
|
176
|
+
const me = authn.currentUser()
|
|
175
177
|
|
|
176
178
|
setPaneStyle()
|
|
177
179
|
|
|
178
180
|
authn.checkUser() // kick off async operation
|
|
179
181
|
|
|
180
|
-
const states =
|
|
182
|
+
const states = store.any(tracker, ns.wf('issueClass'))
|
|
181
183
|
if (!states) { throw new Error('This tracker ' + tracker + ' has no issueClass') }
|
|
182
184
|
const select = widgets.makeSelectForCategory(
|
|
183
185
|
dom,
|
|
184
|
-
|
|
186
|
+
store,
|
|
185
187
|
issue,
|
|
186
188
|
states,
|
|
187
189
|
stateStore,
|
|
188
190
|
function (ok, body) {
|
|
189
191
|
if (ok) {
|
|
190
|
-
setModifiedDate(store,
|
|
192
|
+
setModifiedDate(store, store, store)
|
|
191
193
|
widgets.refreshTree(issueDiv)
|
|
192
194
|
} else {
|
|
193
195
|
console.log('Failed to change state:\n' + body)
|
|
@@ -196,18 +198,18 @@ export function renderIssue (issue, context) {
|
|
|
196
198
|
)
|
|
197
199
|
issueDiv.appendChild(select)
|
|
198
200
|
|
|
199
|
-
const cats =
|
|
201
|
+
const cats = store.each(tracker, ns.wf('issueCategory')) // zero or more
|
|
200
202
|
for (let i = 0; i < cats.length; i++) {
|
|
201
203
|
issueDiv.appendChild(
|
|
202
204
|
widgets.makeSelectForCategory(
|
|
203
205
|
dom,
|
|
204
|
-
|
|
206
|
+
store,
|
|
205
207
|
issue,
|
|
206
208
|
cats[i],
|
|
207
209
|
stateStore,
|
|
208
210
|
function (ok, body) {
|
|
209
211
|
if (ok) {
|
|
210
|
-
setModifiedDate(store,
|
|
212
|
+
setModifiedDate(store, store, store)
|
|
211
213
|
widgets.refreshTree(issueDiv)
|
|
212
214
|
} else {
|
|
213
215
|
console.log('Failed to change category:\n' + body)
|
|
@@ -251,7 +253,7 @@ export function renderIssue (issue, context) {
|
|
|
251
253
|
wf:Task :creationForm core:coreIsueForm .
|
|
252
254
|
`
|
|
253
255
|
const CORE_ISSUE_FORM = ns.wf('coreIsueForm')
|
|
254
|
-
$rdf.parse(coreIssueFormText,
|
|
256
|
+
$rdf.parse(coreIssueFormText, store, CORE_ISSUE_FORM.doc().uri, 'text/turtle')
|
|
255
257
|
widgets.appendForm(
|
|
256
258
|
dom,
|
|
257
259
|
issueDiv,
|
|
@@ -280,11 +282,11 @@ export function renderIssue (issue, context) {
|
|
|
280
282
|
|
|
281
283
|
// Assigned to whom?
|
|
282
284
|
|
|
283
|
-
const assignments =
|
|
285
|
+
const assignments = store.statementsMatching(issue, ns.wf('assignee'))
|
|
284
286
|
if (assignments.length > 1) {
|
|
285
287
|
say('Weird, was assigned to more than one person. Fixing ..')
|
|
286
288
|
const deletions = assignments.slice(1)
|
|
287
|
-
|
|
289
|
+
store.updater.update(deletions, [], function (uri, ok, body) {
|
|
288
290
|
if (ok) {
|
|
289
291
|
say('Now fixed.')
|
|
290
292
|
} else {
|
|
@@ -298,17 +300,17 @@ export function renderIssue (issue, context) {
|
|
|
298
300
|
|
|
299
301
|
async function getPossibleAssignees () {
|
|
300
302
|
let devs = []
|
|
301
|
-
const devGroups =
|
|
303
|
+
const devGroups = store.each(issue, ns.wf('assigneeGroup'))
|
|
302
304
|
for (let i = 0; i < devGroups.length; i++) {
|
|
303
305
|
const group = devGroups[i]
|
|
304
|
-
await
|
|
305
|
-
devs = devs.concat(
|
|
306
|
+
await store.fetcher.load()
|
|
307
|
+
devs = devs.concat(store.each(group, ns.vcard('member')))
|
|
306
308
|
}
|
|
307
309
|
// Anyone who is a developer of any project which uses this tracker
|
|
308
|
-
const proj =
|
|
310
|
+
const proj = store.any(null, ns.doap('bug-database'), tracker) // What project?
|
|
309
311
|
if (proj) {
|
|
310
|
-
await
|
|
311
|
-
devs = devs.concat(
|
|
312
|
+
await store.fetcher.load(proj)
|
|
313
|
+
devs = devs.concat(store.each(proj, ns.doap('developer')))
|
|
312
314
|
}
|
|
313
315
|
return devs
|
|
314
316
|
}
|
|
@@ -322,7 +324,7 @@ export function renderIssue (issue, context) {
|
|
|
322
324
|
getPossibleAssignees().then(devs => {
|
|
323
325
|
if (devs.length) {
|
|
324
326
|
devs.forEach(function (person) {
|
|
325
|
-
|
|
327
|
+
store.fetcher.lookUpThing(person)
|
|
326
328
|
}) // best effort async for names etc
|
|
327
329
|
const opts = {
|
|
328
330
|
// 'mint': '** Add new person **',
|
|
@@ -337,14 +339,14 @@ export function renderIssue (issue, context) {
|
|
|
337
339
|
issueDiv.appendChild(
|
|
338
340
|
widgets.makeSelectForOptions(
|
|
339
341
|
dom,
|
|
340
|
-
|
|
342
|
+
store,
|
|
341
343
|
issue,
|
|
342
344
|
ns.wf('assignee'),
|
|
343
345
|
devs,
|
|
344
346
|
opts,
|
|
345
347
|
store,
|
|
346
348
|
function (ok, body) {
|
|
347
|
-
if (ok) setModifiedDate(store,
|
|
349
|
+
if (ok) setModifiedDate(store, store, store)
|
|
348
350
|
else console.log('Failed to change assignee:\n' + body)
|
|
349
351
|
}
|
|
350
352
|
)
|
|
@@ -364,7 +366,7 @@ export function renderIssue (issue, context) {
|
|
|
364
366
|
subIssuePanel.appendChild(dom.createElement('h4')).textContent = 'Super Issues'
|
|
365
367
|
const listOfSupers = subIssuePanel.appendChild(dom.createElement('div'))
|
|
366
368
|
listOfSupers.refresh = function () {
|
|
367
|
-
utils.syncTableToArrayReOrdered(listOfSupers,
|
|
369
|
+
utils.syncTableToArrayReOrdered(listOfSupers, store.each(null, ns.wf('dependent'), issue), renderSubIssue)
|
|
368
370
|
}
|
|
369
371
|
listOfSupers.refresh()
|
|
370
372
|
|
|
@@ -372,7 +374,7 @@ export function renderIssue (issue, context) {
|
|
|
372
374
|
subIssuePanel.appendChild(dom.createElement('h4')).textContent = 'Sub Issues'
|
|
373
375
|
const listOfSubs = subIssuePanel.appendChild(dom.createElement('div'))
|
|
374
376
|
listOfSubs.refresh = function () {
|
|
375
|
-
utils.syncTableToArrayReOrdered(listOfSubs,
|
|
377
|
+
utils.syncTableToArrayReOrdered(listOfSubs, store.each(issue, ns.wf('dependent')), renderSubIssue)
|
|
376
378
|
}
|
|
377
379
|
listOfSubs.refresh()
|
|
378
380
|
|
|
@@ -385,7 +387,7 @@ export function renderIssue (issue, context) {
|
|
|
385
387
|
b.addEventListener(
|
|
386
388
|
'click',
|
|
387
389
|
function (_event) {
|
|
388
|
-
subIssuePanel.insertBefore(newIssueForm(dom,
|
|
390
|
+
subIssuePanel.insertBefore(newIssueForm(dom, store, tracker, issue, listOfSubs.refresh), b.nextSibling) // Pop form just after button
|
|
389
391
|
},
|
|
390
392
|
false
|
|
391
393
|
)
|
|
@@ -394,7 +396,7 @@ export function renderIssue (issue, context) {
|
|
|
394
396
|
issueDiv.appendChild(dom.createElement('br'))
|
|
395
397
|
|
|
396
398
|
// Extras are stored centrally to the tracker
|
|
397
|
-
const extrasForm =
|
|
399
|
+
const extrasForm = store.any(tracker, ns.wf('extrasEntryForm'))
|
|
398
400
|
if (extrasForm) {
|
|
399
401
|
widgets.appendForm(
|
|
400
402
|
dom,
|
|
@@ -412,7 +414,7 @@ export function renderIssue (issue, context) {
|
|
|
412
414
|
const spacer = issueDiv.appendChild(dom.createElement('tr'))
|
|
413
415
|
spacer.setAttribute('style', 'height: 1em') // spacer and placeHolder
|
|
414
416
|
|
|
415
|
-
const template =
|
|
417
|
+
const template = store.anyValue(tracker, ns.wf('issueURITemplate'))
|
|
416
418
|
/*
|
|
417
419
|
var chatDocURITemplate = kb.anyValue(tracker, ns.wf('chatDocURITemplate')) // relaive to issue
|
|
418
420
|
var chat
|
|
@@ -425,18 +427,18 @@ export function renderIssue (issue, context) {
|
|
|
425
427
|
if (template) {
|
|
426
428
|
messageStore = issue.doc() // for now. Could go deeper
|
|
427
429
|
} else {
|
|
428
|
-
messageStore =
|
|
429
|
-
if (!messageStore) messageStore =
|
|
430
|
-
|
|
430
|
+
messageStore = store.any(tracker, ns.wf('messageStore'))
|
|
431
|
+
if (!messageStore) messageStore = store.any(tracker, ns.wf('stateStore'))
|
|
432
|
+
store.sym(messageStore.uri + '#' + 'Chat' + timestring()) // var chat =
|
|
431
433
|
}
|
|
432
434
|
|
|
433
|
-
|
|
435
|
+
store.fetcher.nowOrWhenFetched(messageStore, function (ok, body, _xhr) {
|
|
434
436
|
if (!ok) {
|
|
435
437
|
const er = dom.createElement('p')
|
|
436
438
|
er.textContent = body // @@ use nice error message
|
|
437
439
|
issueDiv.insertBefore(er, spacer)
|
|
438
440
|
} else {
|
|
439
|
-
const discussion = messageArea(dom,
|
|
441
|
+
const discussion = messageArea(dom, store, issue, messageStore)
|
|
440
442
|
issueDiv.insertBefore(discussion, spacer)
|
|
441
443
|
}
|
|
442
444
|
})
|
|
@@ -455,14 +457,14 @@ export function renderIssue (issue, context) {
|
|
|
455
457
|
widgets.attachmentList(dom, issue, issueDiv, {
|
|
456
458
|
doc: stateStore,
|
|
457
459
|
promptIcon: icons.iconBase + 'noun_25830.svg',
|
|
458
|
-
uploadFolder:
|
|
460
|
+
uploadFolder: store.sym(uploadFolderURI), // Allow local files to be uploaded
|
|
459
461
|
predicate: ns.wf('attachment')
|
|
460
462
|
})
|
|
461
463
|
|
|
462
464
|
// Delete button to delete the issue
|
|
463
465
|
const deleteButton = widgets.deleteButtonWithCheck(dom, issueDiv, 'issue', async function () {
|
|
464
466
|
try {
|
|
465
|
-
await
|
|
467
|
+
await store.updater.update(store.connectedStatements(issue))
|
|
466
468
|
} catch (err) {
|
|
467
469
|
complain(`Unable to delete issue: ${err}`, context)
|
|
468
470
|
}
|
|
@@ -480,7 +482,7 @@ export function renderIssue (issue, context) {
|
|
|
480
482
|
'click',
|
|
481
483
|
async function (_event) {
|
|
482
484
|
try {
|
|
483
|
-
await
|
|
485
|
+
await store.fetcher.load(messageStore, { force: true, clearPreviousData: true })
|
|
484
486
|
} catch (err) {
|
|
485
487
|
alert(err)
|
|
486
488
|
return
|
package/issuePane.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as UI from 'solid-ui'
|
|
9
|
+
import { store, authn } from 'solid-logic'
|
|
9
10
|
import { board } from './board' // @@ will later be in solid-UI
|
|
10
11
|
import { renderIssue, renderIssueCard, getState, exposeOverlay } from './issue'
|
|
11
12
|
import { newTrackerButton } from './newTracker'
|
|
@@ -15,7 +16,6 @@ import { trackerSettingsFormText } from './trackerSettingsForm.js'
|
|
|
15
16
|
|
|
16
17
|
const $rdf = UI.rdf
|
|
17
18
|
const ns = UI.ns
|
|
18
|
-
const kb = UI.store
|
|
19
19
|
const widgets = UI.widgets
|
|
20
20
|
|
|
21
21
|
// const MY_TRACKERS_ICON = UI.icons.iconBase + 'noun_Document_998605.svg'
|
|
@@ -36,10 +36,10 @@ export default {
|
|
|
36
36
|
|
|
37
37
|
// Does the subject deserve an issue pane?
|
|
38
38
|
label: function (subject, _context) {
|
|
39
|
-
const t =
|
|
39
|
+
const t = store.findTypeURIs(subject)
|
|
40
40
|
if (
|
|
41
41
|
t['http://www.w3.org/2005/01/wf/flow#Task'] ||
|
|
42
|
-
|
|
42
|
+
store.holds(subject, UI.ns.wf('tracker'))
|
|
43
43
|
) { return 'issue' } // in case ontology not available
|
|
44
44
|
if (t['http://www.w3.org/2005/01/wf/flow#Tracker']) return 'tracker'
|
|
45
45
|
// Later: Person. For a list of things assigned to them,
|
|
@@ -73,7 +73,7 @@ export default {
|
|
|
73
73
|
const tracker = options.newInstance
|
|
74
74
|
const appDoc = tracker.doc()
|
|
75
75
|
|
|
76
|
-
const me =
|
|
76
|
+
const me = authn.currentUser()
|
|
77
77
|
if (me) {
|
|
78
78
|
kb.add(tracker, ns.dc('author'), me, appDoc)
|
|
79
79
|
}
|
|
@@ -181,32 +181,32 @@ export default {
|
|
|
181
181
|
/** /////////////////////////// Board
|
|
182
182
|
*/
|
|
183
183
|
function renderBoard (tracker, klass) {
|
|
184
|
-
const states =
|
|
184
|
+
const states = store.any(tracker, ns.wf('issueClass'))
|
|
185
185
|
klass = klass || states // default to states
|
|
186
186
|
const doingStates = klass.sameTerm(states)
|
|
187
187
|
|
|
188
188
|
// These are states we will show by default: the open issues.
|
|
189
|
-
const stateArray =
|
|
189
|
+
const stateArray = store.any(klass, ns.owl('disjointUnionOf'))
|
|
190
190
|
if (!stateArray) {
|
|
191
191
|
return complain(`Configuration error: state ${states} does not have substates`)
|
|
192
192
|
}
|
|
193
193
|
let columnValues = stateArray.elements
|
|
194
194
|
if (doingStates && columnValues.length > 2 // and there are more than two
|
|
195
195
|
) { // strip out closed states
|
|
196
|
-
columnValues = columnValues.filter(state =>
|
|
196
|
+
columnValues = columnValues.filter(state => store.holds(state, ns.rdfs('subClassOf'), ns.wf('Open')) || state.sameTerm(ns.wf('Open')))
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
async function columnDropHandler (issue, newState) {
|
|
200
200
|
const currentState = getState(issue, klass)
|
|
201
|
-
const tracker =
|
|
202
|
-
const stateStore =
|
|
201
|
+
const tracker = store.the(issue, ns.wf('tracker'), null, issue.doc())
|
|
202
|
+
const stateStore = store.any(tracker, ns.wf('stateStore'))
|
|
203
203
|
|
|
204
204
|
if (newState.sameTerm(currentState)) {
|
|
205
205
|
// alert('Same state ' + UI.utils.label(currentState)) // @@ remove
|
|
206
206
|
return
|
|
207
207
|
}
|
|
208
208
|
try {
|
|
209
|
-
await
|
|
209
|
+
await store.updater.update(
|
|
210
210
|
[$rdf.st(issue, ns.rdf('type'), currentState, stateStore)],
|
|
211
211
|
[$rdf.st(issue, ns.rdf('type'), newState, stateStore)])
|
|
212
212
|
} catch (err) {
|
|
@@ -216,7 +216,7 @@ export default {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
function isOpen (issue) {
|
|
219
|
-
const types =
|
|
219
|
+
const types = store.findTypeURIs(issue)
|
|
220
220
|
return !!types[ns.wf('Open').uri]
|
|
221
221
|
}
|
|
222
222
|
|
|
@@ -237,7 +237,7 @@ export default {
|
|
|
237
237
|
const refreshButton = widgets.button(dom, UI.icons.iconBase + 'noun_479395.svg',
|
|
238
238
|
'refresh table', async _event => {
|
|
239
239
|
try {
|
|
240
|
-
await
|
|
240
|
+
await store.fetcher.load(stateStore, { force: true, clearPreviousData: true })
|
|
241
241
|
} catch (err) {
|
|
242
242
|
alert(err)
|
|
243
243
|
return
|
|
@@ -253,8 +253,8 @@ export default {
|
|
|
253
253
|
query.pat.optional.push(clause)
|
|
254
254
|
return clause
|
|
255
255
|
}
|
|
256
|
-
const states =
|
|
257
|
-
const cats =
|
|
256
|
+
const states = store.any(subject, ns.wf('issueClass'))
|
|
257
|
+
const cats = store.each(tracker, ns.wf('issueCategory')) // zero or more
|
|
258
258
|
const vars = ['issue', 'state', 'created']
|
|
259
259
|
var query = new $rdf.Query(UI.utils.label(subject))
|
|
260
260
|
for (let i = 0; i < cats.length; i++) {
|
|
@@ -278,7 +278,7 @@ export default {
|
|
|
278
278
|
clause.add(v['_cat_' + i], ns.rdfs('subClassOf'), cats[i])
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
const propertyList =
|
|
281
|
+
const propertyList = store.any(tracker, ns.wf('propertyList')) // List of extra properties
|
|
282
282
|
if (propertyList) {
|
|
283
283
|
const properties = propertyList.elements
|
|
284
284
|
for (let p = 0; p < properties.length; p++) {
|
|
@@ -294,10 +294,10 @@ export default {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
const selectedStates = {}
|
|
297
|
-
const possible =
|
|
297
|
+
const possible = store.each(undefined, ns.rdfs('subClassOf'), states)
|
|
298
298
|
possible.forEach(function (s) {
|
|
299
299
|
if (
|
|
300
|
-
|
|
300
|
+
store.holds(s, ns.rdfs('subClassOf'), ns.wf('Open')) ||
|
|
301
301
|
s.sameTerm(ns.wf('Open'))
|
|
302
302
|
) {
|
|
303
303
|
selectedStates[s.uri] = true
|
|
@@ -321,7 +321,7 @@ export default {
|
|
|
321
321
|
'?state': { initialSelection: selectedStates, label: 'Status' }
|
|
322
322
|
}
|
|
323
323
|
})
|
|
324
|
-
const stateStore =
|
|
324
|
+
const stateStore = store.any(subject, ns.wf('stateStore'))
|
|
325
325
|
tableDiv.appendChild(tableRefreshButton(stateStore, tableDiv))
|
|
326
326
|
return tableDiv
|
|
327
327
|
}
|
|
@@ -329,7 +329,7 @@ export default {
|
|
|
329
329
|
// Allow user to create new things within the folder
|
|
330
330
|
function renderCreationControl (refreshTarget) {
|
|
331
331
|
const creationDiv = dom.createElement('div')
|
|
332
|
-
const me =
|
|
332
|
+
const me = authn.currentUser()
|
|
333
333
|
const creationContext = {
|
|
334
334
|
// folder: subject,
|
|
335
335
|
div: creationDiv,
|
|
@@ -348,7 +348,7 @@ export default {
|
|
|
348
348
|
function renderInstances (theClass) {
|
|
349
349
|
const instancesDiv = dom.createElement('div')
|
|
350
350
|
const context = { dom, div: instancesDiv, noun: 'tracker' }
|
|
351
|
-
UI.
|
|
351
|
+
UI.login.registrationList(context, { public: true, private: true, type: theClass }).then(_context2 => {
|
|
352
352
|
instancesDiv.appendChild(renderCreationControl(instancesDiv))
|
|
353
353
|
/* // keep this code in case we need a form
|
|
354
354
|
const InstancesForm = ns.wf('TrackerInstancesForm')
|
|
@@ -364,10 +364,10 @@ export default {
|
|
|
364
364
|
const settingsDiv = dom.createElement('div')
|
|
365
365
|
// A registration control allows the to record this tracker in their type index
|
|
366
366
|
const context = { dom, div: settingsDiv, noun: 'tracker' }
|
|
367
|
-
UI.
|
|
367
|
+
UI.login.registrationControl(context, tracker, ns.wf('Tracker')).then(_context2 => {
|
|
368
368
|
const settingsForm = ns.wf('TrackerSettingsForm')
|
|
369
369
|
const text = trackerSettingsFormText
|
|
370
|
-
$rdf.parse(text,
|
|
370
|
+
$rdf.parse(text, store, settingsForm.doc().uri, 'text/turtle')
|
|
371
371
|
widgets.appendForm(dom, settingsDiv, {}, tracker, settingsForm,
|
|
372
372
|
tracker.doc(), complainIfBad)
|
|
373
373
|
})
|
|
@@ -385,25 +385,25 @@ export default {
|
|
|
385
385
|
ele.appendChild(renderSettings(tracker))
|
|
386
386
|
} else if (object.sameTerm(instancesView)) {
|
|
387
387
|
ele.appendChild(renderInstances(ns.wf('Tracker')))
|
|
388
|
-
} else if ((
|
|
389
|
-
(
|
|
388
|
+
} else if ((store.holds(tracker, ns.wf('issueCategory'), object)) ||
|
|
389
|
+
(store.holds(tracker, ns.wf('issueClass'), object))) {
|
|
390
390
|
ele.appendChild(renderBoard(tracker, object))
|
|
391
391
|
} else {
|
|
392
392
|
throw new Error('Unexpected tab type: ' + object)
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
const states =
|
|
395
|
+
const states = store.any(tracker, ns.wf('issueClass'))
|
|
396
396
|
const items = [instancesView, tableView, states]
|
|
397
|
-
.concat(
|
|
397
|
+
.concat(store.each(tracker, ns.wf('issueCategory')))
|
|
398
398
|
items.push(settingsView)
|
|
399
399
|
const selectedTab = tableView
|
|
400
400
|
const options = { renderMain, items, selectedTab }
|
|
401
401
|
|
|
402
402
|
// Add stuff to the ontologies which we believe but they don't say
|
|
403
403
|
const doc = instancesView.doc()
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
store.add(instancesView, ns.rdfs('label'), 'My Trackers', doc) // @@ squatting on wf ns
|
|
405
|
+
store.add(settingsView, ns.rdfs('label'), 'Settings', doc) // @@ squatting on wf ns
|
|
406
|
+
store.add(states, ns.rdfs('label'), 'By State', doc) // @@ squatting on wf ns
|
|
407
407
|
|
|
408
408
|
const tabs = UI.tabs.tabWidget(options)
|
|
409
409
|
return tabs
|
|
@@ -418,17 +418,17 @@ export default {
|
|
|
418
418
|
tracker = subject
|
|
419
419
|
|
|
420
420
|
try {
|
|
421
|
-
await fixSubClasses(
|
|
421
|
+
await fixSubClasses(store, tracker)
|
|
422
422
|
} catch (err) {
|
|
423
423
|
console.log('@@@ Error fixing subclasses in config: ' + err)
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
const states =
|
|
426
|
+
const states = store.any(subject, ns.wf('issueClass'))
|
|
427
427
|
if (!states) throw new Error('This tracker has no issueClass')
|
|
428
|
-
const stateStore =
|
|
428
|
+
const stateStore = store.any(subject, ns.wf('stateStore'))
|
|
429
429
|
if (!stateStore) throw new Error('This tracker has no stateStore')
|
|
430
430
|
|
|
431
|
-
|
|
431
|
+
authn.checkUser() // kick off async operation
|
|
432
432
|
|
|
433
433
|
const h = dom.createElement('h2')
|
|
434
434
|
h.setAttribute('style', 'font-size: 150%')
|
|
@@ -454,7 +454,7 @@ export default {
|
|
|
454
454
|
'click',
|
|
455
455
|
function (_event) {
|
|
456
456
|
b.disabled = true
|
|
457
|
-
container.appendChild(newIssueForm(dom,
|
|
457
|
+
container.appendChild(newIssueForm(dom, store, tracker, null, showNewIssue))
|
|
458
458
|
},
|
|
459
459
|
false
|
|
460
460
|
)
|
|
@@ -490,28 +490,28 @@ export default {
|
|
|
490
490
|
const settingsView = ns.wf('SettingsView')
|
|
491
491
|
const instancesView = ns.wf('InstancesView')
|
|
492
492
|
|
|
493
|
-
const updater =
|
|
494
|
-
const t =
|
|
493
|
+
const updater = store.updater
|
|
494
|
+
const t = store.findTypeURIs(subject)
|
|
495
495
|
let tracker
|
|
496
496
|
|
|
497
497
|
// Whatever we are rendering, lets load the ontology
|
|
498
498
|
const flowOntology = UI.ns.wf('').doc()
|
|
499
|
-
if (!
|
|
499
|
+
if (!store.holds(undefined, undefined, undefined, flowOntology)) {
|
|
500
500
|
// If not loaded already
|
|
501
|
-
$rdf.parse(require('./wf.js'),
|
|
501
|
+
$rdf.parse(require('./wf.js'), store, flowOntology.uri, 'text/turtle') // Load ontology directly
|
|
502
502
|
}
|
|
503
503
|
const userInterfaceOntology = UI.ns.ui('').doc()
|
|
504
|
-
if (!
|
|
504
|
+
if (!store.holds(undefined, undefined, undefined, userInterfaceOntology)) {
|
|
505
505
|
// If not loaded already
|
|
506
|
-
$rdf.parse(require('./ui.js'),
|
|
506
|
+
$rdf.parse(require('./ui.js'), store, userInterfaceOntology.uri, 'text/turtle') // Load ontology directly
|
|
507
507
|
}
|
|
508
508
|
|
|
509
509
|
// Render a single issue
|
|
510
510
|
if (
|
|
511
511
|
t['http://www.w3.org/2005/01/wf/flow#Task'] ||
|
|
512
|
-
|
|
512
|
+
store.holds(subject, UI.ns.wf('tracker'))
|
|
513
513
|
) {
|
|
514
|
-
tracker =
|
|
514
|
+
tracker = store.any(subject, ns.wf('tracker'))
|
|
515
515
|
if (!tracker) throw new Error('This issue ' + subject + 'has no tracker')
|
|
516
516
|
|
|
517
517
|
// Much data is in the tracker instance, so wait for the data from it
|
|
@@ -519,7 +519,7 @@ export default {
|
|
|
519
519
|
context.session.store.fetcher
|
|
520
520
|
.load(tracker.doc())
|
|
521
521
|
.then(function (_xhrs) {
|
|
522
|
-
const stateStore =
|
|
522
|
+
const stateStore = store.any(tracker, ns.wf('stateStore'))
|
|
523
523
|
context.session.store.fetcher.nowOrWhenFetched(
|
|
524
524
|
stateStore,
|
|
525
525
|
subject,
|
|
@@ -574,7 +574,7 @@ export default {
|
|
|
574
574
|
|
|
575
575
|
// var overlayPane = null // overlay.appendChild(dom.createElement('div')) // avoid stomping on style by pane
|
|
576
576
|
|
|
577
|
-
|
|
577
|
+
authn.checkUser().then(webId => {
|
|
578
578
|
if (webId) {
|
|
579
579
|
console.log('Web ID set already: ' + webId)
|
|
580
580
|
context.me = webId
|
|
@@ -582,9 +582,9 @@ export default {
|
|
|
582
582
|
return
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
loginOutButton = UI.
|
|
585
|
+
loginOutButton = UI.login.loginStatusBox(dom, webIdUri => {
|
|
586
586
|
if (webIdUri) {
|
|
587
|
-
context.me =
|
|
587
|
+
context.me = store.sym(webIdUri)
|
|
588
588
|
console.log('Web ID set from login button: ' + webIdUri)
|
|
589
589
|
paneDiv.removeChild(loginOutButton)
|
|
590
590
|
// enable things
|
package/newTracker.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as UI from 'solid-ui'
|
|
2
|
+
import { store } from 'solid-logic'
|
|
2
3
|
|
|
3
4
|
const $rdf = UI.rdf
|
|
4
5
|
const ns = UI.ns
|
|
5
|
-
const
|
|
6
|
-
const updater = kb.updater
|
|
6
|
+
const updater = store.updater
|
|
7
7
|
|
|
8
8
|
/* Button for making a whole new tracker
|
|
9
9
|
** This is the least tesetd part of the tracker system at the moment.
|
|
@@ -16,17 +16,17 @@ export function newTrackerButton (thisTracker, context) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// const dom = context.dom
|
|
19
|
-
const button = UI.
|
|
19
|
+
const button = UI.login.newAppInstance(context.dom, { noun: 'tracker' }, function (
|
|
20
20
|
ws,
|
|
21
21
|
base
|
|
22
22
|
) {
|
|
23
23
|
const appPathSegment = 'issuetracker.w3.org' // how to allocate this string and connect to
|
|
24
24
|
// console.log("Ready to make new instance at "+ws)
|
|
25
25
|
const sp = UI.ns.space
|
|
26
|
-
const
|
|
26
|
+
const store = context.session.store
|
|
27
27
|
|
|
28
28
|
if (!base) {
|
|
29
|
-
base =
|
|
29
|
+
base = store.any(ws, sp('uriPrefix')).value
|
|
30
30
|
if (base.slice(-1) !== '/') {
|
|
31
31
|
$rdf.log.error(
|
|
32
32
|
appPathSegment + ': No / at end of uriPrefix ' + base
|
|
@@ -39,14 +39,14 @@ export function newTrackerButton (thisTracker, context) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const stateStore =
|
|
43
|
-
const newStore =
|
|
42
|
+
const stateStore = store.any(thisTracker, ns.wf('stateStore'))
|
|
43
|
+
const newStore = store.sym(base + 'store.ttl')
|
|
44
44
|
|
|
45
45
|
const here = thisTracker.doc()
|
|
46
46
|
|
|
47
47
|
const oldBase = here.uri.slice(0, here.uri.lastIndexOf('/') + 1)
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
const morph = function (x) {
|
|
50
50
|
// Move any URIs in this space into that space
|
|
51
51
|
if (x.elements !== undefined) return x.elements.map(morph) // Morph within lists
|
|
52
52
|
if (x.uri === undefined) return x
|
|
@@ -56,12 +56,12 @@ export function newTrackerButton (thisTracker, context) {
|
|
|
56
56
|
u = base + u.slice(oldBase.length)
|
|
57
57
|
$rdf.log.debug(' Map ' + x.uri + ' to ' + u)
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return store.sym(u)
|
|
60
60
|
}
|
|
61
61
|
const there = morph(here)
|
|
62
62
|
const newTracker = morph(thisTracker)
|
|
63
63
|
|
|
64
|
-
const myConfig =
|
|
64
|
+
const myConfig = store.statementsMatching(
|
|
65
65
|
undefined,
|
|
66
66
|
undefined,
|
|
67
67
|
undefined,
|
|
@@ -69,7 +69,7 @@ export function newTrackerButton (thisTracker, context) {
|
|
|
69
69
|
)
|
|
70
70
|
for (let i = 0; i < myConfig.length; i++) {
|
|
71
71
|
const st = myConfig[i]
|
|
72
|
-
|
|
72
|
+
store.add(
|
|
73
73
|
morph(st.subject),
|
|
74
74
|
morph(st.predicate),
|
|
75
75
|
morph(st.object),
|
|
@@ -79,15 +79,15 @@ export function newTrackerButton (thisTracker, context) {
|
|
|
79
79
|
|
|
80
80
|
// Keep a paper trail @@ Revisit when we have non-public ones @@ Privacy
|
|
81
81
|
//
|
|
82
|
-
|
|
82
|
+
store.add(newTracker, UI.ns.space('inspiration'), thisTracker, stateStore)
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
store.add(newTracker, UI.ns.space('inspiration'), thisTracker, there)
|
|
85
85
|
|
|
86
86
|
// $rdf.log.debug("\n Ready to put " + kb.statementsMatching(undefined, undefined, undefined, there)); //@@
|
|
87
87
|
|
|
88
88
|
updater.put(
|
|
89
89
|
there,
|
|
90
|
-
|
|
90
|
+
store.statementsMatching(undefined, undefined, undefined, there),
|
|
91
91
|
'text/turtle',
|
|
92
92
|
function (uri2, ok, message) {
|
|
93
93
|
if (ok) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "issue-pane",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.10",
|
|
4
4
|
"description": "Solid-compatible Panes: issue editor",
|
|
5
5
|
"main": "./issuePane.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/solid/issue-pane",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"pane-registry": "^2.4.
|
|
37
|
+
"pane-registry": "^2.4.7",
|
|
38
38
|
"rdflib": "^2.2.17",
|
|
39
|
-
"solid-
|
|
39
|
+
"solid-logic": "^1.3.14",
|
|
40
|
+
"solid-ui": "^2.4.19"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"eslint": "^7.32.0",
|