mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	将部分MB、GB...改成MiB、GiB...
This commit is contained in:
		@@ -30,17 +30,17 @@ func FormatBytes(bytes int64) string {
 | 
			
		||||
	if bytes < Pow1024(1) {
 | 
			
		||||
		return FormatInt64(bytes) + "B"
 | 
			
		||||
	} else if bytes < Pow1024(2) {
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fKB", float64(bytes)/float64(Pow1024(1))))
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fKiB", float64(bytes)/float64(Pow1024(1))))
 | 
			
		||||
	} else if bytes < Pow1024(3) {
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fMB", float64(bytes)/float64(Pow1024(2))))
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fMiB", float64(bytes)/float64(Pow1024(2))))
 | 
			
		||||
	} else if bytes < Pow1024(4) {
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fGB", float64(bytes)/float64(Pow1024(3))))
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fGiB", float64(bytes)/float64(Pow1024(3))))
 | 
			
		||||
	} else if bytes < Pow1024(5) {
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fTB", float64(bytes)/float64(Pow1024(4))))
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fTiB", float64(bytes)/float64(Pow1024(4))))
 | 
			
		||||
	} else if bytes < Pow1024(6) {
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fPB", float64(bytes)/float64(Pow1024(5))))
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fPiB", float64(bytes)/float64(Pow1024(5))))
 | 
			
		||||
	} else {
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fEB", float64(bytes)/float64(Pow1024(6))))
 | 
			
		||||
		return TrimZeroSuffix(fmt.Sprintf("%.2fEiB", float64(bytes)/float64(Pow1024(6))))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -63,12 +63,12 @@ Vue.component("size-capacity-box", {
 | 
			
		||||
	<div class="ui field">
 | 
			
		||||
		<select class="ui dropdown" v-model="capacity.unit" @change="change">
 | 
			
		||||
			<option value="byte" v-if="supportedUnits.length == 0 || supportedUnits.$contains('byte')">字节</option>
 | 
			
		||||
			<option value="kb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('kb')">KB</option>
 | 
			
		||||
			<option value="mb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('mb')">MB</option>
 | 
			
		||||
			<option value="gb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('gb')">GB</option>
 | 
			
		||||
			<option value="tb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('tb')">TB</option>
 | 
			
		||||
			<option value="pb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('pb')">PB</option>
 | 
			
		||||
			<option value="eb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('eb')">EB</option>
 | 
			
		||||
			<option value="kb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('kb')">KiB</option>
 | 
			
		||||
			<option value="mb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('mb')">MiB</option>
 | 
			
		||||
			<option value="gb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('gb')">GiB</option>
 | 
			
		||||
			<option value="tb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('tb')">TiB</option>
 | 
			
		||||
			<option value="pb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('pb')">PiB</option>
 | 
			
		||||
			<option value="eb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('eb')">EiB</option>
 | 
			
		||||
		</select>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>`
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ Vue.component("plan-price-view", {
 | 
			
		||||
		按{{plan.bandwidthPrice.percentile}}th带宽计费 
 | 
			
		||||
		<div>
 | 
			
		||||
			<div v-for="range in plan.bandwidthPrice.ranges">
 | 
			
		||||
				<span class="small grey">{{range.minMB}} - <span v-if="range.maxMB > 0">{{range.maxMB}}MB</span><span v-else>∞</span>: <span v-if="range.totalPrice > 0">{{range.totalPrice}}元</span><span v-else="">{{range.pricePerMB}}元/MB</span></span>
 | 
			
		||||
				<span class="small grey">{{range.minMB}} - <span v-if="range.maxMB > 0">{{range.maxMB}}MiB</span><span v-else>∞</span>: <span v-if="range.totalPrice > 0">{{range.totalPrice}}元</span><span v-else="">{{range.pricePerMB}}元/MiB</span></span>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ Vue.component("http-access-log-config-box", {
 | 
			
		||||
						<label :for="'access-log-field-' + index">{{field.name}}</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<p class="comment">在基础信息之外要存储的信息。
 | 
			
		||||
						<span class="red" v-if="hasRequestBodyField">记录"请求Body"将会显著消耗更多的系统资源,建议仅在调试时启用,最大记录尺寸为2MB。</span>
 | 
			
		||||
						<span class="red" v-if="hasRequestBodyField">记录"请求Body"将会显著消耗更多的系统资源,建议仅在调试时启用,最大记录尺寸为2MiB。</span>
 | 
			
		||||
					</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -124,21 +124,21 @@ window.teaweb = {
 | 
			
		||||
			return bytes + "B";
 | 
			
		||||
		}
 | 
			
		||||
		if (bytes < Math.pow(1024, 2)) {
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 1)) / 100) + "KB";
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 1)) / 100) + "KiB";
 | 
			
		||||
		}
 | 
			
		||||
		if (bytes < Math.pow(1024, 3)) {
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 2)) / 100) + "MB";
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 2)) / 100) + "MiB";
 | 
			
		||||
		}
 | 
			
		||||
		if (bytes < Math.pow(1024, 4)) {
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 3)) / 100) + "GB";
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 3)) / 100) + "GiB";
 | 
			
		||||
		}
 | 
			
		||||
		if (bytes < Math.pow(1024, 5)) {
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 4)) / 100) + "TB";
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 4)) / 100) + "TiB";
 | 
			
		||||
		}
 | 
			
		||||
		if (bytes < Math.pow(1024, 6)) {
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 5)) / 100) + "PB";
 | 
			
		||||
			return (Math.round(bytes * 100 / Math.pow(1024, 5)) / 100) + "PiB";
 | 
			
		||||
		}
 | 
			
		||||
		return (Math.round(bytes * 100 / Math.pow(1024, 6)) / 100) + "EB";
 | 
			
		||||
		return (Math.round(bytes * 100 / Math.pow(1024, 6)) / 100) + "EiB";
 | 
			
		||||
	},
 | 
			
		||||
	formatBits: function (bits, decimal) {
 | 
			
		||||
		bits = Math.ceil(bits);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								web/public/js/utils.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								web/public/js/utils.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -184,9 +184,9 @@
 | 
			
		||||
                <td>磁盘预估写入最大速度</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span v-if="node.status.diskWritingSpeedMB == 0">-</span><span v-if="node.status.diskWritingSpeedMB > 0">> {{node.status.diskWritingSpeedMB}}</span>
 | 
			
		||||
                    <span v-if="node.status.diskWritingSpeedMB > 1000">MB/s 极快</span>
 | 
			
		||||
                    <span v-else-if="node.status.diskWritingSpeedMB > 150">MB/s 快</span>
 | 
			
		||||
                    <span v-else-if="node.status.diskWritingSpeedMB > 0">MB/s 一般</span>
 | 
			
		||||
                    <span v-if="node.status.diskWritingSpeedMB > 1000">MiB/s 极快</span>
 | 
			
		||||
                    <span v-else-if="node.status.diskWritingSpeedMB > 150">MiB/s 快</span>
 | 
			
		||||
                    <span v-else-if="node.status.diskWritingSpeedMB > 0">MiB/s 一般</span>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@
 | 
			
		||||
                <td class="color-border">缓存磁盘最小空余空间</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <size-capacity-box :v-name="'fileMinFreeSizeJSON'" :v-count="0" :v-unit="'gb'" :key="'minFreeSizeJSON'"></size-capacity-box>
 | 
			
		||||
                    <p class="comment">缓存磁盘保留的最小空余空间,如果为0表示自动限制(目前默认保留5GB)。</p>
 | 
			
		||||
                    <p class="comment">缓存磁盘保留的最小空余空间,如果为0表示自动限制(目前默认保留5GiB)。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@
 | 
			
		||||
                    <td class="color-border">缓存磁盘最小空余空间</td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <size-capacity-box :v-name="'fileMinFreeSizeJSON'" :v-value="cachePolicy.options.minFreeSize" :key="'minFreeSizeJSON'"></size-capacity-box>
 | 
			
		||||
                        <p class="comment">缓存磁盘保留的最小空余空间,如果为0表示使用默认(目前默认保留5GB)。</p>
 | 
			
		||||
                        <p class="comment">缓存磁盘保留的最小空余空间,如果为0表示使用默认(目前默认保留5GiB)。</p>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@
 | 
			
		||||
                        <option value="avg">平均带宽</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                    <p class="comment" v-if="user.bandwidthAlgo == 'secondly'">按在计时时间段内(5分钟)最高带宽峰值计算,比如5分钟内最高的某个时间点带宽为100Mbps,那么就认为此时间段内的峰值带宽为100Mbps。</p>
 | 
			
		||||
                    <p class="comment" v-if="user.bandwidthAlgo == 'avg'">按在计时时间段内(5分钟)平均带宽计算,即此时间段内的总流量除以时间段的秒数,比如5分钟(300秒)内总流量600MB,那么带宽即为<code-label>600MB * 8bit/300s = 16Mbps</code-label>;通常平均带宽算法要比峰值带宽要少很多。</p>
 | 
			
		||||
                    <p class="comment" v-if="user.bandwidthAlgo == 'avg'">按在计时时间段内(5分钟)平均带宽计算,即此时间段内的总流量除以时间段的秒数,比如5分钟(300秒)内总流量600MiB,那么带宽即为<code-label>600MiB * 8bit/300s = 16Mbps</code-label>;通常平均带宽算法要比峰值带宽要少很多。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user