@abi-software/map-side-bar 2.14.1-simulation.3 → 2.14.1-simulation.5

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.5",
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,15 +19,17 @@
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">
25
+ <b>File path:</b> {{ props.row.filePath }}
16
26
  </p>
17
27
  <p m="t-0 b-2" v-if="props.row.protocol">
18
- Protocol: {{ props.row.protocol }}
28
+ <b>Protocol</b>: {{ props.row.protocol }}
19
29
  </p>
20
30
  <div v-for="(val, key) in props.row.columns">
21
- <p :key="key" m="t-0 b-2">Column {{ key + 1 }}: {{ val }}</p>
31
+ <p :key="key" m="t-0 b-2"><b>Column {{ key + 1 }}</b>: {{ val }}</p>
22
32
  </div>
23
- <p m="t-0 b-2">File path: {{ props.row.filePath }}</p>
24
33
  </div>
25
34
  </template>
26
35
  </el-table-column>
@@ -43,18 +52,19 @@
43
52
  prop="fileName"
44
53
  label="File name"
45
54
  width="200"
46
- class-name="title-text"
55
+ class-name="column-text"
47
56
  />
48
57
  <el-table-column
49
58
  prop="type"
50
59
  label="Type"
51
60
  width="100"
61
+ class-name="column-text"
52
62
  />
53
63
  <el-table-column
54
64
  fixed="right"
55
65
  >
56
66
  <template #header>
57
- <el-input v-model="search" size="small" placeholder="Type to search" />
67
+ <el-input v-model="search" size="small" placeholder="Type to search" clearable/>
58
68
  </template>
59
69
  <template #default="scope">
60
70
  <el-button
@@ -71,6 +81,7 @@
71
81
 
72
82
  <script>
73
83
  //provide the s3Bucket related methods and data.
84
+ import BadgesGroup from './BadgesGroup.vue'
74
85
  import {
75
86
  ElButton as Button,
76
87
  ElImage as Image,
@@ -78,12 +89,12 @@ import {
78
89
  ElTable as Table,
79
90
  ElTableColumn as TableColumn
80
91
  } from "element-plus";
81
- import EventBus from './EventBus.js'
82
92
  import { ref } from 'vue'
83
93
 
84
94
  export default {
85
95
  name: 'FileBrowser',
86
96
  components: {
97
+ BadgesGroup,
87
98
  Button,
88
99
  Image,
89
100
  Input,
@@ -93,11 +104,21 @@ export default {
93
104
  data() {
94
105
  return {
95
106
  category: "All",
107
+ items: {
108
+ Dataset: [],
109
+ Flatmaps:[],
110
+ Scaffolds: [],
111
+ Simulations: [],
112
+ Plots: [],
113
+ },
96
114
  search: "",
97
115
  tableData: undefined,
98
116
  }
99
117
  },
100
118
  methods: {
119
+ categoryChanged: function(name) {
120
+ this.category = name
121
+ },
101
122
  getActionLabel: function(type) {
102
123
  if (type === "Simulations" || type === "Protocol Data") {
103
124
  return "Run"
@@ -131,7 +152,9 @@ export default {
131
152
  }
132
153
  },
133
154
  setData: function(data) {
155
+ Object.assign(this.items, data)
134
156
  this.tableData = ref([])
157
+ this.category = "All"
135
158
  this.search = ""
136
159
  Object.keys(data).forEach((key) => {
137
160
  if (key !== "Dataset") {
@@ -163,10 +186,15 @@ export default {
163
186
  },
164
187
  computed: {
165
188
  fileLists() {
166
- if (!this.search) return this.tableData
189
+ if (!this.search && this.category === "All") return this.tableData
167
190
  const keys = ["fileName", "filePath", "description", "type", "protocol"]
168
191
  const lower = this.search.toLowerCase()
169
192
  const list = this.tableData.filter((data) => {
193
+ if (this.category !== "All") {
194
+ if (data.type !== this.category) {
195
+ return false
196
+ }
197
+ }
170
198
  for (let key of keys) {
171
199
  if (data[key] && data[key].toLowerCase().includes(lower)) {
172
200
  return true
@@ -187,13 +215,18 @@ export default {
187
215
  </script>
188
216
 
189
217
  <style lang="scss" scoped>
218
+ .badges-container {
219
+ padding-bottom: 8px;
220
+ }
221
+
190
222
  :deep(.el-table__body-wrapper) {
191
- .title-text {
192
- font-size: 10px;
223
+ .column-text {
224
+ font-size: 12px;
193
225
  }
194
226
  }
195
227
 
196
228
  .file-details {
197
- font-size: 10px;
229
+ padding-left: 8px;
230
+ font-size: 12px;
198
231
  }
199
232
  </style>