Skip to content

Commit d8c49d8

Browse files
authored
Merge pull request #1121 from HeyPuter/revert-1072-fix/success-msg-deploy
Revert "Fix : the issue with the success message not displaying after deployment"
2 parents 96c4030 + e2d120d commit d8c49d8

File tree

1 file changed

+12
-45
lines changed

1 file changed

+12
-45
lines changed

src/dev-center/js/dev-center.js

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,6 @@ async function create_app(title, source_path = null, items = null) {
296296

297297
})
298298
.then(async (app) => {
299-
$('.new-app-modal').get(0).close();
300-
window.location.reload();
301299
let app_dir;
302300
// ----------------------------------------------------
303301
// Create app directory in AppData
@@ -323,8 +321,6 @@ async function create_app(title, source_path = null, items = null) {
323321
maximizeOnStart: false,
324322
background: false,
325323
}).then(async (app) => {
326-
$('.new-app-modal').get(0).close();
327-
window.location.reload();
328324
// refresh app list
329325
puter.apps.list({ icon_size: 64 }).then(async (resp) => {
330326
apps = resp;
@@ -522,7 +518,7 @@ function generate_edit_app_section(app) {
522518
</ul>
523519
524520
<div class="section-tab active" data-tab="deploy">
525-
<div id="deploy-success-msg" class="success deploy-success-msg">
521+
<div class="success deploy-success-msg">
526522
New version deployed successfully 🎉<span class="close-success-msg">&times;</span>
527523
<p style="margin-bottom:0;"><span class="open-app button button-action" data-uid="${html_encode(app.uid)}" data-app-name="${html_encode(app.name)}">Give it a try!</span></p>
528524
</div>
@@ -914,7 +910,7 @@ async function edit_app_section(cur_app_name, tab = 'deploy') {
914910
dropped_items = items[0].path;
915911
$('.drop-area').removeClass('drop-area-hover');
916912
$('.drop-area').addClass('drop-area-ready-to-deploy');
917-
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">index.html</p><p>Ready to deploy 🚀</p>`;
913+
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">index.html</p><p>Ready to deploy 🚀</p><p class="reset-deploy"><span>Cancel</span></p>`;
918914
$('.drop-area').html(drop_area_content);
919915

920916
// enable deploy button
@@ -948,7 +944,7 @@ async function edit_app_section(cur_app_name, tab = 'deploy') {
948944
dropped_items = items;
949945
$('.drop-area').removeClass('drop-area-hover');
950946
$('.drop-area').addClass('drop-area-ready-to-deploy');
951-
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">${items.length} items</p><p>Ready to deploy 🚀</p>`;
947+
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">${items.length} items</p><p>Ready to deploy 🚀</p><p class="reset-deploy"><span>Cancel</span></p>`;
952948
$('.drop-area').html(drop_area_content);
953949

954950
// enable deploy button
@@ -989,7 +985,7 @@ async function edit_app_section(cur_app_name, tab = 'deploy') {
989985

990986
$('.drop-area').removeClass('drop-area-hover');
991987
$('.drop-area').addClass('drop-area-ready-to-deploy');
992-
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">${rootItems}</p><p>Ready to deploy 🚀</p>`;
988+
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">${rootItems}</p><p>Ready to deploy 🚀</p><p class="reset-deploy"><span>Cancel</span></p>`;
993989
$('.drop-area').html(drop_area_content);
994990

995991
// enable deploy button
@@ -1063,7 +1059,7 @@ async function edit_app_section(cur_app_name, tab = 'deploy') {
10631059
rootItems = html_encode(rootItems);
10641060
$('.drop-area').removeClass('drop-area-hover');
10651061
$('.drop-area').addClass('drop-area-ready-to-deploy');
1066-
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">${rootItems}</p><p>Ready to deploy 🚀</p>`;
1062+
drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">${rootItems}</p><p>Ready to deploy 🚀</p><p class="reset-deploy"><span>Cancel</span></p>`;
10671063
$('.drop-area').html(drop_area_content);
10681064

10691065
// enable deploy button
@@ -1897,7 +1893,7 @@ window.deploy = async function (app, items) {
18971893
$('.deploy-btn').addClass('disabled');
18981894

18991895
// change drop area text
1900-
$('.drop-area').html(deploying_spinner + ' <div>Deploying <span class="deploy-percent">(0%)</span></div><p class="reset-deploy button button-secondary"><span>Cancel</span></p>');
1896+
$('.drop-area').html(deploying_spinner + ' <div>Deploying <span class="deploy-percent">(0%)</span></div>');
19011897

19021898
if (typeof items === 'string' && (items.startsWith('/') || items.startsWith('~'))) {
19031899
$('.drop-area').removeClass('drop-area-hover');
@@ -1977,7 +1973,6 @@ window.deploy = async function (app, items) {
19771973
// update progress
19781974
$('.deploy-percent').text(`(${Math.round((files.indexOf(file) / files.length) * 100)}%)`);
19791975
}
1980-
19811976
}
19821977
}
19831978
// --------------------------------------------------------------------
@@ -2014,7 +2009,7 @@ window.deploy = async function (app, items) {
20142009
// set the 'Index URL' field for the 'Settings' tab
20152010
$('#edit-app-index-url').val(protocol + `://${hostname}.` + static_hosting_domain);
20162011
// show success message
2017-
$('#deploy-success-msg').show();
2012+
$('.deploy-success-msg').show();
20182013
// reset drop area
20192014
reset_drop_area();
20202015
})
@@ -2082,13 +2077,8 @@ window.deploy = async function (app, items) {
20822077
createMissingAncestors: true,
20832078
progress: function (operation_id, op_progress) {
20842079
$('.deploy-percent').text(`(${op_progress}%)`);
2085-
20862080
},
20872081
}).then(async (uploaded) => {
2088-
// show success message
2089-
$('#deploy-success-msg').show();
2090-
// reset drop area
2091-
reset_drop_area()
20922082
// new hostname
20932083
let hostname = `${currently_editing_app.name}-${(Math.random() + 1).toString(36).substring(7)}`;
20942084

@@ -2111,7 +2101,7 @@ window.deploy = async function (app, items) {
21112101
// set the 'Index URL' field for the 'Settings' tab
21122102
$('#edit-app-index-url').val(protocol + `://${hostname}.` + static_hosting_domain);
21132103
// show success message
2114-
$('#deploy-success-msg').show();
2104+
$('.deploy-success-msg').show();
21152105
// reset drop area
21162106
reset_drop_area()
21172107
})
@@ -2274,7 +2264,7 @@ $(document).on('click', '.insta-deploy-existing-app-deploy-btn', function (e) {
22742264

22752265
$('.drop-area').removeClass('drop-area-hover');
22762266
$('.drop-area').addClass('drop-area-ready-to-deploy');
2277-
let drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">Ready to deploy 🚀</p><p class="reset-deploy button button-secondary"><span>Cancel</span></p>`;
2267+
let drop_area_content = `<p style="margin-bottom:0; font-weight: 500;">Ready to deploy 🚀</p><p class="reset-deploy"><span>Cancel</span></p>`;
22782268
$('.drop-area').html(drop_area_content);
22792269

22802270
// deploy
@@ -2717,32 +2707,9 @@ function enable_window_settings(){
27172707
$('#edit-app-hide-titlebar').prop('disabled', false);
27182708
}
27192709

2720-
$(document).on('click', '.reset-deploy', async function (e) {
2721-
// Display a confirmation dialog to ask the user
2722-
const alert_resp = await puter.ui.alert(
2723-
'Are you sure you want to cancel the deployment?',
2724-
[
2725-
{
2726-
label: 'Yes, cancel deployment',
2727-
value: 'cancel',
2728-
type: 'danger', // This can style the button as red/danger
2729-
},
2730-
{
2731-
label: 'No, keep it',
2732-
value: 'keep'
2733-
}
2734-
]
2735-
);
2736-
2737-
if (alert_resp === 'cancel') {
2738-
// If the user clicks "Yes, cancel deployment", reset the drop area
2739-
reset_drop_area();
2740-
} else {
2741-
// If the user clicks "No, keep it", do nothing or log it
2742-
console.log('Deployment is not canceled.');
2743-
}
2744-
});
2745-
2710+
$(document).on('click', '.reset-deploy', function (e) {
2711+
reset_drop_area();
2712+
})
27462713

27472714
$(document).on('click', '.sidebar-toggle', function (e) {
27482715
$('.sidebar').toggleClass('open');

0 commit comments

Comments
 (0)