diff --git a/app/admin/routes.py b/app/admin/routes.py index fd4622e..78422db 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -137,7 +137,7 @@ def list_transactions(): @admin_required def transaction(user_pid=0): cuser = User.query.filter_by(pid=user_pid).first() - transactions = cuser.inv_transactions.order_by(Transaction.date_created.desc()).all() + transactions = cuser.inv_transactions.order_by(Transaction.date_created.desc()).limit(20) labelslist = ['today'] translist = [cuser.wallet] diff --git a/app/templates/admin/list_transactions.html b/app/templates/admin/list_transactions.html index ecc70e6..ba16535 100644 --- a/app/templates/admin/list_transactions.html +++ b/app/templates/admin/list_transactions.html @@ -7,13 +7,14 @@
-
Transactions
+
All Transactions
+ @@ -25,12 +26,14 @@ {% for transaction in transactions %} {% if transaction.value > 0 %} + {% else %} + diff --git a/app/templates/main/index.html b/app/templates/main/index.html index 2c3ee9c..d203a66 100644 --- a/app/templates/main/index.html +++ b/app/templates/main/index.html @@ -90,28 +90,23 @@

Оборудване

Благодарение на внедрените нови технологии ние предлагаме изчислителна мощ, надеждно съхранение на данни и гъвкаво разпределение на ресурсите. Предвиждаме възможности нашата система да бъде неразделна част от текущата ви инфраструктура.

- +i + +
- -

Поддръжка

-

Ще Ви помогнем във всички неприятни ситуации, по всяко време.

- + +

Мисия

+

Желанието ни е да предоставим елегантна платформа за управление на изчислителни процеси, която цели да бъде използваема от всеки, а не само от тесен кръг специалисти, без да се прави компромис със качеството и възможностите й.

+ +
+
-
-
- -

Мисия

-

Желанието ни е да предоставим елегантна платформа за управление на изчислителни процеси, която цели да бъде използваема от всеки, а не само от тесен кръг специалисти, без да се прави компромис със качеството и възможностите й.

-
-
- -
@@ -120,6 +115,18 @@
+ + +
+
+
+ +

Поддръжка

+

Ще Ви помогнем във всички неприятни ситуации, по всяко време.

+ +
+
+
diff --git a/app/templates/panel/dashboard.html b/app/templates/panel/dashboard.html index 9f24d6b..503e807 100644 --- a/app/templates/panel/dashboard.html +++ b/app/templates/panel/dashboard.html @@ -229,26 +229,6 @@ addEventListener("DOMContentLoaded", function() {
Communications

- Private
-

-
ID Description Amount Date
{{ transaction.pid }} {{ transaction.description }} {{ transaction.value }} {{ transaction.currency }} {{ moment(transaction.date_created).format('lll') }} {{ transaction.owner.email }}
{{ transaction.pid }} {{ transaction.description }} {{ transaction.value }} {{ transaction.currency }} {{ moment(transaction.date_created).format('lll') }}
- - - - - - - - {% for bridge in inv_bridges %} - - - - - {% endfor %} - -
UnitNetwork
{{ bridge.bridge_id }}192.168.9.0
-
- Public
diff --git a/app/templates/uinvoice/transactions.html b/app/templates/uinvoice/transactions.html index b86c4f5..6278816 100644 --- a/app/templates/uinvoice/transactions.html +++ b/app/templates/uinvoice/transactions.html @@ -60,7 +60,7 @@ var myChart = new Chart(ctx, {
-
Transactions
+
Last 20 Transactions
diff --git a/app/uinvoice/routes.py b/app/uinvoice/routes.py index b04024b..1d93298 100644 --- a/app/uinvoice/routes.py +++ b/app/uinvoice/routes.py @@ -14,7 +14,7 @@ from ..models import User, Transaction def transactions(): page = { 'title': 'Payment Transaction' } cuser = current_user - transactions = Transaction.query.filter_by(user_id=cuser.pid).order_by(Transaction.date_created.desc()).limit(100) + transactions = Transaction.query.filter_by(user_id=cuser.pid).order_by(Transaction.date_created.desc()).limit(20) labelslist = ['today'] translist = [cuser.wallet] diff --git a/app/vmanager/routes.py b/app/vmanager/routes.py index 0c2fe12..c38dc01 100644 --- a/app/vmanager/routes.py +++ b/app/vmanager/routes.py @@ -56,49 +56,9 @@ def createvm(): form = CreateForm() if current_user.confirmed and form.validate_on_submit(): + #selects the chosen region selected_region = Region.query.filter_by(pid=int(form.region.data)).first() - #TODO: Filter bridges for the selected region only. switch should return slave name - selected_bridge = current_user.inv_bridges.filter_by(deleted=False).first() - if selected_bridge is None: - #no bridges in the account. create one... - data = { 'clientid': str(current_user.pid), - 'clientemail': str(current_user.email), - 'region': str(selected_region.name), - 'type': 'br' - } - #create bridge unit - query = contact_proxmaster(data, 'create') - if query['status'] == 'bridge_created': - newbridge = True - #machine will be installed where the bridge physically is - region_name = query['region'] - slave_name = query['slave'] - bridge_id = query['unit_id'] - bridge_phy_id = query['phy_id'] - selected_bridge = Bridge(user_id=int(current_user.pid), bridge_id=bridge_id) - db.session.add(selected_bridge) - db.session.commit() - flash('New point created successfully in region "{}".'.format(str(selected_region.description))) - else: - flash('Point could not be created! Please try again later...') - return redirect(url_for('panel.dashboard')) - else: - #bridge found. lets see on which slave it is so we can create the instance on the same slave. - data = { 'unit_id': int(selected_bridge.bridge_id), - 'type': 'br' } - query = contact_proxmaster(data, 'query') - if query['status'] == 'query_success': - newbridge = False - #machine will be installed where the switch physically is - region_name = query['region'] - slave_name = query['slave'] - bridge_phy_id = query['phy_id'] - else: - flash('Point found but cannot be used!') - return redirect(url_for('panel.dashboard')) - - ### #create new machine... data = { 'clientid': str(current_user.pid), 'clientemail': str(current_user.email), @@ -109,7 +69,7 @@ def createvm(): 'cpu': '1', 'mem': '512', 'hdd': '20', - 'net0if': 'vmbr' + str(bridge_phy_id) + 'net0if': 'vmbr7' } try: query = contact_proxmaster(data, 'create') @@ -121,10 +81,10 @@ def createvm(): deployment = Deployment(user_id=int(current_user.pid), machine_alias=str(form.servername.data), machine_id=query['unit_id'], machine_cpu=data['cpu'], machine_mem=data['mem'], machine_hdd=data['hdd'], enabled=True, protected=False, daysleft=15, warning=True, discount=0, bridge_id=int(selected_bridge.pid)) db.session.add(deployment) db.session.commit() - flash('New device created successfully in region "{}".'.format(str(selected_region.description))) + flash('A new deployment is created successfully in region "{}".'.format(str(selected_region.description))) return redirect(url_for('panel.dashboard')) else: - flash('Device could not be created! Please try again later...') + flash('Deployment could not be created! Please try again later...') #TODO: cleanup bridge if the machine is new and we were not be able to create it @@ -174,52 +134,6 @@ def activate(itemid=0): else: return redirect(url_for('uinvoice.transactions')) current_app.logger.info('[{}] Charge deployment: {}'.format(owner.email, deploy.machine_id)) - - #TODO: Filter routers for the selected region only. switch should return slave name - selected_router = owner.inv_routers.filter_by(deleted=False).first() - if selected_router is None: - #TODO: Filter bridges for the selected region only. switch should return slave name - selected_bridge = owner.inv_bridges.filter_by(deleted=False).first() - if selected_bridge is None: - flash('No private network found.') - else: - #bridge found. lets see on which slave it is so we can create the instance on the same slave. - data = { 'unit_id': int(selected_bridge.bridge_id), - 'type': 'br' } - query = contact_proxmaster(data, 'query') - if query['status'] == 'query_success': - #TODO: selected random ip address from the pool. - selected_ip = '87.120.110.41' - #machine will be installed where the switch physically is - region_name = query['region'] - slave_name = query['slave'] - bridge_phy_id = query['phy_id'] - data = { 'clientid': str(owner.pid), - 'clientemail': str(owner.email), - 'hostname': 'c' + str(owner.pid) + '-r' + selected_ip, - 'region': str(region_name), - 'slave': str(slave_name), - 'type': 'lxc', - 'cpu': '1', - 'mem': '256', - 'hdd': '1', - 'net0if': 'vmbr' + str(bridge_phy_id), - 'net0ip': '192.168.9.1', - 'net0mask': '24', - 'net1if': 'vmbr0', - 'net1ip': selected_ip, - 'net1mask': '24', - 'net1gw': '87.120.110.1' #should be queried from the current region - } - query = contact_proxmaster(data, 'create') - if query['status'] == 'lxc_created': - router = Router(user_id=int(owner.pid), machine_id=query['unit_id']) - db.session.add(router) - db.session.commit() - else: - flash('Router cannot be created.') - return redirect(url_for('panel.dashboard')) - today = datetime.utcnow() expiry = today + relativedelta(today, months=+(form.period.data)) daysleft = expiry - today