Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.toolbox
Commits
299dbfed
Commit
299dbfed
authored
Mar 18, 2014
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent conflits while opening tabs
parent
6e7664a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+18
-16
No files found.
slapos/runner/static/js/scripts/softwareFolder.js
View file @
299dbfed
...
@@ -71,13 +71,16 @@ $(document).ready(function () {
...
@@ -71,13 +71,16 @@ $(document).ready(function () {
editorlist
[
hash
].
busy
=
false
;
editorlist
[
hash
].
busy
=
false
;
status
=
true
;
status
=
true
;
}
else
{
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
$
(
"
#error
"
).
Popup
(
"
Unable to open file:
"
+
file
+
"
<br/>
"
+
data
.
result
,
$
(
"
#tabControl div.active span.bt_close
"
).
click
();
{
type
:
'
error
'
,
duration
:
5000
});
//Close current tab
$
(
"
#tabControl div[rel='
"
+
hash
+
"
'] span.bt_close
"
).
click
();
}
}
})
})
.
fail
(
function
(
jqXHR
,
exception
)
{
.
fail
(
function
(
jqXHR
,
exception
)
{
alertStatus
(
jqXHR
);
alertStatus
(
jqXHR
);
$
(
"
#tabControl div.active span.bt_close
"
).
click
();
//Close current tab
$
(
"
#tabControl div[rel='
"
+
hash
+
"
'] span.bt_close
"
).
click
();
})
})
.
always
(
function
()
{
.
always
(
function
()
{
// always
// always
...
@@ -189,8 +192,8 @@ $(document).ready(function () {
...
@@ -189,8 +192,8 @@ $(document).ready(function () {
if
(
editorlist
.
hasOwnProperty
(
hash
))
{
if
(
editorlist
.
hasOwnProperty
(
hash
))
{
//this file already exist in editor. Select file and exit!
//this file already exist in editor. Select file and exit!
$
(
"
#tabControl div.item
"
).
each
(
function
()
{
$
(
"
#tabControl div.item
"
).
each
(
function
()
{
var
rel
=
$
(
this
).
attr
(
'
rel
'
)
.
split
(
'
#
'
)
;
var
rel
=
$
(
this
).
attr
(
'
rel
'
);
if
(
(
rel
.
length
===
2
)
&&
(
rel
[
1
]
===
hash
)
)
{
if
(
rel
&&
(
rel
===
hash
)
)
{
$
(
this
).
click
();
$
(
this
).
click
();
return
""
;
return
""
;
}
}
...
@@ -198,7 +201,7 @@ $(document).ready(function () {
...
@@ -198,7 +201,7 @@ $(document).ready(function () {
return
""
;
return
""
;
}
}
var
width
=
resizeTabItems
(
true
);
var
width
=
resizeTabItems
(
true
);
var
tab
=
'
<div class="item" rel="
'
+
path
+
'
#
'
+
hash
var
tab
=
'
<div class="item" rel="
'
+
hash
+
'
"><span style="width:
'
+
width
+
'
px"
'
+
'
"><span style="width:
'
+
width
+
'
px"
'
+
'
title="
'
+
path
+
'
">
'
+
title
+
'
</span>
'
+
'
title="
'
+
path
+
'
">
'
+
title
+
'
</span>
'
+
'
<span class="bt_close" title="Close this tab">×</span></div>
'
;
+
'
<span class="bt_close" title="Close this tab">×</span></div>
'
;
...
@@ -215,7 +218,7 @@ $(document).ready(function () {
...
@@ -215,7 +218,7 @@ $(document).ready(function () {
if
(
$
(
this
).
hasClass
(
'
active
'
)
)
{
if
(
$
(
this
).
hasClass
(
'
active
'
)
)
{
return
false
;
return
false
;
}
}
var
rel
=
$
(
this
).
attr
(
'
rel
'
)
.
split
(
'
#
'
)
,
var
rel
=
$
(
this
).
attr
(
'
rel
'
),
current
=
$
(
"
#tabContent pre.active
"
).
attr
(
'
rel
'
);
current
=
$
(
"
#tabContent pre.active
"
).
attr
(
'
rel
'
);
if
(
current
&&
current
!==
undefined
)
{
if
(
current
&&
current
!==
undefined
)
{
editorlist
[
current
].
isOpened
=
false
;
editorlist
[
current
].
isOpened
=
false
;
...
@@ -223,25 +226,25 @@ $(document).ready(function () {
...
@@ -223,25 +226,25 @@ $(document).ready(function () {
$
(
"
#tabControl div.active
"
).
removeClass
(
'
active
'
);
$
(
"
#tabControl div.active
"
).
removeClass
(
'
active
'
);
$
(
"
#tabContent pre.active
"
).
removeClass
(
'
active
'
);
$
(
"
#tabContent pre.active
"
).
removeClass
(
'
active
'
);
$
(
this
).
addClass
(
'
active
'
);
$
(
this
).
addClass
(
'
active
'
);
$
(
"
#tabContent pre[rel='
"
+
rel
[
1
]
+
"
']
"
).
addClass
(
'
active
'
);
$
(
"
#tabContent pre[rel='
"
+
rel
+
"
']
"
).
addClass
(
'
active
'
);
editorlist
[
rel
[
1
]
].
isOpened
=
true
;
editorlist
[
rel
].
isOpened
=
true
;
editorlist
[
rel
[
1
]
].
editor
.
resize
();
editorlist
[
rel
].
editor
.
resize
();
return
false
;
return
false
;
});
});
/*Close Selected Tab*/
/*Close Selected Tab*/
$
(
"
#tabControl div.item:last span.bt_close
"
).
click
(
function
()
{
$
(
"
#tabControl div.item:last span.bt_close
"
).
click
(
function
()
{
var
$tab
=
$
(
this
).
parent
(),
position
=
0
;
var
$tab
=
$
(
this
).
parent
(),
position
=
0
;
var
rel
=
$tab
.
attr
(
'
rel
'
)
.
split
(
'
#
'
)
;
var
rel
=
$tab
.
attr
(
'
rel
'
);
//Remove tab
//Remove tab
if
(
$tab
.
hasClass
(
'
active
'
)
&&
$
(
"
#tabControl div.item
"
).
length
>
0
)
{
if
(
$tab
.
hasClass
(
'
active
'
)
&&
$
(
"
#tabControl div.item
"
).
length
>
0
)
{
position
=
(
$tab
.
index
()
==
0
)
?
1
:
$tab
.
index
();
position
=
(
$tab
.
index
()
==
0
)
?
1
:
$tab
.
index
();
$
(
"
#tabControl div.item:nth-child(
"
+
position
+
"
)
"
).
click
();
$
(
"
#tabControl div.item:nth-child(
"
+
position
+
"
)
"
).
click
();
}
}
editorlist
[
rel
[
1
]
].
editor
.
destroy
();
editorlist
[
rel
].
editor
.
destroy
();
delete
editorlist
[
rel
[
1
]
];
delete
editorlist
[
rel
];
$tab
.
remove
();
$tab
.
remove
();
$
(
"
#tabContent pre[rel='
"
+
rel
[
1
]
+
"
']
"
).
remove
();
$
(
"
#tabContent pre[rel='
"
+
rel
+
"
']
"
).
remove
();
resizeTabItems
();
resizeTabItems
();
saveTabList
();
saveTabList
();
return
false
;
return
false
;
...
@@ -309,8 +312,7 @@ $(document).ready(function () {
...
@@ -309,8 +312,7 @@ $(document).ready(function () {
function
getActiveTabTitleSelector
(
hash
)
{
function
getActiveTabTitleSelector
(
hash
)
{
var
rel
=
(
hash
)
?
hash
:
$
(
"
#tabContent pre.active
"
).
attr
(
'
rel
'
);
var
rel
=
(
hash
)
?
hash
:
$
(
"
#tabContent pre.active
"
).
attr
(
'
rel
'
);
if
(
editorlist
.
hasOwnProperty
(
rel
)
)
{
if
(
editorlist
.
hasOwnProperty
(
rel
)
)
{
return
"
#tabControl div[rel='
"
+
editorlist
[
rel
].
path
+
"
#
"
+
rel
+
return
"
#tabControl div[rel='
"
+
rel
+
"
'] span:nth-child(1)
"
;
"
'] span:nth-child(1)
"
;
}
}
else
{
return
""
;
}
else
{
return
""
;
}
}
}
...
...
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