mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 09:28:58 +08:00
chore: exactly match the list licenses v2 structure with FF on (#6481)
This commit is contained in:
parent
c01060ccf7
commit
0b03ff07f1
@ -218,6 +218,10 @@ func (ah *APIHandler) getBilling(w http.ResponseWriter, r *http.Request) {
|
|||||||
func convertLicenseV3ToLicenseV2(licenses []*model.LicenseV3) []model.License {
|
func convertLicenseV3ToLicenseV2(licenses []*model.LicenseV3) []model.License {
|
||||||
licensesV2 := []model.License{}
|
licensesV2 := []model.License{}
|
||||||
for _, l := range licenses {
|
for _, l := range licenses {
|
||||||
|
planKeyFromPlanName, ok := model.MapOldPlanKeyToNewPlanName[l.PlanName]
|
||||||
|
if !ok {
|
||||||
|
planKeyFromPlanName = model.Basic
|
||||||
|
}
|
||||||
licenseV2 := model.License{
|
licenseV2 := model.License{
|
||||||
Key: l.Key,
|
Key: l.Key,
|
||||||
ActivationId: "",
|
ActivationId: "",
|
||||||
@ -226,7 +230,7 @@ func convertLicenseV3ToLicenseV2(licenses []*model.LicenseV3) []model.License {
|
|||||||
ValidationMessage: "",
|
ValidationMessage: "",
|
||||||
IsCurrent: l.IsCurrent,
|
IsCurrent: l.IsCurrent,
|
||||||
LicensePlan: model.LicensePlan{
|
LicensePlan: model.LicensePlan{
|
||||||
PlanKey: l.PlanName,
|
PlanKey: planKeyFromPlanName,
|
||||||
ValidFrom: l.ValidFrom,
|
ValidFrom: l.ValidFrom,
|
||||||
ValidUntil: l.ValidUntil,
|
ValidUntil: l.ValidUntil,
|
||||||
Status: l.Status},
|
Status: l.Status},
|
||||||
|
@ -253,6 +253,11 @@ func (lm *Manager) GetLicensesV3(ctx context.Context) (response []*model.License
|
|||||||
if lm.activeLicenseV3 != nil && l.Key == lm.activeLicenseV3.Key {
|
if lm.activeLicenseV3 != nil && l.Key == lm.activeLicenseV3.Key {
|
||||||
l.IsCurrent = true
|
l.IsCurrent = true
|
||||||
}
|
}
|
||||||
|
if l.ValidUntil == -1 {
|
||||||
|
// for subscriptions, there is no end-date as such
|
||||||
|
// but for showing user some validity we default one year timespan
|
||||||
|
l.ValidUntil = l.ValidFrom + 31556926
|
||||||
|
}
|
||||||
response = append(response, l)
|
response = append(response, l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@ var (
|
|||||||
PlanNameBasic = "BASIC"
|
PlanNameBasic = "BASIC"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
MapOldPlanKeyToNewPlanName map[string]string = map[string]string{PlanNameBasic: Basic, PlanNameTeams: Pro, PlanNameEnterprise: Enterprise}
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
LicenseStatusInactive = "INACTIVE"
|
LicenseStatusInactive = "INACTIVE"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user