@abi-software/map-side-bar 2.14.1-simulation.2 → 2.14.1-simulation.4

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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.14.1-simulation.2",
3
+ "version": "2.14.1-simulation.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div v-if="categories['All'].size > 1" class="container" ref="container">
3
- <div>View data types:</div>
2
+ <div v-if="visible" class="container" ref="container">
3
+ <div v-if="displayText">View data types:</div>
4
4
  <template v-for="(item, key) in categories">
5
5
  <el-button
6
6
  v-if="item.size > 0"
@@ -32,7 +32,15 @@ export default {
32
32
  return []
33
33
  },
34
34
  },
35
- entry: {
35
+ displayDataset: {
36
+ type: Boolean,
37
+ default: true,
38
+ },
39
+ displayText: {
40
+ type: Boolean,
41
+ default: true,
42
+ },
43
+ items: {
36
44
  type: Object,
37
45
  default: () => {
38
46
  return {}
@@ -42,22 +50,24 @@ export default {
42
50
  data: function () {
43
51
  return {
44
52
  //Always start with 1 image - the dataset thumbnail itself
45
- categories: { All: { size: 1 }, Dataset: { size: 1 } },
53
+ categories: { },
46
54
  active: 'All',
55
+ totalSize: 0,
56
+ }
57
+ },
58
+ computed: {
59
+ // This computed property populates filter data's entry object with $data from this sidebar
60
+ visible: function () {
61
+ return (this.displayDataset && this.totalSize > 1) ||
62
+ (!this.displayDataset && this.totalSize > 0)
47
63
  }
48
64
  },
49
65
  methods: {
50
- addToCategories: function (array, name) {
66
+ addToCategories: function (name) {
67
+ const array = this.items[name]
51
68
  if (array && array.length > 0) {
52
69
  this.categories[name] = { size: array.length }
53
- this.categories['All'].size += array.length
54
- }
55
- },
56
- addSimulationsToCategories: function (array) {
57
- if (array && array.length > 0) {
58
- const size = array.length
59
- this.categories['Simulations'] = { size }
60
- this.categories['All'].size += size
70
+ this.totalSize += array.length
61
71
  }
62
72
  },
63
73
  categoryClicked: function (name) {
@@ -66,15 +76,34 @@ export default {
66
76
  },
67
77
  },
68
78
  watch: {
69
- entry: {
79
+ items: {
70
80
  deep: true,
71
81
  immediate: true,
72
82
  handler: function () {
73
- this.addToCategories(this.entry.flatmaps, 'Flatmaps')
74
- this.addToCategories(this.entry.plots, 'Plots')
75
- this.addToCategories(this.entry.scaffolds, 'Scaffolds')
76
- this.addToCategories(this.entry['protocol-data'], 'Protocol Data')
77
- this.addSimulationsToCategories(this.entry.simulation)
83
+ this.categories = {}
84
+ this.totalSize = 0
85
+ this.active = "All"
86
+ let keys = ['Flatmaps', 'Plots', 'Protocol Data', 'Scaffolds', 'Simulations']
87
+ keys.forEach(key => this.addToCategories(key))
88
+ if (this.displayDataset) {
89
+ this.totalSize += 1
90
+ this.categories.All = { size: this.totalSize }
91
+ this.categories.Dataset = { size: 1 }
92
+ } else {
93
+ const keys = Object.keys(this.categories)
94
+ if (keys.length > 1) {
95
+ this.categories.All = { size: this.totalSize }
96
+ } else if (keys.length === 1) {
97
+ this.categoryClicked(keys[0])
98
+ }
99
+ }
100
+ this.categories = Object.keys(this.categories).sort().reduce(
101
+ (obj, key) => {
102
+ obj[key] = this.categories[key];
103
+ return obj;
104
+ },
105
+ {}
106
+ );
78
107
  /** disable the following
79
108
  this.addToCategories(this.entry.images, 'Images');
80
109
  this.addToCategories(this.entry.videos, 'Videos');
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  <div class="badges-container">
37
37
  <BadgesGroup
38
- :entry="entry"
38
+ :items="items"
39
39
  @categoryChanged="categoryChanged"
40
40
  />
41
41
  </div>
@@ -274,6 +274,7 @@ export default {
274
274
  }
275
275
  this.items['Flatmaps'].push({
276
276
  id,
277
+ description: flatmap.description,
277
278
  title: baseName(filePath),
278
279
  filePath: filePath,
279
280
  type: 'Flatmap',
@@ -363,6 +364,7 @@ export default {
363
364
  }
364
365
  this.items['Plots'].push({
365
366
  id,
367
+ description: plot.description,
366
368
  title: baseName(filePath),
367
369
  filePath: filePath,
368
370
  type: 'Plot',
@@ -405,12 +407,13 @@ export default {
405
407
  discoverId: this.discoverId,
406
408
  apiLocation: this.envVars.API_LOCATION,
407
409
  version: this.version,
408
- banner: this.datasetThumbnail,
410
+ banner: this.thumbnail,
409
411
  s3uri: this.entry.s3uri,
410
412
  contextCardUrl: this.getContextCardUrl(i),
411
413
  }
412
414
  this.items['Scaffolds'].push({
413
415
  id,
416
+ description: scaffold.description,
414
417
  title: baseName(filePath),
415
418
  filePath: filePath,
416
419
  type: 'Scaffold',
@@ -424,6 +427,7 @@ export default {
424
427
  },
425
428
  createSimulationItems: function () {
426
429
  if (this.entry.simulation) {
430
+ console.log(this.entry.simulation)
427
431
  this.entry.simulation.forEach((simulation) => {
428
432
  if (simulation.additional_mimetype.name === "application/x.vnd.abi.simulation+json") {
429
433
  let action = {
@@ -488,6 +492,7 @@ export default {
488
492
  }
489
493
  this.items['Simulations'].push({
490
494
  id,
495
+ description: simulation.description,
491
496
  title: baseName(filePath),
492
497
  filePath: filePath,
493
498
  type: 'Simulation',
@@ -578,7 +583,11 @@ export default {
578
583
  window.open(this.dataLocation, '_blank')
579
584
  },
580
585
  openFileBrowser: function() {
581
- this.$emit('openFileBrowser', {datasetID: this.discoverId, items: this.items})
586
+ this.$emit('openFileBrowser', {
587
+ datasetID: this.discoverId,
588
+ datasetName: this.entry.name,
589
+ items: this.items,
590
+ })
582
591
  },
583
592
  openRepository: function () {
584
593
  let apiLocation = this.envVars.API_LOCATION
@@ -106,10 +106,15 @@
106
106
  </div>
107
107
  <el-dialog
108
108
  v-model="fileBrowserVisible"
109
- title="File browser"
109
+ :title="fileBrowserTitle"
110
110
  width="700"
111
- top="16px">
112
- <FileBrowser ref="fileBrowserRef" />
111
+ top="16px"
112
+ :modal="false"
113
+ >
114
+ <FileBrowser
115
+ ref="fileBrowserRef"
116
+ @fileActionTriggered="fileActionTriggered"
117
+ />
113
118
  </el-dialog>
114
119
  </el-card>
115
120
 
@@ -214,6 +219,7 @@ export default {
214
219
  display: 'flex',
215
220
  },
216
221
  cascaderIsReady: false,
222
+ fileBrowserTitle: "File Browser",
217
223
  fileBrowserVisible: false,
218
224
  fileSearch: {
219
225
  onGoing: false,
@@ -237,10 +243,14 @@ export default {
237
243
  },
238
244
  },
239
245
  methods: {
246
+ fileActionTriggered: function(action) {
247
+ this.fileBrowserVisible = false
248
+ EventBus.emit('PopoverActionClick', action)
249
+ EventBus.emit('contextUpdate', action) // Pass to mapintegratedvuer
250
+ },
240
251
  fileInfoReady: function(payload) {
241
252
  if (this.fileSearch.onGoing) {
242
253
  if (payload.id === this.fileSearch.datasetID) {
243
- console.log(payload.id)
244
254
  payload.instance.openFileBrowser()
245
255
  }
246
256
  }
@@ -266,6 +276,15 @@ export default {
266
276
  openFileBrowser: function(data) {
267
277
  this.fileBrowserVisible = true
268
278
  this.$nextTick(() => {
279
+ if (data.datasetID) {
280
+ this.fileBrowserTitle = `Dataset ${data.datasetID}`
281
+ if (data.datasetName) {
282
+ this.fileBrowserTitle += `: ${data.datasetName}`
283
+ }
284
+ } else {
285
+ this.fileBrowserTitle = "File Browser"
286
+ }
287
+
269
288
  this.$refs.fileBrowserRef.setData(data.items)
270
289
  if (this.fileSearch.onGoing) {
271
290
  if (this.fileSearch.datasetID === data.datasetID) {
@@ -679,6 +698,45 @@ export default {
679
698
  border: 0;
680
699
  border-top-right-radius: 0;
681
700
  border-bottom-right-radius: 0;
701
+
702
+ :deep(.el-card__header) {
703
+ background-color: #292b66;
704
+ padding: 1rem;
705
+ }
706
+ :deep(.el-card__body) {
707
+ background-color: #f7faff;
708
+ overflow-y: hidden;
709
+ padding: 1rem;
710
+ }
711
+ :deep(.el-card__body) {
712
+ background-color: #f7faff;
713
+ overflow-y: hidden;
714
+ padding: 1rem;
715
+ }
716
+
717
+ :deep(.el-dialog) {
718
+ background: #f7faff;
719
+ padding: 8px;
720
+ border-width:1px;
721
+ .el-dialog__header {
722
+ padding-top: 8px;
723
+ padding-bottom: 8px;
724
+ }
725
+ }
726
+
727
+ :deep(.el-message) {
728
+ position: absolute !important;
729
+ width: 80%;
730
+ font-size: 12px;
731
+ border-radius: var(--el-border-radius-base);
732
+ --el-message-bg-color: var(--el-color-error-light-9);
733
+ --el-message-border-color: var(--el-color-error);
734
+ --el-message-text-color: var(--el-text-color-primary);
735
+
736
+ .el-icon.el-message__icon {
737
+ display: none;
738
+ }
739
+ }
682
740
  }
683
741
 
684
742
  .step-item {
@@ -694,30 +752,6 @@ export default {
694
752
  padding-top: 15px;
695
753
  }
696
754
 
697
- .content-card :deep(.el-card__header) {
698
- background-color: #292b66;
699
- padding: 1rem;
700
- }
701
-
702
- .content-card :deep(.el-card__body) {
703
- background-color: #f7faff;
704
- overflow-y: hidden;
705
- padding: 1rem;
706
- }
707
-
708
- .content-card :deep(.el-message) {
709
- position: absolute !important;
710
- width: 80%;
711
- font-size: 12px;
712
- border-radius: var(--el-border-radius-base);
713
- --el-message-bg-color: var(--el-color-error-light-9);
714
- --el-message-border-color: var(--el-color-error);
715
- --el-message-text-color: var(--el-text-color-primary);
716
-
717
- .el-icon.el-message__icon {
718
- display: none;
719
- }
720
- }
721
755
 
722
756
  .content {
723
757
  // width: 515px;
@@ -728,21 +762,29 @@ export default {
728
762
  overflow-y: scroll;
729
763
  scrollbar-width: thin;
730
764
  border-radius: var(--el-border-radius-base);
731
- }
732
765
 
733
- .content :deep(.el-loading-spinner .path) {
734
- stroke: $app-primary-color;
735
- }
766
+ :deep(.el-loading-spinner .path) {
767
+ stroke: $app-primary-color;
768
+ }
736
769
 
737
- .content :deep(.step-item:first-child .seperator-path) {
738
- display: none;
739
- }
770
+ :deep(.step-item:first-child .seperator-path) {
771
+ display: none;
772
+ }
740
773
 
741
- .content :deep(.step-item:not(:first-child) .seperator-path) {
742
- width: 455px;
743
- height: 0px;
744
- border: solid 1px #e4e7ed;
745
- background-color: #e4e7ed;
774
+ :deep(.step-item:not(:first-child) .seperator-path) {
775
+ width: 455px;
776
+ height: 0px;
777
+ border: solid 1px #e4e7ed;
778
+ background-color: #e4e7ed;
779
+ }
780
+
781
+ :deep(.el-loading-spinner .path) {
782
+ stroke: $app-primary-color;
783
+ }
784
+
785
+ :deep(.step-item:first-child .seperator-path) {
786
+ display: none;
787
+ }
746
788
  }
747
789
 
748
790
  .scrollbar::-webkit-scrollbar-track {
@@ -785,4 +827,5 @@ export default {
785
827
  box-shadow: none !important;
786
828
  }
787
829
  }
830
+
788
831
  </style>
@@ -1,6 +1,13 @@
1
1
  <template>
2
2
  <div>
3
-
3
+ <div class="badges-container">
4
+ <BadgesGroup
5
+ :displayDataset="false"
6
+ :displayText="false"
7
+ :items="items"
8
+ @categoryChanged="categoryChanged"
9
+ />
10
+ </div>
4
11
  <el-table
5
12
  v-if="fileLists"
6
13
  :data="fileLists"
@@ -12,7 +19,16 @@
12
19
  <template #default="props">
13
20
  <div class="file-details" m="4">
14
21
  <p m="t-0 b-2" v-if="props.row.description">
15
- Description: {{ props.row.description }}
22
+ <b>>Description:</b> {{ props.row.description }}
23
+ </p>
24
+ <p m="t-0 b-2" v-if="props.row.protocol">
25
+ <b>Protocol</b>: {{ props.row.protocol }}
26
+ </p>
27
+ <div v-for="(val, key) in props.row.columns">
28
+ <p :key="key" m="t-0 b-2">Column {{ key + 1 }}: {{ val }}</p>
29
+ </div>
30
+ <p m="t-0 b-2">
31
+ <b>File path:</b> {{ props.row.filePath }}
16
32
  </p>
17
33
  <p m="t-0 b-2" v-if="props.row.protocol">
18
34
  Protocol: {{ props.row.protocol }}
@@ -43,18 +59,19 @@
43
59
  prop="fileName"
44
60
  label="File name"
45
61
  width="200"
46
- class-name="title-text"
62
+ class-name="column-text"
47
63
  />
48
64
  <el-table-column
49
65
  prop="type"
50
66
  label="Type"
51
67
  width="100"
68
+ class-name="column-text"
52
69
  />
53
70
  <el-table-column
54
71
  fixed="right"
55
72
  >
56
73
  <template #header>
57
- <el-input v-model="search" size="small" placeholder="Type to search" />
74
+ <el-input v-model="search" size="small" placeholder="Type to search" clearable/>
58
75
  </template>
59
76
  <template #default="scope">
60
77
  <el-button
@@ -71,6 +88,7 @@
71
88
 
72
89
  <script>
73
90
  //provide the s3Bucket related methods and data.
91
+ import BadgesGroup from './BadgesGroup.vue'
74
92
  import {
75
93
  ElButton as Button,
76
94
  ElImage as Image,
@@ -78,12 +96,12 @@ import {
78
96
  ElTable as Table,
79
97
  ElTableColumn as TableColumn
80
98
  } from "element-plus";
81
- import EventBus from './EventBus.js'
82
99
  import { ref } from 'vue'
83
100
 
84
101
  export default {
85
102
  name: 'FileBrowser',
86
103
  components: {
104
+ BadgesGroup,
87
105
  Button,
88
106
  Image,
89
107
  Input,
@@ -93,11 +111,21 @@ export default {
93
111
  data() {
94
112
  return {
95
113
  category: "All",
114
+ items: {
115
+ Dataset: [],
116
+ Flatmaps:[],
117
+ Scaffolds: [],
118
+ Simulations: [],
119
+ Plots: [],
120
+ },
96
121
  search: "",
97
122
  tableData: undefined,
98
123
  }
99
124
  },
100
125
  methods: {
126
+ categoryChanged: function(name) {
127
+ this.category = name
128
+ },
101
129
  getActionLabel: function(type) {
102
130
  if (type === "Simulations" || type === "Protocol Data") {
103
131
  return "Run"
@@ -109,8 +137,7 @@ export default {
109
137
  this.search = searchTerm
110
138
  },
111
139
  handleView: function(row) {
112
- EventBus.emit('PopoverActionClick', row.action)
113
- EventBus.emit('contextUpdate', row.action) // Pass to mapintegratedvuer
140
+ this.$emit("fileActionTriggered", row.action)
114
141
  },
115
142
  downloadThumbnail: async function(url, entry) {
116
143
  const response = await fetch(url)
@@ -132,7 +159,9 @@ export default {
132
159
  }
133
160
  },
134
161
  setData: function(data) {
162
+ Object.assign(this.items, data)
135
163
  this.tableData = ref([])
164
+ this.category = "All"
136
165
  this.search = ""
137
166
  Object.keys(data).forEach((key) => {
138
167
  if (key !== "Dataset") {
@@ -164,10 +193,15 @@ export default {
164
193
  },
165
194
  computed: {
166
195
  fileLists() {
167
- if (!this.search) return this.tableData
196
+ if (!this.search && this.category === "All") return this.tableData
168
197
  const keys = ["fileName", "filePath", "description", "type", "protocol"]
169
198
  const lower = this.search.toLowerCase()
170
199
  const list = this.tableData.filter((data) => {
200
+ if (this.category !== "All") {
201
+ if (data.type !== this.category) {
202
+ return false
203
+ }
204
+ }
171
205
  for (let key of keys) {
172
206
  if (data[key] && data[key].toLowerCase().includes(lower)) {
173
207
  return true
@@ -188,13 +222,18 @@ export default {
188
222
  </script>
189
223
 
190
224
  <style lang="scss" scoped>
225
+ .badges-container {
226
+ padding-bottom: 8px;
227
+ }
228
+
191
229
  :deep(.el-table__body-wrapper) {
192
- .title-text {
193
- font-size: 10px;
230
+ .column-text {
231
+ font-size: 12px;
194
232
  }
195
233
  }
196
234
 
197
235
  .file-details {
198
- font-size: 10px;
236
+ padding-left: 8px;
237
+ font-size: 12px;
199
238
  }
200
239
  </style>