Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b720ade
feat(profile): Implement editable-feature feature flag
pan93412 Nov 11, 2024
386dd17
feat(challenge): Implement "Hint" feature flag
pan93412 Nov 11, 2024
512262b
feat(challenge): Implement "Comment" feature flag
pan93412 Nov 11, 2024
f3c6a32
feat(profile): Implement "Editable Profile" feature flag
pan93412 Nov 11, 2024
c6e3edf
feat(challenge): Implement "Hint" feature flag
pan93412 Nov 11, 2024
ed45df5
feat(challenge): Implement "Comment" feature flag
pan93412 Nov 11, 2024
790353c
feat(comments): Disable the overview page if comment is disabled
pan93412 Nov 11, 2024
383d78f
feat(navbar): Hide comment page if "Comment" feature is disabled
pan93412 Nov 11, 2024
d4f069a
feat(challenge): Do not instruct users to comment if "Comment" is dis…
pan93412 Nov 11, 2024
27063c7
ci: Publish app-sf image for distros
pan93412 Nov 11, 2024
f295391
feat(docker): Update indexes on starting up
pan93412 Nov 11, 2024
6fb712d
chore: Disable features that is not useful for examination
pan93412 Nov 11, 2024
b6e71d5
fix(overview): Handle totalQuestions == 0 case
pan93412 Nov 11, 2024
b22e816
fix(entity): Set default value for Schema::id
pan93412 Nov 11, 2024
f59201d
fix: Add phpdocumentor/reflection-docblock
pan93412 Nov 11, 2024
8286e07
merge: Put exam patch
pan93412 Nov 12, 2024
4f7eead
fix(challenge): Prevent bloated query update AJAX
pan93412 Nov 12, 2024
6651f09
refactor(questions): Make debounce duration longer
pan93412 Nov 12, 2024
28ec249
refactor: Upgrade to dev version again
pan93412 Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- distro/*
tags:
- v*
workflow_dispatch:
Expand Down
47 changes: 34 additions & 13 deletions assets/controllers/challenge_executor_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,65 @@ import { basicSetup, EditorView } from "codemirror";

export default class extends Controller<HTMLElement> {
static values = {
modelName: String,
editorSelector: String,
submitButtonSelector: String,
};

declare modelNameValue: string;
declare editorSelectorValue: string;
declare submitButtonSelectorValue: string;

view: EditorView | undefined;
#editorView: EditorView | undefined;

async connect() {
const component = await getComponent(this.element);
const lastQuery = this.element.dataset["lastQuery"];

const modelName = this.modelNameValue;
const editorSelector = this.editorSelectorValue;

const $editor = this.element.querySelector(editorSelector);
const $editor = this.element.querySelector(this.editorSelectorValue);
if (!$editor) {
throw new Error(`Element not found: ${editorSelector}`);
throw new Error(`Element not found: ${this.editorSelectorValue}`);
}

const lastQuery = this.element.dataset["lastQuery"];
const $submitButton = this.element.querySelector(this.submitButtonSelectorValue);
if (!$submitButton || !($submitButton instanceof HTMLButtonElement)) {
throw new Error(`Element not found or not a button: ${this.submitButtonSelectorValue}`);
}

this.view = new EditorView({
// Create the code editor with the last query.
const editorView = new EditorView({
doc: lastQuery,
extensions: [
basicSetup,
sql(),
EditorView.updateListener.of((update) => {
component.set(modelName, update.state.doc.toString(), true, true);
EditorView.updateListener.of(() => {
const doc = editorView.state.doc.toString();

if (doc.trim() === "" || doc === lastQuery) {
// Disable the button if the user does not query something new.
$submitButton.disabled = true;
} else {
// Enable the button if the user types something.
$submitButton.disabled = false;
}
}),
],
parent: $editor,
});
this.#editorView = editorView;

// If the user presses the submit button, we'll send the query to the server.
$submitButton.addEventListener("click", async () => {
const query = editorView.state.doc.toString();

console.debug("Executing query", { query });
await component.action("execute", {
query,
});
});
}

disconnect() {
super.disconnect();

this.view?.destroy();
this.#editorView?.destroy();
}
}
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The web application of Database Playground.",
"type": "project",
"license": "AGPL-3.0-or-later",
"minimum-stability": "beta",
"minimum-stability": "dev",
"prefer-stable": false,
"require": {
"php": ">=8.3",
Expand All @@ -23,6 +23,7 @@
"nyholm/psr7": "dev-master",
"openai-php/client": "dev-main",
"oro/doctrine-extensions": "dev-master",
"phpdocumentor/reflection-docblock": "^5.5",
"runtime/frankenphp-symfony": "dev-main",
"sensiolabs/typescript-bundle": "dev-main",
"symfony/asset": "7.2.*",
Expand Down Expand Up @@ -62,7 +63,7 @@
"twig/extra-bundle": "3.*",
"twig/markdown-extra": "3.*",
"twig/string-extra": "3.*",
"twig/twig": "3.*"
"twig/twig": "3.14.*"
},
"config": {
"allow-plugins": {
Expand Down
Loading