Skip to content

Commit 04ad019

Browse files
authored
Add files via upload
1 parent 348635e commit 04ad019

File tree

1 file changed

+149
-22
lines changed

1 file changed

+149
-22
lines changed

leap-installer-setup.yaml

+149-22
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Parameters:
99

1010
InitialPassword:
1111
Type: String
12-
Description: Initial password for the admin user (must meet Cognito requirements)
13-
Default: Initial123!
12+
Description: Password for the admin user (8+ chars, uppercase & lowercase letters, numbers, special chars)
13+
MinLength: 8
1414
NoEcho: true
15-
15+
AllowedPattern: "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*])[a-zA-Z\\d!@#$%^&*]{8,}$"
1616

1717

1818
Resources:
@@ -507,7 +507,7 @@ Resources:
507507
background-color: var(--primary-bg);
508508
color: var(--primary-text);
509509
line-height: 1.6;
510-
padding: var(--spacing);
510+
/*padding: var(--spacing);*/
511511
}
512512
513513
.container {
@@ -535,7 +535,7 @@ Resources:
535535
}
536536
537537
.prototype-card {
538-
cursor: pointer;
538+
/*cursor: pointer;*/
539539
}
540540
541541
.prototype-card:hover {
@@ -712,7 +712,7 @@ Resources:
712712
}
713713
714714
.prototype-card.expanded {
715-
min-height: 300px;
715+
/*min-height: 300px;*/
716716
}
717717
718718
.prototype-card h3{
@@ -868,7 +868,86 @@ Resources:
868868
<div class="top-nav">
869869
<div class="nav-container">
870870
<a href="#" class="logo"><img src="https://www.pikpng.com/pngl/b/524-5240809_aws-logo-svg-white-clipart.png" style="width:auto;height:25px;position:relative;top:5px;margin-right:10px;">LEAP - Instant Prototypes</a>
871-
<div><a id="editmodels" href="#" style="color:white;text-decoration:none;margin-right:15px;">Loading...</a><a href="https://aws.amazon.com/startups/credits" target="_blank" class="signup-btn">Apply for Activate credits</a></div>
871+
<div>
872+
<div class="toggle-container" style="width:100px;display:inline-block;color:white;">
873+
<label class="switch">
874+
<input type="checkbox" onchange="handleToggle(this)" checked>
875+
<span class="slider round"></span>
876+
Autodestroy
877+
</label>
878+
</div>
879+
880+
<style>
881+
.switch {
882+
position: relative;
883+
display: inline-block;
884+
width: 60px;
885+
height: 34px;
886+
}
887+
888+
.switch input {
889+
opacity: 0;
890+
width: 0;
891+
height: 0;
892+
}
893+
894+
.slider {
895+
position: absolute;
896+
cursor: pointer;
897+
top: 0;
898+
left: 0;
899+
right: 0;
900+
bottom: 0;
901+
background-color: #ccc;
902+
transition: .4s;
903+
}
904+
905+
.slider:before {
906+
position: absolute;
907+
content: "";
908+
height: 26px;
909+
width: 26px;
910+
left: 4px;
911+
bottom: 4px;
912+
background-color: white;
913+
transition: .4s;
914+
}
915+
916+
input:checked+.slider {
917+
background-color: #0066cc;
918+
}
919+
920+
input:checked+.slider:before {
921+
transform: translateX(26px);
922+
}
923+
924+
.slider.round {
925+
border-radius: 34px;
926+
}
927+
928+
.slider.round:before {
929+
border-radius: 50%;
930+
}
931+
</style>
932+
933+
<script>
934+
var autodestroy=true;
935+
936+
function handleToggle(checkbox) {
937+
938+
autodestroy= checkbox.checked;
939+
940+
if (checkbox.checked) {
941+
console.log('Toggle is ON');
942+
943+
// Add your ON state logic here
944+
} else {
945+
console.log('Toggle is OFF');
946+
// Add your OFF state logic here
947+
}
948+
}
949+
</script>
950+
<a id="editmodels" href="#" style="color:white;text-decoration:none;margin-right:15px;">Loading...</a><a href="https://aws.amazon.com/startups/credits" target="_blank" class="signup-btn">Apply for Activate credits</a></div>
872951
</div>
873952
</div>
874953
@@ -1152,6 +1231,7 @@ Resources:
11521231
11531232
const card = $(
11541233
'<div class="card prototype-card" data-id="' + prototype.id + '" data-stackname="' + prototype.stackname + '">' +
1234+
'<div class="status-msg"></div>' +
11551235
'<div class="card-content"><div style="float:right">'+modstr+'<a href="#" data-id="' + prototype.id + '" class="launchbut" style="">Launch</a></div>' +
11561236
'<div class="card-header">' +
11571237
'<img src="' + prototype.iconurl + '" alt="' + prototype.title + ' icon" class="card-icon">' +
@@ -1230,7 +1310,7 @@ Resources:
12301310
}
12311311
12321312
if (!hasaccess)
1233-
showModal("Bedrock Models", "You need to have access to at least one model to continue.", models_access);
1313+
showModal("Model Access", "You need to have access to at least one model to continue.", models_access);
12341314
12351315
$('#editmodels').html(tote+' models enabled');
12361316
@@ -1354,6 +1434,10 @@ Resources:
13541434
}
13551435
13561436
async function deleteStack(stackName,id) {
1437+
1438+
$('.prototype-card[data-id="' + id + '"]').find('.status-msg').html('Deleting...');
1439+
$('.prototype-card[data-id="' + id + '"]').find('.deployment-info').hide();
1440+
13571441
const output = document.getElementById('output');
13581442
const apiUrl = 'https://${ApiGatewayRestApi}.execute-api.${AWS::Region}.amazonaws.com/prod/delete-stack';
13591443
@@ -1428,15 +1512,20 @@ Resources:
14281512
}
14291513
}
14301514
1515+
$('.prototype-card[data-id="' + pid + '"]').find('.status-msg').html('');
14311516
PrototypeDeployed(pid, pindex);
14321517
saveToLocalStorage('myAppState', fulldata);
14331518
1519+
if (autodestroy)
1520+
{
14341521
selfdestructStack(stackName,pid);
14351522
startCountdownTimer(pid);
1523+
}
14361524
14371525
}
14381526
else
14391527
{
1528+
$('.prototype-card[data-id="' + pid + '"]').find('.status-msg').html('');
14401529
PrototypeDeleted(pid, pindex);
14411530
saveToLocalStorage('myAppState', fulldata);
14421531
}
@@ -1465,6 +1554,7 @@ Resources:
14651554
14661555
console.log('deleted');
14671556
PrototypeDeleted(pid, pindex);
1557+
$('.prototype-card[data-id="' + pid + '"]').find('.status-msg').html('');
14681558
saveToLocalStorage('myAppState', fulldata);
14691559
}
14701560
}
@@ -1586,11 +1676,15 @@ Resources:
15861676
}
15871677
}
15881678
1679+
function getRandomFloat(min, max) {
1680+
return Math.random() * (max - min) + min;
1681+
}
15891682
const getRandomNumber = (min, max) => {
15901683
return Math.floor(Math.random() * (max - min + 1)) + min;
15911684
}
15921685
15931686
function deployPrototype(id) {
1687+
$('.prototype-card[data-id="' + id + '"]').find('.status-msg').html('Loading...');
15941688
const card = $(".prototype-card[data-id='"+id+"']");
15951689
const cardContent = card.find('.card-content');
15961690
const progressBar = card.find('.progress-bar');
@@ -1606,15 +1700,26 @@ Resources:
16061700
// Hide card content, show progress bar
16071701
cardContent.fadeOut();
16081702
progressBar.fadeIn();
1703+
1704+
var pindex = 0;
1705+
1706+
for (var i = 0; i < prototypes.length; i++)
1707+
if (prototypes[i]['id'] == id) {
1708+
pindex = i;
1709+
break;
1710+
}
16091711
16101712
// Simulate deployment progress
16111713
let progress = 0;
1714+
let totsecs = prototypes[pindex]['estimatedSetupTime'] ? prototypes[pindex]['estimatedSetupTime']: 200;
1715+
let tick = totsecs/200;
1716+
16121717
const interval = setInterval(() => {
16131718
1614-
if (progress<65)
1615-
progress += getRandomNumber(1,5);
1616-
else
1617-
progress += getRandomNumber(1,3);
1719+
if (progress < 85)
1720+
progress=progress+getRandomFloat(tick,tick*2);
1721+
else
1722+
progress = progress + tick;
16181723
16191724
if (progress >= 100) {
16201725
progress = 100;
@@ -1665,6 +1770,8 @@ Resources:
16651770
prototypes = loadedDict['prototypes'];
16661771
appinfo = loadedDict["appinfo"];
16671772
1773+
models_access = loadedDict["models_access"];
1774+
16681775
renderPrototypes();
16691776
16701777
var pindex=0;
@@ -1687,6 +1794,21 @@ Resources:
16871794
});
16881795
16891796
1797+
var tote = 0;
1798+
1799+
for (const model of models_access) {
1800+
if (model.enabled) {
1801+
tote = tote + 1;
1802+
hasaccess = true;
1803+
}
1804+
}
1805+
1806+
if (!hasaccess)
1807+
showModal("Model Access", "You need to have access to at least one model to continue.", models_access);
1808+
1809+
$('#editmodels').html(tote + ' models enabled');
1810+
1811+
16901812
16911813
//alert('loaded cache');
16921814
}
@@ -1736,7 +1858,7 @@ Resources:
17361858
$(document).on('click', '#editmodels', function(e) {
17371859
e.preventDefault();
17381860
1739-
showModal("Bedrock Models", "You need to have access to at least one model to continue.", fulldata["models_access"]);
1861+
showModal("Model Access", "You need to have access to at least one model to continue.", fulldata["models_access"]);
17401862
17411863
17421864
});
@@ -2001,7 +2123,12 @@ Resources:
20012123
20022124
result = new_result
20032125
2004-
template_body=result
2126+
#template_body=result
2127+
s3.put_object(
2128+
Bucket=template_bucket,
2129+
Key=template_key,
2130+
Body=result.encode('utf-8')
2131+
)
20052132
20062133
20072134
except Exception as e:
@@ -2011,9 +2138,13 @@ Resources:
20112138
'body': f"error: {e}"
20122139
}
20132140
2141+
#stack_params = {
2142+
# 'TemplateBody': template_body
2143+
#}
20142144
stack_params = {
2015-
'TemplateBody': template_body
2145+
'TemplateURL': f'https://{template_bucket}.s3.amazonaws.com/{template_key}'
20162146
}
2147+
20172148
elif template_key and template_bucket:
20182149
stack_params = {
20192150
'TemplateURL': f'https://{template_bucket}.s3.amazonaws.com/{template_key}'
@@ -2906,16 +3037,12 @@ Outputs:
29063037
Description: Admin username (email)
29073038
Value: !Ref AdminEmail
29083039

2909-
UserPoolId:
2910-
Description: Cognito User Pool ID
2911-
Value: !Ref UserPool
2912-
29133040
Instructions:
29143041
Description: Instructions to access the protected content
29153042
Value: !Sub |
29163043
1. Open the login URL provided above
2917-
2. You will be redirected to the Cognito hosted UI
3044+
2. You will be redirected to the secure login page
29183045
3. Login with:
29193046
Username: ${AdminEmail}
2920-
Password: ${InitialPassword}
2921-
4. After successful login, you'll be automatically redirected to the protected content
3047+
Use the password that you set earlier
3048+
4. After successful login, you'll be automatically redirected to your secure LEAP page

0 commit comments

Comments
 (0)