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

feat: Add prompting code of Adaptation Project generator #2169

Open
wants to merge 187 commits into
base: main
Choose a base branch
from

Conversation

nikmace
Copy link
Contributor

@nikmace nikmace commented Jul 16, 2024

Feat for #2162.

  • Moves prompting for Adaptation Project generator.
  • Enhances CLI prompting.

@nikmace nikmace added feature New feature or request adp-tooling labels Jul 16, 2024
@nikmace nikmace self-assigned this Jul 16, 2024
Copy link

changeset-bot bot commented Jul 16, 2024

🦋 Changeset detected

Latest commit: eb5f8a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@sap-ux/environment-check Minor
@sap-ux/axios-extension Minor
@sap-ux/adp-tooling Minor
@sap-ux/create Minor
@sap-ux/abap-deploy-config-inquirer Patch
@sap-ux/app-config-writer Patch
@sap-ux/backend-proxy-middleware Patch
@sap-ux/deploy-tooling Patch
@sap-ux/odata-service-inquirer Patch
@sap-ux/preview-middleware Patch
@sap-ux/system-access Patch
@sap-ux/odata-cli Patch
@sap-ux/generator-simple-fe Patch
@sap-ux/cap-config-writer Patch
@sap-ux/abap-deploy-config-writer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

*
* @returns {boolean} - if provider is connected to ABAP system.
*/
public getIsConnected(): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this wrapper? wouldn't be a getter/setter a nicer option if it is just about preventing it to be changed from the outside? If you really need this function then please rename it to isConnected and the variable to connected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d4795dc

if (manifest['sap.ovp']) {
return ApplicationType.FIORI_ELEMENTS_OVP;
} else if (hasSmartTemplateId || isSmartTemplate) {
return ApplicationType.FIORI_ELEMENTS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not catching Fiori elements for OData v4 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to differentiate between fiori elements v2 or v4, we don't have such logic which relies on that.

* - If none of these conditions are met, the function defaults to categorizing the application as Free Style.
* - If the manifest is empty, it returns None.
*/
export function getApplicationType(manifest: Manifest): ApplicationType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we actually need the application type? I thought that was something we removed from the templates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check the type because we need to see if the Adaptation Project supports it. These are supported:
FIORI_ELEMENTS = 'FioriElements',
FIORI_ELEMENTS_OVP = 'FioriElementsOVP',
FREE_STYLE = 'FreeStyle'
If it is something else we return an error stating that: ... Adaptation project doesn't support the selected application.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You return one of these three if Object.keys(manifest).length > 0, so technically, you validations just checks if the manifest is neither undefined nor {}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed this check for a valid application type here 3bb3bc6#diff-034445208bf7ca40b734423c5cf343d6d0a4761a4b55cee844776b5458a1c9a0L86-L102.

But since this is used in the writing part we did not remove the method. It is used in a method that builds the descriptor content: createDescriptorChangeForResourceModel.

*/
private constructor(private logger: ToolsLogger) {
this.endpoints = [];
this.isExtensionInstalled = isExtensionInstalledVsCode('sapse.sap-ux-application-modeler-extension');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the extension sapse.sap-ux-application-modeler-extension is not a pre-requisite here. The extension allows modifying the stored systems, however, the systems itself are stored in the OS secure storage and can be added/manipulated with other tools as well, therefore, please remove that check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we need to check whether OS secure storage exists? Otherwise, if it doesn't, then how can we understand what prompts to show. If it exists then we need a list prompt with all the systems. If it doesn't exist then we show input prompts for system, client, username and password.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just call the store module and ask it for a list of systems. If at least one is returned you are good to go would be an option. The better option is that to reuse the functionality that is currently being implemented in the odata-service-inquirer because that one always offers a new system choice that then triggers the system creation prompts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ad544c4

Copy link

sonarcloud bot commented Aug 26, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
61.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adp-tooling axios-extension @sap-ux/axios-extension create @sap-ux/create environment-check @sap-ux/environment-check feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants