Skip to content

Commit 51b638c

Browse files
authored
Merge pull request #138 from biothings/cleanup-modal-columns
Snapshot Cleanup Modal Columns Update
2 parents 48340bf + 0a1146a commit 51b638c

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

webapp/src/Cleanup.vue

+32-10
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@
107107
<label class="pl-0"></label>
108108
</div>
109109
</th>
110-
<th>Name</th>
111-
<th>Build Name</th>
110+
<!-- Combined Name / Index Name column -->
111+
<th>Name / Index Name</th>
112112
<th>S3 Path</th>
113113
<th>Environment</th>
114114
<th>Indexer Env</th>
115-
<th>Index Name</th>
116115
<th class="min-width-9">Created At</th>
117116
</tr>
118117
</thead>
@@ -137,12 +136,16 @@
137136
<label class="pl-0"></label>
138137
</div>
139138
</td>
140-
<td>{{ snapshot_data._id }}</td>
141-
<td>{{ snapshot_data.build_name }}</td>
142-
<td>{{ getBucketName(snapshot_data) }}</td>
139+
<!-- Combined Name / Index Name -->
140+
<td>{{ getCombinedName(snapshot_data) }}</td>
141+
<!-- Hyperlinked S3 Path -->
142+
<td>
143+
<a :href="getS3Url(snapshot_data)" target="_blank">
144+
{{ getBucketName(snapshot_data) }}
145+
</a>
146+
</td>
143147
<td>{{ snapshot_data.environment }}</td>
144148
<td>{{ snapshot_data.indexer_env || snapshot_data.conf.indexer.env }}</td>
145-
<td>{{ snapshot_data.index_name }}</td>
146149
<td class="min-width-9">{{ snapshot_data.created_at | moment('MMM Do YYYY, h:mm:ss a') }}</td>
147150
</tr>
148151
</template>
@@ -161,7 +164,6 @@
161164
</template>
162165

163166
<script>
164-
165167
import axios from 'axios'
166168
import Actionable from './Actionable.vue'
167169
import AsyncCommandLauncher from './AsyncCommandLauncher.vue'
@@ -194,7 +196,6 @@ export default {
194196
195197
// Initialize checkboxes
196198
$('.ui.checkbox').checkbox();
197-
198199
},
199200
data() {
200201
return {
@@ -365,7 +366,7 @@ export default {
365366
366367
this.launchAsyncCommand(cmd, onSuccess, onError);
367368
},
368-
369+
// Returns the S3 bucket path (bucket + base_path)
369370
getBucketName(snapshot_data) {
370371
if (
371372
snapshot_data.conf &&
@@ -375,6 +376,27 @@ export default {
375376
) {
376377
return snapshot_data.conf.repository.settings.bucket + '/' + snapshot_data.conf.repository.settings.base_path;
377378
}
379+
return '';
380+
},
381+
// Returns AWS URL based on the S3 bucket info.
382+
getS3Url(snapshot_data) {
383+
const settings = snapshot_data.conf?.repository?.settings;
384+
if (settings && settings.bucket && settings.region && settings.base_path) {
385+
const region = settings.region;
386+
const bucket = settings.bucket;
387+
const base_path = settings.base_path;
388+
return `https://${region}.console.aws.amazon.com/s3/buckets/${bucket}?region=${region}&bucketType=general&prefix=${base_path}/&showversions=false`;
389+
}
390+
return '#';
391+
},
392+
// Combines the snapshot name (_id) and the index_name.
393+
getCombinedName(snapshot_data) {
394+
const name = snapshot_data._id;
395+
const indexName = snapshot_data.index_name;
396+
if (!indexName || name === indexName) {
397+
return name;
398+
}
399+
return `${name} / ${indexName}`;
378400
},
379401
validate_snapshots(event) {
380402
const self = this;

0 commit comments

Comments
 (0)