Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
b400ad5e
Commit
b400ad5e
authored
Dec 19, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve tabbed menu to dynamically load tab
parent
f4e1f6cf
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
69 deletions
+85
-69
righthand-panel.js
src/app/panels/righthand-panel.js
+16
-44
analysis-tab.js
src/app/tabs/analysis-tab.js
+1
-0
compile-tab.js
src/app/tabs/compile-tab.js
+1
-0
debugger-tab.js
src/app/tabs/debugger-tab.js
+1
-0
run-tab.js
src/app/tabs/run-tab.js
+1
-0
settings-tab.js
src/app/tabs/settings-tab.js
+1
-0
support-tab.js
src/app/tabs/support-tab.js
+1
-0
tabbed-menu.js
src/app/tabs/tabbed-menu.js
+63
-25
No files found.
src/app/panels/righthand-panel.js
View file @
b400ad5e
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
var
t
abbedMenu
=
require
(
'../tabs/tabbed-menu'
)
var
T
abbedMenu
=
require
(
'../tabs/tabbed-menu'
)
var
compileTab
=
require
(
'../tabs/compile-tab'
)
var
compileTab
=
require
(
'../tabs/compile-tab'
)
var
runTab
=
require
(
'../tabs/run-tab'
)
var
runTab
=
require
(
'../tabs/run-tab'
)
var
settingsTab
=
require
(
'../tabs/settings-tab'
)
var
settingsTab
=
require
(
'../tabs/settings-tab'
)
...
@@ -121,15 +121,9 @@ function RighthandPanel (appAPI, events, opts) {
...
@@ -121,15 +121,9 @@ function RighthandPanel (appAPI, events, opts) {
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_view
=
{}
self
.
_view
=
{}
var
optionViews
=
yo
`<div id="optionViews"
class="settingsView">
${
cssTabs
}
</div>`
var
optionViews
=
yo
`<div id="optionViews"
>
</div>`
var
options
=
yo
`
var
options
=
yo
`
<ul class=
${
css
.
opts
}
>
<ul class=
${
css
.
opts
}
>
<li class="
${
css
.
opts_li
}
compileView" title="Compile">Compile</li>
<li class="
${
css
.
opts_li
}
runView" title="Run">Run</li>
<li class="
${
css
.
opts_li
}
settingsView" title="Settings">Settings</li>
<li class="
${
css
.
opts_li
}
debugView" title="Debugger">Debugger</li>
<li class="
${
css
.
opts_li
}
staticanalysisView" title="Static Analysis">Analysis</li>
<li class="
${
css
.
opts_li
}
supportView" title="Help and support">Support</li>
</ul>
</ul>
`
`
self
.
_view
.
dragbar
=
yo
`<div id="dragbar" class=
${
css
.
dragbar
}
></div>`
self
.
_view
.
dragbar
=
yo
`<div id="dragbar" class=
${
css
.
dragbar
}
></div>`
...
@@ -147,24 +141,26 @@ function RighthandPanel (appAPI, events, opts) {
...
@@ -147,24 +141,26 @@ function RighthandPanel (appAPI, events, opts) {
appAPI
.
switchTab
=
(
tabClass
)
=>
{
appAPI
.
switchTab
=
(
tabClass
)
=>
{
this
.
event
.
trigger
(
'switchTab'
,
[
tabClass
])
this
.
event
.
trigger
(
'switchTab'
,
[
tabClass
])
}
}
compileTab
(
optionViews
,
appAPI
,
events
,
opts
)
runTab
(
optionViews
,
appAPI
,
events
,
opts
)
// load tabbed menu component
settingsTab
(
optionViews
,
appAPI
,
events
,
opts
)
var
tabEvents
=
{
compiler
:
events
.
compiler
,
app
:
events
.
app
,
rhp
:
self
.
event
}
analysisTab
(
optionViews
,
appAPI
,
events
,
opts
)
self
.
_view
.
tabbedMenu
=
new
TabbedMenu
(
options
,
{},
tabEvents
,
{})
debuggerTab
(
optionViews
,
appAPI
,
events
,
opts
)
supportTab
(
optionViews
,
appAPI
,
events
,
opts
)
events
.
rhp
=
self
.
event
this
.
_view
.
tabbedMenu
.
addTab
(
'Compile'
,
'compileView'
,
compileTab
(
optionViews
,
appAPI
,
events
,
opts
))
this
.
_view
.
tabbedMenu
.
addTab
(
'Run'
,
'runView'
,
runTab
(
optionViews
,
appAPI
,
events
,
opts
))
this
.
_view
.
tabbedMenu
.
addTab
(
'Settings'
,
'settingsView'
,
settingsTab
(
optionViews
,
appAPI
,
events
,
opts
))
this
.
_view
.
tabbedMenu
.
addTab
(
'Analysis'
,
'staticanalysisView'
,
analysisTab
(
optionViews
,
appAPI
,
events
,
opts
))
this
.
_view
.
tabbedMenu
.
addTab
(
'Debugger'
,
'debugView'
,
debuggerTab
(
optionViews
,
appAPI
,
events
,
opts
))
this
.
_view
.
tabbedMenu
.
addTab
(
'Support'
,
'supportView'
,
supportTab
(
optionViews
,
appAPI
,
events
,
opts
))
this
.
_view
.
tabbedMenu
.
selectTabByTitle
(
'Compile'
)
self
.
render
=
function
()
{
return
self
.
_view
.
element
}
self
.
render
=
function
()
{
return
self
.
_view
.
element
}
self
.
init
=
function
()
{
self
.
init
=
function
()
{
;[...
options
.
children
].
forEach
((
el
)
=>
{
el
.
classList
.
add
(
css
.
options
)
})
;[...
options
.
children
].
forEach
((
el
)
=>
{
el
.
classList
.
add
(
css
.
options
)
})
// ----------------- tabbed menu -----------------
var
tabbedMenuAPI
=
{}
// load tabbed menu component
var
tabEvents
=
{
compiler
:
events
.
compiler
,
app
:
events
.
app
,
rhp
:
self
.
event
}
tabbedMenu
(
options
,
tabbedMenuAPI
,
tabEvents
,
{})
// ----------------- resizeable ui ---------------
// ----------------- resizeable ui ---------------
var
limit
=
60
var
limit
=
60
self
.
_view
.
dragbar
.
addEventListener
(
'mousedown'
,
mousedown
)
self
.
_view
.
dragbar
.
addEventListener
(
'mousedown'
,
mousedown
)
...
@@ -206,27 +202,3 @@ function RighthandPanel (appAPI, events, opts) {
...
@@ -206,27 +202,3 @@ function RighthandPanel (appAPI, events, opts) {
}
}
}
}
}
}
var
cssTabs
=
yo
`<style>#optionViews.settingsView #settingsView {
display: block;
}
#optionViews.compileView #compileTabView {
display: block;
}
#optionViews.runView #runTabView {
display: block;
}
#optionViews.debugView #debugView {
display: block;
}
#optionViews.staticanalysisView #staticanalysisView {
display: block;
}
#optionViews.supportView #supportView {
display: block;
}</style>`
src/app/tabs/analysis-tab.js
View file @
b400ad5e
...
@@ -34,4 +34,5 @@ function analysisTab (container, appAPI, events, opts) {
...
@@ -34,4 +34,5 @@ function analysisTab (container, appAPI, events, opts) {
</div>
</div>
`
`
container
.
appendChild
(
el
)
container
.
appendChild
(
el
)
return
el
}
}
src/app/tabs/compile-tab.js
View file @
b400ad5e
...
@@ -445,6 +445,7 @@ function compileTab (container, appAPI, appEvents, opts) {
...
@@ -445,6 +445,7 @@ function compileTab (container, appAPI, appEvents, opts) {
}
}
return
el
return
el
}
}
return
el
}
}
function
detailsHelpSection
()
{
function
detailsHelpSection
()
{
...
...
src/app/tabs/debugger-tab.js
View file @
b400ad5e
...
@@ -24,4 +24,5 @@ function debuggerTab (container, appAPI, events, opts) {
...
@@ -24,4 +24,5 @@ function debuggerTab (container, appAPI, events, opts) {
<div id="debugger" class="
${
css
.
debugger
}
"></div>
<div id="debugger" class="
${
css
.
debugger
}
"></div>
</div>`
</div>`
container
.
appendChild
(
el
)
container
.
appendChild
(
el
)
return
el
}
}
src/app/tabs/run-tab.js
View file @
b400ad5e
...
@@ -250,6 +250,7 @@ function runTab (container, appAPI, appEvents, opts) {
...
@@ -250,6 +250,7 @@ function runTab (container, appAPI, appEvents, opts) {
noInstancesText
.
style
.
display
=
'block'
noInstancesText
.
style
.
display
=
'block'
instanceContainer
.
appendChild
(
noInstancesText
)
instanceContainer
.
appendChild
(
noInstancesText
)
})
})
return
el
}
}
function
fillAccountsList
(
appAPI
,
container
)
{
function
fillAccountsList
(
appAPI
,
container
)
{
...
...
src/app/tabs/settings-tab.js
View file @
b400ad5e
...
@@ -137,6 +137,7 @@ function SettingsTab (container, appAPI, appEvents, opts) {
...
@@ -137,6 +137,7 @@ function SettingsTab (container, appAPI, appEvents, opts) {
})
})
container
.
appendChild
(
el
)
container
.
appendChild
(
el
)
return
el
}
}
function
setVersionText
(
text
,
el
)
{
function
setVersionText
(
text
,
el
)
{
...
...
src/app/tabs/support-tab.js
View file @
b400ad5e
...
@@ -86,6 +86,7 @@ function supportTab (container, appAPI, events, opts) {
...
@@ -86,6 +86,7 @@ function supportTab (container, appAPI, events, opts) {
</div>
</div>
`
`
container
.
appendChild
(
el
)
container
.
appendChild
(
el
)
return
el
}
}
function
openLink
()
{
function
openLink
()
{
...
...
src/app/tabs/tabbed-menu.js
View file @
b400ad5e
var
$
=
require
(
'jquery
'
)
var
yo
=
require
(
'yo-yo
'
)
// -------------- styling ----------------------
// -------------- styling ----------------------
var
csjs
=
require
(
'csjs-inject'
)
var
csjs
=
require
(
'csjs-inject'
)
...
@@ -6,46 +6,84 @@ var remixLib = require('remix-lib')
...
@@ -6,46 +6,84 @@ var remixLib = require('remix-lib')
var
styleGuide
=
remixLib
.
ui
.
styleGuide
var
styleGuide
=
remixLib
.
ui
.
styleGuide
var
styles
=
styleGuide
()
var
styles
=
styleGuide
()
module
.
exports
=
tabbedMenu
var
helper
=
require
(
'../../lib/helper'
)
var
css
=
csjs
`
var
css
=
csjs
`
li.active {
li.active {
background-color:
${
styles
.
rightPanel
.
backgroundColor_Tab
}
;
background-color:
${
styles
.
rightPanel
.
backgroundColor_Tab
}
;
color:
${
styles
.
appProperties
.
mainText_Color
}
;
color:
${
styles
.
appProperties
.
mainText_Color
}
}
}
`
.options {
float: left;
function
tabbedMenu
(
container
,
appAPI
,
events
,
opts
)
{
padding-top: 0.7em;
var
lis
=
container
.
querySelectorAll
(
'li'
)
min-width: 60px;
for
(
var
li
=
0
;
li
<
lis
.
length
;
++
li
)
{
font-size: 0.9em;
lis
[
li
].
onclick
=
function
(
ev
)
{
selectTab
(
this
)
}
cursor: pointer;
font-size: 1em;
text-align: center;
}
.opts {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
.opts_li {
display: block;
font-weight: bold;
color:
${
styles
.
rightPanel
.
text_Teriary
}
}
}
.opts_li.active {
color:
${
styles
.
rightPanel
.
text_Primary
}
}
.opts_li:hover {
color:
${
styles
.
rightPanel
.
icon_HoverColor_TogglePanel
}
}
`
events
.
app
.
register
(
'debuggingRequested'
,
()
=>
{
class
TabbedMenu
{
selectTab
(
container
.
querySelector
(
'li.debugView'
))
constructor
(
tabView
,
api
,
events
,
opts
)
{
})
var
self
=
this
this
.
tabView
=
tabView
this
.
events
=
events
this
.
tabs
=
{}
this
.
contents
=
{}
events
.
rhp
.
register
(
'switchTab'
,
tabName
=>
{
events
.
app
.
register
(
'debuggingRequested'
,
()
=>
{
selectTab
(
container
.
querySelector
(
`li.
${
tabName
}
`
))
self
.
selectTab
(
tabView
.
querySelector
(
'li.debugView'
))
})
})
// initialize tabbed menu
events
.
rhp
.
register
(
'switchTab'
,
tabName
=>
{
selectTab
(
container
.
querySelector
(
'.compileView'
))
self
.
selectTab
(
tabView
.
querySelector
(
`li.
${
tabName
}
`
))
})
}
// select tab
selectTabByTitle
(
title
)
{
this
.
selectTab
(
this
.
tabs
[
title
])
}
function
selectTab
(
el
)
{
selectTab
(
el
)
{
var
match
=
/
[
a-z
]
+View/
.
exec
(
el
.
className
)
if
(
!
match
)
return
var
cls
=
match
[
0
]
if
(
!
el
.
classList
.
contains
(
css
.
active
))
{
if
(
!
el
.
classList
.
contains
(
css
.
active
))
{
var
nodes
=
el
.
parentNode
.
querySelectorAll
(
'li'
)
var
nodes
=
el
.
parentNode
.
querySelectorAll
(
'li'
)
for
(
var
i
=
0
;
i
<
nodes
.
length
;
++
i
)
{
for
(
var
i
=
0
;
i
<
nodes
.
length
;
++
i
)
{
nodes
[
i
].
classList
.
remove
(
css
.
active
)
nodes
[
i
].
classList
.
remove
(
css
.
active
)
this
.
contents
[
nodes
[
i
].
getAttribute
(
'title'
)].
style
.
display
=
'none'
}
}
$
(
'#optionViews'
).
attr
(
'class'
,
''
).
addClass
(
cls
)
el
.
classList
.
add
(
css
.
active
)
}
}
events
.
app
.
trigger
(
'tabChanged'
,
[
cls
])
var
title
=
el
.
getAttribute
(
'title'
)
this
.
contents
[
el
.
getAttribute
(
'title'
)].
style
.
display
=
'block'
el
.
classList
.
add
(
css
.
active
)
this
.
events
.
app
.
trigger
(
'tabChanged'
,
[
title
])
}
addTab
(
title
,
cssClass
,
content
)
{
var
self
=
this
if
(
!
helper
.
checkSpecialChars
(
title
))
{
this
.
contents
[
title
]
=
content
this
.
tabs
[
title
]
=
yo
`<li class="
${
css
.
opts_li
}
${
css
.
options
}
${
cssClass
}
" onclick=
${
function
(
ev
)
{
self
.
selectTab
(
this
)
}
} title=
${
title
}
>
${
title
}
</li>`
this
.
tabView
.
appendChild
(
this
.
tabs
[
title
])
}
}
}
}
}
module
.
exports
=
TabbedMenu
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