Skip to content

Commit bdcfe8a

Browse files
authored
Merge pull request #43 from haystack/develop
Add configuration to control what events to be logged
2 parents 5fb42d9 + 684bef2 commit bdcfe8a

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

public/style/plugin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
top: 0;
143143
right: 0;
144144
line-height: normal;
145-
font-size: 16px;
145+
font-size: 12px;
146146
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
147147
background: #fff;
148148
z-index: 99999;

src/app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ function embedNbApp() {
311311
isSyncNotificationPopup: false,
312312
isSyncSpotlightNewThread: false,
313313
isNbLog: false,
314+
nbLogEventsEnabled: [],
314315
syncSpotlightNewThreadConfig: {},
315-
isNbLogScroll: false,
316316
nbLogScrollSpoConfig: 2000,
317317
isShowQuickEditor: false,
318318
sortByConfig: 'init',
@@ -554,8 +554,8 @@ function embedNbApp() {
554554
this.currentConfigs.isSyncNotificationPopup = configs['SYNC_NOTIFICATION_POPUP'] === 'true' ? true : false
555555
this.currentConfigs.isSyncSpotlightNewThread = configs['SYNC_SPOTLIGHT_NEW_THREAD'] === 'true' ? true : false
556556
this.currentConfigs.isNbLog = configs['NB_LOG'] === 'true' ? true : false
557+
this.currentConfigs.nbLogEventsEnabled = configs['CONFIG_NB_LOG_EVENTS_ENABLED'] ? JSON.parse(configs['CONFIG_NB_LOG_EVENTS_ENABLED']) : []
557558
this.currentConfigs.syncSpotlightNewThreadConfig = configs['CONFIG_SYNC_SPOTLIGHT_NEW_THREAD'] ? JSON.parse(configs['CONFIG_SYNC_SPOTLIGHT_NEW_THREAD']) : {}
558-
this.currentConfigs.isNbLogScroll = configs['NB_LOG_SCROLL'] === 'true' ? true : false
559559
this.currentConfigs.nbLogScrollSpoConfig = configs['CONFIG_NB_LOG_SCROLL'] ? Number(configs['CONFIG_NB_LOG_SCROLL']) : 2000
560560
this.currentConfigs.isShowQuickEditor = configs['SHOW_QUICK_EDITOR'] === 'true' ? true : false
561561
this.currentConfigs.sortByConfig = configs['CONFIG_SORT_BY'] ? configs['CONFIG_SORT_BY'] : 'recent'
@@ -1277,7 +1277,7 @@ function embedNbApp() {
12771277
window.removeEventListener('scroll', this.handleScroll)
12781278
},
12791279
onLogNb: async function (event = 'NONE', initiator = 'NONE', spotlightType = 'NONE', isSyncAnnotation = false, hasSyncAnnotation = false, notificationTrigger = 'NONE', annotationId = null, countAnnotationReplies = 0) {
1280-
if (this.currentConfigs.isNbLog) {
1280+
if (this.currentConfigs.isNbLog && this.currentConfigs.nbLogEventsEnabled.includes(event)) {
12811281
// console.log(`onLogNb \nevent: ${event} \ninitiator: ${initiator} \nspotlightType: ${spotlightType} \nisSyncAnnotation: ${isSyncAnnotation} \nhasSyncAnnotation: ${hasSyncAnnotation} \nnotificationTrigger: ${notificationTrigger} \nannotationId: ${annotationId} \nannotation_replies_count: ${countAnnotationReplies}`)
12821282
const token = localStorage.getItem("nb.user");
12831283
const config = { headers: { Authorization: 'Bearer ' + token }, params: { url: this.sourceURL } }
@@ -1327,7 +1327,7 @@ function embedNbApp() {
13271327
return new Promise(resolve => setTimeout(resolve, ms))
13281328
},
13291329
handleScroll: function (e) {
1330-
if (this.currentConfigs.isNbLogScroll) {
1330+
if (this.currentConfigs.nbLogEventsEnabled.includes('SCROLL')) {
13311331
clearTimeout(this.scrollLogTimer)
13321332
this.scrollLogTimer = setTimeout(() => this.onLogNb('SCROLL'), this.currentConfigs.nbLogScrollSpoConfig)
13331333
}

src/components/list/ListView.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div v-if="!isCollapsed">
1111
<div class="list-header">
1212
<span class="count">
13-
{{ threads.length }} of {{ totalLabel }}
13+
<span v-bind:class="{ 'filterdThreads': currentThreadsCount !== totalCount}">{{ currentThreadsCount }}</span> of {{ totalLabel }}
1414
</span>
1515
<span class="toggle-highlights" v-tooltip="showHighlights ? 'hide highlights' : 'show highlights'" @click="toggleHighlights">
1616
<font-awesome-icon v-if="showHighlights" icon="eye" class="icon"></font-awesome-icon>
@@ -146,6 +146,9 @@ export default {
146146
this.sortBy = this.currentConfigs.sortByConfig
147147
},
148148
computed: {
149+
currentThreadsCount: function () {
150+
return this.threads.length
151+
},
149152
totalLabel: function () {
150153
if (this.totalCount === 1) {
151154
return '1 thread'
@@ -216,3 +219,11 @@ export default {
216219
}
217220
}
218221
</script>
222+
<style>
223+
.filterdThreads {
224+
background: yellow;
225+
font-weight: bold;
226+
font-style: italic;
227+
}
228+
229+
</style>

0 commit comments

Comments
 (0)