Merge branch 'develop' into google_drive_picker
This commit is contained in:
commit
8618e81e77
21 changed files with 127 additions and 76 deletions
|
|
@ -36,48 +36,10 @@ def get_modules_from_all_apps():
|
|||
return modules_list
|
||||
|
||||
def get_modules_from_app(app):
|
||||
try:
|
||||
modules = frappe.get_attr(app + '.config.desktop.get_data')() or {}
|
||||
except ImportError:
|
||||
return []
|
||||
|
||||
active_domains = frappe.get_active_domains()
|
||||
|
||||
if isinstance(modules, dict):
|
||||
active_modules_list = []
|
||||
for m, module in iteritems(modules):
|
||||
module['module_name'] = m
|
||||
module['app'] = app
|
||||
active_modules_list.append(module)
|
||||
else:
|
||||
for m in modules:
|
||||
if m.get("type") == "module" and "category" not in m:
|
||||
m["category"] = "Modules"
|
||||
|
||||
# Only newly formatted modules that have a category to be shown on desk
|
||||
modules = [m for m in modules if m.get("category")]
|
||||
active_modules_list = []
|
||||
|
||||
for m in modules:
|
||||
to_add = True
|
||||
module_name = m.get("module_name")
|
||||
|
||||
# Check Domain
|
||||
if is_domain(m) and module_name not in active_domains:
|
||||
to_add = False
|
||||
|
||||
# Check if config
|
||||
if is_module(m) and not config_exists(app, frappe.scrub(module_name)):
|
||||
to_add = False
|
||||
|
||||
if "condition" in m and not m["condition"]:
|
||||
to_add = False
|
||||
|
||||
if to_add:
|
||||
m["app"] = app
|
||||
active_modules_list.append(m)
|
||||
|
||||
return active_modules_list
|
||||
return frappe.get_all('Module Def',
|
||||
filters={'app_name': app},
|
||||
fields=['module_name', 'app_name as app']
|
||||
)
|
||||
|
||||
def get_all_empty_tables_by_module():
|
||||
empty_tables = set(r[0] for r in frappe.db.multisql({
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ def make_notification_logs(doc, users):
|
|||
from frappe.social.doctype.energy_point_settings.energy_point_settings import is_energy_point_enabled
|
||||
|
||||
for user in users:
|
||||
if frappe.db.exists('User', {"name": user, "enabled": 1}):
|
||||
if frappe.db.exists('User', {"email": user, "enabled": 1}):
|
||||
if is_notifications_enabled(user):
|
||||
if doc.type == 'Energy Point' and not is_energy_point_enabled():
|
||||
return
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ def get_docinfo(doc=None, doctype=None, name=None):
|
|||
"assignment_logs": get_comments(doc.doctype, doc.name, 'assignment'),
|
||||
"permissions": get_doc_permissions(doc),
|
||||
"shared": frappe.share.get_users(doc.doctype, doc.name),
|
||||
"info_logs": get_comments(doc.doctype, doc.name, 'Info'),
|
||||
"share_logs": get_comments(doc.doctype, doc.name, 'share'),
|
||||
"like_logs": get_comments(doc.doctype, doc.name, 'Like'),
|
||||
"views": get_view_logs(doc.doctype, doc.name),
|
||||
|
|
|
|||
|
|
@ -693,4 +693,10 @@
|
|||
<symbol viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon-star">
|
||||
<path d="M11.5516 2.90849C11.735 2.53687 12.265 2.53687 12.4484 2.90849L14.8226 7.71919C14.8954 7.86677 15.0362 7.96905 15.1991 7.99271L20.508 8.76415C20.9181 8.82374 21.0818 9.32772 20.7851 9.61699L16.9435 13.3616C16.8257 13.4765 16.7719 13.642 16.7997 13.8042L17.7066 19.0916C17.7766 19.5001 17.3479 19.8116 16.9811 19.6187L12.2327 17.1223C12.087 17.0457 11.913 17.0457 11.7673 17.1223L7.01888 19.6187C6.65207 19.8116 6.22335 19.5001 6.29341 19.0916L7.20028 13.8042C7.2281 13.642 7.17433 13.4765 7.05648 13.3616L3.21491 9.61699C2.91815 9.32772 3.08191 8.82374 3.49202 8.76415L8.80094 7.99271C8.9638 7.96905 9.10458 7.86677 9.17741 7.71919L11.5516 2.90849Z" fill="var(--star-fill)" stroke="var(--star-fill)"/>
|
||||
</symbol>
|
||||
<symbol fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="icon-map">
|
||||
<g stroke="#111" stroke-miterlimit="10">
|
||||
<path d="M11.467 3.458c1.958 1.957 1.958 5.088.027 7.02L7.97 14l-3.523-3.523a4.945 4.945 0 010-6.993l.026-.026a4.922 4.922 0 016.993 0zm0 0c-.026-.026-.026-.026 0 0z"></path>
|
||||
<path d="M7.971 8.259a1.305 1.305 0 100-2.61 1.305 1.305 0 000 2.61z"></path>
|
||||
</g>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
|
|
@ -76,7 +76,7 @@ frappe.ui.form.ControlColor = frappe.ui.form.ControlData.extend({
|
|||
refresh() {
|
||||
this._super();
|
||||
let color = this.get_color();
|
||||
if (this.picker.color !== color) {
|
||||
if (this.picker && this.picker.color !== color) {
|
||||
this.picker.color = color;
|
||||
this.picker.refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ class FormTimeline extends BaseTimeline {
|
|||
this.timeline_items.push(...this.get_custom_timeline_contents());
|
||||
this.timeline_items.push(...this.get_assignment_timeline_contents());
|
||||
this.timeline_items.push(...this.get_attachment_timeline_contents());
|
||||
this.timeline_items.push(...this.get_info_timeline_contents());
|
||||
this.timeline_items.push(...this.get_milestone_timeline_contents());
|
||||
}
|
||||
}
|
||||
|
|
@ -269,6 +270,17 @@ class FormTimeline extends BaseTimeline {
|
|||
return assignment_timeline_contents;
|
||||
}
|
||||
|
||||
get_info_timeline_contents() {
|
||||
let info_timeline_contents = [];
|
||||
(this.doc_info.info_logs || []).forEach(info_log => {
|
||||
info_timeline_contents.push({
|
||||
creation: info_log.creation,
|
||||
content: `${this.get_user_link(info_log.comment_email)} ${info_log.content}`,
|
||||
});
|
||||
});
|
||||
return info_timeline_contents;
|
||||
}
|
||||
|
||||
get_attachment_timeline_contents() {
|
||||
let attachment_timeline_contents = [];
|
||||
(this.doc_info.attachment_logs || []).forEach(attachment_log => {
|
||||
|
|
|
|||
|
|
@ -144,6 +144,27 @@ function get_version_timeline_content(version_doc, frm) {
|
|||
|
||||
|
||||
function get_version_comment(version_doc, text) {
|
||||
// TODO: Replace with a better solution
|
||||
if (text.includes("<a")) {
|
||||
// if text already has linked content in it
|
||||
// then just add a version link to unlinked content
|
||||
let version_comment = "";
|
||||
let unlinked_content = "";
|
||||
|
||||
Array.from($(text)).forEach(element => {
|
||||
if ($(element).is('a')) {
|
||||
version_comment += unlinked_content ? frappe.utils.get_form_link('Version', version_doc.name, true, unlinked_content) : "";
|
||||
unlinked_content = "";
|
||||
version_comment += element.outerHTML;
|
||||
} else {
|
||||
unlinked_content += element.outerHTML || element.textContent;
|
||||
}
|
||||
});
|
||||
if (unlinked_content) {
|
||||
version_comment += frappe.utils.get_form_link('Version', version_doc.name, true, unlinked_content);
|
||||
}
|
||||
return version_comment;
|
||||
}
|
||||
return frappe.utils.get_form_link('Version', version_doc.name, true, text);
|
||||
}
|
||||
|
||||
|
|
@ -164,4 +185,5 @@ function get_user_link(doc) {
|
|||
return frappe.utils.get_form_link('User', user, true, user_display_text);
|
||||
}
|
||||
|
||||
export { get_version_timeline_content };
|
||||
export { get_version_timeline_content };
|
||||
|
||||
|
|
|
|||
|
|
@ -293,6 +293,12 @@ frappe.form.formatters = {
|
|||
return frappe.format(value, link_field, options, row);
|
||||
});
|
||||
return formatted_values.join(', ');
|
||||
},
|
||||
Color: (value) => {
|
||||
return `<div>
|
||||
<div class="selected-color" style="background-color: ${value}"></div>
|
||||
<span class="color-value">${value}</span>
|
||||
</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ frappe.views.BaseList = class BaseList {
|
|||
'Calendar': 'calendar',
|
||||
'Gantt': 'gantt',
|
||||
'Kanban': 'kanban',
|
||||
'Dashboard': 'dashboard'
|
||||
'Dashboard': 'dashboard',
|
||||
'Map': 'map',
|
||||
};
|
||||
|
||||
if (frappe.boot.desk_settings.view_switcher) {
|
||||
|
|
@ -285,6 +286,7 @@ frappe.views.BaseList = class BaseList {
|
|||
}
|
||||
|
||||
setup_filter_area() {
|
||||
if (this.hide_filters) return;
|
||||
this.filter_area = new FilterArea(this);
|
||||
|
||||
if (this.filters && this.filters.length > 0) {
|
||||
|
|
@ -293,6 +295,7 @@ frappe.views.BaseList = class BaseList {
|
|||
}
|
||||
|
||||
setup_sort_selector() {
|
||||
if (this.hide_sort_selector) return;
|
||||
this.sort_selector = new frappe.ui.SortSelector({
|
||||
parent: this.$filter_section,
|
||||
doctype: this.doctype,
|
||||
|
|
@ -410,7 +413,7 @@ frappe.views.BaseList = class BaseList {
|
|||
doctype: this.doctype,
|
||||
fields: this.get_fields(),
|
||||
filters: this.get_filters_for_args(),
|
||||
order_by: this.sort_selector.get_sql_string(),
|
||||
order_by: this.sort_selector && this.sort_selector.get_sql_string(),
|
||||
start: this.start,
|
||||
page_length: this.page_length,
|
||||
view: this.view,
|
||||
|
|
@ -821,6 +824,7 @@ frappe.views.view_modes = [
|
|||
"Image",
|
||||
"Inbox",
|
||||
"Tree",
|
||||
"Map",
|
||||
];
|
||||
frappe.views.is_valid = (view_mode) =>
|
||||
frappe.views.view_modes.includes(view_mode);
|
||||
|
|
|
|||
|
|
@ -417,11 +417,11 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
|
||||
get_no_result_message() {
|
||||
let help_link = this.get_documentation_link();
|
||||
let filters = this.filter_area.get();
|
||||
let no_result_message = filters.length
|
||||
let filters = this.filter_area && this.filter_area.get();
|
||||
let no_result_message = filters && filters.length
|
||||
? __("No {0} found", [__(this.doctype)])
|
||||
: __("You haven't created a {0} yet", [__(this.doctype)]);
|
||||
let new_button_label = filters.length
|
||||
let new_button_label = filters && filters.length
|
||||
? __("Create a new {0}", [__(this.doctype)])
|
||||
: __("Create your first {0}", [__(this.doctype)]);
|
||||
let empty_state_image =
|
||||
|
|
@ -461,7 +461,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
}
|
||||
|
||||
before_refresh() {
|
||||
if (frappe.route_options) {
|
||||
if (frappe.route_options && this.filter_area) {
|
||||
this.filters = this.parse_filters_from_route_options();
|
||||
frappe.route_options = null;
|
||||
|
||||
|
|
@ -527,9 +527,9 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
this.view_name
|
||||
);
|
||||
this.save_view_user_settings({
|
||||
filters: this.filter_area.get(),
|
||||
sort_by: this.sort_selector.sort_by,
|
||||
sort_order: this.sort_selector.sort_order,
|
||||
filters: this.filter_area && this.filter_area.get(),
|
||||
sort_by: this.sort_selector && this.sort_selector.sort_by,
|
||||
sort_order: this.sort_selector && this.sort_selector.sort_order,
|
||||
});
|
||||
this.toggle_paging && this.$paging_area.toggle(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,14 @@ frappe.views.ListViewSelect = class ListViewSelect {
|
|||
kanbans => this.setup_kanban_switcher(kanbans)
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
Map: {
|
||||
condition: this.list_view.settings.get_coords_method ||
|
||||
(this.list_view.meta.fields.find(i => i.fieldname === "latitude") &&
|
||||
this.list_view.meta.fields.find(i => i.fieldname === "longitude")) ||
|
||||
(this.list_view.meta.fields.find(i => i.fieldname === 'location' && i.fieldtype == 'Geolocation')),
|
||||
action: () => this.set_route("map")
|
||||
},
|
||||
};
|
||||
|
||||
frappe.views.view_modes.forEach(view => {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,18 @@ frappe.ui.FieldSelect = Class.extend({
|
|||
var item = me.awesomplete.get_item(value);
|
||||
me.$input.val(item.label);
|
||||
});
|
||||
this.$input.on("awesomplete-open", () => {
|
||||
let modal = this.$input.parents('.modal-dialog')[0];
|
||||
if (modal) {
|
||||
$(modal).removeClass("modal-dialog-scrollable");
|
||||
}
|
||||
});
|
||||
this.$input.on("awesomplete-close", () => {
|
||||
let modal = this.$input.parents('.modal-dialog')[0];
|
||||
if (modal) {
|
||||
$(modal).addClass("modal-dialog-scrollable");
|
||||
}
|
||||
});
|
||||
|
||||
if(this.filter_fields) {
|
||||
for(var i in this.filter_fields)
|
||||
|
|
|
|||
|
|
@ -495,6 +495,7 @@ frappe.ui.filter_utils = {
|
|||
'Dynamic Link',
|
||||
'Read Only',
|
||||
'Assign',
|
||||
'Color',
|
||||
].indexOf(df.fieldtype) != -1
|
||||
) {
|
||||
df.fieldtype = 'Data';
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ frappe.ui.FilterGroup = class {
|
|||
}
|
||||
|
||||
get_filter_area_template() {
|
||||
/* eslint-disable indent */
|
||||
return $(`
|
||||
<div class="filter-area">
|
||||
<div class="filter-edit-area">
|
||||
|
|
@ -293,19 +294,23 @@ frappe.ui.FilterGroup = class {
|
|||
<hr class="divider"></hr>
|
||||
<div class="filter-action-buttons">
|
||||
<button class="text-muted add-filter btn btn-xs">
|
||||
${__('+ Add a Filter')}
|
||||
+ ${__('Add a Filter')}
|
||||
</button>
|
||||
<div>
|
||||
<button class="btn btn-secondary btn-xs clear-filters">
|
||||
${__('Clear Filters')}
|
||||
</button>
|
||||
<button class="btn btn-primary btn-xs apply-filters">
|
||||
${__('Apply Filters')}
|
||||
</button>
|
||||
${this.filter_button ?
|
||||
`<button class="btn btn-primary btn-xs apply-filters">
|
||||
${__('Apply Filters')}
|
||||
</button>`
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
/* eslint-disable indent */
|
||||
}
|
||||
|
||||
get_filters_as_object() {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ frappe.views.DashboardView = class DashboardView extends frappe.views.ListView {
|
|||
setup_page() {
|
||||
this.hide_sidebar = true;
|
||||
this.hide_page_form = true;
|
||||
this.hide_filters = true;
|
||||
this.hide_sort_selector = true;
|
||||
super.setup_page();
|
||||
}
|
||||
|
||||
|
|
@ -74,6 +76,10 @@ frappe.views.DashboardView = class DashboardView extends frappe.views.ListView {
|
|||
this.toggle_customization_buttons(false);
|
||||
}
|
||||
|
||||
set_primary_action() {
|
||||
// Don't render Add doc button for dashboard view
|
||||
}
|
||||
|
||||
toggle_customization_buttons(show) {
|
||||
this.save_customizations_button.toggle(show);
|
||||
this.discard_customizations_button.toggle(show);
|
||||
|
|
|
|||
|
|
@ -573,14 +573,17 @@ export default class ChartWidget extends Widget {
|
|||
xIsSeries: this.chart_doc.timeseries,
|
||||
shortenYAxisNumbers: 1
|
||||
},
|
||||
tooltipOptions: {
|
||||
};
|
||||
|
||||
if (this.report_result && this.report_result.chart) {
|
||||
chart_args.tooltipOptions = {
|
||||
formatTooltipY: value =>
|
||||
frappe.format(value, {
|
||||
fieldtype: this.report_result.chart.fieldtype,
|
||||
options: this.report_result.chart.options
|
||||
}, { always_show_decimals: true, inline: true })
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
if (this.chart_doc.type == "Heatmap") {
|
||||
const heatmap_year = parseInt(this.selected_heatmap_year || this.chart_settings.heatmap_year || this.chart_doc.heatmap_year);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.frappe-control[data-fieldtype='Color'] {
|
||||
.frappe-control[data-fieldtype='Color'] {
|
||||
input {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
|
@ -104,11 +104,20 @@
|
|||
background-color: red;
|
||||
position: absolute;
|
||||
top: calc(50% + 1px);
|
||||
left: 5px;
|
||||
left: 8px;
|
||||
content: ' ';
|
||||
&.no-value {
|
||||
background: url('/assets/frappe/images/color-circle.png');
|
||||
background-size: contain;
|
||||
}
|
||||
}
|
||||
}
|
||||
.like-disabled-input {
|
||||
.color-value {
|
||||
padding-left: 25px;
|
||||
}
|
||||
.selected-color {
|
||||
top: 20%;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,10 +332,6 @@ input.list-check-all, input.list-row-checkbox {
|
|||
}
|
||||
|
||||
.page-form {
|
||||
// .awesomplete > ul {
|
||||
// min-width: 300px;
|
||||
// }
|
||||
|
||||
.standard-filter-section {
|
||||
flex-wrap: wrap;
|
||||
// width: 65%;
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.awesomplete > ul {
|
||||
min-width: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
.form-inner-toolbar {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ def is_open(ip, port, timeout=10):
|
|||
def check_database():
|
||||
db_type = config.get("db_type", "mariadb")
|
||||
db_host = config.get("db_host", "localhost")
|
||||
db_port = config.get("db_port", 3306 if db_type == "mariadb" else 5342)
|
||||
db_port = config.get("db_port", 3306 if db_type == "mariadb" else 5432)
|
||||
return {db_type: is_open(db_host, db_port)}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8525,16 +8525,11 @@ xtend@~4.0.1:
|
|||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
||||
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
|
||||
|
||||
"y18n@^3.2.1 || ^4.0.0":
|
||||
"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
|
||||
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
|
||||
|
||||
y18n@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
|
||||
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
|
||||
|
||||
yallist@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue