-
Notifications
You must be signed in to change notification settings - Fork 16
Added bulk publish queue link #2038
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
Open
sunil-lakshman
wants to merge
17
commits into
development
Choose a base branch
from
enh/dx-2196
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8d490b8
Added bulk publish queue link
sunil-lakshman c0741a8
Fixed copilot PR comments
sunil-lakshman 47252f4
Merge branch 'development' into enh/dx-2196
sunil-lakshman f4c7afc
Fixed PR comments
sunil-lakshman a587ceb
Removed custom host logic
sunil-lakshman 923ef2b
Fixed merge conflits
sunil-lakshman b8b1dd6
Merge branch 'development' into enh/dx-2196
sunil-lakshman bba07b2
Fixed failed unit testcases in contentstack-config
sunil-lakshman 2569422
Fixed failed unit testcases in contentstack-config
sunil-lakshman d5b7f51
Fixed ES module/CommonJS conflicts
sunil-lakshman 6a505a6
Disable the warnings
sunil-lakshman d50b8b8
Fixed failed testcases
sunil-lakshman 8cf3a7e
Fixed failed testcases
sunil-lakshman ae8bee6
Updated package.json file
sunil-lakshman 462e4fc
Add .mocharc.json configuration file for test setup
harshithad0703 cf8bb22
Merge branch development into enh/dx-2196
harshithad0703 0303f12
update package-lock
harshithad0703 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/contentstack-bulk-publish/src/util/bulk-publish-utils.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const { regions } = require('@contentstack/cli-config/lib/utils/region-handler'); | ||
|
||
/** | ||
* Get the appropriate app URL based on the host | ||
* @param {string} host - The host URL | ||
* @returns {string} The app URL | ||
*/ | ||
function getAppUrlFromHost(host) { | ||
// Handle development and staging environments | ||
if (host.includes('stag')) { | ||
return 'https://stag-app.csnonprod.com'; | ||
} | ||
|
||
if (host.includes('dev')) { | ||
const devMatch = host.match(/dev(\d+)/); | ||
if (devMatch) { | ||
const devNumber = devMatch[1]; | ||
return `https://dev${devNumber}-app.csnonprod.com`; | ||
} | ||
return 'https://dev-app.csnonprod.com'; | ||
} | ||
sunil-lakshman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// Find matching region based on host | ||
for (const regionConfig of Object.values(regions)) { | ||
if (host.includes(regionConfig.cma.replace('https://', ''))) { | ||
return regionConfig.uiHost; | ||
} | ||
} | ||
// Default to NA region | ||
return regions['AWS-NA'].uiHost; | ||
} | ||
|
||
/** | ||
* Generate the bulk publish status URL based on stack configuration | ||
* @param {Object} stack - Stack object containing api_key and host | ||
* @param {Object} config - Config object containing stackApiKey, branch, and host | ||
* @returns {string|null} The status URL or null if apiKey is not available | ||
*/ | ||
function generateBulkPublishStatusUrl(stack, config) { | ||
const apiKey = stack?.api_key || config?.stackApiKey; | ||
if (!apiKey) { | ||
return null; | ||
} | ||
const branch = config?.branch || 'main'; | ||
const host = stack?.host || config?.host || 'app.contentstack.com'; | ||
const appUrl = getAppUrlFromHost(host); | ||
return `${appUrl}/#!/stack/${apiKey}/publish-queue?branch=${branch}`; | ||
} | ||
|
||
module.exports = { | ||
generateBulkPublishStatusUrl, | ||
}; | ||
sunil-lakshman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.