@abi-software/map-side-bar 2.14.1-simulation.3 → 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.3",
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,9 +106,10 @@
106
106
  </div>
107
107
  <el-dialog
108
108
  v-model="fileBrowserVisible"
109
- title="File browser"
109
+ :title="fileBrowserTitle"
110
110
  width="700"
111
111
  top="16px"
112
+ :modal="false"
112
113
  >
113
114
  <FileBrowser
114
115
  ref="fileBrowserRef"
@@ -218,6 +219,7 @@ export default {
218
219
  display: 'flex',
219
220
  },
220
221
  cascaderIsReady: false,
222
+ fileBrowserTitle: "File Browser",
221
223
  fileBrowserVisible: false,
222
224
  fileSearch: {
223
225
  onGoing: false,
@@ -274,6 +276,15 @@ export default {
274
276
  openFileBrowser: function(data) {
275
277
  this.fileBrowserVisible = true
276
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
+
277
288
  this.$refs.fileBrowserRef.setData(data.items)
278
289
  if (this.fileSearch.onGoing) {
279
290
  if (this.fileSearch.datasetID === data.datasetID) {
@@ -687,6 +698,45 @@ export default {
687
698
  border: 0;
688
699
  border-top-right-radius: 0;
689
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
+ }
690
740
  }
691
741
 
692
742
  .step-item {
@@ -702,30 +752,6 @@ export default {
702
752
  padding-top: 15px;
703
753
  }
704
754
 
705
- .content-card :deep(.el-card__header) {
706
- background-color: #292b66;
707
- padding: 1rem;
708
- }
709
-
710
- .content-card :deep(.el-card__body) {
711
- background-color: #f7faff;
712
- overflow-y: hidden;
713
- padding: 1rem;
714
- }
715
-
716
- .content-card :deep(.el-message) {
717
- position: absolute !important;
718
- width: 80%;
719
- font-size: 12px;
720
- border-radius: var(--el-border-radius-base);
721
- --el-message-bg-color: var(--el-color-error-light-9);
722
- --el-message-border-color: var(--el-color-error);
723
- --el-message-text-color: var(--el-text-color-primary);
724
-
725
- .el-icon.el-message__icon {
726
- display: none;
727
- }
728
- }
729
755
 
730
756
  .content {
731
757
  // width: 515px;
@@ -736,21 +762,29 @@ export default {
736
762
  overflow-y: scroll;
737
763
  scrollbar-width: thin;
738
764
  border-radius: var(--el-border-radius-base);
739
- }
740
765
 
741
- .content :deep(.el-loading-spinner .path) {
742
- stroke: $app-primary-color;
743
- }
766
+ :deep(.el-loading-spinner .path) {
767
+ stroke: $app-primary-color;
768
+ }
744
769
 
745
- .content :deep(.step-item:first-child .seperator-path) {
746
- display: none;
747
- }
770
+ :deep(.step-item:first-child .seperator-path) {
771
+ display: none;
772
+ }
748
773
 
749
- .content :deep(.step-item:not(:first-child) .seperator-path) {
750
- width: 455px;
751
- height: 0px;
752
- border: solid 1px #e4e7ed;
753
- 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
+ }
754
788
  }
755
789
 
756
790
  .scrollbar::-webkit-scrollbar-track {
@@ -793,4 +827,5 @@ export default {
793
827
  box-shadow: none !important;
794
828
  }
795
829
  }
830
+
796
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"
@@ -131,7 +159,9 @@ export default {
131
159
  }
132
160
  },
133
161
  setData: function(data) {
162
+ Object.assign(this.items, data)
134
163
  this.tableData = ref([])
164
+ this.category = "All"
135
165
  this.search = ""
136
166
  Object.keys(data).forEach((key) => {
137
167
  if (key !== "Dataset") {
@@ -163,10 +193,15 @@ export default {
163
193
  },
164
194
  computed: {
165
195
  fileLists() {
166
- if (!this.search) return this.tableData
196
+ if (!this.search && this.category === "All") return this.tableData
167
197
  const keys = ["fileName", "filePath", "description", "type", "protocol"]
168
198
  const lower = this.search.toLowerCase()
169
199
  const list = this.tableData.filter((data) => {
200
+ if (this.category !== "All") {
201
+ if (data.type !== this.category) {
202
+ return false
203
+ }
204
+ }
170
205
  for (let key of keys) {
171
206
  if (data[key] && data[key].toLowerCase().includes(lower)) {
172
207
  return true
@@ -187,13 +222,18 @@ export default {
187
222
  </script>
188
223
 
189
224
  <style lang="scss" scoped>
225
+ .badges-container {
226
+ padding-bottom: 8px;
227
+ }
228
+
190
229
  :deep(.el-table__body-wrapper) {
191
- .title-text {
192
- font-size: 10px;
230
+ .column-text {
231
+ font-size: 12px;
193
232
  }
194
233
  }
195
234
 
196
235
  .file-details {
197
- font-size: 10px;
236
+ padding-left: 8px;
237
+ font-size: 12px;
198
238
  }
199
239
  </style>