Skip to content

Commit 4f17ee1

Browse files
committed
fix bug in UI
1 parent 3809a95 commit 4f17ee1

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

application/src/tira_app/endpoints/admin_api.py

+14-17
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717

1818
from .. import tira_model as model
1919
from ..authentication import auth
20-
from ..checks import (
21-
check_conditional_permissions,
22-
check_permissions,
23-
check_resources_exist,
24-
)
20+
from ..checks import check_conditional_permissions, check_permissions, check_resources_exist
2521
from ..git_runner import check_that_git_integration_is_valid
2622
from ..ir_datasets_loader import run_irds_command
2723
from .v1._datasets import download_mirrored_resource
@@ -219,18 +215,19 @@ def admin_delete_task(request, task_id):
219215
def file_listing(path, title):
220216
path = Path(path)
221217
children = []
222-
for f in os.listdir(path):
223-
if len(children) > 5:
224-
children += [{"title": "..."}]
225-
break
226-
227-
if os.path.isdir(path / f):
228-
c = file_listing(path / f, str(f))["children"]
229-
children += [{"title": f, "children": c}]
230-
else:
231-
md5 = hashlib.md5(open(path / f, "rb").read()).hexdigest()
232-
size = os.path.getsize(path / f)
233-
children += [{"title": f + f" (size: {size}; md5sum: {md5})", "size": size, "md5sum": md5}]
218+
if path and Path(path).exists() and Path(path).is_dir():
219+
for f in os.listdir(path):
220+
if len(children) > 5:
221+
children += [{"title": "..."}]
222+
break
223+
224+
if os.path.isdir(path / f):
225+
c = file_listing(path / f, str(f))["children"]
226+
children += [{"title": f, "children": c}]
227+
else:
228+
md5 = hashlib.md5(open(path / f, "rb").read()).hexdigest()
229+
size = os.path.getsize(path / f)
230+
children += [{"title": f + f" (size: {size}; md5sum: {md5})", "size": size, "md5sum": md5}]
234231

235232
current_item = {"title": title}
236233
if len(children) > 0:

frontend/src/Datasets.vue

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
let ret : Record<string, string> = {}
8585
for (let resource_type of Object.keys(mirrors)) {
8686
for (let resource_name of Object.keys(mirrors[resource_type])) {
87+
if (resource_type.includes('md5_sum') || resource_type.includes('subdirectory') || resource_type.includes('rename_to')) {
88+
continue
89+
}
8790
ret[resource_name + ' (' + resource_type + ')'] = mirrors[resource_type][resource_name]
8891
}
8992
}

frontend/src/components/EditDataset.vue

+3
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@
194194
},
195195
watch: {
196196
evaluation_type(new_value, old_value) {
197+
if (this.dataset_id_from_props) {
198+
return
199+
}
197200
if (new_value != old_value && new_value == 'eval-1') {
198201
this.git_runner_image = "ubuntu:18.04"
199202
this.git_runner_command = "echo 'this is no real evaluator'"

0 commit comments

Comments
 (0)