@abi-software/map-side-bar 1.5.1 → 1.5.2

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/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -12205,7 +12205,7 @@
12205
12205
  "simple-html-tokenizer": {
12206
12206
  "version": "0.1.1",
12207
12207
  "resolved": "https://registry.npmjs.org/simple-html-tokenizer/-/simple-html-tokenizer-0.1.1.tgz",
12208
- "integrity": "sha512-Mc/gH3RvlKvB/gkp9XwgDKEWrSYyefIJPGG8Jk1suZms/rISdUuVEMx5O1WBnTWaScvxXDvGJrZQWblUmQHjkQ=="
12208
+ "integrity": "sha1-BcLuxXn//+FFoDCsJs/qYbmA+r4="
12209
12209
  },
12210
12210
  "simple-swizzle": {
12211
12211
  "version": "0.2.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "main": "./dist/map-side-bar.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -506,7 +506,6 @@ export default {
506
506
  position: relative;
507
507
  float: left;
508
508
  padding-right: 15px;
509
- padding-bottom: 12px;
510
509
  }
511
510
 
512
511
  .number-shown-select {
@@ -0,0 +1,146 @@
1
+ <template>
2
+ <div class="container">
3
+ <!-- <span v-if="reversedSearchHistory.length > 0" class="title"> Search History </span> -->
4
+ <template v-for="(item, i) in reversedSearchHistory">
5
+ <el-tag class="search-tag" v-if="i < 3" v-bind:key="i" @click="search(item)">{{ item.search }} </el-tag>
6
+ </template>
7
+ <el-select
8
+ v-if="reversedSearchHistory.length > 0"
9
+ :value="selectValue"
10
+ class="m-2 search-select"
11
+ placeholder="Full search History"
12
+ size="small"
13
+ popper-class="sidebar-search-select-popper"
14
+ @change="selectChange"
15
+ >
16
+ <el-option
17
+ v-for="(item, i) in cascaderOptions"
18
+ :key="i"
19
+ :label="item.label"
20
+ :value="item.value"
21
+ />
22
+ </el-select>
23
+ </div>
24
+
25
+ </template>
26
+
27
+ <script>
28
+ /* eslint-disable no-alert, no-console */
29
+ import Vue from "vue";
30
+ import {
31
+ Tag,
32
+ Select,
33
+ } from "element-ui";
34
+
35
+ Vue.use(Tag);
36
+ Vue.use(Select);
37
+ import EventBus from './EventBus';
38
+
39
+ // remove duplicates by stringifying the objects
40
+ const removeDuplicates = function(arrayOfAnything){
41
+ return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
42
+ }
43
+
44
+ export default {
45
+ name: 'SearchHistory',
46
+ data() {
47
+ return {
48
+ searchHistory: [],
49
+ selectValue: 'Full search history'
50
+ }
51
+
52
+ },
53
+ computed: {
54
+ reversedSearchHistory: function(){
55
+ return removeDuplicates(this.searchHistory.slice().reverse().filter(item => item.search !== ''))
56
+ },
57
+ cascaderOptions: function(){
58
+ return this.reversedSearchHistory.map(item => {
59
+ return {
60
+ value: item.search,
61
+ label: item.search
62
+ }
63
+ })
64
+ }
65
+ },
66
+ methods: {
67
+ getSearchHistory() {
68
+ if (localStorage.getItem('sparc.science-sidebar-search-history')) {
69
+ this.searchHistory = JSON.parse(localStorage.getItem('sparc.science-sidebar-search-history'));
70
+ } else {
71
+ this.searchHistory = [];
72
+ }
73
+ },
74
+ clearSearchHistory() {
75
+ localStorage.removeItem('sparc.science-sidebar-search-history');
76
+ this.searchHistory = [];
77
+ },
78
+ addSearchToHistory(filters, search) {
79
+ filters = [] // disable filters for now
80
+ let searchHistory = JSON.parse(localStorage.getItem('sparc.science-sidebar-search-history'));
81
+ if (searchHistory) {
82
+ searchHistory.push({filters: filters, search: search});
83
+ this.searchHistory = removeDuplicates(searchHistory)
84
+ localStorage.setItem('sparc.science-sidebar-search-history', JSON.stringify(searchHistory));
85
+ } else {
86
+ localStorage.setItem('sparc.science-sidebar-search-history', JSON.stringify([{filters: filters, search: search}]));
87
+ }
88
+ },
89
+ search: function(item) {
90
+ this.$emit("search", item);
91
+ },
92
+ selectChange: function(value) {
93
+ this.selectValue = value;
94
+ this.search({search: value})
95
+ }
96
+ },
97
+ mounted: function () {
98
+ this.getSearchHistory();
99
+ EventBus.$on('search-changed', (data) => {
100
+ this.setSearchHistory(data);
101
+ })
102
+ }
103
+ }
104
+ </script>
105
+
106
+ <style scoped lang="scss">
107
+ @import "~element-ui/packages/theme-chalk/src/tag";
108
+
109
+ .container {
110
+ }
111
+
112
+ .search-tag {
113
+ margin: 0 5px 5px 0;
114
+ cursor: pointer;
115
+ max-width: 100px;
116
+ overflow: hidden;
117
+ text-overflow: ellipsis;
118
+ }
119
+
120
+ .title {
121
+ font-size: 14px;
122
+ font-weight: bold;
123
+ margin-right: 5px;
124
+ // center text vertically
125
+ display: flex;
126
+ align-items: center;
127
+
128
+ }
129
+
130
+ .search-select {
131
+ float: right;
132
+ }
133
+ </style>
134
+
135
+ <style lang="scss">
136
+ .sidebar-search-select-popper {
137
+ font-family: Asap;
138
+ font-size: 14px;
139
+ font-weight: 500;
140
+ font-stretch: normal;
141
+ font-style: normal;
142
+ line-height: normal;
143
+ letter-spacing: normal;
144
+ color: #292b66;
145
+ }
146
+ </style>
@@ -21,6 +21,7 @@
21
21
  @loading="filtersLoading"
22
22
  @cascaderReady="cascaderReady"
23
23
  ></SearchFilters>
24
+ <search-history ref="searchHistory" @search="searchHistorySearch"></search-history>
24
25
  <div class="content scrollbar" v-loading="loadingCards" ref="content">
25
26
  <div class="error-feedback" v-if="results.length === 0 && !loadingCards">
26
27
  No results found - Please change your search / filter criteria.
@@ -61,6 +62,7 @@ import {
61
62
  import lang from "element-ui/lib/locale/lang/en";
62
63
  import locale from "element-ui/lib/locale";
63
64
  import SearchFilters from "./SearchFilters";
65
+ import SearchHistory from "./SearchHistory";
64
66
  import DatasetCard from "./DatasetCard";
65
67
  import EventBus from "./EventBus";
66
68
 
@@ -106,7 +108,7 @@ var initial_state = {
106
108
  };
107
109
 
108
110
  export default {
109
- components: { SearchFilters, DatasetCard },
111
+ components: { SearchFilters, DatasetCard, SearchHistory },
110
112
  name: "SideBarContent",
111
113
  props: {
112
114
  visible: {
@@ -207,11 +209,14 @@ export default {
207
209
  this.searchInput = "";
208
210
  this.resetPageNavigation();
209
211
  this.searchAlgolia(this.filters, this.searchInput);
212
+ this.$refs.searchHistory.selectValue = 'Full search history'
210
213
  },
211
214
  searchEvent: function (event = false) {
212
215
  if (event.keyCode === 13 || event instanceof MouseEvent) {
213
216
  this.resetPageNavigation();
214
217
  this.searchAlgolia(this.filters, this.searchInput);
218
+ this.$refs.searchHistory.selectValue = 'Full search history'
219
+ this.$refs.searchHistory.addSearchToHistory(this.filters, this.searchInput);
215
220
  }
216
221
  },
217
222
  filterUpdate: function (filters) {
@@ -408,6 +413,11 @@ export default {
408
413
  getAlgoliaFacets: async function(){
409
414
  let facets = await this.algoliaClient.getAlgoliaFacets(facetPropPathMapping)
410
415
  return facets;
416
+ },
417
+ searchHistorySearch: function(item){
418
+ this.searchInput = item.search;
419
+ this.filters = item.filters;
420
+ this.openSearch(item.filters, item.search);
411
421
  }
412
422
  },
413
423
  mounted: function () {
package/del.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "description": "Mean luminal pressure (represented by a color field with red as high pressure and blue as low pressure) recorded from the proximal, transverse and distal sections of the pig colon are mapped on the scaffold. \n\nBaseline data was collected for 30min, followed by 15min of stimulation and 30min of post-stimulation.",
3
- "heading": "Direct proximal colon stimulation",
4
- "id": "sparc.science.context_data",
5
- "samples": [
6
- {
7
- "annotation": "",
8
- "description": "Manometry data recorded from pigs under direct proximal colon stimulation.",
9
- "doi": "https://doi.org/10.26275/up27-ibcr",
10
- "heading": "Proximal direct stimulation samples",
11
- "id": "Sample 1",
12
- "path": "derivative\\stim_proximal-colon_manometry.csv",
13
- "view": "View 1"
14
- }
15
- ],
16
- "version": "0.1.0",
17
- "views": [
18
- {
19
- "annotation": "--",
20
- "description": "Sections of pig colon scaffold with mapped manometry data where the data are collected from. ",
21
- "id": "View 1",
22
- "path": "colon_Layout1_view.json",
23
- "sample": "Sample 1",
24
- "thumbnail": "derivative\\pig_colon_main_thumbnail.jpeg"
25
- }
26
- ]
27
- }
@@ -1,31 +0,0 @@
1
- {
2
- "description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
3
- "heading": "Mapped ICN samples",
4
- "id": "sparc.science.context_data",
5
- "views": [],
6
- "samples": [
7
- {
8
- "annotation": "",
9
- "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
10
- "doi": "",
11
- "heading": "ICNS from subject M54-8",
12
- "id": "Sample 1",
13
- "path": "",
14
- "view": "View 1",
15
- "color": "#FFFF00",
16
- "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
17
- },
18
- {
19
- "annotation": "",
20
- "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
21
- "doi": "",
22
- "heading": "ICNS from subject M54-5",
23
- "id": "Sample 2",
24
- "path": "",
25
- "view": "View 2",
26
- "color": "#FFA500",
27
- "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
28
- }
29
- ],
30
- "version": "0.1.0"
31
- }
@@ -1,172 +0,0 @@
1
- <template>
2
- <div class="dataset-card-container" ref="container">
3
- <div class="dataset-card" ref="card">
4
- <div class="seperator-path"></div>
5
- <div v-loading="loading" class="card" >
6
- <span class="card-left">
7
- <img class="banner-img" :src="thumbnail" @click="openDataset" />
8
- </span>
9
- <div class="card-right" @click="openDataset">
10
- {{entry[0]}}
11
- {{entry [1]}}
12
- <el-button class="button">View on flatmap</el-button>
13
- <el-button class="button">View connectivity</el-button>
14
- </div>
15
-
16
- </div>
17
- </div>
18
- </div>
19
- </template>
20
-
21
-
22
- <script>
23
- /* eslint-disable no-alert, no-console */
24
- import Vue from "vue";
25
- import { Button, Icon } from "element-ui";
26
- import lang from "element-ui/lib/locale/lang/en";
27
- import locale from "element-ui/lib/locale";
28
-
29
- locale.use(lang);
30
- Vue.use(Button);
31
- Vue.use(Icon);
32
-
33
- export default {
34
- name: "PMRDatasetCard",
35
- props: {
36
- /**
37
- * Object containing information for
38
- * the required viewing.
39
- */
40
- entry: {
41
- type: Array,
42
- default: () => []
43
- },
44
- envVars: {
45
- type: Object,
46
- default: () => {}
47
- },
48
- },
49
- data: function () {
50
- return {
51
- thumbnail: require('@/../assets/missing-image.svg'),
52
- dataLocation: this.entry.doi,
53
- discoverId: undefined,
54
- loading: false,
55
- version: 1,
56
- lastDoi: undefined,
57
- biolucidaData: undefined,
58
- currentCategory: "All"
59
- };
60
- },
61
- methods: {
62
- openDataset() {
63
- window.open(this.entry.model, "_blank");
64
- },
65
- }
66
- };
67
- </script>
68
-
69
- <!-- Add "scoped" attribute to limit CSS to this component only -->
70
- <style scoped lang="scss">
71
- @import "~element-ui/packages/theme-chalk/src/col";
72
- @import "~element-ui/packages/theme-chalk/src/loading";
73
-
74
- .dataset-card {
75
- padding-left: 16px;
76
- position: relative;
77
- min-height:17rem;
78
- }
79
-
80
- .title {
81
- padding-bottom: 0.75rem;
82
- font-family: Asap;
83
- font-size: 14px;
84
- font-weight: bold;
85
- font-stretch: normal;
86
- font-style: normal;
87
- line-height: 1.5;
88
- letter-spacing: 1.05px;
89
- color: #484848;
90
- cursor: pointer;
91
- }
92
- .card {
93
- padding-top: 18px;
94
- position: relative;
95
- display: flex;
96
- }
97
-
98
- .card-left{
99
- flex: 1
100
- }
101
-
102
- .card-right {
103
- flex: 1.3;
104
- padding-left: 6px;
105
- }
106
-
107
- .button{
108
- z-index: 10;
109
- font-family: Asap;
110
- font-size: 14px;
111
- font-weight: normal;
112
- font-stretch: normal;
113
- font-style: normal;
114
- line-height: normal;
115
- letter-spacing: normal;
116
- background-color: $app-primary-color;
117
- border: $app-primary-color;
118
- color: white;
119
- cursor: pointer;
120
- margin-top: 8px;
121
- }
122
-
123
- .button:hover {
124
- background-color: $app-primary-color;
125
- color: white;
126
- }
127
-
128
- .banner-img {
129
- width: 128px;
130
- height: 128px;
131
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);
132
- background-color: #ffffff;
133
- cursor: pointer;
134
- }
135
- .details{
136
- font-family: Asap;
137
- font-size: 14px;
138
- font-weight: normal;
139
- font-stretch: normal;
140
- font-style: normal;
141
- line-height: 1.5;
142
- letter-spacing: 1.05px;
143
- color: #484848;
144
- }
145
-
146
- .badges-container {
147
- margin-top:0.75rem;
148
- }
149
-
150
- .loading-icon {
151
- z-index: 20;
152
- width: 40px;
153
- height: 40px;
154
- left: 80px;
155
- }
156
-
157
- .loading-icon ::v-deep .el-loading-mask {
158
- background-color: rgba(117, 190, 218, 0.0) !important;
159
- }
160
-
161
- .loading-icon ::v-deep .el-loading-spinner .path {
162
- stroke: $app-primary-color;
163
- }
164
-
165
- .button {
166
- width: 150px;
167
- height: 40px;
168
- background-color: $app-primary-color;
169
- border: $app-primary-color;
170
- color: white;
171
- }
172
- </style>
@@ -1,162 +0,0 @@
1
- <template>
2
- <div class="dataset-card-container" ref="container">
3
- <div class="dataset-card" ref="card">
4
- <div class="seperator-path"></div>
5
- <div v-loading="loading" class="card" >
6
- <span class="card-left">
7
- <img class="banner-img" :src="thumbnail" @click="openDataset" />
8
- </span>
9
- <div class="card-right" @click="openDataset">
10
- {{entry.model}}
11
- <el-button class="button">Download file</el-button>
12
- </div>
13
-
14
- </div>
15
- </div>
16
- </div>
17
- </template>
18
-
19
-
20
- <script>
21
- /* eslint-disable no-alert, no-console */
22
- import Vue from "vue";
23
- import { Button, Icon } from "element-ui";
24
- import lang from "element-ui/lib/locale/lang/en";
25
- import locale from "element-ui/lib/locale";
26
-
27
- locale.use(lang);
28
- Vue.use(Button);
29
- Vue.use(Icon);
30
-
31
- export default {
32
- name: "PMRDatasetCard",
33
- props: {
34
- /**
35
- * Object containing information for
36
- * the required viewing.
37
- */
38
- entry: {
39
- type: Object,
40
- default: () => {}
41
- },
42
- envVars: {
43
- type: Object,
44
- default: () => {}
45
- },
46
- },
47
- data: function () {
48
- return {
49
- thumbnail: require('@/../assets/missing-image.svg'),
50
- dataLocation: this.entry.doi,
51
- discoverId: undefined,
52
- loading: false,
53
- version: 1,
54
- lastDoi: undefined,
55
- biolucidaData: undefined,
56
- currentCategory: "All"
57
- };
58
- },
59
- methods: {
60
- openDataset() {
61
- window.open(this.entry.model, "_blank");
62
- },
63
- }
64
- };
65
- </script>
66
-
67
- <!-- Add "scoped" attribute to limit CSS to this component only -->
68
- <style scoped lang="scss">
69
- @import "~element-ui/packages/theme-chalk/src/col";
70
- @import "~element-ui/packages/theme-chalk/src/loading";
71
-
72
- .dataset-card {
73
- padding-left: 16px;
74
- position: relative;
75
- min-height:17rem;
76
- }
77
-
78
- .title {
79
- padding-bottom: 0.75rem;
80
- font-family: Asap;
81
- font-size: 14px;
82
- font-weight: bold;
83
- font-stretch: normal;
84
- font-style: normal;
85
- line-height: 1.5;
86
- letter-spacing: 1.05px;
87
- color: #484848;
88
- cursor: pointer;
89
- }
90
- .card {
91
- padding-top: 18px;
92
- position: relative;
93
- display: flex;
94
- }
95
-
96
- .card-left{
97
- flex: 1
98
- }
99
-
100
- .card-right {
101
- flex: 1.3;
102
- padding-left: 6px;
103
- }
104
-
105
- .button{
106
- z-index: 10;
107
- font-family: Asap;
108
- font-size: 14px;
109
- font-weight: normal;
110
- font-stretch: normal;
111
- font-style: normal;
112
- line-height: normal;
113
- letter-spacing: normal;
114
- background-color: $app-primary-color;
115
- border: $app-primary-color;
116
- color: white;
117
- cursor: pointer;
118
- margin-top: 8px;
119
- }
120
-
121
- .button:hover {
122
- background-color: $app-primary-color;
123
- color: white;
124
- }
125
-
126
- .banner-img {
127
- width: 128px;
128
- height: 128px;
129
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);
130
- background-color: #ffffff;
131
- cursor: pointer;
132
- }
133
- .details{
134
- font-family: Asap;
135
- font-size: 14px;
136
- font-weight: normal;
137
- font-stretch: normal;
138
- font-style: normal;
139
- line-height: 1.5;
140
- letter-spacing: 1.05px;
141
- color: #484848;
142
- }
143
-
144
- .badges-container {
145
- margin-top:0.75rem;
146
- }
147
-
148
- .loading-icon {
149
- z-index: 20;
150
- width: 40px;
151
- height: 40px;
152
- left: 80px;
153
- }
154
-
155
- .loading-icon ::v-deep .el-loading-mask {
156
- background-color: rgba(117, 190, 218, 0.0) !important;
157
- }
158
-
159
- .loading-icon ::v-deep .el-loading-spinner .path {
160
- stroke: $app-primary-color;
161
- }
162
- </style>