Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-124580 - Promote Publish Milo changes #782

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tools/floodgate/css/floodgate.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 20%;
width: 25%;
text-align: center;
}

.fg-modal-buttons button {
margin: 10px;
}

.promote-publish-options {
display: none;
padding-top: 20px;
}
4 changes: 4 additions & 0 deletions tools/floodgate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ <h2 class="title">Project Status</h2>
<button id="yes-btn">Yes</button>
<button id="no-btn">No</button>
</div>
<div id="promote-publish-options" class="promote-publish-options">
<input class="promote-publish-radio" type="radio" name="promotePublishRadio" value="promoteOnly" checked>Promote Only?</input>
<input class="promote-publish-radio" type="radio" name="promotePublishRadio" value="promotePublish">Promote and Publish Promoted Pages?</input>
</div>
</div>
</div>
</main>
Expand Down
13 changes: 13 additions & 0 deletions tools/floodgate/js/floodgate.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ async function promoteContentAction(project, config) {
params.spToken = getAccessToken();
// consider fgRoot as the project path for promote action.
params.projectRoot = config.sp.fgRootFolder;
// Based on User selection on the Promote Dialog,
// passing the param if user also wants to Publish the Promoted pages.
params.doPublish = 'promotePublish' ===
document.querySelector('input[name="promotePublishRadio"]:checked')?.value;
const promoteStatus = await postData(config.sp.aioPromoteAction, params);
updateProjectStatusUIFromAction({ promoteStatus });
}
Expand Down Expand Up @@ -89,14 +93,23 @@ function setListeners(project, config) {
document.querySelector('#promoteFiles button').addEventListener('click', (e) => {
modal.getElementsByTagName('p')[0].innerText = `Confirm to ${e.target.textContent}`;
modal.style.display = 'block';
togglePromotePublishRadioVisibility('block');
document.querySelector('#fg-modal #yes-btn').addEventListener('click', handlePromoteConfirm);
});
document.querySelector('#fg-modal #no-btn').addEventListener('click', () => {
modal.style.display = 'none';
togglePromotePublishRadioVisibility('none');
});
document.querySelector('#loading').addEventListener('click', loadingOFF);
}

function togglePromotePublishRadioVisibility(visibility) {
const promotePublishOptions = document.getElementById('promote-publish-options');
promotePublishOptions.style.display = visibility;
const promotePublishRadio = document.getElementById('promotePublishRadio');
promotePublishRadio.checked = true;
}

async function init() {
try {
// Read the Floodgate Sharepoint Config
Expand Down