Adapters
Bot-2 / AndrewCruz
DaddyAloha's picture
Create AndrewCruz
dfa7b9e verified
raw
history blame
3.62 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quantum Systems Terminal</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal/css/jquery.terminal.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal/js/jquery.terminal.min.js"></script>
<style>
body {
margin: 0;
background: black;
color: green;
}
#terminal {
height: 100vh;
}
</style>
</head>
<body>
<div id="terminal"></div>
<script>
$(function () {
const keycloakConfig = {
tokenStore: "session", // Default value
proxyUrl: null,
print: function () {
return `Current Keycloak Configuration:
- Token Store: ${this.tokenStore}
- Proxy URL: ${this.proxyUrl || "Not Set"}`;
}
};
// Initialize the terminal
const terminal = $('#terminal').terminal({
// Echo Command
echo: function (...args) {
this.echo(`[[;cyan;]${args.join(' ')}]`);
},
// Simulate Quantum Operation
quantum: function (operation) {
if (!operation) {
this.echo("[[;red;]Error: Please specify a quantum operation (e.g., QAOA, QSVC).]");
return;
}
this.echo(`[[;yellow;]Simulating quantum operation: ${operation}]`);
this.pause();
setTimeout(() => {
this.echo(`[[;green;]Quantum ${operation} completed successfully.]`);
this.resume();
}, 2000);
},
// Configure Keycloak
configure_keycloak: function (option, value) {
if (!option || !value) {
this.echo("[[;red;]Error: Please provide a configuration option and value.]");
return;
}
if (keycloakConfig.hasOwnProperty(option)) {
keycloakConfig[option] = value;
this.echo(`[[;green;]Keycloak ${option} set to: ${value}]`);
} else {
this.echo(`[[;red;]Error: Unknown Keycloak configuration option '${option}']`);
}
},
// Print Keycloak Configuration
keycloak_status: function () {
this.echo(`[[;yellow;]${keycloakConfig.print()}]`);
},
// Help Command
help: function () {
this.echo(`
[[;yellow;]Available Commands:]
- echo <text> : Echoes back the input text
- quantum <operation> : Simulates a quantum operation (e.g., QAOA, QSVC)
- configure_keycloak <key> <value> : Configures Keycloak adapter (e.g., tokenStore, proxyUrl)
- keycloak_status : Prints the current Keycloak configuration
- help : Displays this help menu
`);
}
}, {
greetings: '[[;yellow;]Welcome to the Quantum Systems Terminal]',
name: 'quantum_terminal',
prompt: '>> '
});
});
</script>
</body>
</html>