caixanegra 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caixanegra/designer.js +56 -26
- data/app/assets/stylesheets/caixanegra/designer.scss +9 -0
- data/app/controllers/caixanegra/api/designer/units_controller.rb +2 -1
- data/app/models/caixanegra/unit.rb +12 -4
- data/lib/caixanegra/executor.rb +4 -2
- data/lib/caixanegra/unit_helper.rb +11 -15
- data/lib/caixanegra/version.rb +1 -1
- metadata +2 -3
- data/app/helpers/caixanegra/application_helper.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c291dfc1c33d2c17e87093eff1bceff3c061ef8c7230a561ace088cd9e23f279
|
4
|
+
data.tar.gz: e812c3f4c1d202902f926115162c0b9b46885b35af56db52db3aa94ab8e53ac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6276bd14d36c832729b8a717a15ad5a8c6b9e6223343d6169fa1c153dc0389d0d0ef73ed61b0eb4f19a9dfc1936683b59b80e994b740df4cc670958fbc21833
|
7
|
+
data.tar.gz: 70059940599beff0f5cf09bbb73defa53fc31e336166a15a0262902f194862cd318b5bb8fb7bcb22a7934960411c7dce14f997816a0430fc943ba6d0dceddb88
|
@@ -522,33 +522,63 @@ window.Caixanegra.Designer = {
|
|
522
522
|
this.#catalog = response;
|
523
523
|
const unitMenu = document.querySelector("#unitMenu");
|
524
524
|
unitMenu.innerHTML = "";
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
525
|
+
|
526
|
+
const scopes = [];
|
527
|
+
|
528
|
+
this.#catalog.forEach(unit => {
|
529
|
+
if (unit.hasOwnProperty("scope") && Array.isArray(unit.scope)) {
|
530
|
+
scopes.push(...unit.scope);
|
531
|
+
} else {
|
532
|
+
scopes.push("_unscoped");
|
533
|
+
}
|
534
|
+
});
|
535
|
+
|
536
|
+
[...new Set(scopes)].sort().forEach(scope => {
|
537
|
+
const scopeWrapper = document.createElement("div");
|
538
|
+
const scopeTitle = document.createElement("div");
|
539
|
+
const scopeUnits = document.createElement("div");
|
540
|
+
|
541
|
+
scopeWrapper.classList.add("unit-wrapper");
|
542
|
+
scopeTitle.classList.add("title");
|
543
|
+
|
544
|
+
scopeTitle.innerHTML = scope === "_unscoped" ? "unscoped" : scope.replace(/_/g, " ");
|
545
|
+
scopeWrapper.appendChild(scopeTitle);
|
546
|
+
scopeWrapper.appendChild(scopeUnits);
|
547
|
+
|
548
|
+
const filteredUnits = this.#catalog.filter(unit => {
|
549
|
+
return (unit.scope === null && scope === "_unscoped") || (unit.scope || []).includes(scope)
|
550
|
+
});
|
551
|
+
|
552
|
+
filteredUnits.forEach((unitData) => {
|
553
|
+
const item = document.createElement("div");
|
554
|
+
const content = document.createElement("div");
|
555
|
+
const colorCode = document.createElement("div");
|
556
|
+
const header = document.createElement("div");
|
557
|
+
const name = document.createElement("span");
|
558
|
+
const type = document.createElement("span");
|
559
|
+
const description = document.createElement("div");
|
560
|
+
description.classList.add("description");
|
561
|
+
item.classList.add("unit");
|
562
|
+
header.classList.add("header");
|
563
|
+
content.classList.add("content");
|
564
|
+
colorCode.classList.add("color-code");
|
565
|
+
name.classList.add("name");
|
566
|
+
type.classList.add("type");
|
567
|
+
|
568
|
+
name.innerHTML = unitData.title;
|
569
|
+
type.innerHTML = unitData.type;
|
570
|
+
description.innerHTML = unitData.description;
|
571
|
+
colorCode.style.backgroundColor = Caixanegra.Designer.typeColor(unitData.type);
|
572
|
+
|
573
|
+
header.append(name, type);
|
574
|
+
content.append(header, description);
|
575
|
+
item.append(colorCode, content);
|
576
|
+
item.addEventListener("click", this.createUnit.bind(this, unitData));
|
577
|
+
scopeUnits.appendChild(item);
|
578
|
+
});
|
579
|
+
unitMenu.appendChild(scopeWrapper);
|
551
580
|
});
|
581
|
+
|
552
582
|
this.#loadedComponents.catalog = true;
|
553
583
|
this.#reveal();
|
554
584
|
});
|
@@ -119,6 +119,15 @@ $accent-contrast-color: darken($accent-color, 20%);
|
|
119
119
|
transform: translateY(0%);
|
120
120
|
}
|
121
121
|
|
122
|
+
.unit-wrapper {
|
123
|
+
.title {
|
124
|
+
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
125
|
+
font-size: 0.7em;
|
126
|
+
color: rgba(0,0,0,.7);
|
127
|
+
margin-bottom: 5px;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
122
131
|
.unit {
|
123
132
|
display: flex;
|
124
133
|
flex-direction: row;
|
@@ -76,8 +76,12 @@ module Caixanegra
|
|
76
76
|
raise(UnitIOException.new, "Unable to fetch input '#{id}'")
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
80
|
-
self.class.
|
79
|
+
def scope
|
80
|
+
self.class.scope
|
81
|
+
end
|
82
|
+
|
83
|
+
def unit_name
|
84
|
+
self.class.unit_name
|
81
85
|
end
|
82
86
|
|
83
87
|
def description
|
@@ -108,12 +112,16 @@ module Caixanegra
|
|
108
112
|
end
|
109
113
|
|
110
114
|
class << self
|
111
|
-
attr_reader :
|
115
|
+
attr_reader :unit_name, :description, :inputs, :exits, :assignments, :type, :scope
|
112
116
|
|
113
117
|
@type = :passthrough
|
114
118
|
|
119
|
+
def configure_scope(value)
|
120
|
+
@scope = value
|
121
|
+
end
|
122
|
+
|
115
123
|
def configure_name(value)
|
116
|
-
@
|
124
|
+
@unit_name = value
|
117
125
|
end
|
118
126
|
|
119
127
|
def configure_description(value)
|
data/lib/caixanegra/executor.rb
CHANGED
@@ -148,9 +148,11 @@ module Caixanegra
|
|
148
148
|
|
149
149
|
exit_name = result[:exit_through]
|
150
150
|
metadata = unit_metadata(@step_unit.oid)
|
151
|
-
log_console_entry "Next unit found through '#{exit_name}': '#{@step_unit.oid}'"
|
152
151
|
exit_metadata = metadata[:exits].find { |ex| ex[:name] == exit_name.to_s }
|
153
|
-
unit(exit_metadata[:target], map_carry_over(result))
|
152
|
+
next_unit = unit(exit_metadata[:target], map_carry_over(result))
|
153
|
+
log_console_entry "Next unit found through '#{exit_name}': '#{next_unit.oid}'"
|
154
|
+
|
155
|
+
next_unit
|
154
156
|
end
|
155
157
|
|
156
158
|
def process_feeders
|
@@ -2,30 +2,26 @@ module Caixanegra
|
|
2
2
|
class UnitHelper
|
3
3
|
class << self
|
4
4
|
def scoped_units(scope)
|
5
|
-
|
6
|
-
all_units = all_units.merge(Caixanegra.units.reject { |_, v| v.is_a? Hash })
|
5
|
+
units = {}
|
7
6
|
|
8
|
-
(scope || "").split(",").
|
9
|
-
|
7
|
+
scopes = (scope || "").split(",").map(&:to_sym)
|
8
|
+
Caixanegra.units.each do |unit|
|
9
|
+
if unit.scope.nil? || unit.scope.any? { |checking_scope| scopes.include?(checking_scope) }
|
10
|
+
units[unit.name.demodulize.underscore.to_sym] = unit
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
|
-
|
14
|
+
units
|
13
15
|
end
|
14
16
|
|
15
17
|
def all_units
|
16
|
-
|
18
|
+
units = {}
|
17
19
|
|
18
|
-
Caixanegra.units.each do |
|
19
|
-
|
20
|
-
v.each do |ik, iv|
|
21
|
-
all_units[ik] = iv
|
22
|
-
end
|
23
|
-
else
|
24
|
-
all_units[k] = v
|
25
|
-
end
|
20
|
+
Caixanegra.units.each do |unit|
|
21
|
+
units[unit.name.demodulize.underscore.to_sym] = unit
|
26
22
|
end
|
27
23
|
|
28
|
-
|
24
|
+
units
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/caixanegra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caixanegra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sergiorribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -61,7 +61,6 @@ files:
|
|
61
61
|
- app/controllers/caixanegra/api_controller.rb
|
62
62
|
- app/controllers/caixanegra/application_controller.rb
|
63
63
|
- app/controllers/caixanegra/designer_controller.rb
|
64
|
-
- app/helpers/caixanegra/application_helper.rb
|
65
64
|
- app/models/caixanegra/unit.rb
|
66
65
|
- app/views/caixanegra/designer/index.html.erb
|
67
66
|
- app/views/layouts/caixanegra/application.html.erb
|