Skip to content

Commit 2fd6d83

Browse files
committed
public narratives now "just" public -- includes owned and shared-with
The public narratives originally showed only public narratives which where NOT already shown as owned by or shared with the current user. This change removes those filters, so that the panel shows all public narratives the current user has access to.
1 parent 04c558a commit 2fd6d83

File tree

5 files changed

+43
-47
lines changed

5 files changed

+43
-47
lines changed

src/plugin/modules/widgets/PublicNarrativesWidget.js

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -127,43 +127,43 @@ define([
127127
}
128128
var searchRe = new RegExp(options.search, 'i'),
129129
nar = this.getState('narratives').filter(function (x) {
130-
if (
131-
x.workspace.metadata.narrative_nice_name.match(searchRe)
130+
if (
131+
x.workspace.metadata.narrative_nice_name.match(searchRe)
132132

133-
||
134-
135-
x.workspace.owner.match(searchRe)
133+
||
136134

137-
||
138-
139-
(x.object.metadata.cellInfo &&
140-
(function (apps) {
141-
for (var i in apps) {
142-
var app = apps[i];
143-
if (app.match(searchRe) || this.getAppName(app).match(searchRe)) {
144-
return true;
135+
x.workspace.owner.match(searchRe)
136+
137+
||
138+
139+
(x.object.metadata.cellInfo &&
140+
(function (apps) {
141+
for (var i in apps) {
142+
var app = apps[i];
143+
if (app.match(searchRe) || this.getAppName(app).match(searchRe)) {
144+
return true;
145+
}
145146
}
146-
}
147-
}.bind(this))(Object.keys(x.object.metadata.cellInfo.app)))
147+
}.bind(this))(Object.keys(x.object.metadata.cellInfo.app)))
148+
149+
||
148150

149-
||
150-
151-
(x.object.metadata.cellInfo &&
152-
(function (methods) {
153-
for (var i in methods) {
154-
var method = methods[i];
155-
if (method.match(searchRe) || this.getMethodName(method).match(searchRe)) {
156-
return true;
151+
(x.object.metadata.cellInfo &&
152+
(function (methods) {
153+
for (var i in methods) {
154+
var method = methods[i];
155+
if (method.match(searchRe) || this.getMethodName(method).match(searchRe)) {
156+
return true;
157+
}
157158
}
158-
}
159-
}.bind(this))(Object.keys(x.object.metadata.cellInfo.method)))
159+
}.bind(this))(Object.keys(x.object.metadata.cellInfo.method)))
160160

161-
) {
162-
return true;
163-
} else {
164-
return false;
165-
}
166-
}.bind(this));
161+
) {
162+
return true;
163+
} else {
164+
return false;
165+
}
166+
}.bind(this));
167167
this.setState('narrativesFiltered', nar);
168168
}
169169
},
@@ -196,16 +196,6 @@ define([
196196
excludeGlobal: 0
197197
})
198198
.then(function (narratives) {
199-
var username = this.runtime.getService('session').getUsername();
200-
narratives = narratives.filter(function (x) {
201-
if (x.workspace.owner === username ||
202-
x.workspace.user_permission !== 'n') {
203-
return false;
204-
} else {
205-
return true;
206-
}
207-
}.bind(this));
208-
209199
this.setState('narratives', narratives);
210200
this.setState('narrativesFiltered', narratives);
211201
}.bind(this));

src/plugin/modules/widgets/SharedNarrativesWidget.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ define([
135135
onStateChange: {
136136
value: function () {
137137
var count = this.doState('narratives', function (x) {
138-
return x.length
138+
return x.length;
139139
}, null);
140140
var filtered = this.doState('narrativesFiltered', function (x) {
141-
return x.length
141+
return x.length;
142142
}, null);
143143

144144
this.viewState.setItem('sharedNarratives', {
@@ -153,7 +153,7 @@ define([
153153
token: this.runtime.service('session').getAuthToken()
154154
});
155155
return Promise.all([
156-
methodStore.list_apps({}),
156+
methodStore.list_apps({})
157157
])
158158
.spread(function (apps) {
159159
var appMap = {};

src/plugin/resources/NarrativesWidget/templates/slider.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
</span>
166166
{% endif %}
167167
{% if narrative.workspace.globalread == 'r' or narrative.workspace.globalread == 'w' %}
168-
<span class="fa fa-globe" data-toggle="tooltip" data-placement="auto" title="This narrative is Publicly available (read-only)" data-container="body"></span>
168+
<span class="fa fa-globe" data-toggle="tooltip" data-placement="auto" title="This narrative is Publicly available" data-container="body"></span>
169169
{% endif %}
170170
</div><div style="display:inline-block; width: 33%;text-align: center;">
171171
{% set runningJobs = narrative.object.metadata.jobInfo.running %}

src/plugin/resources/PublicNarrativesWidget/templates/slider.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@
144144
<div class="-footer">
145145
<div style="display:inline-block; width: 33%;text-align: center;">
146146
{% if narrative.workspace.user_permission == 'r' %}
147-
<span class="fa fa-minus dimmed" style="opacity: 0.4;" data-toggle="tooltip" data-placement="auto" title="Sharing information not available for this Narrative" data-container="body"></span> {% else %} {% if narrative.permissions|length > 0 %} {{ narrative.permissions | length }} {% else %} 0 {% endif %} <span class="fa fa-share-alt" data-toggle="tooltip" data-placement="auto" title="The number of other users with whom this Narrative has been shared" data-container="body"></span> {% endif %} {% if narrative.workspace.globalread == 'r' or narrative.workspace.globalread == 'w' %} P{% endif %}
147+
<span class="fa fa-minus dimmed" style="opacity: 0.4;" data-toggle="tooltip" data-placement="auto" title="Sharing information not available for this Narrative" data-container="body"></span> {% else %}
148+
{% if narrative.permissions|length > 0 %} {{ narrative.permissions | length }} {% else %} 0 {% endif %}
149+
<span class="fa fa-share-alt" data-toggle="tooltip" data-placement="auto" title="The number of other users with whom this Narrative has been shared" data-container="body"></span> {% endif %}
150+
151+
{% if narrative.workspace.globalread == 'r' or narrative.workspace.globalread == 'w' %}
152+
<span class="fa fa-globe" data-toggle="tooltip" data-placement="auto" title="This narrative is Publicly available" data-container="body"></span>
153+
{% endif %}
148154
</div><div style="display:inline-block; width: 33%;text-align: center;">
149155

150156
{% set runningJobs = narrative.object.metadata.jobInfo.running %}

src/plugin/resources/SharedNarrativesWidget/templates/slider.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
</span>
156156
{% endif %}
157157
{% if narrative.workspace.globalread == 'r' or narrative.workspace.globalread == 'w' %}
158-
<span class="fa fa-globe" data-toggle="tooltip" data-placement="auto" title="This narrative is Publicly available (read-only)" data-container="body"></span>
158+
<span class="fa fa-globe" data-toggle="tooltip" data-placement="auto" title="This narrative is Publicly available" data-container="body"></span>
159159
{% endif %}
160160
</div><div style="display:inline-block; width: 33%;text-align: center;">
161161

0 commit comments

Comments
 (0)