Skip to content

Commit 37fb3ef

Browse files
committed
disabled lstart and lclean if no lab is copied before
1 parent 0f7a99e commit 37fb3ef

2 files changed

Lines changed: 25 additions & 9 deletions

File tree

css/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ body {
1313
position: absolute;
1414
margin-top: -130px;
1515
}
16+
.disabledLink {
17+
color: currentColor;
18+
cursor: not-allowed !important;
19+
opacity: 0.5;
20+
text-decoration: none;
21+
}
1622
/* scrollbar */
1723
::-webkit-scrollbar {
1824
width: 12px;

index.html

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ <h4>Bash file preview:</h4>
317317
<!-- Collect the nav links, forms, and other content for toggling -->
318318
<ul class="nav navbar-nav">
319319
<li><a id="copyLab"><i class="fas fa-copy"></i> <strong>Copy lab on Host *</strong></a></li>
320-
<li><a id="lstart"><i class="fas fa-play-circle"></i> <strong>Run LStart on Host **</strong></a></li>
321-
<li><a id="lclean"><i class="fas fa-stop-circle"></i> <strong>Run LClean on Host **</strong></a></li>
320+
<li><a id="lstart" class="disabledLink"><i class="fas fa-play-circle"></i> <strong>Run LStart on Host **</strong></a></li>
321+
<li><a id="lclean" class="disabledLink"><i class="fas fa-stop-circle"></i> <strong>Run LClean on Host **</strong></a></li>
322322
</ul>
323323
<div style="clear:both">
324324
<span class="label label-warning">
@@ -416,26 +416,36 @@ <h4 class="modal-title">Running Commands</h4>
416416

417417
var electron;
418418
var isWin;
419+
var isCopied = false;
419420

420421
function copyLab(e){
421422
e.preventDefault();
422423
var script = document.querySelector('#sh_script').value;
423424
const {ipcRenderer} = electron;
424425
//console.log(script);
425426
ipcRenderer.send('script:copy', script);
427+
isCopied = true;
428+
var lStartButton = document.getElementById('lstart');
429+
lStartButton.classList.remove("disabledLink");
430+
var lCleanButton = document.getElementById('lclean');
431+
lCleanButton.classList.remove("disabledLink");
426432
}
427433
function executeStart(e){
428434
e.preventDefault();
429-
show_modal();
430-
const {ipcRenderer} = electron;
431-
//console.log(script);
432-
ipcRenderer.send('script:execute');
435+
if(isCopied) {
436+
show_modal();
437+
const {ipcRenderer} = electron;
438+
//console.log(script);
439+
ipcRenderer.send('script:execute');
440+
}
433441
}
434442
function executeClean(e){
435443
e.preventDefault();
436-
show_modal();
437-
const {ipcRenderer} = electron;
438-
ipcRenderer.send('script:clean');
444+
if(isCopied) {
445+
show_modal();
446+
const {ipcRenderer} = electron;
447+
ipcRenderer.send('script:clean');
448+
}
439449
}
440450

441451
if(isElectron()) {

0 commit comments

Comments
 (0)