1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00

Display subscription information

This commit is contained in:
Harvey Kandola 2018-09-10 10:12:14 +01:00
parent 53e4861ded
commit 9ee9526a47
6 changed files with 708 additions and 684 deletions

4
core/env/product.go vendored
View file

@ -32,11 +32,13 @@ type License struct {
Name string `json:"name"`
Email string `json:"email"`
Edition string `json:"edition"`
Package string `json:"package"`
Plan string `json:"plan"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
Seats int `json:"seats"`
Trial bool `json:"trial"`
Valid bool
Valid bool `json:"valid"`
}
// IsEmpty determines if we have a license.

View file

@ -59,6 +59,7 @@ func (h *Handler) Meta(w http.ResponseWriter, r *http.Request) {
data.Edition = h.Runtime.Product.License.Edition
data.Valid = h.Runtime.Product.License.Valid
data.ConversionEndpoint = org.ConversionEndpoint
data.License = h.Runtime.Product.License
// Strip secrets
data.AuthConfig = auth.StripAuthSecrets(h.Runtime, org.AuthProvider, org.AuthConfig)

File diff suppressed because one or more lines are too long

View file

@ -12,9 +12,9 @@
import $ from 'jquery';
import { htmlSafe } from '@ember/string';
import { resolve } from 'rsvp';
import Service, { inject as service } from '@ember/service';
import miscUtil from '../utils/misc';
import config from '../config/environment';
import Service, { inject as service } from '@ember/service';
export default Service.extend({
ajax: service(),
@ -29,9 +29,6 @@ export default Service.extend({
version: '',
message: '',
edition: 'Community',
// for major.minor semver release detection
// for bugfix releases, only admin is made aware of new release and end users see no What's New messaging
updateAvailable: false,
valid: true,
allowAnonymousAccess: false,
authProvider: null,
@ -40,6 +37,10 @@ export default Service.extend({
secureMode: false,
maxTags: 3,
// for major.minor semver release detection
// for bugfix releases, only admin is made aware of new release and end users see no What's New messaging
updateAvailable: false,
invalidLicense() {
return this.valid === false;
},

View file

@ -12,13 +12,29 @@
<div class="view-customize">
<form class="mt-5 ">
<div class="form-group">
<label for="product-license-xml">Enterprise Edition license (optional)</label>
<label for="product-license-xml">Optional Enterprise Edition License Key</label>
{{textarea id="product-license-xml" value=license rows="18" class=(if LicenseError 'form-control is-invalid' 'form-control')}}
<small class="form-text text-muted ">XML format</small>
{{#if appMeta.valid}}
<p class="mt-2 color-green">Valid</p>
{{#if (eq appMeta.edition "Enterprise")}}
<p class="mt-2 color-green">Registered to {{appMeta.license.email}} @ {{appMeta.license.name}}</p>
<p class="mt-2 color-green">{{appMeta.license.package}} package up to {{appMeta.license.seats}} users</p>
{{#if appMeta.license.trial}}
<p class="mt-2 color-red">Trial expiry {{formatted-date appMeta.license.end}}</p>
{{else}}
<p class="mt-2 color-green">Subscribed to {{formatted-date appMeta.license.end}}</p>
{{/if}}
{{else}}
<small class="form-text text-muted">License key is XML format and activates Enterprise edition</small>
{{/if}}
{{else}}
<p class="mt-2 color-red">Invalid</p>
<p class="mt-2 color-red">License is not valid &mdash; check user count and expirty date</p>
<p class="mt-2 color-gray">Registered to {{appMeta.license.email}} @ {{appMeta.license.name}}</p>
<p class="mt-2 color-gray">{{appMeta.license.package}} package up to {{appMeta.license.seats}} users</p>
{{#if appMeta.license.trial}}
<p class="mt-2 color-gray">Trial expiry {{formatted-date appMeta.license.end}}</p>
{{else}}
<p class="mt-2 color-gray">Subscribed to {{formatted-date appMeta.license.end}}</p>
{{/if}}
{{/if}}
</div>
<div class="btn btn-success mt-3" {{action 'saveLicense'}}>Save</div>

View file

@ -11,7 +11,10 @@
package org
import "time"
import (
"github.com/documize/community/core/env"
"time"
)
// SitemapDocument details a document that can be exposed via Sitemap.
type SitemapDocument struct {
@ -24,16 +27,17 @@ type SitemapDocument struct {
// SiteMeta holds information associated with an Organization.
type SiteMeta struct {
OrgID string `json:"orgId"`
Title string `json:"title"`
Message string `json:"message"`
URL string `json:"url"`
AllowAnonymousAccess bool `json:"allowAnonymousAccess"`
AuthProvider string `json:"authProvider"`
AuthConfig string `json:"authConfig"`
Version string `json:"version"`
MaxTags int `json:"maxTags"`
Edition string `json:"edition"`
Valid bool `json:"valid"`
ConversionEndpoint string `json:"conversionEndpoint"`
OrgID string `json:"orgId"`
Title string `json:"title"`
Message string `json:"message"`
URL string `json:"url"`
AllowAnonymousAccess bool `json:"allowAnonymousAccess"`
AuthProvider string `json:"authProvider"`
AuthConfig string `json:"authConfig"`
Version string `json:"version"`
MaxTags int `json:"maxTags"`
Edition string `json:"edition"`
Valid bool `json:"valid"`
ConversionEndpoint string `json:"conversionEndpoint"`
License env.License `json:"license"`
}