Skip to content

Commit

Permalink
Add a Deprecated filter (#50)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Radka <[email protected]>
  • Loading branch information
mikeradka authored Nov 6, 2023
1 parent 9f188d4 commit abc4a0c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/schema_web/templates/page/class.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ limitations under the License.
<option selected id="base-event-select" class="base-event" value="base-event" title="Base Event">Base
Event Attributes
</option>
<option value="deprecated" title="Deprecated">Deprecated Attributes</option>
<optgroup id="groups-select" label="Groups">
<option selected value="classification">Classification</option>
<option selected value="context">Context</option>
Expand Down
1 change: 1 addition & 0 deletions lib/schema_web/templates/page/class_graph.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ limitations under the License.
<option selected id="base-event-select" class="base-event" value="base-event" title="Base Event">Base
Event Attributes
</option>
<option value="deprecated" title="Deprecated">Deprecated Attributes</option>
<optgroup id="groups-select" label="Groups">
<option selected value="classification">Classification</option>
<option selected value="context">Context</option>
Expand Down
1 change: 1 addition & 0 deletions lib/schema_web/templates/page/object.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
data-selected-text-format="count > 3"
data-actions-box="true"
data-width="auto">
<option value="deprecated" title="Deprecated">Deprecated Attributes</option>
<optgroup id="requirements-select" label="Requirements">
<option class="optional" value="optional" title="Optional">Optional Attributes</option>
<option class="recommended" value="recommended" title="Recommended">Recommended Attributes</option>
Expand Down
1 change: 1 addition & 0 deletions lib/schema_web/templates/page/object_graph.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ limitations under the License.
data-selected-text-format="count > 3"
data-actions-box="true"
data-width="auto">
<option value="deprecated" title="Deprecated">Deprecated Attributes</option>
<optgroup id="requirements-select" label="Requirements">
<option class="optional" value="optional" title="Optional">Optional Attributes</option>
<option class="recommended" value="recommended" title="Recommended">Recommended Attributes</option>
Expand Down
1 change: 1 addition & 0 deletions lib/schema_web/templates/page/profile.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
data-selected-text-format="count > 3"
data-actions-box="true"
data-width="auto">
<option value="deprecated" title="Deprecated">Deprecated Attributes</option>
<optgroup id="groups-select" label="Groups">
<option selected value="classification">Classification</option>
<option selected value="context">Context</option>
Expand Down
13 changes: 10 additions & 3 deletions lib/schema_web/views/page_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,21 @@ defmodule SchemaWeb.PageView do
"event "
end

deprecation_status =
if field[:"@deprecated"] != nil do
base <> "deprecated "
else
base <> "not-deprecated "
end

classes =
if required?(field) do
base <> "required "
deprecation_status <> "required "
else
if recommended?(field) do
base <> "recommended "
deprecation_status <> "recommended "
else
base <> "optional "
deprecation_status <> "optional "
end
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
defmodule Schema.MixProject do
use Mix.Project

@version "2.59.0"
@version "2.60.0"

def project do
build = System.get_env("GITHUB_RUN_NUMBER") || "SNAPSHOT"
Expand Down
5 changes: 3 additions & 2 deletions priv/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function set_selected_extensions(extensions) {
localStorage.setItem("schema_extensions", JSON.stringify(extensions));
}

const defaultSelectedValues = ["base-event", "optional", "recommended", "classification", "context", "occurrence", "primary"];
const defaultSelectedValues = ["base-event", "deprecated", "optional", "recommended", "classification", "context", "occurrence", "primary"];
const storageKey = "selected-attributes"

function hide(name) {
Expand Down Expand Up @@ -99,6 +99,7 @@ function display_attributes(options) {
if (table != null) {
// add classes that are always shown
options.add("event");
options.add("not-deprecated")
options.add("required");
options.add("no-group");
options.add("no-profile");
Expand Down Expand Up @@ -133,7 +134,7 @@ function intersection(setA, setB) {
}

function display_row(set, classList) {
if (set.size == 4)
if (set.size == 5)
classList.remove('d-none');
else
classList.add('d-none');
Expand Down

0 comments on commit abc4a0c

Please sign in to comment.