Skip to content

Commit

Permalink
Addressing review feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
CDimonaco committed Jan 9, 2024
1 parent a3c26cc commit d67a6b0
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
3 changes: 0 additions & 3 deletions assets/js/common/ChartDisabledBox/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import ChartDisabledBox from '@common/ChartDisabledBox';
import ChartsDisabledBox from '@common/ChartsDisabledBox';

function ChartFeatureWrapper({ children }) {
// eslint-disable-next-line no-undef
if (!config.chartsEnabled) return <ChartDisabledBox />;
if (!config.chartsEnabled) return <ChartsDisabledBox />;
return children;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

function ChartDisabledBox() {
function ChartsDisabledBox() {
return (
<div
className="mt-4 bg-white shadow rounded-lg py-4 px-8 mx-auto"
Expand All @@ -13,4 +13,4 @@ function ChartDisabledBox() {
);
}

export default ChartDisabledBox;
export default ChartsDisabledBox;
3 changes: 3 additions & 0 deletions assets/js/common/ChartsDisabledBox/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ChartsDisabledBox from './ChartsDisabledBox';

export default ChartsDisabledBox;
4 changes: 2 additions & 2 deletions lib/trento_web/plugs/charts_disabled_plug.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule TrentoWeb.Plugs.ChartsDisabledPlug do
@moduledoc """
This plug will act as a barrier for the charts endpoint, will return 501 for all the requests.
This plug acts as a barrier for the charts endpoint, will return 501 for all the requests.
The endpoints will be accessible only if the ":trento, Trento.Charts, enabled" configuration entry is properly set.
The endpoints are accessible only if the ":trento, Trento.Charts, enabled" configuration entry is properly set.
The plug itself is mounted only when the charts are disabled in the configuration.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule TrentoWeb.Plugs.UnplugChartsEnabledPredicate do
defmodule TrentoWeb.Plugs.Unplug.Predicates.ChartsDisabled do
@moduledoc false

@behaviour Unplug.Predicate
Expand Down
2 changes: 1 addition & 1 deletion lib/trento_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule TrentoWeb.Router do

pipeline :charts_feature do
plug Unplug,
if: TrentoWeb.Plugs.UnplugChartsEnabledPredicate,
if: TrentoWeb.Plugs.Unplug.Predicates.ChartsDisabled,
do: TrentoWeb.Plugs.ChartsDisabledPlug
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule TrentoWeb.Plugs.ChartsDisabledPlugTest do
defmodule TrentoWeb.Plugs.Unplug.Predicates.ChartsDisabledTest do
use TrentoWeb.ConnCase, async: true
use Plug.Test

Expand Down

0 comments on commit d67a6b0

Please sign in to comment.