inferno_core 0.6.17 → 1.0.1
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.
- checksums.yaml +4 -4
- data/lib/inferno/apps/cli/execute.rb +1 -1
- data/lib/inferno/apps/cli/templates/.rubocop.yml +2 -2
- data/lib/inferno/apps/cli/templates/lib/%library_name%/example_suite.rb.tt +0 -1
- data/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt +11 -10
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +1 -1
- data/lib/inferno/apps/web/controllers/test_session_form_post_controller.rb +32 -1
- data/lib/inferno/apps/web/controllers/test_sessions/client_show.rb +1 -1
- data/lib/inferno/apps/web/router.rb +30 -3
- data/lib/inferno/apps/web/serializers/requirements_filtering_extractor.rb +17 -0
- data/lib/inferno/apps/web/serializers/test.rb +2 -1
- data/lib/inferno/apps/web/serializers/test_group.rb +7 -3
- data/lib/inferno/apps/web/serializers/test_session.rb +12 -2
- data/lib/inferno/apps/web/serializers/test_suite.rb +9 -6
- data/lib/inferno/apps/web/templates/test_kit.html.erb +316 -0
- data/lib/inferno/entities/test_kit.rb +4 -0
- data/lib/inferno/public/bundle.js +34 -34
- data/lib/inferno/public/bundle.js.LICENSE.txt +1 -1
- data/lib/inferno/public/common.js +48 -0
- data/lib/inferno/public/session.js +35 -0
- data/lib/inferno/public/test_kits.js +59 -0
- data/lib/inferno/repositories/test_kits.rb +11 -0
- data/lib/inferno/utils/persist_inputs.rb +4 -4
- data/lib/inferno/version.rb +1 -1
- metadata +36 -3
- /data/lib/inferno/apps/web/{index.html.erb → templates/client_index.html.erb} +0 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
/* UTILITIES */
|
2
|
+
|
3
|
+
// Show/hide element based on condition
|
4
|
+
const showElement = (condition, element) => {
|
5
|
+
if (condition) {
|
6
|
+
element.classList.add('show-item');
|
7
|
+
element.classList.remove('hide-item');
|
8
|
+
} else {
|
9
|
+
element.classList.add('hide-item');
|
10
|
+
element.classList.remove('show-item');
|
11
|
+
}
|
12
|
+
};
|
13
|
+
|
14
|
+
// Show toast message -- there should only be one at a time,
|
15
|
+
// if this behavior changes then this will need to be updated
|
16
|
+
const showToast = (message) => {
|
17
|
+
const toastElement = document.querySelector('.toast');
|
18
|
+
const toast = new bootstrap.Toast(toastElement);
|
19
|
+
const toastBody = document.querySelector('.toast-body');
|
20
|
+
toastBody.innerHTML = ''; // clear any existing errors
|
21
|
+
toastBody.append(message);
|
22
|
+
toast.show();
|
23
|
+
};
|
24
|
+
|
25
|
+
$(document).ready(function () {
|
26
|
+
const scrollTopTrigger = 0;
|
27
|
+
$(window).scroll(function () {
|
28
|
+
if ($(window).scrollTop() > scrollTopTrigger) {
|
29
|
+
$('.navbar').addClass('scrolled');
|
30
|
+
} else {
|
31
|
+
$('.navbar').removeClass('scrolled');
|
32
|
+
}
|
33
|
+
});
|
34
|
+
if ($(window).scrollTop() > scrollTopTrigger) {
|
35
|
+
$('.navbar').addClass('scrolled');
|
36
|
+
} else {
|
37
|
+
$('.navbar').removeClass('scrolled');
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
document.addEventListener('DOMContentLoaded', function () {
|
42
|
+
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
43
|
+
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
44
|
+
return new bootstrap.Tooltip(tooltipTriggerEl);
|
45
|
+
});
|
46
|
+
});
|
47
|
+
|
48
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
const createSession = () => {
|
2
|
+
// Get Suite ID
|
3
|
+
const suiteId = Array.from(document.getElementsByTagName('input'))
|
4
|
+
.filter((elem) => elem.checked && elem.name === 'suite')
|
5
|
+
.map((elem) => elem.value)[0]; // should only have one selected option
|
6
|
+
|
7
|
+
// Get checked options and map to id and value
|
8
|
+
const checkedOptions = Array.from(document.getElementsByTagName('input'))
|
9
|
+
.filter((elem) => elem.checked && elem.name !== 'suite' && $(elem).is(':visible'))
|
10
|
+
.map((elem) => ({
|
11
|
+
id: elem.name,
|
12
|
+
value: elem.value
|
13
|
+
}));
|
14
|
+
|
15
|
+
const postUrl = `api/test_sessions?test_suite_id=${suiteId}`;
|
16
|
+
const postBody = {
|
17
|
+
preset_id: null,
|
18
|
+
suite_options: checkedOptions,
|
19
|
+
};
|
20
|
+
fetch(postUrl, { method: 'POST', body: JSON.stringify(postBody) })
|
21
|
+
.then((response) => response.json())
|
22
|
+
.then((result) => {
|
23
|
+
const sessionId = result.id;
|
24
|
+
if (!result) {
|
25
|
+
throw Error('Session could not be created. Please check input values.');
|
26
|
+
} else if (!sessionId || sessionId === 'undefined') {
|
27
|
+
throw Error('Session could not be created. Session ID is undefined.');
|
28
|
+
} else {
|
29
|
+
location.href = `test_sessions/${sessionId}`;
|
30
|
+
}
|
31
|
+
})
|
32
|
+
.catch((e) => {
|
33
|
+
showToast(e);
|
34
|
+
});
|
35
|
+
};
|
@@ -0,0 +1,59 @@
|
|
1
|
+
// Returns a list of all tags as strings from a test kit element
|
2
|
+
const getTags = (tags, elem) => {
|
3
|
+
Array.from(elem.children).forEach((e) => {
|
4
|
+
if (e.className === 'tag') {
|
5
|
+
tags.push(e.innerText);
|
6
|
+
}
|
7
|
+
getTags(tags, e);
|
8
|
+
});
|
9
|
+
return tags;
|
10
|
+
};
|
11
|
+
|
12
|
+
// Returns the level of maturity for a given test kit element
|
13
|
+
const getMaturity = (elem) => {
|
14
|
+
let innerText = '';
|
15
|
+
Array.from(elem.children).forEach((e) => {
|
16
|
+
if (e.className === 'maturity') {
|
17
|
+
innerText = e.innerText;
|
18
|
+
return e.innerText;
|
19
|
+
}
|
20
|
+
|
21
|
+
// ignore the pinned icon for traversal, which is hit last
|
22
|
+
if(e.nodeName !== 'I'){
|
23
|
+
innerText = getMaturity(e);
|
24
|
+
}
|
25
|
+
|
26
|
+
});
|
27
|
+
|
28
|
+
return innerText;
|
29
|
+
};
|
30
|
+
|
31
|
+
// Returns true if test kit should be shown based on standard filter
|
32
|
+
const filterTag = (testKit, standard) => {
|
33
|
+
if (!standard) return true;
|
34
|
+
const tags = getTags([], testKit);
|
35
|
+
return tags.includes(standard) || standard === 'All Tags';
|
36
|
+
};
|
37
|
+
|
38
|
+
// Returns true if test kit should be shown based on maturity filter
|
39
|
+
const filterMaturity = (testKit, maturity) => {
|
40
|
+
if (!maturity) return true;
|
41
|
+
const testKitMaturity = getMaturity(testKit);
|
42
|
+
return testKitMaturity.includes(maturity) || maturity === 'All Levels';
|
43
|
+
};
|
44
|
+
|
45
|
+
// Returns true if test kit should be shown based on text filter
|
46
|
+
const filterText = (testKit, text) => {
|
47
|
+
const testKitText = testKit.innerText.toLowerCase();
|
48
|
+
return testKitText.includes(text);
|
49
|
+
};
|
50
|
+
|
51
|
+
// Ensure all applied filters take effect
|
52
|
+
const filterAll = (text, standard, maturity) => {
|
53
|
+
for (let testKit of document.getElementsByName('test-kit')) {
|
54
|
+
showElement(
|
55
|
+
filterText(testKit, text) && filterTag(testKit, standard) && filterMaturity(testKit, maturity),
|
56
|
+
testKit,
|
57
|
+
);
|
58
|
+
}
|
59
|
+
};
|
@@ -4,6 +4,17 @@ module Inferno
|
|
4
4
|
module Repositories
|
5
5
|
# Repository that deals with persistence for the `TestKit` entity.
|
6
6
|
class TestKits < InMemoryRepository
|
7
|
+
def local_test_kit
|
8
|
+
local_base_path = File.join(Dir.pwd, 'lib')
|
9
|
+
|
10
|
+
self.class.all.find do |test_kit|
|
11
|
+
Object.const_source_location(test_kit.name).first.start_with? local_base_path
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_kit_for_suite(suite_id)
|
16
|
+
self.class.all.find { |test_kit| test_kit.contains_test_suite? suite_id }
|
17
|
+
end
|
7
18
|
end
|
8
19
|
end
|
9
20
|
end
|
@@ -2,8 +2,8 @@ module Inferno
|
|
2
2
|
module Utils
|
3
3
|
# @private
|
4
4
|
module PersistInputs
|
5
|
-
def persist_inputs(session_data_repo, params,
|
6
|
-
available_inputs =
|
5
|
+
def persist_inputs(session_data_repo, params, runnable)
|
6
|
+
available_inputs = runnable.available_inputs
|
7
7
|
params[:inputs]&.each do |input_params|
|
8
8
|
input =
|
9
9
|
available_inputs
|
@@ -12,13 +12,13 @@ module Inferno
|
|
12
12
|
|
13
13
|
if input.nil?
|
14
14
|
Inferno::Application['logger'].warn(
|
15
|
-
"Unknown input `#{input_params[:name]}` for #{
|
15
|
+
"Unknown input `#{input_params[:name]}` for #{runnable.id}: #{runnable.title}"
|
16
16
|
)
|
17
17
|
next
|
18
18
|
end
|
19
19
|
|
20
20
|
session_data_repo.save(
|
21
|
-
test_session_id:
|
21
|
+
test_session_id: params[:test_session_id],
|
22
22
|
name: input.name,
|
23
23
|
value: input_params[:value],
|
24
24
|
type: input.type
|
data/lib/inferno/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inferno_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen MacVicar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-07-
|
13
|
+
date: 2025-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -250,6 +250,34 @@ dependencies:
|
|
250
250
|
- - '='
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: 2.0.0
|
253
|
+
- !ruby/object:Gem::Dependency
|
254
|
+
name: kramdown
|
255
|
+
requirement: !ruby/object:Gem::Requirement
|
256
|
+
requirements:
|
257
|
+
- - "~>"
|
258
|
+
- !ruby/object:Gem::Version
|
259
|
+
version: 2.5.1
|
260
|
+
type: :runtime
|
261
|
+
prerelease: false
|
262
|
+
version_requirements: !ruby/object:Gem::Requirement
|
263
|
+
requirements:
|
264
|
+
- - "~>"
|
265
|
+
- !ruby/object:Gem::Version
|
266
|
+
version: 2.5.1
|
267
|
+
- !ruby/object:Gem::Dependency
|
268
|
+
name: kramdown-parser-gfm
|
269
|
+
requirement: !ruby/object:Gem::Requirement
|
270
|
+
requirements:
|
271
|
+
- - "~>"
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
version: 1.1.0
|
274
|
+
type: :runtime
|
275
|
+
prerelease: false
|
276
|
+
version_requirements: !ruby/object:Gem::Requirement
|
277
|
+
requirements:
|
278
|
+
- - "~>"
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: 1.1.0
|
253
281
|
- !ruby/object:Gem::Dependency
|
254
282
|
name: mutex_m
|
255
283
|
requirement: !ruby/object:Gem::Requirement
|
@@ -531,7 +559,6 @@ files:
|
|
531
559
|
- lib/inferno/apps/web/controllers/test_suites/index.rb
|
532
560
|
- lib/inferno/apps/web/controllers/test_suites/requirements/index.rb
|
533
561
|
- lib/inferno/apps/web/controllers/test_suites/show.rb
|
534
|
-
- lib/inferno/apps/web/index.html.erb
|
535
562
|
- lib/inferno/apps/web/router.rb
|
536
563
|
- lib/inferno/apps/web/serializers/hash_value_extractor.rb
|
537
564
|
- lib/inferno/apps/web/serializers/header.rb
|
@@ -542,6 +569,7 @@ files:
|
|
542
569
|
- lib/inferno/apps/web/serializers/request.rb
|
543
570
|
- lib/inferno/apps/web/serializers/requirement.rb
|
544
571
|
- lib/inferno/apps/web/serializers/requirement_set.rb
|
572
|
+
- lib/inferno/apps/web/serializers/requirements_filtering_extractor.rb
|
545
573
|
- lib/inferno/apps/web/serializers/result.rb
|
546
574
|
- lib/inferno/apps/web/serializers/serializer.rb
|
547
575
|
- lib/inferno/apps/web/serializers/session_data.rb
|
@@ -551,6 +579,8 @@ files:
|
|
551
579
|
- lib/inferno/apps/web/serializers/test_run.rb
|
552
580
|
- lib/inferno/apps/web/serializers/test_session.rb
|
553
581
|
- lib/inferno/apps/web/serializers/test_suite.rb
|
582
|
+
- lib/inferno/apps/web/templates/client_index.html.erb
|
583
|
+
- lib/inferno/apps/web/templates/test_kit.html.erb
|
554
584
|
- lib/inferno/config/application.rb
|
555
585
|
- lib/inferno/config/boot.rb
|
556
586
|
- lib/inferno/config/boot/db.rb
|
@@ -660,8 +690,11 @@ files:
|
|
660
690
|
- lib/inferno/public/assets.json
|
661
691
|
- lib/inferno/public/bundle.js
|
662
692
|
- lib/inferno/public/bundle.js.LICENSE.txt
|
693
|
+
- lib/inferno/public/common.js
|
663
694
|
- lib/inferno/public/favicon.ico
|
664
695
|
- lib/inferno/public/logo192.png
|
696
|
+
- lib/inferno/public/session.js
|
697
|
+
- lib/inferno/public/test_kits.js
|
665
698
|
- lib/inferno/repositories.rb
|
666
699
|
- lib/inferno/repositories/headers.rb
|
667
700
|
- lib/inferno/repositories/igs.rb
|
File without changes
|