2424 </template >
2525 </a-alert >
2626 <div v-if =" ['host'].includes($route.meta.name)" >
27- <a-alert type =" error " :showIcon =" true" v-if =" !dataResource.licenseExpiryDate " :message =" $t('message.license.not.found') " />
28- <a-alert type =" error" :showIcon =" true" v-else-if =" isLicenseNotStarted(dataResource.licenseStartDate) " :message =" $t('message.alert.licenseexpired') + ' : ' + dataResource.licenseStartDate + ' ~ ' + dataResource.licenseExpiryDate+ '(' + calculateDday(dataResource.licenseExpiryDate) + $t('message.license.days.left ') + ')'" />
29- <a-alert type =" error" :showIcon =" true" v-else-if =" isLicenseExpired(dataResource.licenseExpiryDate) " :message =" $t('message.alert.licenseexpired') + ' : ' + dataResource.licenseStartDate + ' ~ ' + dataResource.licenseExpiryDate + '(' + $t('message.license.renewal.required ') + ')'" />
30- <a-alert type =" success " :showIcon =" true" v-else :message = " $t('message.alert.licenseexpired') + ' : ' + dataResource.licenseStartDate + ' ~ ' + dataResource.licenseExpiryDate + '(' + calculateDday(dataResource.licenseExpiryDate) + $t('message.license.days.left') + ')' " />
27+ <a-alert type =" success " :showIcon =" true" v-if =" licenseCode == 'OK' " :message =" $t('message.alert.licenseexpired') + ' : ' + dataResource.licenseStartDate + '~' + dataResource.licenseExpiryDate + '(' + calculateDday(dataResource.licenseExpiryDate) + $t('message. license.days.left') + ')' " />
28+ <a-alert type =" error" :showIcon =" true" v-else-if =" licenseCode == 'PASSED' " :message =" $t('message.alert.licenseexpired') + ' : ' + dataResource.licenseStartDate + '~ ' + dataResource.licenseExpiryDate + '(' + $t('message.license.renewal.required ') + ')'" />
29+ <a-alert type =" error" :showIcon =" true" v-else-if =" licenseCode == 'NOSTART' " :message =" $t('message.alert.licenseexpired') + ' : ' + dataResource.licenseStartDate + '~ ' + dataResource.licenseExpiryDate + '(' + calculateDday(dataResource.licenseExpiryDate) + $t('message.license.days.left ') + ')'" />
30+ <a-alert type =" error " :showIcon =" true" v-else-if = " licenseCode == 'NONE' " :message = " $t('message.license.not.found') " />
3131 </div >
3232 <a-alert v-if =" ip4routes" type =" info" :showIcon =" true" :message =" $t('label.add.upstream.ipv4.routes')" >
3333 <template #description >
@@ -242,7 +242,7 @@ export default {
242242 expired: false ,
243243 expiryDate: ' '
244244 },
245- licenseStateType : ' error '
245+ licenseCode : ' NONE '
246246 }
247247 },
248248 mounted () {
@@ -473,6 +473,7 @@ export default {
473473 return ` label.${ source} `
474474 },
475475 fetchLicenseInfo () {
476+ const today = new Date ()
476477 api (' licenseCheck' , { hostid: this .resource .id }).then (response => {
477478 const licenseData = response? .null ? .licensecheck
478479 if (licenseData) {
@@ -483,25 +484,25 @@ export default {
483484 this .dataResource .hostId = licenseData .hostid
484485 this .dataResource .hasLicense = licenseData .haslicense === ' true'
485486 this .dataResource .licenseValid = licenseData .success === ' true'
486- if (this .isLicenseExpired (this .dataResource .licenseExpiryDate )) {
487- this .licenseStateType = ' error'
487+
488+ if (today <= expiryDate && today >= issuedDate) {
489+ this .licenseCode = ' OK'
490+ } else if (today > expiryDate) {
491+ this .licenseCode = ' PASSED'
492+ } else if (today < issuedDate) {
493+ this .licenseCode = ' NOSTART'
488494 } else {
489- this .licenseStateType = ' success '
495+ this .licenseCode = ' NONE '
490496 }
491497 } else {
492498 this .dataResource .licenseStartDate = ' '
493499 this .dataResource .licenseExpiryDate = ' '
494500 this .dataResource .hasLicense = false
495501 this .dataResource .licenseValid = false
496- this .licenseStateType = ' error '
502+ this .licenseCode = ' NONE '
497503 }
498504 })
499505 },
500- isLicenseExpired (expiryDate ) {
501- const today = new Date ()
502- const expiry = new Date (expiryDate)
503- return today > expiry
504- },
505506 calculateDday (expiryDate ) {
506507 const today = new Date ()
507508 const expiry = new Date (expiryDate)
@@ -514,11 +515,6 @@ export default {
514515 return value
515516 }
516517 return ` 0${ value} `
517- },
518- isLicenseNotStarted (startDate ) {
519- const today = new Date ()
520- const start = new Date (startDate)
521- return today < start
522518 }
523519 }
524520}
0 commit comments