Skip to content

Commit

Permalink
Merge pull request #585 from emqx/license-nodes
Browse files Browse the repository at this point in the history
refactor(License.vue): remove 'nodes' info
  • Loading branch information
ljemq authored Oct 10, 2023
2 parents b177fb7 + 65a23c7 commit 4c02085
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/components/LicenseTipDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<span v-if="isLicenseInvalid" v-html="$t('admin.licenseInvalidTip')" />
<!-- Expired -->
<span v-else-if="isLicenseExpiry" v-html="$t('admin.licenseExpiryTip')" />
<!-- Over Maximum Nodes-->
<span v-else-if="isOverMaximumNodes" v-html="$t('admin.licenseOverMaximumNodesTip')" />
<!-- Over Maximum Tags-->
<span v-else-if="isOverMaximumTags" v-html="$t('admin.licenseOverMaximumTagsTip')" />
<!-- Hardware Mismatch-->
Expand Down Expand Up @@ -56,7 +54,6 @@ const props = defineProps({
isLicenseExpiry: { type: Boolean, default: false },
isLicenseReadyExpiry: { type: Boolean, default: false },
isHardwareMismatch: { type: Boolean, default: false },
isOverMaximumNodes: { type: Boolean, default: false },
isOverMaximumTags: { type: Boolean, default: false },
isDefaultLicense: { type: Boolean, default: false },
})
Expand Down
4 changes: 0 additions & 4 deletions src/composables/useCheckLicense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default () => {
const isLicenseInvalid = ref(false)
const isHardwareMismatch = ref(false)
const isOverMaximumTags = ref(false)
const isOverMaximumNodes = ref(false)
const isDefaultLicense = ref(false)

const checkLicense = async () => {
Expand All @@ -31,7 +30,6 @@ export default () => {
isHasLicense.value = !(Number(error) === 2400) // no License
isLicenseInvalid.value = Number(error) === 2401 // Invalid
isLicenseExpiry.value = Number(error) === 2402 // expired
isOverMaximumNodes.value = Number(error) === 2404 // over Maximum nodes
isOverMaximumTags.value = Number(error) === 2405 // over Maximum Tags
isHardwareMismatch.value = Number(error) === 2406 // hardware mismatch

Expand All @@ -43,7 +41,6 @@ export default () => {
isLicenseInvalid.value ||
isLicenseExpiry.value ||
isHardwareMismatch.value ||
isOverMaximumNodes.value ||
isOverMaximumTags.value ||
isLicenseReadyExpiry.value ||
isDefaultLicense
Expand All @@ -65,7 +62,6 @@ export default () => {
isLicenseExpiry,
isLicenseReadyExpiry,
isHardwareMismatch,
isOverMaximumNodes,
isOverMaximumTags,
isDefaultLicense,
}
Expand Down
8 changes: 3 additions & 5 deletions src/views/about/License.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<emqx-descriptions-item :label="$t('admin.object')">
{{ licenseData.object }}
</emqx-descriptions-item>
<emqx-descriptions-item :label="$t('admin.nodeUsage')">
<!-- <emqx-descriptions-item :label="$t('admin.nodeUsage')">
<el-progress :stroke-width="14" :percentage="licenseData.nodesUsage" status="success" class="progress-bar">
<span class="progress-text">{{ licenseData.used_nodes }} / {{ licenseData.max_nodes }}</span>
</el-progress>
</emqx-descriptions-item>
</emqx-descriptions-item> -->
<emqx-descriptions-item :label="$t('admin.tagUsage')">
<el-progress :stroke-width="14" :percentage="licenseData.tagsUsage" status="success" class="progress-bar">
<span class="progress-text">{{ licenseData.used_tags }} / {{ licenseData.max_node_tags }}</span>
Expand Down Expand Up @@ -121,12 +121,10 @@ const getLicense = async () => {
isDataLoading.value = true
const { data } = await queryLicense()
const { error, ...license } = data
const { max_nodes, used_nodes, used_tags, max_node_tags } = license
const nodesUsage = parseFloat((Number(used_nodes) / Number(max_nodes)).toFixed(2)) * 100
const { used_tags, max_node_tags } = license
const tagsUsage = parseFloat((Number(used_tags) / Number(max_node_tags)).toFixed(2)) * 100
licenseData.value = {
...license,
nodesUsage,
tagsUsage,
}
} catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions src/views/config/southDriver/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@
:isLicenseExpiry="isLicenseExpiry"
:isLicenseReadyExpiry="isLicenseReadyExpiry"
:isHardwareMismatch="isHardwareMismatch"
:isOverMaximumNodes="isOverMaximumNodes"
:isOverMaximumTags="isOverMaximumTags"
:isDefaultLicense="isDefaultLicense"
/>
Expand Down Expand Up @@ -311,7 +310,6 @@ const {
isLicenseReadyExpiry,
isLicenseInvalid,
isHardwareMismatch,
isOverMaximumNodes,
isOverMaximumTags,
isDefaultLicense,
} = useCheckLicense()
Expand Down

0 comments on commit 4c02085

Please sign in to comment.