-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Servers console performance improvements (#3007)
* feat: init selecting paper+purpur on purchase flow Signed-off-by: Evan Song <theevansong@gmail.com> * feat: properly implement Paper/Purpur in Platform Signed-off-by: Evan Song <theevansong@gmail.com> * chore: correct wording Signed-off-by: Evan Song <theevansong@gmail.com> * feat: redo platform modal Signed-off-by: Evan Song <theevansong@gmail.com> * Switch to HCaptcha for Auth-related captchas (#2945) * Switch to HCaptcha for Auth-related captchas * run fmt * fix hcaptcha not loading * fix: more robust loader dropdown logic Signed-off-by: Evan Song <theevansong@gmail.com> * fix: handle "not yet supported" install err Signed-off-by: Evan Song <theevansong@gmail.com> * chore: fix icon kerfuffles Signed-off-by: Evan Song <theevansong@gmail.com> * chore: improve vanilla install modal title Signed-off-by: Evan Song <theevansong@gmail.com> * fix: spacing Signed-off-by: Evan Song <theevansong@gmail.com> * feat: usePyroConsole store instead of passing a prop to prevent bulk panel refreshing * chore: improve no loader state Signed-off-by: Evan Song <theevansong@gmail.com> * fix: type error Signed-off-by: Evan Song <theevansong@gmail.com> * chore: adjust mod version modal title Signed-off-by: Evan Song <theevansong@gmail.com> * chore: adjust modpack warning copy Signed-off-by: Evan Song <theevansong@gmail.com> * feat: vanilla empty state in content page Signed-off-by: Evan Song <theevansong@gmail.com> * chore: adjust copy Signed-off-by: Evan Song <theevansong@gmail.com> * chore: update icon Signed-off-by: Evan Song <theevansong@gmail.com> * fix: loader type Signed-off-by: Evan Song <theevansong@gmail.com> * fix: loader type Signed-off-by: Evan Song <theevansong@gmail.com> * feat: always show dropdown if possible Signed-off-by: Evan Song <theevansong@gmail.com> * chore: improve spacing Signed-off-by: Evan Song <theevansong@gmail.com> * chore: appear disabled Signed-off-by: Evan Song <theevansong@gmail.com> * h Signed-off-by: Evan Song <theevansong@gmail.com> * chore: if reinstalling, show it on the modal title Signed-off-by: Evan Song <theevansong@gmail.com> * feat: put it in the dropdown, they said Signed-off-by: Evan Song <theevansong@gmail.com> * chore: adjust style Signed-off-by: Evan Song <theevansong@gmail.com> * chore: sort paper-purpur versions desc Signed-off-by: Evan Song <theevansong@gmail.com> * fix: do not consider backup limit in reinstall prompt Signed-off-by: Evan Song <theevansong@gmail.com> * feat: backup locking, plugin support * fix: content type error Signed-off-by: Evan Song <theevansong@gmail.com> * fix: casing Signed-off-by: Evan Song <theevansong@gmail.com> * fix: plugins pt 2 * feat: backups, mrpack * fix: type errors come on Signed-off-by: Evan Song <theevansong@gmail.com> * fix: spacing Signed-off-by: Evan Song <theevansong@gmail.com> * fix: type maxing * chore: show copy button on allocation rows Signed-off-by: Evan Song <theevansong@gmail.com> * feat: suspend improvement --------- Signed-off-by: Evan Song <theevansong@gmail.com> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: TheWander02 <48934424+thewander02@users.noreply.github.com>
- Loading branch information
1 parent
742c0ed
commit 6ec1dcf
Showing
4 changed files
with
89 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { createGlobalState } from "@vueuse/core"; | ||
import { type Ref, ref } from "vue"; | ||
|
||
/** | ||
* Maximum number of console output lines to store | ||
* @type {number} | ||
*/ | ||
const maxLines = 5000; | ||
|
||
/** | ||
* Provides a global console output state management system | ||
* Allows adding, storing, and clearing console output with a maximum line limit | ||
* | ||
* @returns {Object} Console state management methods and reactive state | ||
* @property {Ref<string[]>} consoleOutput - Reactive array of console output lines | ||
* @property {function(string): void} addConsoleOutput - Method to add a new console output line | ||
* @property {function(): void} clear - Method to clear all console output | ||
*/ | ||
export const usePyroConsole = createGlobalState(() => { | ||
/** | ||
* Reactive array storing console output lines | ||
* @type {Ref<string[]>} | ||
*/ | ||
const output: Ref<string[]> = ref<string[]>([]); | ||
|
||
/** | ||
* Adds a new output line to the console output | ||
* Automatically removes the oldest line if max output is exceeded | ||
* | ||
* @param {string} line - The console output line to add | ||
*/ | ||
const addLine = (line: string): void => { | ||
output.value.push(line); | ||
|
||
if (output.value.length > maxLines) { | ||
output.value.shift(); | ||
} | ||
}; | ||
|
||
/** | ||
* Adds multiple output lines to the console output | ||
* Automatically removes the oldest lines if max output is exceeded | ||
* | ||
* @param {string[]} lines - The console output lines to add | ||
* @returns {void} | ||
*/ | ||
const addLines = (lines: string[]): void => { | ||
output.value.push(...lines); | ||
|
||
if (output.value.length > maxLines) { | ||
output.value.splice(0, output.value.length - maxLines); | ||
} | ||
}; | ||
|
||
/** | ||
* Clears all console output lines | ||
*/ | ||
const clear = (): void => { | ||
output.value = []; | ||
}; | ||
|
||
return { | ||
output, | ||
addLine, | ||
addLines, | ||
clear, | ||
}; | ||
}); |