-
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
1a1b96a
e345dfe
adf6040
dcd1e90
09a81de
6370c64
7d10833
87cf8c2
338f928
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 |
|---|---|---|
|
|
@@ -1388,18 +1388,6 @@ type FlatOrganizerEntry { | |
| meta: DockerContainer | ||
| } | ||
|
|
||
| type NotificationCounts { | ||
| info: Int! | ||
| warning: Int! | ||
| alert: Int! | ||
| total: Int! | ||
| } | ||
|
|
||
| type NotificationOverview { | ||
| unread: NotificationCounts! | ||
| archive: NotificationCounts! | ||
| } | ||
|
|
||
| type Notification implements Node { | ||
| id: PrefixedID! | ||
|
|
||
|
|
@@ -1427,6 +1415,37 @@ enum NotificationType { | |
| ARCHIVE | ||
| } | ||
|
|
||
| type NotificationEvent { | ||
| type: NotificationEventType! | ||
| notification: Notification | ||
| } | ||
|
|
||
| enum NotificationEventType { | ||
| ADDED | ||
| UPDATED | ||
| DELETED | ||
| CLEARED | ||
| } | ||
|
|
||
| type NotificationCounts { | ||
| info: Int! | ||
| warning: Int! | ||
| alert: Int! | ||
| total: Int! | ||
| } | ||
|
|
||
| type NotificationSettings { | ||
| position: String! | ||
| expand: Boolean! | ||
| duration: Int! | ||
| max: Int! | ||
| } | ||
|
|
||
| type NotificationOverview { | ||
| unread: NotificationCounts! | ||
| archive: NotificationCounts! | ||
| } | ||
|
|
||
| type Notifications implements Node { | ||
| id: PrefixedID! | ||
|
|
||
|
|
@@ -1438,6 +1457,7 @@ type Notifications implements Node { | |
| Deduplicated list of unread warning and alert notifications, sorted latest first. | ||
| """ | ||
| warningsAndAlerts: [Notification!]! | ||
| settings: NotificationSettings! | ||
| } | ||
|
|
||
| input NotificationFilter { | ||
|
|
@@ -2890,9 +2910,9 @@ input AccessUrlInput { | |
| } | ||
|
|
||
| type Subscription { | ||
| notificationAdded: Notification! | ||
| notificationsOverview: NotificationOverview! | ||
| notificationsWarningsAndAlerts: [Notification!]! | ||
| notificationEvent: NotificationEvent! | ||
| ownerSubscription: Owner! | ||
|
Comment on lines
2912
to
2916
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify no remaining clients still use the old subscription field.
rg -n --hidden -S '\bnotificationAdded\b' .
rg -n --hidden -S '\bNotificationAddedSub\b' .Repository: unraid/api Length of output: 4407 🏁 Script executed: #!/bin/bash
# Check for actual usage of NotificationAddedSub in Vue/component files
rg -n 'NotificationAddedSub' web --type vue --type ts --type js -A 2
# Check if these are generated files (look for generation comments)
head -20 web/composables/gql/graphql.tsRepository: unraid/api Length of output: 1369 🏁 Script executed: #!/bin/bash
# Search for actual usage of NotificationAddedSub in web components
rg -n 'NotificationAddedSub' web --type ts --type js -B 2 -A 2
# Also check for usage in .vue files directly
rg -n 'NotificationAddedSub' webRepository: unraid/api Length of output: 12592 🏁 Script executed: #!/bin/bash
# Search for actual component imports of the old subscription
rg -n 'NotificationAddedSubDocument' web --type ts --type js
# Also search for imports from graphql.ts or gql.ts
rg -n 'import.*notificationAdded' web --type ts --type jsRepository: unraid/api Length of output: 1765 🏁 Script executed: #!/bin/bash
# Search for subscription usage in components - look for useSubscription or subscription patterns
rg -n 'useSubscription\|graphql\(' web -A 3 --type ts --type js | head -100
# Also check if there's any notification-related subscription in components
rg -n 'notificationEvent\|notificationsOverview\|notificationsWarningsAndAlerts' web --type ts --type js | head -50Repository: unraid/api Length of output: 36 🏁 Script executed: #!/bin/bash
# Find GraphQL query/subscription files
find web -name "*.graphql" -o -name "*.gql" | head -20
# Also check composables directory structure
ls -la web/composables/
# Search for any Vue files that might use subscriptions
find web -name "*.vue" -type f | head -20Repository: unraid/api Length of output: 1112 🏁 Script executed: #!/bin/bash
# Find Notification-related Vue components
find web -name "*otification*.vue" -type f
# Also search for components that might use notification subscriptions
rg -l 'notification' web/src/components --type vue -i | head -20Repository: unraid/api Length of output: 168 🏁 Script executed: #!/bin/bash
# Search for notification-related Vue components
find web -name "*otification*.vue" -o -name "*otification*.ts"
# Check the CriticalNotifications component
cat -n web/src/components/Notifications/CriticalNotifications.standalone.vue | head -100Repository: unraid/api Length of output: 4244 🏁 Script executed: #!/bin/bash
# Check the subscription file
cat -n web/src/components/Notifications/graphql/notification.subscription.tsRepository: unraid/api Length of output: 1030 Breaking change confirmed: The old To maintain backward compatibility with external clients, consider adding 🤖 Prompt for AI Agents |
||
| serversSubscription: Server! | ||
| parityHistorySubscription: ParityCheck! | ||
|
|
||
| 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 |
||||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| /** | ||||||||||||||||
|
|
||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.