Skip to content

Commit 15e6810

Browse files
committed
Renaming setStatus to renderStatus
1 parent 6eaf625 commit 15e6810

3 files changed

Lines changed: 12 additions & 21 deletions

File tree

src/acl/access-controller.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ export class AccessController {
3636
this.isContainer = targetDoc.uri.slice(-1) === '/' // Give default for all directories
3737
if (defaultHolder && defaultACLDoc) {
3838
this.isUsingDefaults = true
39-
const defaults = this.store
40-
.each(null, ACL('default'), defaultHolder, defaultACLDoc)
41-
.concat(this.store.each(null, ACL('defaultForNew'), defaultHolder, defaultACLDoc))
42-
if (!defaults.length) {
43-
this.status.innerText = ' (No defaults given.)'
44-
} else {
45-
this.status.innerText = ''
46-
}
4739
const aclDefaultStore = adoptACLDefault(this.targetDoc, targetACLDoc, defaultHolder, defaultACLDoc)
4840
this.mainCombo = new AccessGroups(targetDoc, targetACLDoc, this, aclDefaultStore, { defaults: true })
4941
this.defaultsCombo = null
@@ -63,16 +55,16 @@ export class AccessController {
6355
public render (): HTMLElement {
6456
this.root.innerHTML = ''
6557
if (this.isUsingDefaults) {
66-
this.setStatus(`The sharing for this ${this.noun} is the default for folder `)
58+
this.renderStatus(`The sharing for this ${this.noun} is the default for folder `)
6759
if (this.defaultHolder) {
6860
const defaultHolderLink = this.status.appendChild(this.dom.createElement('a'))
6961
defaultHolderLink.href = this.defaultHolder.uri
7062
defaultHolderLink.innerText = shortNameForFolder(this.defaultHolder)
7163
}
7264
} else if (!this.defaultsDiffer) {
73-
this.setStatus('This is also the default for things in this folder.')
65+
this.renderStatus('This is also the default for things in this folder.')
7466
} else {
75-
this.setStatus('')
67+
this.renderStatus('')
7668
}
7769
this.root.appendChild(this.mainCombo.render())
7870
if (this.defaultsCombo && this.defaultsDiffer) {
@@ -95,7 +87,7 @@ export class AccessController {
9587
useDefaultButton.classList.add(this.classes.bigButton)
9688
useDefaultButton.addEventListener('click', () => this.removeAcls()
9789
.then(() => this.render())
98-
.catch(error => this.setStatus(error)))
90+
.catch(error => this.renderStatus(error)))
9991
return useDefaultButton
10092
}
10193

@@ -105,7 +97,7 @@ export class AccessController {
10597
addAclButton.classList.add(this.classes.bigButton)
10698
addAclButton.addEventListener('click', () => this.addAcls()
10799
.then(() => this.render())
108-
.catch(error => this.setStatus(error)))
100+
.catch(error => this.renderStatus(error)))
109101
return addAclButton
110102
}
111103

@@ -138,7 +130,7 @@ export class AccessController {
138130
button.classList.add(this.classes.bigButton)
139131
button.addEventListener('click', () => this.removeDefaults()
140132
.then(() => this.render())
141-
.catch(error => this.setStatus(error)))
133+
.catch(error => this.renderStatus(error)))
142134
return removeDefaults
143135
}
144136

@@ -155,7 +147,7 @@ export class AccessController {
155147
}, 5000)
156148
}
157149

158-
public setStatus (message: string): void {
150+
public renderStatus (message: string): void {
159151
// @@ TODO Introduce better system for error notification to user https://github.com/solid/mashlib/issues/87
160152
this.status.classList.toggle(this.classes.aclControlBoxStatusRevealed, !!message)
161153
this.status.innerText = message

src/acl/access-groups.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class AccessGroups {
8585
groupRow.classList.add(this.controller.classes.accessGroupListItem)
8686
widgets.makeDropTarget(groupRow, (uris) => this.handleDroppedUris(uris, combo)
8787
.then(() => this.controller.render())
88-
.catch(error => this.controller.setStatus(error)))
88+
.catch(error => this.controller.renderStatus(error)))
8989
const groupColumns = this.renderGroupElements(comboIndex, combo)
9090
groupColumns.forEach(column => groupRow.appendChild(column))
9191
return groupRow
@@ -118,7 +118,7 @@ export class AccessGroups {
118118
const personRow = widgets.personTR(this.controller.dom, ACL(pred), sym(obj), this.controller.isEditable ? {
119119
deleteFunction: () => this.deleteAgent(combo, pred, obj)
120120
.then(() => groupAgentsTable.removeChild(personRow))
121-
.catch(error => this.controller.setStatus(error))
121+
.catch(error => this.controller.renderStatus(error))
122122
} : {})
123123
return personRow
124124
}
@@ -141,7 +141,6 @@ export class AccessGroups {
141141
public async addNewURI (uri: string): Promise<void> {
142142
await this.handleDroppedUri(uri, kToCombo(1))
143143
await this.controller.save()
144-
// this.render()
145144
}
146145

147146
private async handleDroppedUris (uris: string[], combo: string): Promise<void> {

src/acl/add-agent-buttons.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class AddAgentButtons {
6565
this.renderNameForm(ns.vcard('Individual'), 'person')
6666
.then(name => this.addPerson(name))
6767
.then(() => this.renderCleanup())
68-
.catch(error => this.groupList.controller.setStatus(error))
68+
.catch(error => this.groupList.controller.renderStatus(error))
6969
}
7070
)
7171
}
@@ -80,7 +80,7 @@ export class AddAgentButtons {
8080
this.renderNameForm(ns.vcard('Group'), 'group')
8181
.then(name => this.addGroup(name))
8282
.then(() => this.renderCleanup())
83-
.catch(error => this.groupList.controller.setStatus(error))
83+
.catch(error => this.groupList.controller.renderStatus(error))
8484
}
8585
)
8686
}
@@ -141,7 +141,7 @@ export class AddAgentButtons {
141141
dom: this.groupList.controller.dom
142142
}
143143
const existingApps = this.renderAppsTable(eventContext)
144-
.catch(error => this.groupList.controller.setStatus(error))
144+
.catch(error => this.groupList.controller.renderStatus(error))
145145
this.renderAppsView()
146146
const newApp = this.renderNameForm(ns.schema('WebApplication'), 'webapp domain')
147147
.then(name => this.getOriginFromName(name))

0 commit comments

Comments
 (0)