@@ -9,10 +9,10 @@ Parameters:
9
9
10
10
InitialPassword :
11
11
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
14
14
NoEcho : true
15
-
15
+ AllowedPattern : " ^(?=.*[a-z])(?=.*[A-Z])(?=.* \\ d)(?=.*[!@#$%^&*])[a-zA-Z \\ d!@#$%^&*]{8,}$ "
16
16
17
17
18
18
Resources :
@@ -507,7 +507,7 @@ Resources:
507
507
background-color: var(--primary-bg);
508
508
color: var(--primary-text);
509
509
line-height: 1.6;
510
- padding: var(--spacing);
510
+ /* padding: var(--spacing);*/
511
511
}
512
512
513
513
.container {
@@ -535,7 +535,7 @@ Resources:
535
535
}
536
536
537
537
.prototype-card {
538
- cursor: pointer;
538
+ /* cursor: pointer;*/
539
539
}
540
540
541
541
.prototype-card:hover {
@@ -712,7 +712,7 @@ Resources:
712
712
}
713
713
714
714
.prototype-card.expanded {
715
- min-height: 300px;
715
+ /* min-height: 300px;*/
716
716
}
717
717
718
718
.prototype-card h3{
@@ -868,7 +868,86 @@ Resources:
868
868
<div class="top-nav">
869
869
<div class="nav-container">
870
870
<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>
872
951
</div>
873
952
</div>
874
953
@@ -1152,6 +1231,7 @@ Resources:
1152
1231
1153
1232
const card = $(
1154
1233
'<div class="card prototype-card" data-id="' + prototype.id + '" data-stackname="' + prototype.stackname + '">' +
1234
+ '<div class="status-msg"></div>' +
1155
1235
'<div class="card-content"><div style="float:right">'+modstr+'<a href="#" data-id="' + prototype.id + '" class="launchbut" style="">Launch</a></div>' +
1156
1236
'<div class="card-header">' +
1157
1237
'<img src="' + prototype.iconurl + '" alt="' + prototype.title + ' icon" class="card-icon">' +
@@ -1230,7 +1310,7 @@ Resources:
1230
1310
}
1231
1311
1232
1312
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);
1234
1314
1235
1315
$('#editmodels').html(tote+' models enabled');
1236
1316
@@ -1354,6 +1434,10 @@ Resources:
1354
1434
}
1355
1435
1356
1436
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
+
1357
1441
const output = document.getElementById('output');
1358
1442
const apiUrl = 'https://${ApiGatewayRestApi}.execute-api.${AWS::Region}.amazonaws.com/prod/delete-stack';
1359
1443
@@ -1428,15 +1512,20 @@ Resources:
1428
1512
}
1429
1513
}
1430
1514
1515
+ $('.prototype-card[data-id="' + pid + '"]').find('.status-msg').html('');
1431
1516
PrototypeDeployed(pid, pindex);
1432
1517
saveToLocalStorage('myAppState', fulldata);
1433
1518
1519
+ if (autodestroy)
1520
+ {
1434
1521
selfdestructStack(stackName,pid);
1435
1522
startCountdownTimer(pid);
1523
+ }
1436
1524
1437
1525
}
1438
1526
else
1439
1527
{
1528
+ $('.prototype-card[data-id="' + pid + '"]').find('.status-msg').html('');
1440
1529
PrototypeDeleted(pid, pindex);
1441
1530
saveToLocalStorage('myAppState', fulldata);
1442
1531
}
@@ -1465,6 +1554,7 @@ Resources:
1465
1554
1466
1555
console.log('deleted');
1467
1556
PrototypeDeleted(pid, pindex);
1557
+ $('.prototype-card[data-id="' + pid + '"]').find('.status-msg').html('');
1468
1558
saveToLocalStorage('myAppState', fulldata);
1469
1559
}
1470
1560
}
@@ -1586,11 +1676,15 @@ Resources:
1586
1676
}
1587
1677
}
1588
1678
1679
+ function getRandomFloat(min, max) {
1680
+ return Math.random() * (max - min) + min;
1681
+ }
1589
1682
const getRandomNumber = (min, max) => {
1590
1683
return Math.floor(Math.random() * (max - min + 1)) + min;
1591
1684
}
1592
1685
1593
1686
function deployPrototype(id) {
1687
+ $('.prototype-card[data-id="' + id + '"]').find('.status-msg').html('Loading...');
1594
1688
const card = $(".prototype-card[data-id='"+id+"']");
1595
1689
const cardContent = card.find('.card-content');
1596
1690
const progressBar = card.find('.progress-bar');
@@ -1606,15 +1700,26 @@ Resources:
1606
1700
// Hide card content, show progress bar
1607
1701
cardContent.fadeOut();
1608
1702
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
+ }
1609
1711
1610
1712
// Simulate deployment progress
1611
1713
let progress = 0;
1714
+ let totsecs = prototypes[pindex]['estimatedSetupTime'] ? prototypes[pindex]['estimatedSetupTime']: 200;
1715
+ let tick = totsecs/200;
1716
+
1612
1717
const interval = setInterval(() => {
1613
1718
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;
1618
1723
1619
1724
if (progress >= 100) {
1620
1725
progress = 100;
@@ -1665,6 +1770,8 @@ Resources:
1665
1770
prototypes = loadedDict['prototypes'];
1666
1771
appinfo = loadedDict["appinfo"];
1667
1772
1773
+ models_access = loadedDict["models_access"];
1774
+
1668
1775
renderPrototypes();
1669
1776
1670
1777
var pindex=0;
@@ -1687,6 +1794,21 @@ Resources:
1687
1794
});
1688
1795
1689
1796
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
+
1690
1812
1691
1813
//alert('loaded cache');
1692
1814
}
@@ -1736,7 +1858,7 @@ Resources:
1736
1858
$(document).on('click', '#editmodels', function(e) {
1737
1859
e.preventDefault();
1738
1860
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"]);
1740
1862
1741
1863
1742
1864
});
@@ -2001,7 +2123,12 @@ Resources:
2001
2123
2002
2124
result = new_result
2003
2125
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
+ )
2005
2132
2006
2133
2007
2134
except Exception as e:
@@ -2011,9 +2138,13 @@ Resources:
2011
2138
'body': f"error: {e}"
2012
2139
}
2013
2140
2141
+ #stack_params = {
2142
+ # 'TemplateBody': template_body
2143
+ #}
2014
2144
stack_params = {
2015
- 'TemplateBody ': template_body
2145
+ 'TemplateURL ': f'https://{template_bucket}.s3.amazonaws.com/{template_key}'
2016
2146
}
2147
+
2017
2148
elif template_key and template_bucket:
2018
2149
stack_params = {
2019
2150
'TemplateURL': f'https://{template_bucket}.s3.amazonaws.com/{template_key}'
@@ -2906,16 +3037,12 @@ Outputs:
2906
3037
Description : Admin username (email)
2907
3038
Value : !Ref AdminEmail
2908
3039
2909
- UserPoolId :
2910
- Description : Cognito User Pool ID
2911
- Value : !Ref UserPool
2912
-
2913
3040
Instructions :
2914
3041
Description : Instructions to access the protected content
2915
3042
Value : !Sub |
2916
3043
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
2918
3045
3. Login with:
2919
3046
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