Skip to content

Commit

Permalink
Revert "Minor web page changes"
Browse files Browse the repository at this point in the history
This reverts commit fd3c7bd.
  • Loading branch information
geir-eilertsen committed Dec 27, 2024
1 parent fd3c7bd commit fcabcca
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 29 deletions.
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ services:
- 9090:9090
restart: no
environment:
EXTERNAL_ADDRESS: http://localhost:9090
OPENHAB_URL: http://openhab:8080
OPENHAB_USERNAME: $OPENHAB_USERNAME
OPENHAB_PASSWORD: $OPENHAB_PASSWORD
Expand All @@ -62,9 +61,8 @@ services:
OPENAI_APIKEY: $OPENAI_APIKEY
GITHUB_CLIENT_ID: $GITHUB_CLIENT_ID
GITHUB_CLIENT_SECRET: $GITHUB_CLIENT_SECRET
GOOGLE_CLIENT_ID: $GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET: $GOOGLE_CLIENT_SECRET
VECTORDB_ADDRESS: cassandra:9042
SPRING_PROFILES_ACTIVE: teach
volumes:
- /home/cnb:/home/cnb
networks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http, OAuth2UserServ
http.authorizeHttpRequests((requests) -> requests
.requestMatchers("/", "/whatsapp", "/error", "/webjars").permitAll()
.anyRequest().authenticated())
.formLogin(form -> form
.loginPage("/index.html") // Specify your custom login page URL
.defaultSuccessUrl("/index.html", true) // Redirect after successful login
.permitAll()
)
.logout(logout -> logout.logoutSuccessUrl("/").permitAll())
.oauth2Login(oauth -> oauth.userInfoEndpoint(userInfo -> userInfo.userService(userService)))
.csrf(AbstractHttpConfigurer::disable);
Expand Down
16 changes: 5 additions & 11 deletions marvin.interaction.web/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" type="text/css" href="/webjars/bootstrap/css/bootstrap.min.css"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script type="text/javascript" src="/webjars/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/webjars/bootstrap/js/bootstrap.min.js"></script>
Expand All @@ -24,17 +23,12 @@
<title>Chat with Marvin</title>
</head>
<body>

<div class="container unauthenticated" style="display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 40px; text-align: center; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 10px;">
<h2>Welcome! Please Log In</h2>
<p style="color: #666;">Access Marvin by logging in with your preferred method below.</p>
<div style="display: flex; align-items: center; gap: 10px;">
<i class="fab fa-github" style="font-size: 24px; color: #333;"></i>
<a href="/oauth2/authorization/github" class="btn btn-dark">Login with GitHub</a>
<div class="container unauthenticated">
<div>
With GitHub: <a href="/oauth2/authorization/github">click here</a>
</div>
<div style="display: flex; align-items: center; gap: 10px;">
<i class="fab fa-google" style="font-size: 24px; color: #db4437;"></i>
<a href="/oauth2/authorization/google" class="btn btn-danger">Login with Google</a>
<div>
With Google: <a href="/oauth2/authorization/google">click here</a>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
package com.assetvisor.marvin.robot.domain.communication;

import java.time.LocalDateTime;

public abstract class Message {

private final String sender;
private final LocalDateTime timestamp;


public Message(String sender) {
this.sender = sender;
this.timestamp = LocalDateTime.now();
}

public String getSender() {
return sender;
}

public LocalDateTime getTimestamp() {
return timestamp;
}

@Override
public boolean equals(Object o) {
if (!(o instanceof Message message)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.assetvisor.marvin.robot.domain.environment;

import com.assetvisor.marvin.robot.domain.communication.Message;
import java.time.LocalDateTime;
import java.util.Objects;

public final class Observation extends Message {
Expand All @@ -9,18 +10,20 @@ public final class Observation extends Message {
private final String value;
private final String oldValue;
private final String description;
private LocalDateTime timestamp;

public Observation(String sender, String itemId, String value, String oldValue, String description) {
super(sender);
this.itemId = itemId;
this.value = value;
this.oldValue = oldValue;
this.description = description;
this.timestamp = LocalDateTime.now();
}

@Override
public String toString() {
return "Item: " + itemId + " changed value from " + oldValue + " to " + value + " at " + getTimestamp();
return "Item: " + itemId + " changed value from " + oldValue + " to " + value + " - " + description;
}

public String itemId() {
Expand All @@ -39,6 +42,10 @@ public String description() {
return description;
}

public LocalDateTime timestamp() {
return timestamp;
}

@Override
public boolean equals(Object obj) {
if (obj == this) {
Expand Down

0 comments on commit fcabcca

Please sign in to comment.