Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KnowageLabs
Knowage-Server
Commits
7f703fcb
Commit
7f703fcb
authored
May 27, 2022
by
Marco Balestri
Browse files
[Ticket#2022052687000024] Table widget PDF export is now optional
parent
47cb4535
Changes
4
Hide whitespace changes
Inline
Side-by-side
knowagecockpitengine/src/main/webapp/js/src/angular_1.4/cockpit/directives/cockpit-widget/cockpitWidget.js
View file @
7f703fcb
...
...
@@ -291,6 +291,13 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
return
availableTypes
.
indexOf
(
type
)
!=
-
1
;
}
$scope
.
isExportPdfEnabled
=
function
(){
toReturn
=
true
;
if
(
$scope
.
ngModel
.
settings
&&
$scope
.
ngModel
.
settings
.
exportpdf
)
toReturn
=
$scope
.
ngModel
.
settings
.
exportpdf
.
enabled
;
toReturn
=
typeof
(
toReturn
)
!=
'
undefined
'
?
toReturn
:
true
;
return
toReturn
;
}
$scope
.
checkChartType
=
function
(
model
,
notAvailableCharts
){
return
!
(
notAvailableCharts
.
indexOf
(
model
.
content
.
chartTemplate
.
CHART
.
type
.
toLowerCase
())
!=
-
1
);
}
...
...
@@ -1081,7 +1088,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
}
}
// temporary section needed as a workaround to get vue instance
var
hasVueParent
=
false
if
(
window
.
parent
.
document
.
getElementById
(
'
_KNOWAGE_VUE
'
)){
...
...
@@ -1089,7 +1096,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
}
else
if
(
window
.
parent
.
parent
.
document
.
getElementById
(
'
_KNOWAGE_VUE
'
)){
hasVueParent
=
window
.
parent
.
parent
}
if
(
hasVueParent
){
hasVueParent
.
postMessage
({
"
type
"
:
"
crossNavigation
"
,
"
outputParameters
"
:
outputParameter
,
"
inputParameters
"
:{},
"
targetCrossNavigation
"
:
crossSettings
,
"
docLabel
"
:
null
,
"
otherOutputParameters
"
:
otherOutputParameters
},
'
*
'
)
}
else
{
...
...
@@ -1129,7 +1136,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
}
else
if
(
parameter
.
column
==
columnName
){
paramValue
=
columnValue
;
}
}
else
{
for
(
var
c
in
$scope
.
ngModel
.
content
.
columnSelectedOfDataset
){
...
...
@@ -1698,7 +1705,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
var
matchedProperties
=
lintConfig
.
match
(
/categoriesCardinality:
(?<
categoriesCardinality>
\[
.*
?\]){1}
,range:
(?<
range>
\[
.*
?\]){1}
/
);
var
range
=
JSON
.
parse
(
matchedProperties
.
groups
.
range
);
var
categoriesCardinality
=
JSON
.
parse
(
matchedProperties
.
groups
.
categoriesCardinality
);
var
tempObject
=
{
type
:
$scope
.
ngModel
.
content
.
chartTemplate
.
CHART
.
type
.
toLowerCase
(),
categoriesNumber
:
cockpitModule_widgetServices
.
checkNumOfCategory
(
$scope
.
ngModel
.
content
.
chartTemplate
.
CHART
.
VALUES
.
CATEGORY
),
...
...
@@ -1709,7 +1716,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
range
:
range
,
categoriesCardinality
:
categoriesCardinality
};
if
(
cockpitModule_widgetServices
.
checkNumOfCategory
(
$scope
.
ngModel
.
content
.
chartTemplate
.
CHART
.
VALUES
.
CATEGORY
)
===
1
){
if
(
Array
.
isArray
(
$scope
.
ngModel
.
content
.
chartTemplate
.
CHART
.
VALUES
.
CATEGORY
)){
var
javaType
=
$scope
.
ngModel
.
content
.
columnSelectedOfDatasetAggregations
.
filter
(
x
=>
x
.
name
===
$scope
.
ngModel
.
content
.
chartTemplate
.
CHART
.
VALUES
.
CATEGORY
[
0
].
column
)[
0
].
type
;
...
...
@@ -1718,10 +1725,10 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
}
tempObject
.
typeOfCategory
=
cockpitModule_generalOptions
.
fieldsTypes
.
filter
(
x
=>
x
.
value
===
javaType
)[
0
].
label
;
}
$scope
.
chartTypes
=
knModule_chartOptions
.
getAvailableCharts
(
tempObject
);
$scope
.
suggestedChartType
=
knModule_chartOptions
.
getSuggestedChart
(
tempObject
)
if
(
!
$scope
.
ngModel
.
content
.
chartTemplateOriginal
){
$scope
.
ngModel
.
content
.
chartTemplateOriginal
=
angular
.
copy
(
$scope
.
ngModel
.
content
.
chartTemplate
);
}
...
...
@@ -1738,7 +1745,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
scope
.
isOriginal
=
isOriginal
;
scope
.
ngModel
=
angular
.
copy
(
ngModel
);
scope
.
suggestedChartType
=
suggestedChartType
;
scope
.
changeChartType
=
function
(
type
,
isOriginal
){
...
...
@@ -1758,7 +1765,7 @@ cockpitModule_templateServices.getDatasetUsetByWidgetWithParams();
scope
.
ngModel
.
content
.
chartTemplate
.
CHART
.
type
=
type
.
toUpperCase
();
}
$mdDialog
.
hide
({
model
:
scope
.
ngModel
,
isOriginal
:
scope
.
isOriginal
,
type
:
type
});
}
...
...
knowagecockpitengine/src/main/webapp/js/src/angular_1.4/cockpit/directives/cockpit-widget/templates/cockpitWidget.html
View file @
7f703fcb
...
...
@@ -214,7 +214,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<md-tooltip
md-direction=
"bottom"
md-delay=
"1000"
>
{{::translate.load("sbi.cockpit.widgets.tooltip.export.excel")}}
</md-tooltip>
<md-icon
md-font-icon=
"fa fa-file-excel-o"
ng-if=
"!ngModel.loadingScreen"
></md-icon>
</md-button>
<md-button
class=
"md-fab md-raised md-mini"
ng-click=
"exportToPdf($event,ngModel,options)"
ng-disabled=
"ngModel.loadingScreen"
ng-if=
"checkType(ngModel.type, ['table'])"
>
<md-button
class=
"md-fab md-raised md-mini"
ng-click=
"exportToPdf($event,ngModel,options)"
ng-disabled=
"ngModel.loadingScreen"
ng-if=
"checkType(ngModel.type, ['table'])
&& isExportPdfEnabled()
"
>
<md-tooltip
md-direction=
"bottom"
md-delay=
"1000"
>
{{::translate.load("sbi.cockpit.widgets.tooltip.export.pdf")}}
</md-tooltip>
<md-icon
md-font-icon=
"fa fa-file-pdf"
ng-if=
"!ngModel.loadingScreen"
></md-icon>
</md-button>
...
...
knowagecockpitengine/src/main/webapp/js/src/angular_1.4/cockpit/directives/cockpit-widget/widget/advancedTableWidget/advancedTableWidgetEdit.js
View file @
7f703fcb
...
...
@@ -44,6 +44,9 @@ function advancedTableWidgetEditControllerFunction($scope,$compile,finishEdit,$q
break
;
}
}
if
(
!
$scope
.
newModel
.
settings
)
$scope
.
newModel
.
settings
=
{}
if
(
!
$scope
.
newModel
.
settings
.
exportpdf
)
$scope
.
newModel
.
settings
.
exportpdf
=
{}
$scope
.
newModel
.
settings
.
exportpdf
.
enabled
=
typeof
(
$scope
.
newModel
.
settings
.
exportpdf
.
enabled
)
!=
'
undefined
'
?
$scope
.
newModel
.
settings
.
exportpdf
.
enabled
:
true
;
$scope
.
isObject
=
function
(
item
){
return
typeof
item
==
'
object
'
;
...
...
@@ -299,6 +302,10 @@ function advancedTableWidgetEditControllerFunction($scope,$compile,finishEdit,$q
return
typeof
(
$scope
.
newModel
.
style
.
th
.
enabled
)
!=
'
undefined
'
?
$scope
.
newModel
.
style
.
th
.
enabled
:
true
;
}
$scope
.
toggleExportPDF
=
function
(){
$scope
.
newModel
.
settings
.
exportpdf
.
enabled
=
!
$scope
.
newModel
.
settings
.
exportpdf
.
enabled
;
}
$scope
.
toggleColumnVisibility
=
function
(
rowIndex
){
if
(
$scope
.
newModel
.
content
.
columnSelectedOfDataset
[
rowIndex
].
style
)
$scope
.
newModel
.
content
.
columnSelectedOfDataset
[
rowIndex
].
style
.
hiddenColumn
=
!
$scope
.
newModel
.
content
.
columnSelectedOfDataset
[
rowIndex
].
style
.
hiddenColumn
;
else
$scope
.
newModel
.
content
.
columnSelectedOfDataset
[
rowIndex
].
style
=
{
'
hiddenColumn
'
:
true
};
...
...
knowagecockpitengine/src/main/webapp/js/src/angular_1.4/cockpit/directives/cockpit-widget/widget/advancedTableWidget/templates/advancedTableWidgetEditPropertyTemplate.html
View file @
7f703fcb
...
...
@@ -403,11 +403,12 @@
<md-card>
<md-toolbar
class=
"ternaryToolbar"
>
<div
class=
"md-toolbar-tools"
layout=
"row"
>
Export PDF
<md-switch
ng-model=
"newModel.settings.exportpdf.enabled"
>
Export PDF
</md-switch>
<span
flex
></span>
</div>
</md-toolbar>
<md-card-content>
<div
flex
layout=
"row"
>
<div
flex
layout=
"row"
ng-show=
"newModel.settings.exportpdf.enabled"
>
<md-checkbox
flex
layout=
"row"
layout-align=
"start center"
ng-model=
"newModel.settings.exportpdf.a4portrait"
class=
"md-block"
ng-click=
"setPortrait()"
"
>
A4 Portrait
</md-checkbox>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment