Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
i2dash
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loosolab
software
i2dash
Commits
097aaf8e
Commit
097aaf8e
authored
5 years ago
by
Ustjanzew
Browse files
Options
Downloads
Patches
Plain Diff
Interactive R session case catched.
parent
9cbf455f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/pages.R
+30
-23
30 additions, 23 deletions
R/pages.R
with
30 additions
and
23 deletions
R/pages.R
+
30
−
23
View file @
097aaf8e
...
...
@@ -28,34 +28,41 @@ setMethod("add_page", "i2dashboard", function(object, page, title, layout = "sto
dir.create
(
object
@
workdir
,
showWarnings
=
FALSE
)
dir.create
(
file.path
(
object
@
workdir
,
"envs"
),
recursive
=
T
,
showWarnings
=
FALSE
)
if
(
name
%in%
names
(
object
@
pages
)){
print
(
"A page with this 'page'-argument already exists."
)
answer1
<-
menu
(
c
(
"Yes"
,
"No"
),
title
=
"Do you want to overwrite this page? If 'No' you can input another 'page'-argument or cancel."
)
switch
(
answer1
,
"1"
=
{
print
(
"The page was overwritten."
)
object
@
pages
[[
name
]]
<-
list
(
title
=
title
,
layout
=
layout
,
menu
=
menu
,
components
=
list
())
},
"2"
=
{
answer2
<-
menu
(
c
(
"Yes"
,
"Cancel"
),
title
=
"Do you want to provide another 'page'-argument?"
)
switch
(
answer2
,
"1"
=
{
new_name
<-
readline
(
"Please input a new 'page'-argument: "
)
if
(
is.character
(
new_name
)){
new_name
<-
.create_page_name
(
new_name
)
print
(
"Page with new 'page'-argument created."
)
object
@
pages
[[
new_name
]]
<-
list
(
title
=
title
,
layout
=
layout
,
menu
=
menu
,
components
=
list
())
}
},
"2"
=
{
print
(
"Function 'add_page' canceled"
)
}
if
(
base
::
interactive
()){
if
(
name
%in%
names
(
object
@
pages
)){
print
(
"A page with this 'page'-argument already exists."
)
answer1
<-
menu
(
c
(
"Yes"
,
"No"
),
title
=
"Do you want to overwrite this page? If 'No' you can input another 'page'-argument or cancel."
)
switch
(
answer1
,
"1"
=
{
print
(
"The page was overwritten."
)
object
@
pages
[[
name
]]
<-
list
(
title
=
title
,
layout
=
layout
,
menu
=
menu
,
components
=
list
())
},
"2"
=
{
answer2
<-
menu
(
c
(
"Yes"
,
"Cancel"
),
title
=
"Do you want to provide another 'page'-argument?"
)
switch
(
answer2
,
"1"
=
{
new_name
<-
readline
(
"Please input a new 'page'-argument: "
)
if
(
is.character
(
new_name
)){
new_name
<-
.create_page_name
(
new_name
)
print
(
"Page with new 'page'-argument created."
)
object
@
pages
[[
new_name
]]
<-
list
(
title
=
title
,
layout
=
layout
,
menu
=
menu
,
components
=
list
())
}
},
"2"
=
{
print
(
"Function 'add_page' canceled"
)
}
)
}
)
}
else
{
object
@
pages
[[
name
]]
<-
list
(
title
=
title
,
layout
=
layout
,
menu
=
menu
,
components
=
list
())
}
)
}
else
{
warning
(
"A page with this 'page'-argument already exists. The existing page will be overwritten."
)
object
@
pages
[[
name
]]
<-
list
(
title
=
title
,
layout
=
layout
,
menu
=
menu
,
components
=
list
())
}
return
(
object
)
})
...
...
This diff is collapsed.
Click to expand it.
jens.preussner
@jens.preussner
mentioned in issue
#1 (closed)
·
5 years ago
mentioned in issue
#1 (closed)
mentioned in issue #1
Toggle commit list
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