Skip to content

Feature/finished/iia 2353 retrieve list of author concepts to select during login to komet#657

Merged
swaroopsalvi merged 11 commits intoikmdev:mainfrom
swaroopsalvi:feature/finished/IIA-2353-Retrieve-list-of-Author-Concepts-to-select-during-login-to-Komet
Aug 19, 2025
Merged

Feature/finished/iia 2353 retrieve list of author concepts to select during login to komet#657
swaroopsalvi merged 11 commits intoikmdev:mainfrom
swaroopsalvi:feature/finished/IIA-2353-Retrieve-list-of-Author-Concepts-to-select-during-login-to-Komet

Conversation

@swaroopsalvi
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a login author feature that allows users to select from a list of author concepts during login to Komet. The implementation replaces a mock user selection system with a dynamic retrieval of author concepts from the system.

  • Replaces hardcoded fake users with dynamic retrieval of author concepts from the USER concept hierarchy
  • Implements proper MVVM pattern for the login author functionality with validation
  • Updates UI event handlers from signupAction to signInAction for consistency

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
JournalWindowPreferences.java Adds constant for author login window preferences
loginAuthor.fxml Updates action method names from signup to sign-in for consistency
LoginAuthorViewModel.java New view model implementing validation and data binding for author login
LoginAuthorController.java Refactored to use MVVM pattern with dynamic author concept retrieval
AppPages.java Updated to use proper MVVM loader and pass view properties to login controller

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…st-of-Author-Concepts-to-select-during-login-to-Komet
public static final String AUTHORS = "authors";
public static final String SELECTED_AUTHOR = "selected-author";
public static final String LOGIN_ERROR = "login-error";
public static final String PASSWORD = "password";
Copy link
Contributor

@carldea carldea Aug 18, 2025

Choose a reason for hiding this comment

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

Can you make an enum here?

   public enum LoginProperties {
          AUTHORS("authors"), 
          SELECTED_AUTHOR("selected author"),
          ...
          
        public final String name;
        LoginProperties(String name){
            this.name = name;
        }
        LoginProperties(){
            this.name = this.name();
        }
   }

Please create a constructor to add a friendly name. An example is shown here:
https://github.com/carldea/cognitive/blob/main/src/test/java/org/carlfx/cognitive/test/demo/AccountViewModel.java#L33-L50
Friendly error messages used in validation messages can use string interpolation if needed.
For example: validationResult.error("${%s} first character must be upper case.".formatted(FIRST_NAME));

.addProperty(PASSWORD, "")
.addProperty(LOGIN_ERROR, "");

addValidator(SELECTED_AUTHOR, "selected-author", (ReadOnlyObjectProperty prop, ValidationResult validationResult, ViewModel viewModel) -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the second parameter make use of the enum for SELECTED_AUTHOR.name()?


passwordTextField.setVisible(false);
loginButton.setDisable(true);
loginErrorLabel.textProperty().bindBidirectional(loginAuthorViewModel.getProperty(LOGIN_ERROR));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just do a unidirectional bind?

passwordField.textProperty().bindBidirectional(loginAuthorViewModel.getProperty(PASSWORD));

passwordTextField.setVisible(false);
loginButton.setDisable(true);
Copy link
Contributor

@carldea carldea Aug 19, 2025

Choose a reason for hiding this comment

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

Can we bind disableProperty() to view model's is

loginButton.disableProperty().bind(loginAuthorViewModel.invalidProperty());


userChooser.valueProperty().bindBidirectional(loginAuthorViewModel.getProperty(SELECTED_AUTHOR));
passwordField.textProperty().bindBidirectional(loginAuthorViewModel.getProperty(PASSWORD));

Copy link
Contributor

@carldea carldea Aug 19, 2025

Choose a reason for hiding this comment

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

Can we add the following?

loginAuthorViewModel.doOnChange(()->{
   loginAuthorViewModel.validate();
}, SELECTED_AUTHOR, PASSWORD);

A view model contain validators will be update the validation messages.
Assuming the submit or login button is bound to the view model's invalidProperty().

Copy link
Contributor

@carldea carldea left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@swaroopsalvi swaroopsalvi merged commit 6a54a4d into ikmdev:main Aug 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants