diff --git a/client/Helpers/AccessEditor.elm b/client/Helpers/AccessEditor.elm index e99da4a..9d2796f 100644 --- a/client/Helpers/AccessEditor.elm +++ b/client/Helpers/AccessEditor.elm @@ -42,6 +42,7 @@ type alias Model = type alias Config = { appsInfoUrl : String , usersInfoUrl : String + , teamsInfoUrl : String , showWrite : Bool , showAnyToken : Bool , help : List (Html Msg) @@ -344,6 +345,9 @@ addRowControls config model = "service" -> "Service Id with '" ++ appPreffix ++ "' prefix, i.e. '" ++ appPreffix ++ "_shop'" + "team" -> + "Team Id in teams API, e.g. 'aruha'" + _ -> "Value" in @@ -356,6 +360,7 @@ addRowControls config model = ] [ option [ value "user" ] [ text "User" ] , option [ value "service" ] [ text "Service" ] + , option [ value "team" ] [ text "Team" ] ] , input [ onInput AddValueChange @@ -420,6 +425,7 @@ accessTable config renderer records = [] , renderSection User "Users:" , renderSection Service "Services:" + , renderSection Team "Teams:" , renderSection Unknown "Unknown types:" ] ) @@ -492,6 +498,9 @@ recordName config record = Service -> span [ class "access-editor_name" ] [ UI.linkToApp config.appsInfoUrl record.value ] + Team -> + span [ class "access-editor_name" ] [ UI.linkToApp config.teamsInfoUrl record.value ] + User -> span [ class "access-editor_name" ] [ UI.linkToApp config.usersInfoUrl record.value ] diff --git a/client/Pages/EventTypeCreate/Query.elm b/client/Pages/EventTypeCreate/Query.elm index 3e124f4..f77e30f 100644 --- a/client/Pages/EventTypeCreate/Query.elm +++ b/client/Pages/EventTypeCreate/Query.elm @@ -207,6 +207,7 @@ sqlAccessEditor appsInfoUrl usersInfoUrl formModel = AccessEditor.view { appsInfoUrl = appsInfoUrl , usersInfoUrl = usersInfoUrl + , teamsInfoUrl = "" , showWrite = False , showAnyToken = False , help = Help.authorization diff --git a/client/Pages/EventTypeCreate/View.elm b/client/Pages/EventTypeCreate/View.elm index a4c6fd8..2e9f3f1 100644 --- a/client/Pages/EventTypeCreate/View.elm +++ b/client/Pages/EventTypeCreate/View.elm @@ -231,6 +231,9 @@ viewForm model setup = usersInfoUrl = model.userStore.user.settings.usersInfoUrl + teamsInfoUrl = + model.userStore.user.settings.teamsInfoUrl + supportUrl = model.userStore.user.settings.supportUrl @@ -432,7 +435,7 @@ viewForm model setup = compatibilityModeOptions , schemaEditor formModel , hr [ class "dc-divider" ] [] - , accessEditor appsInfoUrl usersInfoUrl formModel + , accessEditor appsInfoUrl usersInfoUrl teamsInfoUrl formModel ] , hr [ class "dc-divider" ] [] @@ -444,11 +447,12 @@ viewForm model setup = ] -accessEditor : String -> String -> Model -> Html Msg -accessEditor appsInfoUrl usersInfoUrl formModel = +accessEditor : String -> String -> String -> Model -> Html Msg +accessEditor appsInfoUrl usersInfoUrl teamsInfoUrl formModel = AccessEditor.view { appsInfoUrl = appsInfoUrl , usersInfoUrl = usersInfoUrl + , teamsInfoUrl = teamsInfoUrl , showWrite = True , showAnyToken = True , help = Help.authorization diff --git a/client/Pages/EventTypeDetails/View.elm b/client/Pages/EventTypeDetails/View.elm index 57c6a86..c445bd4 100644 --- a/client/Pages/EventTypeDetails/View.elm +++ b/client/Pages/EventTypeDetails/View.elm @@ -94,6 +94,9 @@ detailsLayout typeName eventType model = usersInfoUrl = settings.usersInfoUrl + teamsInfoUrl = + settings.teamsInfoUrl + showNakadiSql = settings.showNakadiSql @@ -257,6 +260,7 @@ detailsLayout typeName eventType model = , authTab appsInfoUrl usersInfoUrl + teamsInfoUrl eventType ) ] @@ -752,8 +756,8 @@ renderSqlQueries query = ] -authTab : String -> String -> EventType -> Html Msg -authTab appsInfoUrl usersInfoUrl eventType = +authTab : String -> String -> String -> EventType -> Html Msg +authTab appsInfoUrl usersInfoUrl teamsInfoUrl eventType = case eventType.authorization of Nothing -> div [ class "dc-card auth-tab" ] @@ -769,6 +773,7 @@ authTab appsInfoUrl usersInfoUrl eventType = [ AccessEditor.viewReadOnly { appsInfoUrl = appsInfoUrl , usersInfoUrl = usersInfoUrl + , teamsInfoUrl = teamsInfoUrl , showWrite = True , showAnyToken = True , help = Help.authorization diff --git a/client/Pages/SubscriptionCreate/View.elm b/client/Pages/SubscriptionCreate/View.elm index 1298d59..7c9f04e 100644 --- a/client/Pages/SubscriptionCreate/View.elm +++ b/client/Pages/SubscriptionCreate/View.elm @@ -110,6 +110,9 @@ viewForm model setup = usersInfoUrl = model.userStore.user.settings.usersInfoUrl + teamsInfoUrl = + model.userStore.user.settings.teamsInfoUrl + cursosId = "subscriptionCursorFileSelector" in @@ -202,7 +205,7 @@ viewForm model setup = else none , eventTypesEditor updateMode model - , accessEditor appsInfoUrl usersInfoUrl formModel + , accessEditor appsInfoUrl usersInfoUrl teamsInfoUrl formModel , hr [ class "dc-divider" ] [] , div [ class "dc-toast__content dc-toast__content--success" ] [ text successMessage ] @@ -212,11 +215,12 @@ viewForm model setup = ] -accessEditor : String -> String -> Model -> Html Msg -accessEditor appsInfoUrl usersInfoUrl formModel = +accessEditor : String -> String -> String -> Model -> Html Msg +accessEditor appsInfoUrl usersInfoUrl teamsInfoUrl formModel = AccessEditor.view { appsInfoUrl = appsInfoUrl , usersInfoUrl = usersInfoUrl + , teamsInfoUrl = teamsInfoUrl , showWrite = False , showAnyToken = True , help = Help.authorization diff --git a/client/Pages/SubscriptionDetails/View.elm b/client/Pages/SubscriptionDetails/View.elm index bf0a299..7b8bdca 100644 --- a/client/Pages/SubscriptionDetails/View.elm +++ b/client/Pages/SubscriptionDetails/View.elm @@ -77,6 +77,9 @@ detailsLayout id subscription model = usersInfoUrl = model.userStore.user.settings.usersInfoUrl + teamsInfoUrl = + model.userStore.user.settings.teamsInfoUrl + tabOptions = { onChange = \tab -> TabChange tab , notSelectedView = Just (div [] [ text "No tab selected" ]) @@ -167,6 +170,7 @@ detailsLayout id subscription model = , authTab appsInfoUrl usersInfoUrl + teamsInfoUrl subscription ) ] @@ -459,8 +463,8 @@ deletePopup model subscription appsInfoUrl = none -authTab : String -> String -> Subscription -> Html Msg -authTab appsInfoUrl usersInfoUrl subscription = +authTab : String -> String -> String -> Subscription -> Html Msg +authTab appsInfoUrl usersInfoUrl teamsInfoUrl subscription = div [ class "dc-card auth-tab" ] <| case subscription.authorization of Nothing -> @@ -472,6 +476,7 @@ authTab appsInfoUrl usersInfoUrl subscription = [ AccessEditor.viewReadOnly { appsInfoUrl = appsInfoUrl , usersInfoUrl = usersInfoUrl + , teamsInfoUrl = teamsInfoUrl , showWrite = False , showAnyToken = True , help = Help.authorization diff --git a/client/Stores/Authorization.elm b/client/Stores/Authorization.elm index 7e326e4..b360139 100644 --- a/client/Stores/Authorization.elm +++ b/client/Stores/Authorization.elm @@ -16,6 +16,7 @@ type alias AuthorizationAttribute = type Key = User | Service + | Team | All | Unknown @@ -179,6 +180,9 @@ dataTypeToKey str = "service" -> Service + "team" -> + Team + "*" -> All diff --git a/client/User/Commands.elm b/client/User/Commands.elm index f963aaa..9156dc6 100644 --- a/client/User/Commands.elm +++ b/client/User/Commands.elm @@ -30,6 +30,7 @@ settingsDecoder = |> required "nakadiApiUrl" string |> optional "appsInfoUrl" string emptyString |> optional "usersInfoUrl" string emptyString + |> optional "teamsInfoUrl" string emptyString |> optional "monitoringUrl" string emptyString |> optional "sloMonitoringUrl" string emptyString |> optional "eventTypeMonitoringUrl" string emptyString diff --git a/client/User/Models.elm b/client/User/Models.elm index c866a7c..75813dd 100644 --- a/client/User/Models.elm +++ b/client/User/Models.elm @@ -45,6 +45,7 @@ type alias Settings = { nakadiApiUrl : String , appsInfoUrl : String , usersInfoUrl : String + , teamsInfoUrl : String , monitoringUrl : String , sloMonitoringUrl : String , eventTypeMonitoringUrl : String @@ -67,6 +68,7 @@ initialSettings = { nakadiApiUrl = emptyString , appsInfoUrl = emptyString , usersInfoUrl = emptyString + , teamsInfoUrl = emptyString , monitoringUrl = emptyString , sloMonitoringUrl = emptyString , eventTypeMonitoringUrl = emptyString diff --git a/server/config.js b/server/config.js index 7fd7333..de4abfd 100644 --- a/server/config.js +++ b/server/config.js @@ -28,6 +28,7 @@ exports = module.exports = function createConfiguration(env) { settings: { appsInfoUrl: optional('APPS_INFO_URL', env, ''), usersInfoUrl: optional('USERS_INFO_URL', env, ''), + teamsInfoUrl: optional('TEAMS_INFO_URL', env, ''), nakadiApiUrl: required('NAKADI_API_URL', env), monitoringUrl: optional('MONITORING_URL', env, ''), sloMonitoringUrl: optional('SLO_MONITORING_URL', env, ''), diff --git a/tests/unit/config.spec.js b/tests/unit/config.spec.js index aada548..14a6657 100644 --- a/tests/unit/config.spec.js +++ b/tests/unit/config.spec.js @@ -10,6 +10,7 @@ describe('Config', function() { NAKADI_API_URL: "https://nakadi-staging.example.com", APPS_INFO_URL: "https://yourturn.example.com", USERS_INFO_URL: "https://people.example.com", + TEAMS_INFO_URL: "https://teams-api.example.com", MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-staging", SLO_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-slos", EVENT_TYPE_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-et/?var-stack=nakadi-staging&var-et={et}", @@ -62,6 +63,7 @@ describe('Config', function() { settings: { appsInfoUrl: "https://yourturn.example.com", usersInfoUrl: "https://people.example.com", + teamsInfoUrl: "https://teams-api.example.com", nakadiApiUrl: 'https://nakadi-staging.example.com', monitoringUrl: "https://zmon.example.com/grafana/dashboard/db/nakadi-staging", sloMonitoringUrl: "https://zmon.example.com/grafana/dashboard/db/nakadi-slos", @@ -123,6 +125,7 @@ describe('Config', function() { BASE_URL: "https://localhost:3000", APPS_INFO_URL: "https://yourturn.example.com", USERS_INFO_URL: "https://people.example.com", + TEAMS_INFO_URL: "https://teams-api.example.com", // this is missing for example // NAKADI_API_URL: "https://nakadi-staging.example.com", MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-staging", @@ -153,6 +156,7 @@ describe('Config', function() { NAKADI_API_URL: "https://nakadi-staging.example.com", USERS_INFO_URL: "https://people.example.com", APPS_INFO_URL: "https://yourturn.example.com", + TEAMS_INFO_URL: "https://teams-api.example.com", MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-staging", SLO_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-slos", EVENT_TYPE_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-et/?var-stack=nakadi-staging&var-et={et}", @@ -180,6 +184,7 @@ describe('Config', function() { NAKADI_API_URL: "https://nakadi-staging.example.com", APPS_INFO_URL: "https://yourturn.example.com", USERS_INFO_URL: "https://people.example.com", + TEAMS_INFO_URL: "https://teams-api.example.com", MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-staging", SLO_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-slos", EVENT_TYPE_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-et/?var-stack=nakadi-staging&var-et={et}", @@ -206,6 +211,7 @@ describe('Config', function() { NAKADI_API_URL: "https://nakadi-staging.example.com", APPS_INFO_URL: "https://yourturn.example.com", USERS_INFO_URL: "https://people.example.com", + TEAMS_INFO_URL: "https://teams-api.example.com", MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-staging", SLO_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-slos", EVENT_TYPE_MONITORING_URL: "https://zmon.example.com/grafana/dashboard/db/nakadi-et/?var-stack=nakadi-staging&var-et={et}",