github.com/oam-dev/kubevela@v1.9.11/references/cli/top/model/type.go (about) 1 /* 2 Copyright 2022 The KubeVela Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package model 18 19 import "github.com/rivo/tview" 20 21 type ( 22 // View is an abstract of view of app 23 View interface { 24 Primitive 25 Initer 26 Hinter 27 } 28 // Primitive is an abstract of tview ui component 29 Primitive interface { 30 tview.Primitive 31 // Name return name of the component 32 Name() string 33 } 34 35 // Initer is an abstract of components whose need to init 36 Initer interface { 37 // Start the component 38 Start() 39 // Stop the component 40 Stop() 41 // Init the component 42 Init() 43 } 44 45 // Hinter is an abstract of components which can provide menu hints to menu component 46 Hinter interface { 47 // Hint return key action menu hints of the component 48 Hint() []MenuHint 49 } 50 ) 51 52 var ( 53 // CtxKeyAppName request context key of application name 54 CtxKeyAppName = "appName" 55 // CtxKeyNamespace request context key of namespace name 56 CtxKeyNamespace = "appNs" 57 // CtxKeyCluster request context key of cluster name 58 CtxKeyCluster = "cluster" 59 // CtxKeyClusterNamespace request context key of cluster namespace name 60 CtxKeyClusterNamespace = "cluster" 61 // CtxKeyComponentName request context key of component name 62 CtxKeyComponentName = "componentName" 63 // CtxKeyGVR request context key of GVR 64 CtxKeyGVR = "gvr" 65 // CtxKeyPod request context key of pod 66 CtxKeyPod = "pod" 67 // CtxKeyContainer request context key of container 68 CtxKeyContainer = "container" 69 ) 70 71 const ( 72 // AllNamespace represent all namespaces 73 AllNamespace = "all" 74 // AllClusterNamespace represent all cluster namespace 75 AllClusterNamespace = "all" 76 // AllCluster represent all cluster 77 AllCluster = "all" 78 )