Skip to content

Commit

Permalink
Merge pull request #460 from datalad/runprov-render
Browse files Browse the repository at this point in the history
Small tweaks to rendering of runprov records
  • Loading branch information
jsheunis authored May 23, 2024
2 parents 68b7665 + 55ef5e5 commit 76bb8d9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
17 changes: 9 additions & 8 deletions datalad_catalog/catalog/templates/dataset-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ <h5><span v-if="fund.name">{{fund.name}}</span><span v-else><em>(fund name not s
<span v-else v-for="record in selectedDataset.provenance">
<b-container>
<b-row>
<b-col>
<b-col cols="3">
<b-card header-bg-variant="transparent" >
<template v-slot:header>
<b-row no-gutters>
Expand All @@ -486,8 +486,7 @@ <h5><span v-if="fund.name">{{fund.name}}</span><span v-else><em>(fund name not s
</b-card-text>
</b-card>
</b-col>
<b-col cols="1"></b-col>
<b-col cols="5">
<b-col cols="6">
<b-card border-variant="dark">
<template v-slot:header class="text-center">
<b-card-title class="text-center"><i class="fas fa-terminal"></i>&nbsp;&nbsp;run-record</strong></b-card-title>
Expand All @@ -497,8 +496,11 @@ <h5><span v-if="fund.name">{{fund.name}}</span><span v-else><em>(fund name not s
<span class="text-muted"><i class="fas fa-code-commit"></i> {{record.dataset_version}}</span>
</small>
</b-card-text>
<b-card-text class="border rounded p-2">
{{record.description}}
<small>
<strong>&nbsp;Run command message: </strong><br>
</small>
<b-card-text class="shadow p-3 mb-3 bg-white rounded">
<span style="white-space: pre-wrap;">{{record.description.replace('[DATALAD RUNCMD] ', '')}}</span>
</b-card-text>
<b-card-text >
<small>
Expand All @@ -523,14 +525,13 @@ <h5><span v-if="fund.name">{{fund.name}}</span><span v-else><em>(fund name not s
<span class="lfont"><i class="fas fa-user-check"></i></span>&nbsp;&nbsp;{{record.author.name}}
</b-col>
<b-col align-h="right">
<small>{{record.datetime}}</small>
<small>{{record.datetime.replace('T', ' ')}}</small>
</b-col>
</b-row>
</template>
</b-card>
</b-col>
<b-col cols="1"></b-col>
<b-col>
<b-col cols="3">
<b-card header-bg-variant="transparent" >
<template v-slot:header>
<b-row no-gutters>
Expand Down
14 changes: 9 additions & 5 deletions datalad_catalog/extractors/catalog_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,15 @@ def ri2url(ri):
f["hostname"],
":" if f["port"] else "",
f["port"],
f["path"]
if op.isabs(f["path"])
else "/{}".format(f["path"])
if f["path"].startswith("~")
else "/~/{}".format(f["path"]),
(
f["path"]
if op.isabs(f["path"])
else (
"/{}".format(f["path"])
if f["path"].startswith("~")
else "/~/{}".format(f["path"])
)
),
)
elif isinstance(ri, dsn.PathRI):
# this has no chance of being resolved outside this machine
Expand Down
22 changes: 14 additions & 8 deletions datalad_catalog/extractors/catalog_runprov.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,20 @@ def get_file_id(rec):
rec["key"]
if "key" in rec
else "SHA1-s{}--{}".format(
rec["bytesize"]
if "bytesize" in rec
else 0
if rec["type"] == "symlink"
else os.stat(rec["path"]).st_size,
rec["gitshasum"]
if "gitshasum" in rec
else Digester(digests=["sha1"])(rec["path"])["sha1"],
(
rec["bytesize"]
if "bytesize" in rec
else (
0
if rec["type"] == "symlink"
else os.stat(rec["path"]).st_size
)
),
(
rec["gitshasum"]
if "gitshasum" in rec
else Digester(digests=["sha1"])(rec["path"])["sha1"]
),
)
)
return "datalad:{}".format(id_)
Expand Down

0 comments on commit 76bb8d9

Please sign in to comment.