feat: single doctype to store installed apps data

updated on migrate
versions enabled
This commit is contained in:
Gavin D'souza 2020-05-11 20:12:05 +05:30
parent f5f3ed4488
commit ed74f52e20
10 changed files with 140 additions and 1 deletions

View file

@ -0,0 +1,49 @@
{
"actions": [],
"creation": "2020-05-11 17:44:54.674657",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"application_name",
"application_version",
"git_branch"
],
"fields": [
{
"fieldname": "application_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Application Name",
"read_only": 1,
"reqd": 1
},
{
"fieldname": "application_version",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Application Version",
"read_only": 1,
"reqd": 1
},
{
"fieldname": "git_branch",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Git Branch",
"read_only": 1,
"reqd": 1
}
],
"istable": 1,
"links": [],
"modified": "2020-05-11 19:54:07.141641",
"modified_by": "Administrator",
"module": "Core",
"name": "Installed Application Details",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View file

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class InstalledApplicationDetails(Document):
pass

View file

@ -0,0 +1,8 @@
// Copyright (c) 2020, Frappe Technologies and contributors
// For license information, please see license.txt
frappe.ui.form.on('Installed Applications', {
// refresh: function(frm) {
// }
});

View file

@ -0,0 +1,42 @@
{
"actions": [],
"creation": "2020-05-11 17:45:41.587750",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"installed_applications"
],
"fields": [
{
"fieldname": "installed_applications",
"fieldtype": "Table",
"label": "Installed Applications",
"options": "Installed Application Details",
"read_only": 1
}
],
"issingle": 1,
"links": [],
"modified": "2020-05-11 19:52:47.775562",
"modified_by": "Administrator",
"module": "Core",
"name": "Installed Applications",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View file

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class InstalledApplications(Document):
def before_save(self):
self.delete_key("installed_applications")
for app in frappe.utils.get_installed_apps_info():
self.append("installed_applications", {
"application_name": app.get("app_name"),
"application_version": app.get("version"),
"git_branch": app.get("branch")
})

View file

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestInstalledApplications(unittest.TestCase):
pass

View file

@ -67,6 +67,9 @@ def migrate(verbose=True, rebuild_website=False, skip_failing=False):
# add static pages to global search
global_search.update_global_search_for_all_web_pages()
# updating installed applications data
frappe.get_single('Installed Applications').save()
#run after_migrate hooks
for app in frappe.get_installed_apps():
for fn in frappe.get_hooks('after_migrate', app_name=app):

View file

@ -19,4 +19,4 @@
"theme": "Standard",
"theme_scss": "$enable-shadows: false;\n$enable-gradients: false;\n$enable-rounded: true;\n\n@import \"frappe/public/scss/website\";\n\n",
"theme_url": "/assets/css/standard_style.css"
}
}