Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
olapy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
olapy
Commits
b2622e4a
Commit
b2622e4a
authored
May 16, 2017
by
mouadh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config file dash
parent
5d7e68cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
14 deletions
+53
-14
olapy/core/mdx/tools/config_file_parser.py
olapy/core/mdx/tools/config_file_parser.py
+36
-14
olapy/core/mdx/tools/models.py
olapy/core/mdx/tools/models.py
+17
-0
No files found.
olapy/core/mdx/tools/config_file_parser.py
View file @
b2622e4a
...
@@ -4,7 +4,7 @@ import os
...
@@ -4,7 +4,7 @@ import os
from
lxml
import
etree
from
lxml
import
etree
from
.models
import
Cube
,
Dimension
,
Facts
,
Table
from
.models
import
Cube
,
Dimension
,
Facts
,
Table
,
Dashboard
class
ConfigParser
:
class
ConfigParser
:
...
@@ -294,6 +294,24 @@ class ConfigParser:
...
@@ -294,6 +294,24 @@ class ConfigParser:
except
:
except
:
raise
(
'Bad configuration in the configuration file'
)
raise
(
'Bad configuration in the configuration file'
)
def
construct_cubes
(
self
,
client_type
=
'excel'
):
"""
Construct cube (with it dimensions) and facts from the config file.
:param client_type: excel | web
:return: list of Cubes instance
"""
if
self
.
config_file_exist
(
client_type
):
if
client_type
==
'excel'
:
return
self
.
_construct_cubes_excel
()
elif
client_type
==
'web'
:
return
self
.
_construct_cubes_web
()
else
:
raise
(
"Config file don't exist"
)
def
_construct_cubes_web
(
self
):
def
_construct_cubes_web
(
self
):
# try:
# try:
...
@@ -338,18 +356,22 @@ class ConfigParser:
...
@@ -338,18 +356,22 @@ class ConfigParser:
# except:
# except:
# raise ('Bad configuration in the configuration file')
# raise ('Bad configuration in the configuration file')
def
construct_cubes
(
self
,
client_type
=
'excel'
):
def
construct_web_dashboard
(
self
):
"""
Construct cube (with it dimensions) and facts from the config file.
:param client_type: excel | web
:return: list of Cubes instance
"""
if
self
.
config_file_exist
(
client_type
):
# try:
if
client_type
==
'excel'
:
with
open
(
os
.
path
.
join
(
self
.
cube_path
,
return
self
.
_construct_cubes_excel
()
self
.
web_config_file_name
))
as
config_file
:
elif
client_type
==
'web'
:
return
self
.
_construct_cubes_web
()
else
:
parser
=
etree
.
XMLParser
()
raise
(
"Config file don't exist"
)
tree
=
etree
.
parse
(
config_file
,
parser
)
return
[
Dashboard
(
pie_charts
=
dashboard
.
find
(
'PieCharts'
).
text
.
split
(
','
),
bar_chats
=
dashboard
.
find
(
'BarCharts'
).
text
.
split
(
','
)
)
for
dashboard
in
tree
.
xpath
(
'/cubes/cube/Dashboards/Dashboard'
)
]
# except:
# raise ('Bad configuration in the configuration file')
olapy/core/mdx/tools/models.py
View file @
b2622e4a
...
@@ -69,3 +69,20 @@ class Table:
...
@@ -69,3 +69,20 @@ class Table:
def
__str__
(
self
):
def
__str__
(
self
):
return
str
(
self
.
__dict__
)
return
str
(
self
.
__dict__
)
class
Dashboard
:
"""Column class used to encapsulate config file attributes for web client."""
def
__init__
(
self
,
**
kwargs
):
"""
:param kwargs: {
table_name : 'something',
old_column_name : 'something',
new_column_name : 'something'
}
"""
self
.
__dict__
.
update
(
kwargs
)
def
__str__
(
self
):
return
str
(
self
.
__dict__
)
\ No newline at end of file
Write
Preview
Markdown
is supported
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