-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add diff view to lookup results #301
Just like with regular value display from a single file this now checks if a node is from a different environment than the selected one. If it is, the same tabbed view with a diff is presented, showing the lookup result in the selected environment and the diff to the lookup in the original environment.
- Loading branch information
Showing
5 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
<% if file.has_differing_value_in_original_environment?(@key) %> | ||
<ul class="nav nav-tabs mb-2" role="tablist"> | ||
<li class="nav-item" role="presentation"> | ||
<button id="<%= "tab-value-#{dom_id(file)}" %>" class="nav-link active" data-bs-target="<%= "#value-#{dom_id(file)}" %>" data-bs-toggle="tab" type="button" role="tab" aria-controls="<%= "value-#{dom_id(file)}" %>" aria-selected="true">Value</button> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<button id="<%= "tab-diff-#{dom_id(file)}" %>" class="nav-link" data-bs-target="<%= "#diff-#{dom_id(file)}" %>" data-bs-toggle="tab" type="button" role="tab" aria-controls="<%= "diff-#{dom_id(file)}" %>" aria-selected="false">Diff</button> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div id="<%= "value-#{dom_id(file)}" %>" class="tab-pane fade show active" role="tabpanel" aria-labelledby="<%= "tab-value-#{dom_id(file)}" %>"> | ||
<%= render "form", file: file, value: value %> | ||
</div> | ||
|
||
<div id="<%= "diff-#{dom_id(file)}" %>" class="tab-pane fade" role="tabpanel" aria-labelledby="<%= "tab-diff-#{dom_id(file)}" %>"> | ||
<%= render "diff", file: file, value: value %> | ||
</div> | ||
</div> | ||
<%= render "shared/tabbed_diff", dom_id: dom_id(file), original_value:file.value_from_original_environment(key: @key).value, current_value: value.value do %> | ||
<%= render "form", file: file, value: value %> | ||
<% end %> | ||
<% else %> | ||
<%= render "form", file: file, value: value %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
<%= turbo_frame_tag "lookup-result-frame" do %> | ||
<code><pre><%= HieraData::Util.yaml_format(@result) %></pre></code> | ||
<% if @original_result && @original_result != @result %> | ||
<%= render "shared/tabbed_diff", dom_id: "lookup-#{dom_id(@key)}", original_value: @original_result, current_value: @result do %> | ||
<div class="p-2"> | ||
<code><pre><%= HieraData::Util.yaml_format(@result) %></pre></code> | ||
</div> | ||
<% end %> | ||
<% else %> | ||
<code><pre><%= HieraData::Util.yaml_format(@result) %></pre></code> | ||
<% end %> | ||
<% end %> |
2 changes: 1 addition & 1 deletion
2
app/views/keys/_diff.html.erb → app/views/shared/_diff.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<ul class="nav nav-tabs mb-2" role="tablist"> | ||
<li class="nav-item" role="presentation"> | ||
<button id="<%= "tab-value-#{dom_id}" %>" class="nav-link active" data-bs-target="<%= "#value-#{dom_id}" %>" data-bs-toggle="tab" type="button" role="tab" aria-controls="<%= "value-#{dom_id}" %>" aria-selected="true">Value</button> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<button id="<%= "tab-diff-#{dom_id}" %>" class="nav-link" data-bs-target="<%= "#diff-#{dom_id}" %>" data-bs-toggle="tab" type="button" role="tab" aria-controls="<%= "diff-#{dom_id}" %>" aria-selected="false">Diff</button> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<div id="<%= "value-#{dom_id}" %>" class="tab-pane fade show active" role="tabpanel" aria-labelledby="<%= "tab-value-#{dom_id}" %>"> | ||
<%= yield %> | ||
</div> | ||
|
||
<div id="<%= "diff-#{dom_id}" %>" class="tab-pane fade" role="tabpanel" aria-labelledby="<%= "tab-diff-#{dom_id}" %>"> | ||
<%= render "shared/diff", current_value:, original_value: %> | ||
</div> | ||
</div> |