github.com/erda-project/erda-infra@v1.0.9/providers/component-protocol/components/commodel/progress_bar.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 // ProgressBar is progress bar. 18 // formula: BarPercent = BarCompletedNum / BarTotalNum * 100 19 // example: 7/10 * 100 = 70 20 type ProgressBar struct { 21 // BarCompletedNum is Numerator. 22 BarCompletedNum int64 `json:"barCompletedNum,omitempty"` 23 // BarTotalNum is Denominator. 24 BarTotalNum int64 `json:"barTotalNum,omitempty"` 25 26 // BarPercent is the calculated result. 27 // Optional. 28 // If not present, BarCompletedNum and BarTotalNum must provide. 29 // For some situations, backend only have percent value. 30 BarPercent float64 `json:"barPercent,omitempty"` // optional, percent, range: [0,100], such as: 0.1, 20, 100 31 32 Text string `json:"text,omitempty"` // optional, bar detail text 33 Tip string `json:"tip,omitempty"` // optional, tip 34 Status UnifiedStatus `json:"status,omitempty"` // optional, status 35 } 36 37 // ModelType . 38 func (p ProgressBar) ModelType() string { 39 return "progressBar" 40 }