<commit_before>module App.TreeStatus.Types exposing (..)

import App.Types
import Form
import RemoteData exposing (WebData)


type Route
    = AddTreeRoute
    | UpdateTreesRoute
    | DeleteTreesRoute
    | ShowTreesRoute
    | ShowTreeRoute String


type alias Tree =
    { name : String
    , status : String
    , reason : String
    , message_of_the_day : String
    , tags : List String
    }


type alias Trees =
    List Tree


type alias TreeLog =
    { id : Int
    , name : String
    , when : String
    , who : String
    , status : String
    , reason : String
    , tags : List String
    }


type alias TreeLogs =
    List TreeLog


type alias RecentChangeTreeLastState =
    { reason : String
    , status : String
    , tags : List String
    , log_id : Maybe Int
    , current_reason : String
    , current_status : String
    , current_tags : List String
    , current_log_id : Maybe Int
    }


type alias RecentChangeTree =
    { id : Int
    , tree : String
    , last_state : RecentChangeTreeLastState
    }


type alias RecentChangeId =
    Int


type alias RecentChange =
    { id : RecentChangeId
    , trees : List RecentChangeTree
    , when : String
    , who : String
    , status : String
    , reason : String
    }


type alias Model addForm updateForm updateStackForm updateLogForm =
    { baseUrl : String
    , treesAlerts : List App.Types.Alert
    , trees : RemoteData.WebData Trees
    , treesSelected : List String
    , tree : RemoteData.WebData Tree
    , treeLogs : RemoteData.WebData TreeLogs
    , treeLogsAll : RemoteData.WebData TreeLogs
    , showMoreTreeLogs : Bool
    , formAddTree : Form.Form () addForm
    , formUpdateTree : Form.Form () updateForm
    , formUpdateStack : Form.Form () updateStackForm
    , showUpdateStackForm : Maybe RecentChangeId
    , recentChangesAlerts : List App.Types.Alert
    , recentChanges : RemoteData.WebData (List RecentChange)
    , deleteTreesConfirm : Bool
    , deleteError : Maybe String
    , showUpdateLog : Maybe Int
    , formUpdateLog : Form.Form () updateLogForm
    }


type Msg
    = NavigateTo Route
    | GetTreesResult (RemoteData.WebData Trees)
    | GetTreeResult (RemoteData.WebData Tree)
    | GetTreeLogs String Bool
    | GetTreeLogsResult (RemoteData.WebData TreeLogs)
    | GetTreeLogsAllResult (RemoteData.WebData TreeLogs)
    | GetRecentChangesResult (RemoteData.WebData (List RecentChange))
    | FormAddTreeMsg Form.Msg
    | FormAddTreeResult (WebData String)
    | FormUpdateTreesMsg Form.Msg
    | FormUpdateTreesResult (WebData String)
    | SelectAllTrees
    | SelectTree String
    | UnselectAllTrees
    | UnselectTree String
    | DeleteTrees
    | DeleteTreesConfirmToggle
    | DeleteTreesResult (WebData String)
    | RevertChange Int
    | DiscardChange Int
    | RecentChangeResult (WebData String)
    | UpdateStackShow Int
    | FormUpdateStackMsg Form.Msg
    | FormUpdateStackResult (WebData String)
    | UpdateLogShow Int
    | FormUpdateLogMsg Form.Msg
    | FormUpdateLogResult (WebData String)


possibleTreeStatuses : List ( String, String )
possibleTreeStatuses =
    [ ( "open", "Open" )
    , ( "approval required", "Approval required" )
    , ( "closed", "Closed" )
    ]


possibleTreeTags : List ( String, String )
possibleTreeTags =
    [ ( "checkin_compilation", "Check-in compilation failure" )
    , ( "checkin_test", "Check-in test failure" )
    , ( "infra", "Infrastructure related" )
    , ( "backlog", "Job backlog" )
    , ( "planned", "Planned closure" )
    , ( "merges", "Merges" )
    , ( "waiting_for_coverage", "Waiting for coverage" )
    , ( "other", "Other" )
    ]<commit_msg>releng-frontend: fix for how to store/display tag(s) (#2270)<commit_after>module App.TreeStatus.Types exposing (..)

import App.Types
import Form
import RemoteData exposing (WebData)


type Route
    = AddTreeRoute
    | UpdateTreesRoute
    | DeleteTreesRoute
    | ShowTreesRoute
    | ShowTreeRoute String


type alias Tree =
    { name : String
    , status : String
    , reason : String
    , message_of_the_day : String
    , tags : List String
    }


type alias Trees =
    List Tree


type alias TreeLog =
    { id : Int
    , name : String
    , when : String
    , who : String
    , status : String
    , reason : String
    , tags : List String
    }


type alias TreeLogs =
    List TreeLog


type alias RecentChangeTreeLastState =
    { reason : String
    , status : String
    , tags : List String
    , log_id : Maybe Int
    , current_reason : String
    , current_status : String
    , current_tags : List String
    , current_log_id : Maybe Int
    }


type alias RecentChangeTree =
    { id : Int
    , tree : String
    , last_state : RecentChangeTreeLastState
    }


type alias RecentChangeId =
    Int


type alias RecentChange =
    { id : RecentChangeId
    , trees : List RecentChangeTree
    , when : String
    , who : String
    , status : String
    , reason : String
    }


type alias Model addForm updateForm updateStackForm updateLogForm =
    { baseUrl : String
    , treesAlerts : List App.Types.Alert
    , trees : RemoteData.WebData Trees
    , treesSelected : List String
    , tree : RemoteData.WebData Tree
    , treeLogs : RemoteData.WebData TreeLogs
    , treeLogsAll : RemoteData.WebData TreeLogs
    , showMoreTreeLogs : Bool
    , formAddTree : Form.Form () addForm
    , formUpdateTree : Form.Form () updateForm
    , formUpdateStack : Form.Form () updateStackForm
    , showUpdateStackForm : Maybe RecentChangeId
    , recentChangesAlerts : List App.Types.Alert
    , recentChanges : RemoteData.WebData (List RecentChange)
    , deleteTreesConfirm : Bool
    , deleteError : Maybe String
    , showUpdateLog : Maybe Int
    , formUpdateLog : Form.Form () updateLogForm
    }


type Msg
    = NavigateTo Route
    | GetTreesResult (RemoteData.WebData Trees)
    | GetTreeResult (RemoteData.WebData Tree)
    | GetTreeLogs String Bool
    | GetTreeLogsResult (RemoteData.WebData TreeLogs)
    | GetTreeLogsAllResult (RemoteData.WebData TreeLogs)
    | GetRecentChangesResult (RemoteData.WebData (List RecentChange))
    | FormAddTreeMsg Form.Msg
    | FormAddTreeResult (WebData String)
    | FormUpdateTreesMsg Form.Msg
    | FormUpdateTreesResult (WebData String)
    | SelectAllTrees
    | SelectTree String
    | UnselectAllTrees
    | UnselectTree String
    | DeleteTrees
    | DeleteTreesConfirmToggle
    | DeleteTreesResult (WebData String)
    | RevertChange Int
    | DiscardChange Int
    | RecentChangeResult (WebData String)
    | UpdateStackShow Int
    | FormUpdateStackMsg Form.Msg
    | FormUpdateStackResult (WebData String)
    | UpdateLogShow Int
    | FormUpdateLogMsg Form.Msg
    | FormUpdateLogResult (WebData String)


possibleTreeStatuses : List ( String, String )
possibleTreeStatuses =
    [ ( "open", "Open" )
    , ( "approval required", "Approval required" )
    , ( "closed", "Closed" )
    ]


possibleTreeTags : List ( String, String )
possibleTreeTags =
    [ ( "checkin-compilation", "Check-in compilation failure" )
    , ( "checkin-test", "Check-in test failure" )
    , ( "infra", "Infrastructure related" )
    , ( "backlog", "Job backlog" )
    , ( "planned", "Planned closure" )
    , ( "merges", "Merges" )
    , ( "waiting-for-coverage", "Waiting for coverage" )
    , ( "other", "Other" )
    ]
{'fraction_non_alphanumeric': 0.08645847538524479, 'fraction_numerical': 0.0005454793399699986, 'mean_word_length': 2.9219251336898395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7551183', 'n_tokens_mistral': 2256, 'n_tokens_neox': 2210, 'n_words': 567}