Skip to content

Commit

Permalink
feat: create a login options screen
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This introduces a new authentication system
  • Loading branch information
nickchecan committed Jan 15, 2025
1 parent aba7a8a commit 7079701
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryResourceGroup;
import com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryServiceKey;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.LoginOptionsPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondLoginWizardPage;

/**
Expand Down Expand Up @@ -42,7 +43,7 @@ public class LoginWizard extends Wizard {
public LoginWizard(final Browser browser) {
this.browser = browser;

setWindowTitle("Login to SAP AI Core");
setWindowTitle("AI Provider Setup");
loginClient = createLoginClient();
}

Expand All @@ -57,6 +58,7 @@ public LoginWizard(final Browser browser) {
*/
@Override
public void addPages() {
addPage(new LoginOptionsPage());
addPage(new FirstLoginWizardPage(loginClient));
addPage(new SecondLoginWizardPage(loginClient, TemporaryMemoryResourceGroup.getInstance(), TemporaryMemoryDeployment.getInstance()));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.developer.nefarious.zjoule.plugin.login.pages;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

public class LoginOptionsPage extends WizardPage {

public static final String PAGE_ID = "Login Options";

public LoginOptionsPage() {
super(PAGE_ID);
setTitle("Login Options");
setDescription("Choose the AI provider.");
setPageComplete(false); // Initially set the page as incomplete
}

@Override
public void createControl(final Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, false));

Button option1 = new Button(container, SWT.RADIO);
option1.setText("SAP AI Core");
option1.setToolTipText("Select model from the SAP AI Core Generative AI Hub.");
option1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
option1.addListener(SWT.Selection, event -> setOption1());

Button option2 = new Button(container, SWT.RADIO);
option2.setText("Ollama (Local)");
option2.setToolTipText("Select a local Ollama model.");
option2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
option2.addListener(SWT.Selection, event -> setOption2());

setControl(container);
}

private void setOption1() {
setPageComplete(true);
}

private void setOption2() {
setPageComplete(true);
}

}

0 comments on commit 7079701

Please sign in to comment.