-
Notifications
You must be signed in to change notification settings - Fork 16
fix: notification display and functionality + nuxtui refactor #1860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d07aa42
a32dd21
29312d7
a8459c7
7679d71
e80ea79
88766ad
4798c89
80bbf2d
9f27eb7
1000976
c21ecc7
67ac307
be1e2f5
fe74e53
f690c23
f7fe959
875aa09
6a04a06
e3bf571
2122e6d
ddd6b0b
4a19d4d
4c42b4b
53ee465
6458457
d10e054
fd1a046
7969e44
e61657c
c18de73
ad78a02
c2d2fbe
e817d6a
4abc79a
17f0176
4c49baf
1e5decc
88e76d7
a8578bf
3c9c04d
5628bf9
2f88228
902307a
b456678
716789f
8ef00ce
9ed71e5
ad2a5cc
443335e
00f015f
1c4f33e
b0ff85b
9504b4a
18f3227
bff05e0
86ec429
4ee5506
f23e5bc
41aa09f
736c24c
e140863
aa2c6eb
eae2651
d8f3e92
de860cb
acb5427
2b0f8d0
41ae0e2
6a088db
33d32ff
0858b4f
c14237d
82b6819
c93d4f2
5c742e4
7d39b78
265a407
197213a
933d341
ac03da2
f748f5a
e9b53c8
11bfdc3
95de2e4
07cbde3
89ad63a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "files.associations": { | ||
| "*.page": "php" | ||
| }, | ||
| "intelephense.format.enable": false, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,4 +86,4 @@ unraid-sso-button.unapi { | |
| --text-7xl: 4.5rem; | ||
| --text-8xl: 6rem; | ||
| --text-9xl: 8rem; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,4 +65,4 @@ | |
| /* Dark Mode Overrides */ | ||
| .dark { | ||
| --color-border: #383735; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,5 @@ | |
| "extraOrigins": [], | ||
| "sandbox": true, | ||
| "ssoSubIds": [], | ||
| "plugins": [ | ||
| "unraid-api-plugin-connect" | ||
| ] | ||
| "plugins": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -39,13 +39,15 @@ | |||||
| "// Testing": "", | ||||||
| "test": "NODE_ENV=test vitest run", | ||||||
| "test:watch": "NODE_ENV=test vitest --ui", | ||||||
| "test:modifications:update": "rm -rf src/unraid-api/unraid-file-modifier/modifications/__test__/__fixtures__/downloaded src/unraid-api/unraid-file-modifier/modifications/patches /Users/ajitmehrotra/Projects/Unraid/api/api/src/unraid-api/unraid-file-modifier/modifications/__test__/snapshots && NODE_ENV=test vitest run src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts -u", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Remove hardcoded absolute path from script. The script contains a hardcoded absolute path 🔎 Proposed fix- "test:modifications:update": "rm -rf src/unraid-api/unraid-file-modifier/modifications/__test__/__fixtures__/downloaded src/unraid-api/unraid-file-modifier/modifications/patches /Users/ajitmehrotra/Projects/Unraid/api/api/src/unraid-api/unraid-file-modifier/modifications/__test__/snapshots && NODE_ENV=test vitest run src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts -u",
+ "test:modifications:update": "rm -rf src/unraid-api/unraid-file-modifier/modifications/__test__/__fixtures__/downloaded src/unraid-api/unraid-file-modifier/modifications/patches src/unraid-api/unraid-file-modifier/modifications/__test__/snapshots && NODE_ENV=test vitest run src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts -u",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| "coverage": "NODE_ENV=test vitest run --coverage", | ||||||
| "// Docker": "", | ||||||
| "container:build": "./scripts/dc.sh build dev", | ||||||
| "container:start": "pnpm run container:stop && ./scripts/dc.sh run --rm --service-ports dev", | ||||||
| "container:stop": "./scripts/dc.sh stop dev", | ||||||
| "container:test": "./scripts/dc.sh run --rm builder pnpm run test", | ||||||
| "container:enter": "./scripts/dc.sh exec dev /bin/bash", | ||||||
| "docker:build-and-run": "pnpm --filter @unraid/connect-plugin docker:build-and-run", | ||||||
| "// Migration Scripts": "", | ||||||
| "migration:codefirst": "tsx ./src/unraid-api/graph/migration-script.ts" | ||||||
| }, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,21 +29,25 @@ export const loadApiConfig = async () => { | |||||||||||||||
| const defaultConfig = createDefaultConfig(); | ||||||||||||||||
| const apiHandler = new ApiConfigPersistence(new ConfigService()).getFileHandler(); | ||||||||||||||||
|
|
||||||||||||||||
| const diskConfig: Partial<ApiConfig> = await apiHandler.loadConfig(); | ||||||||||||||||
| // Hack: cleanup stale connect plugin entry if necessary | ||||||||||||||||
| if (!isConnectPluginInstalled()) { | ||||||||||||||||
| diskConfig.plugins = diskConfig.plugins?.filter( | ||||||||||||||||
| (plugin) => plugin !== 'unraid-api-plugin-connect' | ||||||||||||||||
| ); | ||||||||||||||||
| await apiHandler.writeConfigFile(diskConfig as ApiConfig); | ||||||||||||||||
| } | ||||||||||||||||
| try { | ||||||||||||||||
| const diskConfig: Partial<ApiConfig> = await apiHandler.loadConfig(); | ||||||||||||||||
| // Hack: cleanup stale connect plugin entry if necessary | ||||||||||||||||
| if (!isConnectPluginInstalled() && diskConfig.plugins) { | ||||||||||||||||
| diskConfig.plugins = diskConfig.plugins?.filter( | ||||||||||||||||
| (plugin) => plugin !== 'unraid-api-plugin-connect' | ||||||||||||||||
| ); | ||||||||||||||||
| await apiHandler.writeConfigFile(diskConfig as ApiConfig); | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsafe type cast from Partial to ApiConfig. The cast assumes Consider either:
🔎 Proposed fix if (!isConnectPluginInstalled() && diskConfig.plugins) {
diskConfig.plugins = diskConfig.plugins.filter(
(plugin) => plugin !== 'unraid-api-plugin-connect'
);
- await apiHandler.writeConfigFile(diskConfig as ApiConfig);
+
+ const configToWrite: ApiConfig = {
+ ...defaultConfig,
+ ...diskConfig,
+ version: API_VERSION,
+ };
+ await apiHandler.writeConfigFile(configToWrite);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| return { | ||||||||||||||||
| ...defaultConfig, | ||||||||||||||||
| ...diskConfig, | ||||||||||||||||
| // diskConfig's version may be older, but we still want to use the correct version | ||||||||||||||||
| version: API_VERSION, | ||||||||||||||||
| }; | ||||||||||||||||
| return { | ||||||||||||||||
| ...defaultConfig, | ||||||||||||||||
| ...diskConfig, | ||||||||||||||||
| // diskConfig's version may be older, but we still want to use the correct version | ||||||||||||||||
| version: API_VERSION, | ||||||||||||||||
| }; | ||||||||||||||||
| } catch (e) { | ||||||||||||||||
| return defaultConfig; | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+32
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error logging and improve error handling. The try/catch block silently swallows all errors and returns the default config. While graceful degradation is appropriate per the learnings about Unraid API handling missing configs, errors should be logged for debugging and operational visibility. Additionally, the 🔎 Proposed fix try {
const diskConfig: Partial<ApiConfig> = await apiHandler.loadConfig();
- // Hack: cleanup stale connect plugin entry if necessary
- if (!isConnectPluginInstalled() && diskConfig.plugins) {
- diskConfig.plugins = diskConfig.plugins?.filter(
- (plugin) => plugin !== 'unraid-api-plugin-connect'
- );
- await apiHandler.writeConfigFile(diskConfig as ApiConfig);
+
+ if (!isConnectPluginInstalled() && diskConfig.plugins) {
+ diskConfig.plugins = diskConfig.plugins.filter(
+ (plugin) => plugin !== 'unraid-api-plugin-connect'
+ );
+
+ try {
+ await apiHandler.writeConfigFile(diskConfig as ApiConfig);
+ } catch (writeError) {
+ console.error('Failed to write cleaned config, proceeding with loaded config:', writeError);
+ }
}
return {
...defaultConfig,
...diskConfig,
- // diskConfig's version may be older, but we still want to use the correct version
version: API_VERSION,
};
} catch (e) {
+ console.error('Failed to load API config, using defaults:', e);
return defaultConfig;
}Based on learnings, the Unraid API handles missing configs gracefully with fallbacks. 🤖 Prompt for AI Agents |
||||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| /** | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const DOCKER_SERVICE_TOKEN = Symbol('DOCKER_SERVICE'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing comma in JSON object.
The JSON file has a syntax error: a trailing comma after
"intelephense.format.enable": false,before the closing brace. JSON does not permit trailing commas, and this will cause VS Code to fail parsing the settings file.🔎 Proposed fix
{ "files.associations": { "*.page": "php" }, - "intelephense.format.enable": false, + "intelephense.format.enable": false }📝 Committable suggestion
🧰 Tools
🪛 Biome (2.1.2)
[error] 5-6: Expected a property but instead found '}'.
Expected a property here.
(parse)
🤖 Prompt for AI Agents