Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DashboardLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ProjectLeaf
DashboardLeaf
Commits
36dadabf
Commit
36dadabf
authored
Jul 5, 2020
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
added Page and PageManager
parent
f3d88b64
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
src/ProjectLeaf.py
+8
-3
8 additions, 3 deletions
src/ProjectLeaf.py
src/logic/Constants.py
+1
-1
1 addition, 1 deletion
src/logic/Constants.py
src/logic/Page.py
+41
-0
41 additions, 0 deletions
src/logic/Page.py
with
51 additions
and
4 deletions
.gitignore
+
1
−
0
View file @
36dadabf
/Pipfile.lock
/settings.json
/pageSettings.json
This diff is collapsed.
Click to expand it.
src/ProjectLeaf.py
+
8
−
3
View file @
36dadabf
...
...
@@ -5,15 +5,20 @@ from TheCodeLabs_FlaskUtils.FlaskBaseApp import FlaskBaseApp
from
blueprints
import
Routes
from
logic
import
Constants
from
logic.Page
import
PageManager
from
logic.services.JenkinsSingleJobService
import
JenkinsSingleJobService
LOGGER
=
DefaultLogger
().
create_logger_if_not_exists
(
Constants
.
APP_NAME
)
class
CarrotCastleWebsite
(
FlaskBaseApp
):
SUPPORTED_LANGUAGES
=
[
'
en
'
,
'
de
'
]
class
ProjectLeaf
(
FlaskBaseApp
):
SERVICES
=
{
'
JenkinsSingleJob
'
:
JenkinsSingleJobService
}
def
__init__
(
self
,
appName
:
str
):
super
().
__init__
(
appName
,
os
.
path
.
dirname
(
__file__
),
LOGGER
,
serveRobotsTxt
=
True
)
self
.
_pageManager
=
PageManager
(
Constants
.
ROOT_DIR
)
def
_register_blueprints
(
self
,
app
):
app
.
register_blueprint
(
Routes
.
construct_blueprint
(
self
.
_settings
))
...
...
@@ -21,5 +26,5 @@ class CarrotCastleWebsite(FlaskBaseApp):
if
__name__
==
'
__main__
'
:
website
=
CarrotCastleWebsite
(
Constants
.
APP_NAME
)
website
=
ProjectLeaf
(
Constants
.
APP_NAME
)
website
.
start_server
()
This diff is collapsed.
Click to expand it.
src/logic/Constants.py
+
1
−
1
View file @
36dadabf
This diff is collapsed.
Click to expand it.
src/logic/Page.py
0 → 100644
+
41
−
0
View file @
36dadabf
import
json
import
os
from
dataclasses
import
dataclass
from
typing
import
List
from
TheCodeLabs_BaseUtils
import
CachedService
@dataclass
class
VisualPage
:
code
:
str
@dataclass
class
Page
:
visualPage
:
VisualPage
services
:
List
[
CachedService
]
class
PageManager
:
def
__init__
(
self
,
saveFolder
:
str
):
self
.
_saveFolder
=
saveFolder
self
.
_pageSettingsPath
=
os
.
path
.
join
(
self
.
_saveFolder
,
'
pageSettings.json
'
)
self
.
_pages
=
self
.
__load
()
def
__load
(
self
)
->
List
[
Page
]:
if
not
os
.
path
.
exists
(
self
.
_pageSettingsPath
):
self
.
__save
()
with
open
(
self
.
_pageSettingsPath
,
encoding
=
'
UTF-8
'
)
as
f
:
return
json
.
load
(
f
)
def
__save
(
self
):
with
open
(
self
.
_pageSettingsPath
,
'
w
'
,
encoding
=
'
UTF-8
'
)
as
f
:
return
json
.
dump
([],
f
)
def
addPage
(
self
,
index
:
int
,
page
:
Page
):
self
.
_pages
.
insert
(
index
,
page
)
def
removePage
(
self
,
index
:
int
):
del
self
.
_pages
[
index
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment