forked from Normation/rudder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24f44e4
commit f3b9bd2
Showing
10 changed files
with
201 additions
and
25 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
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
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
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
105 changes: 105 additions & 0 deletions
105
webapp/sources/rudder/rudder-web/src/main/elm/rules/sources/ViewCategoryDetails.elm
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,105 @@ | ||
module ViewCategoryDetails exposing (..) | ||
|
||
import DataTypes exposing (..) | ||
import Html exposing (Html, button, div, i, span, text, h1, h4, ul, li, input, a, p, form, label, textarea, select, option, table, thead, tbody, tr, th, td, small) | ||
import Html.Attributes exposing (id, class, type_, placeholder, value, for, href, colspan, rowspan, style, selected, disabled, attribute) | ||
import Html.Events exposing (onClick, onInput) | ||
import List.Extra | ||
import List | ||
import String exposing ( fromFloat) | ||
import NaturalOrdering exposing (compareOn) | ||
import ApiCalls exposing (..) | ||
import ViewTabContent exposing (buildListCategories) | ||
|
||
-- | ||
-- This file contains all methods to display the details of the selected category. | ||
-- | ||
|
||
editionTemplateCat : Model -> EditCategoryDetails -> Bool -> Html Msg | ||
editionTemplateCat model details isNewCat = | ||
let | ||
originCat = details.originCategory | ||
category = details.category | ||
categoryTitle = if (String.isEmpty originCat.name && isNewCat) then | ||
span[style "opacity" "0.4"][text "New category"] | ||
else | ||
text originCat.name | ||
|
||
topButtons = | ||
let | ||
disableWhileCreating = case model.mode of | ||
EditCategory _ -> "" | ||
_ -> " disabled" | ||
in | ||
[ li [] [ | ||
a [ class ("action-success"++disableWhileCreating) ] --, onClick (GenerateId (\r -> CloneRule originRule (RuleId r)))] | ||
[ i [ class "fa fa-clone"] [] | ||
, text "Clone" | ||
] | ||
] | ||
, li [class "divider"][] | ||
, li [] [ | ||
a [ class ("action-danger"++disableWhileCreating) ] --, onClick (OpenDeletionPopup rule)] | ||
[ i [ class "fa fa-times-circle"] [] | ||
, text "Delete" | ||
] | ||
] | ||
] | ||
|
||
in | ||
div [class "main-container"] | ||
[ div [class "main-header "] | ||
[ div [class "header-title"] | ||
[ h1[] | ||
[ i [class "title-icon fa fa-folder"][] | ||
, categoryTitle | ||
] | ||
, div[class "header-buttons"] | ||
[ div [ class "btn-group" ] | ||
[ button [ class "btn btn-default dropdown-toggle" , attribute "data-toggle" "dropdown" ] [ | ||
text "Actions " | ||
, i [ class "caret" ] [] | ||
] | ||
, ul [ class "dropdown-menu" ] topButtons | ||
] | ||
, button [class "btn btn-default", type_ "button", onClick CloseDetails] | ||
[ text "Close", i [ class "fa fa-times"][]] | ||
, button [class "btn btn-success", type_ "button", onClick (CallApi (saveCategoryDetails category isNewCat))] | ||
[ text "Save", i [ class "fa fa-download"][]] | ||
] | ||
] | ||
, div [class "header-description"] | ||
[ p[][text ""] ] | ||
] | ||
, div [class "main-navbar" ] | ||
[ ul[class "ui-tabs-nav "] | ||
[ li[class "ui-tabs-tab ui-tabs-active"] | ||
[ a[][ text "Information" ] | ||
] | ||
] | ||
] | ||
, div [class "main-details"] | ||
[ div[class "row"][ | ||
form[class "col-xs-12 col-sm-6 col-lg-7"] | ||
[ div [class "form-group"] | ||
[ label[for "category-name"][text "Name"] | ||
, div[] | ||
[ input[ id "category-name", type_ "text", value category.name, class "form-control" , onInput (\s -> UpdateCategory {category | name = s} ) ][] ] | ||
] | ||
, div [class "form-group"] | ||
[ label[for "category-parent"][text "Parent"] | ||
, div[] | ||
[ select[ id "category-parent", class "form-control" ] --, onInput (\s -> UpdateCategory {category | parent = s} ) ] | ||
(buildListCategories "" model.rulesTree) | ||
] | ||
] | ||
, div [class "form-group"] | ||
[ label[for "category-description"][text "Description"] | ||
, div[] | ||
[ textarea[ id "category-description", value category.description, placeholder "There is no description", class "form-control" , onInput (\s -> UpdateCategory {category | description = s} ) ][] ] | ||
] | ||
] | ||
, div [class "col-xs-12 col-sm-6 col-lg-5"][] -- <== Right column | ||
] | ||
] | ||
] |
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