- Modernized authentication with the introduction of TenantProject
- Created a base mail template - Adapt and improve document API to usage of catalogs and processors - Adapt eveai_sync to new authentication mechanism and usage of catalogs and processors
This commit is contained in:
@@ -35,7 +35,7 @@ def license_tier():
|
||||
return render_template('entitlements/license_tier.html', form=form)
|
||||
|
||||
current_app.logger.info(f"Successfully created license tier {new_license_tier.id}")
|
||||
flash(f"Successfully created tenant license tier {new_license_tier.id}")
|
||||
flash(f"Successfully created tenant license tier {new_license_tier.id}", 'success')
|
||||
|
||||
return redirect(prefixed_url_for('entitlements_bp.view_license_tiers'))
|
||||
else:
|
||||
@@ -232,3 +232,63 @@ def view_usages():
|
||||
|
||||
# Render the users in a template
|
||||
return render_template('entitlements/view_usages.html', rows=rows, pagination=pagination)
|
||||
|
||||
|
||||
@entitlements_bp.route('/handle_usage_selection', methods=['POST'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def handle_usage_selection():
|
||||
usage_identification = request.form['selected_row']
|
||||
usage_id = ast.literal_eval(usage_identification).get('value')
|
||||
the_usage = LicenseUsage.query.get_or_404(usage_id)
|
||||
|
||||
action = request.form['action']
|
||||
|
||||
pass # Currently, no actions are defined
|
||||
|
||||
|
||||
@entitlements_bp.route('/view_licenses')
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def view_licenses():
|
||||
page = request.args.get('page', 1, type=int)
|
||||
per_page = request.args.get('per_page', 10, type=int)
|
||||
|
||||
tenant_id = session.get('tenant').get('id')
|
||||
# Get current date in UTC
|
||||
current_date = dt.now(tz=tz.utc).date()
|
||||
|
||||
# Query licenses for the tenant, with ordering and active status
|
||||
query = (
|
||||
License.query.filter_by(tenant_id=tenant_id)
|
||||
.add_columns(
|
||||
License.id,
|
||||
License.start_date,
|
||||
License.end_date,
|
||||
License.license_tier,
|
||||
License.license_tier.name.label('license_tier_name'),
|
||||
((License.start_date <= current_date) &
|
||||
(or_(License.end_date.is_(None), License.end_date >= current_date))).label('active')
|
||||
)
|
||||
.order_by(License.start_date.desc())
|
||||
)
|
||||
|
||||
pagination = query.paginate(page=page, per_page=per_page)
|
||||
lics = pagination.items
|
||||
|
||||
# prepare table data
|
||||
rows = prepare_table_for_macro(lics, [('id', ''), ('license_tier_name', ''), ('start_date', ''), ('end_date', ''),
|
||||
('active', ''),])
|
||||
|
||||
# Render the licenses in a template
|
||||
return render_template('entitlements/view_licenses.html', rows=rows, pagination=pagination)
|
||||
|
||||
|
||||
@entitlements_bp.route('/handle_license_selection', methods=['POST'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def handle_license_selection():
|
||||
license_identification = request.form['selected_row']
|
||||
license_id = ast.literal_eval(license_identification).get('value')
|
||||
the_license = LicenseUsage.query.get_or_404(license_id)
|
||||
|
||||
action = request.form['action']
|
||||
|
||||
pass # Currently, no actions are defined
|
||||
Reference in New Issue
Block a user