Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
cfa9a15
Make chat code more moular
Mar 27, 2019
dbdf0a2
standard
Mar 27, 2019
99eb349
dateFolders extracts the common handling of tree of YYYY/MM/DD files
Apr 1, 2019
9240886
dateFolders extracts the common handling of tree of YYYY/MM/DD files
Apr 2, 2019
2921077
Getting there with chat refactor, not there yet
Apr 5, 2019
ba7f40f
should fix https://github.com/solid/solid-ui/issues/61
Apr 10, 2019
0e2d386
aimed at fixing https://github.com/solid/solid-ui/issues/62
Apr 10, 2019
971890b
Seeems to work with refactored code, not 100% yet
Apr 28, 2019
d0d508c
not tested, refactored
May 23, 2019
eecb36d
Robot and padlock icons
Jun 1, 2019
a96a10d
New larger simple padlock
Jun 1, 2019
735e10a
ACL control plus basically working
Jun 3, 2019
4a2dd59
standard
Jun 3, 2019
64053af
webapp acls starting to work
Jun 5, 2019
2631e87
standard js
Jun 6, 2019
df5db34
sigh unmerged paths must be committed
Jun 16, 2019
002c28b
merge in master to chat
Jul 26, 2019
c3eb166
Add icon for filing cabinet
Jul 31, 2019
5dde28c
hand merge from select-tabs branch and bump version to match that - p…
Aug 1, 2019
e7df3ca
0.12.7
Aug 1, 2019
f09f540
Alternative solution to https://github.com/solid/solid-ui/issues/78
megoth Aug 5, 2019
261eb7f
Hopefully how it should work
megoth Aug 6, 2019
3aec54b
Added one more defaultForNew+default fix
megoth Aug 6, 2019
0d2806e
Upgrading to latest version of rdflib
megoth Aug 6, 2019
71c7b45
0.12.8-0
Aug 6, 2019
4df5c9e
Small fixes to be able to create ACL files for folders
megoth Aug 6, 2019
9876d53
Will now refresh pane as expected
megoth Aug 6, 2019
b9575a8
A hacky fix to the never-ending spawning green plus icons
megoth Aug 6, 2019
e2eaf0d
Revert "A hacky fix to the never-ending spawning green plus icons"
megoth Aug 6, 2019
6d21f11
Revert "Revert "A hacky fix to the never-ending spawning green plus i…
megoth Aug 6, 2019
9e9a69f
Merge pull request #80 from solid/stop-tryParent-on-root
megoth Aug 7, 2019
14e5f3c
Suggested icon for ScratchPad pane
megoth Aug 8, 2019
57ca23d
Revert "Suggested icon for ScratchPad pane"
Aug 8, 2019
ab1846b
0.12.8-1
Aug 8, 2019
3b40654
0.12.8-2
Aug 8, 2019
46726f2
Will prepend the name of the pane if multiple panes create same class
megoth Aug 8, 2019
3f687ce
This should make the model correct wrt default values
megoth Aug 8, 2019
b1c6b6b
Removing faulty logic -> This should handle the default value logic
megoth Aug 8, 2019
d748c6d
Merge pull request #83 from solid/default-value-fix
megoth Aug 9, 2019
79b7160
Merge pull request #81 from solid/refresh-sharing-on-creating-and-del…
megoth Aug 12, 2019
d235683
Merge pull request #84 from solid/stop-tryParent-on-root
megoth Aug 12, 2019
df69280
Merge pull request #82 from solid/add-panename-on-multiple-mintclass
megoth Aug 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
528 changes: 240 additions & 288 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solid-ui",
"version": "0.12.5",
"version": "0.12.8-2",
"description": "UI library for writing Solid read-write-web applications",
"main": "./lib/index.js",
"files": [
Expand Down Expand Up @@ -44,7 +44,7 @@
"escape-html": "^1.0.3",
"mime-types": "^2.1.20",
"node-uuid": "^1.4.7",
"rdflib": ">=0.20.1",
"rdflib": "^0.21.1",
"solid-auth-client": "^2.2.13",
"solid-auth-tls": "^0.1.2",
"solid-namespace": "0.2.0"
Expand Down
20 changes: 12 additions & 8 deletions src/acl-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
} else {
box.isContainer = targetDoc.uri.slice(-1) === '/' // Give default for all directories
if (defa) {
var defaults = kb.each(undefined, ACL('defaultForNew'), defaultHolder, defaultACLDoc)
var defaults = kb.each(undefined, ACL('default'), defaultHolder, defaultACLDoc)
.concat(kb.each(undefined, ACL('defaultForNew'), defaultHolder, defaultACLDoc))
if (!defaults.length) {
statusBlock.textContent += ' (No defaults given.)'
} else {
Expand All @@ -561,21 +562,23 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
editPlease.textContent = 'Set specific sharing\nfor this ' + noun
editPlease.style.cssText = bigButtonStyle
editPlease.addEventListener('click', async function (event) {
kb2.forEach(st => {
kb2.statements.forEach(st => {
kb.add(st.subject, st.predicate, st.object, targetACLDoc)
})
try {
fetcher.putBack(targetACLDoc)
kb.fetcher.putBack(targetACLDoc)
.then(function () {
statusBlock.textContent = ' (Now editing specific access for this ' + noun + ')'
bottomRightCell.removeChild(editPlease)
renderBox()
})
} catch (e) {
let msg = ' Error writing back access control file! ' + e
console.error(msg)
statusBlock.textContent += msg
return
}
kb.fetcher.requested[targetACLDoc.uri] = 'done' // cheat - say cache is now in sync
statusBlock.textContent = ' (Now editing specific access for this ' + noun + ')'
bottomRightCell.removeChild(editPlease)
renderBox()
// kb.fetcher.requested[targetACLDoc.uri] = 'done' // cheat - say cache is now in sync
})
} // defaults.length
} else { // Not using defaults
Expand All @@ -592,8 +595,9 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
kb.fetcher.delete(targetACLDoc.uri)
.then(function () {
statusBlock.textContent = ' The sharing for this ' + noun + ' is now the default.'
bottomRow.removeChild(useDefault)
bottomRightCell.removeChild(useDefault)
box.style.cssText = 'color: #777;'
bottomLeftCell.innerHTML = ''
renderBox()
})
.catch(function (e) {
Expand Down
28 changes: 13 additions & 15 deletions src/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ UI.acl.getACLorDefault = function (doc, callbackFunction) {
}
var right = uri.lastIndexOf('/')
var left = uri.indexOf('/', uri.indexOf('//') + 2)
if (left >= right) {
return callbackFunction(false, true, 404, 'Found no ACL resource')
}
uri = uri.slice(0, right + 1)
var doc2 = $rdf.sym(uri)
UI.acl.getACL(doc2, function (ok, status, defaultACLDoc) {
Expand All @@ -345,24 +348,19 @@ UI.acl.getACLorDefault = function (doc, callbackFunction) {
} else if (status === 403) {
return callbackFunction(false, true, status, '( default ACL file FORBIDDEN. Stop.' + uri + ')')
} else if (status === 404) {
if (left >= right) {
return callbackFunction(false, true, 499, 'Nothing to hold a default')
} else {
tryParent(uri)
}
return tryParent(uri)
} else if (status !== 200) {
return callbackFunction(false, true, status, "Error status '" + status + "' searching for default for " + doc2)
} else { // 200
// statusBlock.textContent += (" ACCESS set at " + uri + ". End search.")
var defaults = kb.each(undefined, ACL('default'), kb.sym(uri), defaultACLDoc)
.concat(kb.each(undefined, ACL('defaultForNew'), kb.sym(uri), defaultACLDoc))
if (!defaults.length) {
tryParent(uri) // Keep searching
} else {
var defaultHolder = kb.sym(uri)
callbackFunction(true, false, doc, aclDoc, defaultHolder, defaultACLDoc)
}
}
// 200
// statusBlock.textContent += (" ACCESS set at " + uri + ". End search.")
var defaults = kb.each(undefined, ACL('default'), kb.sym(uri), defaultACLDoc)
.concat(kb.each(undefined, ACL('defaultForNew'), kb.sym(uri), defaultACLDoc))
if (!defaults.length) {
return tryParent(uri) // Keep searching
}
var defaultHolder = kb.sym(uri)
return callbackFunction(true, false, doc, aclDoc, defaultHolder, defaultACLDoc)
})
} // tryParent

Expand Down
71 changes: 36 additions & 35 deletions src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,42 +144,43 @@ function newThingUI (context, thePanes) {
)
} // makeNewAppInstance

var iconArray = []
for (var pn in thePanes) {
var pane = thePanes[pn]
if (pane.mintNew) {
var icon = context.div.appendChild(dom.createElement('img'))
icon.setAttribute('src', pane.icon)
var noun = pane.mintClass ? UI.utils.label(pane.mintClass) : (pane.name + ' @@')
icon.setAttribute('title', 'Make new ' + noun)
icon.setAttribute('style', iconStyle + 'display: none;')
iconArray.push(icon)
var foo = function (pane, icon, noun) {
var iconEle = icon
var thisPane = pane
var thisNoun = noun
if (!icon.disabled) {
icon.addEventListener('click', function (e) {
selectTool(iconEle)
var options = {
event: e,
folder: context.folder,
iconEle: iconEle,
pane: thisPane,
noun: thisNoun,
noIndexHTML: true, // do NOT @@ for now write a HTML file
div: context.div,
me: context.me,
dom: context.dom,
refreshTarget: context.refreshTarget
}
makeNewAppInstance(options)
})
}
} // foo
foo(pane, icon, noun)
const iconArray = []
const mintingPanes = Object.values(thePanes).filter(pane => pane.mintNew)
const mintingClassMap = mintingPanes.reduce((classMap, pane) => {
if (pane.mintClass) {
classMap[pane.mintClass] = (classMap[pane.mintClass] || 0) + 1
}
}
return classMap
}, {})
mintingPanes.forEach(pane => {
const icon = context.div.appendChild(dom.createElement('img'))
icon.setAttribute('src', pane.icon)
const noun = pane.mintClass
? (mintingClassMap[pane.mintClass] > 1
? `${UI.utils.label(pane.mintClass)} (using ${pane.name} pane)`
: UI.utils.label(pane.mintClass))
: (pane.name + ' @@')
icon.setAttribute('title', 'Make new ' + noun)
icon.setAttribute('style', iconStyle + 'display: none;')
iconArray.push(icon)
if (!icon.disabled) {
icon.addEventListener('click', function (e) {
selectTool(icon)
makeNewAppInstance({
event: e,
folder: context.folder,
iconEle: icon,
pane,
noun,
noIndexHTML: true, // do NOT @@ for now write a HTML file
div: context.div,
me: context.me,
dom: context.dom,
refreshTarget: context.refreshTarget
})
})
}
})

var styleTheIcons = function (style) {
for (var i = 0; i < iconArray.length; i++) {
Expand Down
1 change: 1 addition & 0 deletions src/icons/noun_Cabinet_251723.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ function genACLText (docURI, me, aclURI, options = {}) {
g.add(a, UI.ns.rdf('type'), auth('Authorization'), acl)
g.add(a, auth('accessTo'), doc, acl)
if (options.defaultForNew) {
// TODO: Should this be auth('default') instead?
g.add(a, auth('defaultForNew'), doc, acl)
}
g.add(a, auth('agent'), me, acl)
Expand Down
3 changes: 2 additions & 1 deletion src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
buttonStyle: 'background-color: #fff; padding: 0.5em; border: .01em solid white; font-size: 100%;', // 'background-color: #eef;
// The width of the text field must bot be 100% or it switches to overlapping
messageBodyStyle: 'white-space: pre-wrap; width: 99%; font-size:100%; border: 0.07em solid #eee; padding: .3em 0.5em; margin: 0.1em;',
pendingeditModifier: 'color: #bbb;'
pendingeditModifier: 'color: #bbb;',
highlightColor: '#7C4DFF' // Solid lavendar https://design.inrupt.com/atomic-core/?cat=Core

}
16 changes: 15 additions & 1 deletion src/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,21 @@ UI.tabs.tabWidget = function (options) {
box.refresh = sync
sync()

if (!options.startEmpty && tabContainer.children.length) {
// From select-tabs branch by hand
if (!options.startEmpty && tabContainer.children.length && options.selectedTab) {
var tab
var found = false
for (var i = 0; i < tabContainer.children.length; i++) {
tab = tabContainer.children[i]
if (tab.firstChild && tab.firstChild.dataset.name === options.selectedTab) {
tab.firstChild.click()
found = true
}
}
if (!found) {
tabContainer.children[0].firstChild.click() // Open first tab
}
} else if (!options.startEmpty && tabContainer.children.length) {
tabContainer.children[0].firstChild.click() // Open first tab
}
return box
Expand Down
7 changes: 2 additions & 5 deletions src/widgets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -904,11 +904,8 @@ UI.widgets.field[UI.ns.ui('PhoneField').uri] =

store = store || UI.widgets.fieldStore(subject, property, store)

var obj = kb.any(subject, property, undefined, store)
if (!obj) {
obj = kb.any(form, ui('default'))
if (obj) kb.add(subject, property, obj, store)
}
var obj = kb.any(subject, property, undefined, store) ||
kb.any(form, ui('default'))
if (obj && obj.uri && params.uriPrefix) { // eg tel: or mailto:
field.value = decodeURIComponent(obj.uri.replace(params.uriPrefix, '')) // should have no spaces but in case
.replace(/ /g, '')
Expand Down