From 48e4bebe7a488a5661ec54cac44e2bffa8f2114d Mon Sep 17 00:00:00 2001 From: "suyashgargsfam@gmail.com" Date: Thu, 16 Jan 2020 18:11:29 +0100 Subject: [PATCH 1/5] WIP: Add event_auth_field --- client/Pages/EventTypeCreate/View.elm | 1 - client/Pages/EventTypeDetails/Help.elm | 31 ++++++++++++++++++++++++++ client/Pages/EventTypeDetails/View.elm | 17 +++++++++++++- client/Stores/EventType.elm | 13 +++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/client/Pages/EventTypeCreate/View.elm b/client/Pages/EventTypeCreate/View.elm index 627565d..767d0fd 100644 --- a/client/Pages/EventTypeCreate/View.elm +++ b/client/Pages/EventTypeCreate/View.elm @@ -171,7 +171,6 @@ viewForm model setup = appsInfoUrl = model.userStore.user.settings.appsInfoUrl - usersInfoUrl = model.userStore.user.settings.usersInfoUrl diff --git a/client/Pages/EventTypeDetails/Help.elm b/client/Pages/EventTypeDetails/Help.elm index d8cbdab..e1d5b49 100644 --- a/client/Pages/EventTypeDetails/Help.elm +++ b/client/Pages/EventTypeDetails/Help.elm @@ -414,6 +414,37 @@ audience = ] +eventAuthField : List (Html msg) +eventAuthField = + [ text "Event Auth Field for per-event authorization." + , text "Can be used to point to a string field in the event, which " + , text "is used by Nakadi do decide if an authorized consumer " + , text "can read a published event. It is optional and " + , text "if not specified or field is not present/null, all " + , text "authorized consumers can read the event." + , newline + , bold "The event_auth_field must contain the following fields:" + , newline + , text "- " + , mono "path" + , text " path in dot notation of the string field" + , text " in an event which will be used to" + , text " classify if the consumer is allowed to read the event." + , newline + , text "- " + , mono "type" + , text " informational field specifying what type of data the field" + , text " represents (eg: team/retailers, etc)" + , newline + , newline + , bold "Key: " + , mono "event_auth_field" + , bold "optional" + , newline + , man "#definition_EventAuthField" + ] + + cleanupPolicy : List (Html msg) cleanupPolicy = [ text "Event type cleanup policy." diff --git a/client/Pages/EventTypeDetails/View.elm b/client/Pages/EventTypeDetails/View.elm index 2d24423..e25c03e 100644 --- a/client/Pages/EventTypeDetails/View.elm +++ b/client/Pages/EventTypeDetails/View.elm @@ -31,6 +31,7 @@ import Stores.EventType ( EventType , EventTypeOptions , EventTypeStatistics + , EventAuthField , cleanupPolicies ) import Stores.EventTypeSchema @@ -198,7 +199,9 @@ detailsLayout typeName eventType model = none , infoField "Audience " Help.audience TopRight <| infoStringToText eventType.audience - , infoField "Created " Help.createdAt TopRight <| + , infoField "Event Auth Field " Help.eventAuthField TopRight <| + infoEventAuthFieldToText eventType.eventAuthField + , infoField "Created " Help.createdAt | infoDateToText eventType.created_at , infoField "Updated " Help.updatedAt TopRight <| infoDateToText eventType.updated_at @@ -380,6 +383,18 @@ infoStatisticsToText maybeStatistics = infoEmpty +infoEventAuthFieldToText : Maybe EventAuthField -> Html Msg +infoEventAuthFieldToText maybeEventAuthField = + case eventAuthField of + Just auth_field -> + div [] + [ infoSubField "Path: " (String.fromString auth_field.path) + , infoSubField "Type: " (String.fromString auth_field.type) + ] + Nothing -> + infoEmpty + + schemaTab : JsonEditor.Model -> Stores.EventTypeSchema.Model diff --git a/client/Stores/EventType.elm b/client/Stores/EventType.elm index df44027..49aa388 100644 --- a/client/Stores/EventType.elm +++ b/client/Stores/EventType.elm @@ -25,6 +25,7 @@ type alias EventType = , ordering_key_fields : Maybe (List String) , default_statistic : Maybe EventTypeStatistics , options : Maybe EventTypeOptions + , event_auth_field : Maybe EventAuthField , authorization : Maybe Authorization , --enum delete, compact @@ -49,6 +50,10 @@ type alias EventTypeOptions = { retention_time : Maybe Int } +type alias EventAuthField = + { path : String + , type : String + } type alias Model = Helpers.Store.Model EventType @@ -198,6 +203,7 @@ memberDecoder = |> optional "authorization" (nullable Stores.Authorization.collectionDecoder) Nothing |> optional "cleanup_policy" string cleanupPolicies.delete |> optional "audience" (nullable string) Nothing + |> optional "event_auth_field" (nullable eventAuthFieldDecoder) Nothing |> optional "created_at" (nullable string) Nothing |> optional "updated_at" (nullable string) Nothing @@ -215,3 +221,10 @@ optionsDecoder : Decoder EventTypeOptions optionsDecoder = succeed EventTypeOptions |> optional "retention_time" (nullable int) Nothing + + +eventAuthFieldDecoder : Decoder EventAuthField +eventAuthFieldDecoder = + succeed EventAuthField + |> required "path" String + |> required "type" String \ No newline at end of file From fdf90c3b3eb2140e77a48c072dd1832758e96e88 Mon Sep 17 00:00:00 2001 From: "suyashgargsfam@gmail.com" Date: Mon, 20 Jan 2020 13:01:21 +0100 Subject: [PATCH 2/5] Add event_owner_selector field in the UI --- client/Pages/EventTypeCreate/Models.elm | 6 ++++ client/Pages/EventTypeCreate/Update.elm | 46 +++++++++++++++++++++++-- client/Pages/EventTypeCreate/View.elm | 36 +++++++++++++++++++ client/Pages/EventTypeDetails/Help.elm | 30 +++++++++------- client/Pages/EventTypeDetails/View.elm | 21 +++++------ client/Stores/EventType.elm | 39 +++++++++++++++------ 6 files changed, 143 insertions(+), 35 deletions(-) diff --git a/client/Pages/EventTypeCreate/Models.elm b/client/Pages/EventTypeCreate/Models.elm index 6e40cdc..67a2f80 100644 --- a/client/Pages/EventTypeCreate/Models.elm +++ b/client/Pages/EventTypeCreate/Models.elm @@ -38,6 +38,9 @@ type Field | FieldSchema | FieldEnvelope | FieldAudience + | FieldEventOwnerSelectorType + | FieldEventOwnerSelectorName + | FieldEventOwnerSelectorValue | FieldCleanupPolicy | FieldSql | FieldPartitionCompactionKeyField @@ -100,6 +103,9 @@ defaultValues = , ( FieldEnvelope, boolToString True ) , ( FieldCompatibilityMode, compatibilityModes.forward ) , ( FieldAudience, "" ) + , ( FieldEventOwnerSelectorType, "" ) + , ( FieldEventOwnerSelectorName, "" ) + , ( FieldEventOwnerSelectorValue, "" ) , ( FieldCleanupPolicy, cleanupPolicies.delete ) , ( FieldPartitionCompactionKeyField, emptyString ) ] diff --git a/client/Pages/EventTypeCreate/Update.elm b/client/Pages/EventTypeCreate/Update.elm index 48156e7..679e76c 100644 --- a/client/Pages/EventTypeCreate/Update.elm +++ b/client/Pages/EventTypeCreate/Update.elm @@ -372,10 +372,31 @@ submitCreate model = |> String.trim |> Json.string + isEmptyString field = + model.values + |> getValue field + |> String.trim + |> String.isEmpty + auth = AccessEditor.unflatten model.accessEditor.authorization |> Stores.Authorization.encoder + event_owner_selector = + if isEmptyString FieldEventOwnerSelectorName && + isEmptyString FieldEventOwnerSelectorValue && + isEmptyString FieldEventOwnerSelectorType then + [] + + else + [ ( "event_owner_selector", Json.object + [ ( "type", asString FieldEventOwnerSelectorType ) + , ( "name", asString FieldEventOwnerSelectorName ) + , ( "value", asString FieldEventOwnerSelectorValue ) + ] + ) + ] + fields = [ ( "name", asString FieldName ) , ( "owning_application", asString FieldOwningApplication ) @@ -419,7 +440,7 @@ submitCreate model = ] body = - Json.object (List.concat [ fields, enrichment ]) + Json.object (List.concat [ fields, enrichment, event_owner_selector ]) in post body @@ -456,11 +477,32 @@ submitUpdate model = |> getValue field |> String.trim |> Json.string + + isEmptyString field = + model.values + |> getValue field + |> String.trim + |> String.isEmpty auth = AccessEditor.unflatten model.accessEditor.authorization |> Stores.Authorization.encoder + event_owner_selector = + if isEmptyString FieldEventOwnerSelectorName && + isEmptyString FieldEventOwnerSelectorValue && + isEmptyString FieldEventOwnerSelectorType then + [] + + else + [ ( "event_owner_selector", Json.object + [ ( "type", asString FieldEventOwnerSelectorType ) + , ( "name", asString FieldEventOwnerSelectorName ) + , ( "value", asString FieldEventOwnerSelectorValue ) + ] + ) + ] + fields = [ ( "name", asString FieldName ) , ( "owning_application", asString FieldOwningApplication ) @@ -496,7 +538,7 @@ submitUpdate model = ] body = - Json.object (List.concat [ fields, enrichment ]) + Json.object (List.concat [ fields, enrichment, event_owner_selector ]) in put body (getValue FieldName model.values) diff --git a/client/Pages/EventTypeCreate/View.elm b/client/Pages/EventTypeCreate/View.elm index 767d0fd..7779887 100644 --- a/client/Pages/EventTypeCreate/View.elm +++ b/client/Pages/EventTypeCreate/View.elm @@ -26,6 +26,7 @@ import Stores.EventType , cleanupPolicies , compatibilityModes , partitionStrategies + , allOwnerSelectorTypes ) @@ -264,6 +265,41 @@ viewForm model setup = Required Enabled ("" :: allAudiences) + , div [ class "dc-row form-create__input-row" ] + [ selectInput formModel + FieldEventOwnerSelectorType + OnInput + "Event Owner Selector Type" + "" + Help.eventOwnerSelector + Optional + Enabled + ("" :: allOwnerSelectorTypes) + , div + [ class "dc-column" ] + [textInput formModel + FieldEventOwnerSelectorName + OnInput + "Event Owner Selector Name" + "Example: retailer_id" + "" + Help.eventOwnerSelector + Optional + Enabled + ] + , div + [ class "dc-column" ] + [textInput formModel + FieldEventOwnerSelectorValue + OnInput + "Event Owner Selector Value" + "Example: security.owners" + "" + Help.eventOwnerSelector + Optional + Enabled + ] + ] , selectInput formModel FieldCleanupPolicy OnInput diff --git a/client/Pages/EventTypeDetails/Help.elm b/client/Pages/EventTypeDetails/Help.elm index e1d5b49..9dfd9a8 100644 --- a/client/Pages/EventTypeDetails/Help.elm +++ b/client/Pages/EventTypeDetails/Help.elm @@ -1,4 +1,4 @@ -module Pages.EventTypeDetails.Help exposing (audience, authorization, category, cleanupPolicy, cleanupPolicyCompact, compatibilityMode, consumers, consumingQueries, createdAt, defaultStatistic, enrichmentStrategies, envelope, eventType, options, orderingKeyFields, owningApplication, partitionCompactionKeyField, partitionKeyFields, partitionStrategy, partitions, publishers, schema, subscription, updatedAt) +module Pages.EventTypeDetails.Help exposing (audience, authorization, category, cleanupPolicy, cleanupPolicyCompact, compatibilityMode, consumers, consumingQueries, createdAt, defaultStatistic, enrichmentStrategies, envelope, eventType, options, orderingKeyFields, owningApplication, partitionCompactionKeyField, partitionKeyFields, partitionStrategy, partitions, publishers, schema, subscription, updatedAt, eventOwnerSelector) import Config exposing (appPreffix) import Helpers.UI exposing (..) @@ -414,34 +414,38 @@ audience = ] -eventAuthField : List (Html msg) -eventAuthField = - [ text "Event Auth Field for per-event authorization." +eventOwnerSelector : List (Html msg) +eventOwnerSelector = + [ text "Event Owner Selector for per-event authorization. " , text "Can be used to point to a string field in the event, which " , text "is used by Nakadi do decide if an authorized consumer " , text "can read a published event. It is optional and " , text "if not specified or field is not present/null, all " , text "authorized consumers can read the event." , newline - , bold "The event_auth_field must contain the following fields:" + , bold "The event_owner_selector must contain the following fields:" , newline , text "- " - , mono "path" - , text " path in dot notation of the string field" - , text " in an event which will be used to" - , text " classify if the consumer is allowed to read the event." + , mono "type" + , text " Specifies the type of the selector" , newline , text "- " - , mono "type" - , text " informational field specifying what type of data the field" + , mono "name" + , text " Informational field specifying what type of data the field" , text " represents (eg: team/retailers, etc)" , newline + , text "- " + , mono "value" + , text " value in dot notation pointing to a string field" + , text " in an event which will be used to" + , text " classify if the consumer is allowed to read the event." + , newline , newline , bold "Key: " - , mono "event_auth_field" + , mono "event_owner_selector" , bold "optional" , newline - , man "#definition_EventAuthField" + , man "#definition_EventOwnerSelector" ] diff --git a/client/Pages/EventTypeDetails/View.elm b/client/Pages/EventTypeDetails/View.elm index e25c03e..167a3e4 100644 --- a/client/Pages/EventTypeDetails/View.elm +++ b/client/Pages/EventTypeDetails/View.elm @@ -31,7 +31,7 @@ import Stores.EventType ( EventType , EventTypeOptions , EventTypeStatistics - , EventAuthField + , EventOwnerSelector , cleanupPolicies ) import Stores.EventTypeSchema @@ -199,9 +199,9 @@ detailsLayout typeName eventType model = none , infoField "Audience " Help.audience TopRight <| infoStringToText eventType.audience - , infoField "Event Auth Field " Help.eventAuthField TopRight <| - infoEventAuthFieldToText eventType.eventAuthField - , infoField "Created " Help.createdAt | + , infoField "Event Owner Selector " Help.eventOwnerSelector TopRight <| + infoEventOwnerSelectorToText eventType.event_owner_selector + , infoField "Created " Help.createdAt TopRight <| infoDateToText eventType.created_at , infoField "Updated " Help.updatedAt TopRight <| infoDateToText eventType.updated_at @@ -383,13 +383,14 @@ infoStatisticsToText maybeStatistics = infoEmpty -infoEventAuthFieldToText : Maybe EventAuthField -> Html Msg -infoEventAuthFieldToText maybeEventAuthField = - case eventAuthField of - Just auth_field -> +infoEventOwnerSelectorToText : Maybe EventOwnerSelector -> Html Msg +infoEventOwnerSelectorToText maybeEventOwnerSelector = + case maybeEventOwnerSelector of + Just owner_selector -> div [] - [ infoSubField "Path: " (String.fromString auth_field.path) - , infoSubField "Type: " (String.fromString auth_field.type) + [ infoSubField "Type: " (owner_selector.type_) + , infoSubField "Name: " (owner_selector.name) + , infoSubField "Value: " (owner_selector.value) ] Nothing -> infoEmpty diff --git a/client/Stores/EventType.elm b/client/Stores/EventType.elm index 49aa388..d5f8266 100644 --- a/client/Stores/EventType.elm +++ b/client/Stores/EventType.elm @@ -1,4 +1,4 @@ -module Stores.EventType exposing (EventType, EventTypeOptions, EventTypeStatistics, Model, Msg, allAudiences, allCategories, allCleanupPolicies, allModes, audiences, categories, cleanupPolicies, collectionDecoder, compatibilityModes, config, defaultStatisticDecoder, initialModel, memberDecoder, optionsDecoder, partitionStrategies, update) +module Stores.EventType exposing (EventType, EventTypeOptions, EventTypeStatistics, Model, Msg, allAudiences, allCategories, allCleanupPolicies, allModes, audiences, categories, cleanupPolicies, collectionDecoder, compatibilityModes, config, defaultStatisticDecoder, initialModel, memberDecoder, optionsDecoder, partitionStrategies, EventOwnerSelector, allOwnerSelectorTypes, update) import Config import Constants @@ -25,7 +25,6 @@ type alias EventType = , ordering_key_fields : Maybe (List String) , default_statistic : Maybe EventTypeStatistics , options : Maybe EventTypeOptions - , event_auth_field : Maybe EventAuthField , authorization : Maybe Authorization , --enum delete, compact @@ -33,6 +32,7 @@ type alias EventType = , --enum component-internal, business-unit-internal, -- company-internal, external-partner, external-public audience : Maybe String + , event_owner_selector : Maybe EventOwnerSelector , created_at : Maybe String , updated_at : Maybe String } @@ -50,11 +50,29 @@ type alias EventTypeOptions = { retention_time : Maybe Int } -type alias EventAuthField = + +type alias EventOwnerSelector = + { type_ : String + , name : String + , value : String + } + + +ownerSelectorTypes : { path : String - , type : String + , static : String + } +ownerSelectorTypes = + { path = "path" + , static = "static" } +allOwnerSelectorTypes : List String +allOwnerSelectorTypes = + [ ownerSelectorTypes.path + , ownerSelectorTypes.static + ] + type alias Model = Helpers.Store.Model EventType @@ -203,7 +221,7 @@ memberDecoder = |> optional "authorization" (nullable Stores.Authorization.collectionDecoder) Nothing |> optional "cleanup_policy" string cleanupPolicies.delete |> optional "audience" (nullable string) Nothing - |> optional "event_auth_field" (nullable eventAuthFieldDecoder) Nothing + |> optional "event_owner_selector" (nullable eventOwnerSelectorDecoder) Nothing |> optional "created_at" (nullable string) Nothing |> optional "updated_at" (nullable string) Nothing @@ -223,8 +241,9 @@ optionsDecoder = |> optional "retention_time" (nullable int) Nothing -eventAuthFieldDecoder : Decoder EventAuthField -eventAuthFieldDecoder = - succeed EventAuthField - |> required "path" String - |> required "type" String \ No newline at end of file +eventOwnerSelectorDecoder : Decoder EventOwnerSelector +eventOwnerSelectorDecoder = + succeed EventOwnerSelector + |> required "type" string + |> required "name" string + |> required "value" string \ No newline at end of file From 163128070eed4ac31bb3f8ed8caf23e504f84dfb Mon Sep 17 00:00:00 2001 From: "suyashgargsfam@gmail.com" Date: Mon, 20 Jan 2020 13:58:40 +0100 Subject: [PATCH 3/5] Set values --- client/Pages/EventTypeCreate/Models.elm | 9 +++++++++ client/Stores/EventType.elm | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/Pages/EventTypeCreate/Models.elm b/client/Pages/EventTypeCreate/Models.elm index 67a2f80..26f45ab 100644 --- a/client/Pages/EventTypeCreate/Models.elm +++ b/client/Pages/EventTypeCreate/Models.elm @@ -14,6 +14,7 @@ import Stores.EventType , cleanupPolicies , compatibilityModes , partitionStrategies + , emptyEventOwnerSelector ) import Stores.Partition @@ -126,6 +127,11 @@ loadValues eventType = |> Basics.ceiling |> Basics.clamp 2 4 |> String.fromInt + + ownerField = + eventType.event_owner_selector + |> Maybe.withDefault emptyEventOwnerSelector + in defaultValues |> setValue FieldName eventType.name @@ -138,6 +144,9 @@ loadValues eventType = |> setValue FieldSchema eventType.schema.schema |> setValue FieldRetentionTime retentionTime |> maybeSetValue FieldAudience eventType.audience + |> setValue FieldEventOwnerSelectorType ownerField.type_ + |> setValue FieldEventOwnerSelectorName ownerField.name + |> setValue FieldEventOwnerSelectorValue ownerField.value |> setValue FieldCleanupPolicy eventType.cleanup_policy diff --git a/client/Stores/EventType.elm b/client/Stores/EventType.elm index d5f8266..441b964 100644 --- a/client/Stores/EventType.elm +++ b/client/Stores/EventType.elm @@ -1,4 +1,4 @@ -module Stores.EventType exposing (EventType, EventTypeOptions, EventTypeStatistics, Model, Msg, allAudiences, allCategories, allCleanupPolicies, allModes, audiences, categories, cleanupPolicies, collectionDecoder, compatibilityModes, config, defaultStatisticDecoder, initialModel, memberDecoder, optionsDecoder, partitionStrategies, EventOwnerSelector, allOwnerSelectorTypes, update) +module Stores.EventType exposing (EventType, EventTypeOptions, EventTypeStatistics, Model, Msg, allAudiences, allCategories, allCleanupPolicies, allModes, audiences, categories, cleanupPolicies, collectionDecoder, compatibilityModes, config, defaultStatisticDecoder, initialModel, memberDecoder, optionsDecoder, partitionStrategies, EventOwnerSelector, allOwnerSelectorTypes, update, emptyEventOwnerSelector) import Config import Constants @@ -56,6 +56,11 @@ type alias EventOwnerSelector = , name : String , value : String } +emptyEventOwnerSelector = + { type_ = "" + , name = "" + , value = "" + } ownerSelectorTypes : From 7a87f7ccf73450babd554e3e35e020f767e205e7 Mon Sep 17 00:00:00 2001 From: "suyashgargsfam@gmail.com" Date: Mon, 20 Jan 2020 14:04:03 +0100 Subject: [PATCH 4/5] Fix format using elm-format --- client/Pages/EventTypeCreate/Models.elm | 5 ++-- client/Pages/EventTypeCreate/Update.elm | 40 ++++++++++++++----------- client/Pages/EventTypeCreate/View.elm | 7 +++-- client/Pages/EventTypeDetails/Help.elm | 2 +- client/Pages/EventTypeDetails/View.elm | 11 +++---- client/Stores/EventType.elm | 8 +++-- 6 files changed, 42 insertions(+), 31 deletions(-) diff --git a/client/Pages/EventTypeCreate/Models.elm b/client/Pages/EventTypeCreate/Models.elm index 26f45ab..db69024 100644 --- a/client/Pages/EventTypeCreate/Models.elm +++ b/client/Pages/EventTypeCreate/Models.elm @@ -13,8 +13,8 @@ import Stores.EventType , categories , cleanupPolicies , compatibilityModes - , partitionStrategies , emptyEventOwnerSelector + , partitionStrategies ) import Stores.Partition @@ -127,11 +127,10 @@ loadValues eventType = |> Basics.ceiling |> Basics.clamp 2 4 |> String.fromInt - + ownerField = eventType.event_owner_selector |> Maybe.withDefault emptyEventOwnerSelector - in defaultValues |> setValue FieldName eventType.name diff --git a/client/Pages/EventTypeCreate/Update.elm b/client/Pages/EventTypeCreate/Update.elm index 679e76c..5fab513 100644 --- a/client/Pages/EventTypeCreate/Update.elm +++ b/client/Pages/EventTypeCreate/Update.elm @@ -383,17 +383,20 @@ submitCreate model = |> Stores.Authorization.encoder event_owner_selector = - if isEmptyString FieldEventOwnerSelectorName && - isEmptyString FieldEventOwnerSelectorValue && - isEmptyString FieldEventOwnerSelectorType then + if + isEmptyString FieldEventOwnerSelectorName + && isEmptyString FieldEventOwnerSelectorValue + && isEmptyString FieldEventOwnerSelectorType + then [] else - [ ( "event_owner_selector", Json.object - [ ( "type", asString FieldEventOwnerSelectorType ) - , ( "name", asString FieldEventOwnerSelectorName ) - , ( "value", asString FieldEventOwnerSelectorValue ) - ] + [ ( "event_owner_selector" + , Json.object + [ ( "type", asString FieldEventOwnerSelectorType ) + , ( "name", asString FieldEventOwnerSelectorName ) + , ( "value", asString FieldEventOwnerSelectorValue ) + ] ) ] @@ -477,7 +480,7 @@ submitUpdate model = |> getValue field |> String.trim |> Json.string - + isEmptyString field = model.values |> getValue field @@ -489,17 +492,20 @@ submitUpdate model = |> Stores.Authorization.encoder event_owner_selector = - if isEmptyString FieldEventOwnerSelectorName && - isEmptyString FieldEventOwnerSelectorValue && - isEmptyString FieldEventOwnerSelectorType then + if + isEmptyString FieldEventOwnerSelectorName + && isEmptyString FieldEventOwnerSelectorValue + && isEmptyString FieldEventOwnerSelectorType + then [] else - [ ( "event_owner_selector", Json.object - [ ( "type", asString FieldEventOwnerSelectorType ) - , ( "name", asString FieldEventOwnerSelectorName ) - , ( "value", asString FieldEventOwnerSelectorValue ) - ] + [ ( "event_owner_selector" + , Json.object + [ ( "type", asString FieldEventOwnerSelectorType ) + , ( "name", asString FieldEventOwnerSelectorName ) + , ( "value", asString FieldEventOwnerSelectorValue ) + ] ) ] diff --git a/client/Pages/EventTypeCreate/View.elm b/client/Pages/EventTypeCreate/View.elm index 7779887..d656f50 100644 --- a/client/Pages/EventTypeCreate/View.elm +++ b/client/Pages/EventTypeCreate/View.elm @@ -22,11 +22,11 @@ import Stores.EventType , allCategories , allCleanupPolicies , allModes + , allOwnerSelectorTypes , categories , cleanupPolicies , compatibilityModes , partitionStrategies - , allOwnerSelectorTypes ) @@ -172,6 +172,7 @@ viewForm model setup = appsInfoUrl = model.userStore.user.settings.appsInfoUrl + usersInfoUrl = model.userStore.user.settings.usersInfoUrl @@ -277,7 +278,7 @@ viewForm model setup = ("" :: allOwnerSelectorTypes) , div [ class "dc-column" ] - [textInput formModel + [ textInput formModel FieldEventOwnerSelectorName OnInput "Event Owner Selector Name" @@ -289,7 +290,7 @@ viewForm model setup = ] , div [ class "dc-column" ] - [textInput formModel + [ textInput formModel FieldEventOwnerSelectorValue OnInput "Event Owner Selector Value" diff --git a/client/Pages/EventTypeDetails/Help.elm b/client/Pages/EventTypeDetails/Help.elm index 9dfd9a8..d7eafc4 100644 --- a/client/Pages/EventTypeDetails/Help.elm +++ b/client/Pages/EventTypeDetails/Help.elm @@ -1,4 +1,4 @@ -module Pages.EventTypeDetails.Help exposing (audience, authorization, category, cleanupPolicy, cleanupPolicyCompact, compatibilityMode, consumers, consumingQueries, createdAt, defaultStatistic, enrichmentStrategies, envelope, eventType, options, orderingKeyFields, owningApplication, partitionCompactionKeyField, partitionKeyFields, partitionStrategy, partitions, publishers, schema, subscription, updatedAt, eventOwnerSelector) +module Pages.EventTypeDetails.Help exposing (audience, authorization, category, cleanupPolicy, cleanupPolicyCompact, compatibilityMode, consumers, consumingQueries, createdAt, defaultStatistic, enrichmentStrategies, envelope, eventOwnerSelector, eventType, options, orderingKeyFields, owningApplication, partitionCompactionKeyField, partitionKeyFields, partitionStrategy, partitions, publishers, schema, subscription, updatedAt) import Config exposing (appPreffix) import Helpers.UI exposing (..) diff --git a/client/Pages/EventTypeDetails/View.elm b/client/Pages/EventTypeDetails/View.elm index 167a3e4..cec4187 100644 --- a/client/Pages/EventTypeDetails/View.elm +++ b/client/Pages/EventTypeDetails/View.elm @@ -28,10 +28,10 @@ import Stores.ConsumingQuery exposing (ConsumingQuery) import Stores.CursorDistance import Stores.EventType exposing - ( EventType + ( EventOwnerSelector + , EventType , EventTypeOptions , EventTypeStatistics - , EventOwnerSelector , cleanupPolicies ) import Stores.EventTypeSchema @@ -388,10 +388,11 @@ infoEventOwnerSelectorToText maybeEventOwnerSelector = case maybeEventOwnerSelector of Just owner_selector -> div [] - [ infoSubField "Type: " (owner_selector.type_) - , infoSubField "Name: " (owner_selector.name) - , infoSubField "Value: " (owner_selector.value) + [ infoSubField "Type: " owner_selector.type_ + , infoSubField "Name: " owner_selector.name + , infoSubField "Value: " owner_selector.value ] + Nothing -> infoEmpty diff --git a/client/Stores/EventType.elm b/client/Stores/EventType.elm index 441b964..e5ddf67 100644 --- a/client/Stores/EventType.elm +++ b/client/Stores/EventType.elm @@ -1,4 +1,4 @@ -module Stores.EventType exposing (EventType, EventTypeOptions, EventTypeStatistics, Model, Msg, allAudiences, allCategories, allCleanupPolicies, allModes, audiences, categories, cleanupPolicies, collectionDecoder, compatibilityModes, config, defaultStatisticDecoder, initialModel, memberDecoder, optionsDecoder, partitionStrategies, EventOwnerSelector, allOwnerSelectorTypes, update, emptyEventOwnerSelector) +module Stores.EventType exposing (EventOwnerSelector, EventType, EventTypeOptions, EventTypeStatistics, Model, Msg, allAudiences, allCategories, allCleanupPolicies, allModes, allOwnerSelectorTypes, audiences, categories, cleanupPolicies, collectionDecoder, compatibilityModes, config, defaultStatisticDecoder, emptyEventOwnerSelector, initialModel, memberDecoder, optionsDecoder, partitionStrategies, update) import Config import Constants @@ -56,6 +56,8 @@ type alias EventOwnerSelector = , name : String , value : String } + + emptyEventOwnerSelector = { type_ = "" , name = "" @@ -72,12 +74,14 @@ ownerSelectorTypes = , static = "static" } + allOwnerSelectorTypes : List String allOwnerSelectorTypes = [ ownerSelectorTypes.path , ownerSelectorTypes.static ] + type alias Model = Helpers.Store.Model EventType @@ -251,4 +255,4 @@ eventOwnerSelectorDecoder = succeed EventOwnerSelector |> required "type" string |> required "name" string - |> required "value" string \ No newline at end of file + |> required "value" string From 5e2a241bf6b8ff1a2f830331f726da24add0c223 Mon Sep 17 00:00:00 2001 From: "suyashgargsfam@gmail.com" Date: Mon, 20 Jan 2020 15:58:15 +0100 Subject: [PATCH 5/5] Improve Help to trigger travis --- client/Pages/EventTypeDetails/Help.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/Pages/EventTypeDetails/Help.elm b/client/Pages/EventTypeDetails/Help.elm index d7eafc4..62179a1 100644 --- a/client/Pages/EventTypeDetails/Help.elm +++ b/client/Pages/EventTypeDetails/Help.elm @@ -427,7 +427,7 @@ eventOwnerSelector = , newline , text "- " , mono "type" - , text " Specifies the type of the selector" + , text " Specifies the type of the selector (can be 'path' or 'static')" , newline , text "- " , mono "name" @@ -436,7 +436,7 @@ eventOwnerSelector = , newline , text "- " , mono "value" - , text " value in dot notation pointing to a string field" + , text " Static value or value in dot notation pointing to a string field" , text " in an event which will be used to" , text " classify if the consumer is allowed to read the event." , newline