github.com/erda-project/erda-infra@v1.0.9/providers/component-protocol/components/commodel/userselector.go (about) 1 // Copyright (c) 2021 Terminus, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package commodel 16 17 import ( 18 "github.com/erda-project/erda-infra/providers/component-protocol/cptype" 19 ) 20 21 // UserSelector . 22 type UserSelector struct { 23 Scope string `json:"scope,omitempty"` // org/project/app/etc 24 ScopeID string `json:"scopeID,omitempty"` 25 SelectedUserIDs []string `json:"selectedUserIDs,omitempty"` 26 27 Operations map[cptype.OperationKey]cptype.Operation `json:"operations,omitempty"` 28 } 29 30 // ModelType . 31 func (us UserSelector) ModelType() string { return "userSelector" } 32 33 // OpUserSelectorChange . 34 type ( 35 // OpUserSelectorChange . 36 OpUserSelectorChange struct { 37 cptype.Operation 38 ServerData OpUserSelectorChangeServerData `json:"serverData,omitempty"` 39 ClientData OpUserSelectorChangeClientData `json:"clientData,omitempty"` 40 } 41 // OpUserSelectorChangeServerData . 42 OpUserSelectorChangeServerData struct{} 43 // OpUserSelectorChangeClientData . 44 OpUserSelectorChangeClientData struct { 45 DataRef *DropDownMenuItem `json:"dataRef,omitempty"` 46 SelectedUserIDs []string `json:"selectedUserIDs,omitempty"` 47 } 48 ) 49 50 // OpKey . 51 func (o OpUserSelectorChange) OpKey() cptype.OperationKey { return "userSelector" }