fix: Dashboard Setting already exist error and linter fixes

This commit is contained in:
Shariq Ansari 2021-09-02 20:46:19 +05:30
parent a194a05c06
commit ab09ebf696
2 changed files with 40 additions and 38 deletions

View file

@ -155,7 +155,7 @@ frappe.views.Workspace = class Workspace {
});
// Scroll sidebar to selected page if it is not in viewport.
!frappe.dom.is_element_in_viewport(this.sidebar.find('.selected'))
!frappe.dom.is_element_in_viewport(this.sidebar.find('.selected'))
&& this.sidebar.find('.selected')[0].scrollIntoView();
}
@ -185,7 +185,7 @@ frappe.views.Workspace = class Workspace {
}
append_item(item, container) {
let is_current_page = frappe.router.slug(item.title) == frappe.router.slug(this.get_page_to_show().name)
let is_current_page = frappe.router.slug(item.title) == frappe.router.slug(this.get_page_to_show().name)
&& item.public == this.get_page_to_show().public;
if (is_current_page) {
item.selected = true;
@ -253,11 +253,13 @@ frappe.views.Workspace = class Workspace {
if (!this.page_data || Object.keys(this.page_data).length === 0) return;
return frappe.dashboard_utils.get_dashboard_settings().then(settings => {
let chart_config = settings.chart_config ? JSON.parse(settings.chart_config) : {};
if (this.page_data.charts && this.page_data.charts.items) {
this.page_data.charts.items.map(chart => {
chart.chart_settings = chart_config[chart.chart_name] || {};
});
if (settings) {
let chart_config = settings.chart_config ? JSON.parse(settings.chart_config) : {};
if (this.page_data.charts && this.page_data.charts.items) {
this.page_data.charts.items.map(chart => {
chart.chart_settings = chart_config[chart.chart_name] || {};
});
}
}
});
});
@ -560,7 +562,7 @@ frappe.views.Workspace = class Workspace {
fieldname: 'is_public',
depends_on: `eval:${this.has_access}`,
onchange: function() {
d.set_df_property('parent', 'options',
d.set_df_property('parent', 'options',
this.get_value() ? me.public_parent_pages : me.private_parent_pages);
}
},
@ -704,9 +706,9 @@ frappe.views.Workspace = class Workspace {
}
});
let blocks = outputData.blocks.filter(
item => item.type != 'card' ||
(item.data.card_name !== 'Custom Documents' &&
let blocks = outputData.blocks.filter(
item => item.type != 'card' ||
(item.data.card_name !== 'Custom Documents' &&
item.data.card_name !== 'Custom Reports')
);
@ -752,4 +754,4 @@ frappe.views.Workspace = class Workspace {
this.setup_pages();
this.undo.readOnly = true;
}
};
};

View file

@ -17,10 +17,10 @@ body {
}
.standard-sidebar-section {
margin-top: var(--margin-xl);
margin-bottom: var(--margin-xl);
&:first-of-type {
margin-top: var(--margin-sm);
&:last-of-type {
margin-bottom: var(--margin-sm);
}
}
}
@ -143,7 +143,7 @@ body {
font-weight: 500;
line-height: 1.3em;
color: var(--heading-color);
svg {
flex: none;
margin-right: 6px;
@ -863,7 +863,7 @@ body {
.drag-handle {
display: inline-block;
}
.delete-page {
display: inline-block;
margin-right: 8px;
@ -888,44 +888,44 @@ body {
.codex-editor {
min-height: 630px;
.codex-editor__redactor{
display: flex;
flex-wrap: wrap;
flex-direction: row;
margin: 0px -7px;
padding-bottom: 20px !important;
.ce-block{
width: 100%;
padding-left: 0;
padding-right: 0;
&.ce-block--selected {
.ce-block__content {
background-color: inherit;
}
}
.ce-block__content {
max-width: 100%;
height: 100%;
padding: 7px;
&> div {
height: 100%;
}
.tune-btn > * {
pointer-events: none;
}
.ce-header {
padding: 0 !important;
margin-bottom: 0 !important;
flex: 1;
}
.widget{
&.header {
display: flex;
@ -938,11 +938,11 @@ body {
background-color: var(--control-bg);
color: var(--text-muted);
}
&:focus {
outline: none;
}
&.new-widget {
align-items: inherit;
}
@ -959,7 +959,7 @@ body {
gap: 5px;
background-color: var(--card-bg);
padding-left: 5px;
.drag-handle {
cursor: all-scroll;
cursor: -webkit-grabbing;
@ -969,22 +969,22 @@ body {
}
}
}
svg {
fill: none;
}
.ce-toolbar {
svg {
fill: currentColor;
}
.icon {
stroke: none;
width: fit-content;
height: fit-content;
}
.ce-settings {
width: fit-content;
@ -1011,18 +1011,18 @@ body {
border-radius: 0 4px 4px 0;z-index: 0;
}
}
.ce-toolbar__settings-btn {
display: none;
}
}
.ce-inline-tool, .ce-inline-toolbar__dropdown {
.icon {
fill: currentColor;
}
}
@media (min-width: 1199px) {
.ce-toolbar__content {
max-width: 930px;
@ -1033,14 +1033,14 @@ body {
max-width: 760px;
}
}
@media (max-width: 1199px) {
.ce-block.col-4 {
flex: 0 0 50%;
max-width: 50%;
}
}
@media (max-width: 750px) {
.ce-block.col-4 {
flex: 0 0 100%;
@ -1053,6 +1053,6 @@ body {
max-width: 100%;
}
}
}
}