diff --git a/.gitignore b/.gitignore index 8449fad731..96417168a3 100644 --- a/.gitignore +++ b/.gitignore @@ -122,7 +122,10 @@ api/dev/Unraid.net/myservers.cfg # local Mise settings .mise.toml +mise.toml # Compiled test pages (generated from Nunjucks templates) web/public/test-pages/*.html +# local scripts for testing and development +.dev-scripts/ diff --git a/api/generated-schema.graphql b/api/generated-schema.graphql index d76c616aa7..01946674fb 100644 --- a/api/generated-schema.graphql +++ b/api/generated-schema.graphql @@ -2,42 +2,66 @@ # THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) # ------------------------------------------------------ -"""Directive to document required permissions for fields""" +""" +Directive to document required permissions for fields +""" directive @usePermissions( - """The action required for access (must be a valid AuthAction enum value)""" - action: String - - """The resource required for access (must be a valid Resource enum value)""" - resource: String + """ + The action required for access (must be a valid AuthAction enum value) + """ + action: String + + """ + The resource required for access (must be a valid Resource enum value) + """ + resource: String ) on FIELD_DEFINITION type ParityCheck { - """Date of the parity check""" - date: DateTime - - """Duration of the parity check in seconds""" - duration: Int - - """Speed of the parity check, in MB/s""" - speed: String - - """Status of the parity check""" - status: ParityCheckStatus! - - """Number of errors during the parity check""" - errors: Int - - """Progress percentage of the parity check""" - progress: Int - - """Whether corrections are being written to parity""" - correcting: Boolean - - """Whether the parity check is paused""" - paused: Boolean - - """Whether the parity check is running""" - running: Boolean + """ + Date of the parity check + """ + date: DateTime + + """ + Duration of the parity check in seconds + """ + duration: Int + + """ + Speed of the parity check, in MB/s + """ + speed: String + + """ + Status of the parity check + """ + status: ParityCheckStatus! + + """ + Number of errors during the parity check + """ + errors: Int + + """ + Progress percentage of the parity check + """ + progress: Int + + """ + Whether corrections are being written to parity + """ + correcting: Boolean + + """ + Whether the parity check is paused + """ + paused: Boolean + + """ + Whether the parity check is running + """ + running: Boolean } """ @@ -46,106 +70,144 @@ A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date scalar DateTime enum ParityCheckStatus { - NEVER_RUN - RUNNING - PAUSED - COMPLETED - CANCELLED - FAILED + NEVER_RUN + RUNNING + PAUSED + COMPLETED + CANCELLED + FAILED } type Capacity { - """Free capacity""" - free: String! + """ + Free capacity + """ + free: String! - """Used capacity""" - used: String! + """ + Used capacity + """ + used: String! - """Total capacity""" - total: String! + """ + Total capacity + """ + total: String! } type ArrayCapacity { - """Capacity in kilobytes""" - kilobytes: Capacity! + """ + Capacity in kilobytes + """ + kilobytes: Capacity! - """Capacity in number of disks""" - disks: Capacity! + """ + Capacity in number of disks + """ + disks: Capacity! } type ArrayDisk implements Node { - id: PrefixedID! - - """ - Array slot number. Parity1 is always 0 and Parity2 is always 29. Array slots will be 1 - 28. Cache slots are 30 - 53. Flash is 54. - """ - idx: Int! - name: String - device: String - - """(KB) Disk Size total""" - size: BigInt - status: ArrayDiskStatus - - """Is the disk a HDD or SSD.""" - rotational: Boolean - - """Disk temp - will be NaN if array is not started or DISK_NP""" - temp: Int - - """ - Count of I/O read requests sent to the device I/O drivers. These statistics may be cleared at any time. - """ - numReads: BigInt - - """ - Count of I/O writes requests sent to the device I/O drivers. These statistics may be cleared at any time. - """ - numWrites: BigInt - - """ - Number of unrecoverable errors reported by the device I/O drivers. Missing data due to unrecoverable array read errors is filled in on-the-fly using parity reconstruct (and we attempt to write this data back to the sector(s) which failed). Any unrecoverable write error results in disabling the disk. - """ - numErrors: BigInt - - """(KB) Total Size of the FS (Not present on Parity type drive)""" - fsSize: BigInt - - """(KB) Free Size on the FS (Not present on Parity type drive)""" - fsFree: BigInt - - """(KB) Used Size on the FS (Not present on Parity type drive)""" - fsUsed: BigInt - exportable: Boolean - - """Type of Disk - used to differentiate Cache / Flash / Array / Parity""" - type: ArrayDiskType! - - """(%) Disk space left to warn""" - warning: Int - - """(%) Disk space left for critical""" - critical: Int - - """File system type for the disk""" - fsType: String - - """User comment on disk""" - comment: String - - """File format (ex MBR: 4KiB-aligned)""" - format: String - - """ata | nvme | usb | (others)""" - transport: String - color: ArrayDiskFsColor - - """Whether the disk is currently spinning""" - isSpinning: Boolean + id: PrefixedID! + + """ + Array slot number. Parity1 is always 0 and Parity2 is always 29. Array slots will be 1 - 28. Cache slots are 30 - 53. Flash is 54. + """ + idx: Int! + name: String + device: String + + """ + (KB) Disk Size total + """ + size: BigInt + status: ArrayDiskStatus + + """ + Is the disk a HDD or SSD. + """ + rotational: Boolean + + """ + Disk temp - will be NaN if array is not started or DISK_NP + """ + temp: Int + + """ + Count of I/O read requests sent to the device I/O drivers. These statistics may be cleared at any time. + """ + numReads: BigInt + + """ + Count of I/O writes requests sent to the device I/O drivers. These statistics may be cleared at any time. + """ + numWrites: BigInt + + """ + Number of unrecoverable errors reported by the device I/O drivers. Missing data due to unrecoverable array read errors is filled in on-the-fly using parity reconstruct (and we attempt to write this data back to the sector(s) which failed). Any unrecoverable write error results in disabling the disk. + """ + numErrors: BigInt + + """ + (KB) Total Size of the FS (Not present on Parity type drive) + """ + fsSize: BigInt + + """ + (KB) Free Size on the FS (Not present on Parity type drive) + """ + fsFree: BigInt + + """ + (KB) Used Size on the FS (Not present on Parity type drive) + """ + fsUsed: BigInt + exportable: Boolean + + """ + Type of Disk - used to differentiate Cache / Flash / Array / Parity + """ + type: ArrayDiskType! + + """ + (%) Disk space left to warn + """ + warning: Int + + """ + (%) Disk space left for critical + """ + critical: Int + + """ + File system type for the disk + """ + fsType: String + + """ + User comment on disk + """ + comment: String + + """ + File format (ex MBR: 4KiB-aligned) + """ + format: String + + """ + ata | nvme | usb | (others) + """ + transport: String + color: ArrayDiskFsColor + + """ + Whether the disk is currently spinning + """ + isSpinning: Boolean } interface Node { - id: PrefixedID! + id: PrefixedID! } """ @@ -154,949 +216,1247 @@ The `BigInt` scalar type represents non-fractional signed whole numeric values. scalar BigInt enum ArrayDiskStatus { - DISK_NP - DISK_OK - DISK_NP_MISSING - DISK_INVALID - DISK_WRONG - DISK_DSBL - DISK_NP_DSBL - DISK_DSBL_NEW - DISK_NEW + DISK_NP + DISK_OK + DISK_NP_MISSING + DISK_INVALID + DISK_WRONG + DISK_DSBL + DISK_NP_DSBL + DISK_DSBL_NEW + DISK_NEW } enum ArrayDiskType { - DATA - PARITY - FLASH - CACHE + DATA + PARITY + FLASH + CACHE } enum ArrayDiskFsColor { - GREEN_ON - GREEN_BLINK - BLUE_ON - BLUE_BLINK - YELLOW_ON - YELLOW_BLINK - RED_ON - RED_OFF - GREY_OFF + GREEN_ON + GREEN_BLINK + BLUE_ON + BLUE_BLINK + YELLOW_ON + YELLOW_BLINK + RED_ON + RED_OFF + GREY_OFF } type UnraidArray implements Node { - id: PrefixedID! + id: PrefixedID! - """Current array state""" - state: ArrayState! + """ + Current array state + """ + state: ArrayState! - """Current array capacity""" - capacity: ArrayCapacity! + """ + Current array capacity + """ + capacity: ArrayCapacity! - """Current boot disk""" - boot: ArrayDisk + """ + Current boot disk + """ + boot: ArrayDisk - """Parity disks in the current array""" - parities: [ArrayDisk!]! + """ + Parity disks in the current array + """ + parities: [ArrayDisk!]! - """Current parity check status""" - parityCheckStatus: ParityCheck! + """ + Current parity check status + """ + parityCheckStatus: ParityCheck! - """Data disks in the current array""" - disks: [ArrayDisk!]! + """ + Data disks in the current array + """ + disks: [ArrayDisk!]! - """Caches in the current array""" - caches: [ArrayDisk!]! + """ + Caches in the current array + """ + caches: [ArrayDisk!]! } enum ArrayState { - STARTED - STOPPED - NEW_ARRAY - RECON_DISK - DISABLE_DISK - SWAP_DSBL - INVALID_EXPANSION - PARITY_NOT_BIGGEST - TOO_MANY_MISSING_DISKS - NEW_DISK_TOO_SMALL - NO_DATA_DISKS + STARTED + STOPPED + NEW_ARRAY + RECON_DISK + DISABLE_DISK + SWAP_DSBL + INVALID_EXPANSION + PARITY_NOT_BIGGEST + TOO_MANY_MISSING_DISKS + NEW_DISK_TOO_SMALL + NO_DATA_DISKS } type Share implements Node { - id: PrefixedID! - - """Display name""" - name: String - - """(KB) Free space""" - free: BigInt - - """(KB) Used Size""" - used: BigInt - - """(KB) Total size""" - size: BigInt - - """Disks that are included in this share""" - include: [String!] - - """Disks that are excluded from this share""" - exclude: [String!] - - """Is this share cached""" - cache: Boolean - - """Original name""" - nameOrig: String - - """User comment""" - comment: String - - """Allocator""" - allocator: String - - """Split level""" - splitLevel: String - - """Floor""" - floor: String - - """COW""" - cow: String - - """Color""" - color: String - - """LUKS status""" - luksStatus: String + id: PrefixedID! + + """ + Display name + """ + name: String + + """ + (KB) Free space + """ + free: BigInt + + """ + (KB) Used Size + """ + used: BigInt + + """ + (KB) Total size + """ + size: BigInt + + """ + Disks that are included in this share + """ + include: [String!] + + """ + Disks that are excluded from this share + """ + exclude: [String!] + + """ + Is this share cached + """ + cache: Boolean + + """ + Original name + """ + nameOrig: String + + """ + User comment + """ + comment: String + + """ + Allocator + """ + allocator: String + + """ + Split level + """ + splitLevel: String + + """ + Floor + """ + floor: String + + """ + COW + """ + cow: String + + """ + Color + """ + color: String + + """ + LUKS status + """ + luksStatus: String } type DiskPartition { - """The name of the partition""" - name: String! + """ + The name of the partition + """ + name: String! - """The filesystem type of the partition""" - fsType: DiskFsType! + """ + The filesystem type of the partition + """ + fsType: DiskFsType! - """The size of the partition in bytes""" - size: Float! + """ + The size of the partition in bytes + """ + size: Float! } -"""The type of filesystem on the disk partition""" +""" +The type of filesystem on the disk partition +""" enum DiskFsType { - XFS - BTRFS - VFAT - ZFS - EXT4 - NTFS + XFS + BTRFS + VFAT + ZFS + EXT4 + NTFS } type Disk implements Node { - id: PrefixedID! - - """The device path of the disk (e.g. /dev/sdb)""" - device: String! - - """The type of disk (e.g. SSD, HDD)""" - type: String! - - """The model name of the disk""" - name: String! - - """The manufacturer of the disk""" - vendor: String! - - """The total size of the disk in bytes""" - size: Float! - - """The number of bytes per sector""" - bytesPerSector: Float! - - """The total number of cylinders on the disk""" - totalCylinders: Float! - - """The total number of heads on the disk""" - totalHeads: Float! - - """The total number of sectors on the disk""" - totalSectors: Float! - - """The total number of tracks on the disk""" - totalTracks: Float! - - """The number of tracks per cylinder""" - tracksPerCylinder: Float! - - """The number of sectors per track""" - sectorsPerTrack: Float! - - """The firmware revision of the disk""" - firmwareRevision: String! - - """The serial number of the disk""" - serialNum: String! - - """The interface type of the disk""" - interfaceType: DiskInterfaceType! - - """The SMART status of the disk""" - smartStatus: DiskSmartStatus! - - """The current temperature of the disk in Celsius""" - temperature: Float - - """The partitions on the disk""" - partitions: [DiskPartition!]! - - """Whether the disk is spinning or not""" - isSpinning: Boolean! + id: PrefixedID! + + """ + The device path of the disk (e.g. /dev/sdb) + """ + device: String! + + """ + The type of disk (e.g. SSD, HDD) + """ + type: String! + + """ + The model name of the disk + """ + name: String! + + """ + The manufacturer of the disk + """ + vendor: String! + + """ + The total size of the disk in bytes + """ + size: Float! + + """ + The number of bytes per sector + """ + bytesPerSector: Float! + + """ + The total number of cylinders on the disk + """ + totalCylinders: Float! + + """ + The total number of heads on the disk + """ + totalHeads: Float! + + """ + The total number of sectors on the disk + """ + totalSectors: Float! + + """ + The total number of tracks on the disk + """ + totalTracks: Float! + + """ + The number of tracks per cylinder + """ + tracksPerCylinder: Float! + + """ + The number of sectors per track + """ + sectorsPerTrack: Float! + + """ + The firmware revision of the disk + """ + firmwareRevision: String! + + """ + The serial number of the disk + """ + serialNum: String! + + """ + The interface type of the disk + """ + interfaceType: DiskInterfaceType! + + """ + The SMART status of the disk + """ + smartStatus: DiskSmartStatus! + + """ + The current temperature of the disk in Celsius + """ + temperature: Float + + """ + The partitions on the disk + """ + partitions: [DiskPartition!]! + + """ + Whether the disk is spinning or not + """ + isSpinning: Boolean! } -"""The type of interface the disk uses to connect to the system""" +""" +The type of interface the disk uses to connect to the system +""" enum DiskInterfaceType { - SAS - SATA - USB - PCIE - UNKNOWN + SAS + SATA + USB + PCIE + UNKNOWN } """ The SMART (Self-Monitoring, Analysis and Reporting Technology) status of the disk """ enum DiskSmartStatus { - OK - UNKNOWN + OK + UNKNOWN } type KeyFile { - location: String - contents: String + location: String + contents: String } type Registration implements Node { - id: PrefixedID! - type: registrationType - keyFile: KeyFile - state: RegistrationState - expiration: String - updateExpiration: String + id: PrefixedID! + type: registrationType + keyFile: KeyFile + state: RegistrationState + expiration: String + updateExpiration: String } enum registrationType { - BASIC - PLUS - PRO - STARTER - UNLEASHED - LIFETIME - INVALID - TRIAL + BASIC + PLUS + PRO + STARTER + UNLEASHED + LIFETIME + INVALID + TRIAL } enum RegistrationState { - TRIAL - BASIC - PLUS - PRO - STARTER - UNLEASHED - LIFETIME - EEXPIRED - EGUID - EGUID1 - ETRIAL - ENOKEYFILE - ENOKEYFILE1 - ENOKEYFILE2 - ENOFLASH - ENOFLASH1 - ENOFLASH2 - ENOFLASH3 - ENOFLASH4 - ENOFLASH5 - ENOFLASH6 - ENOFLASH7 - EBLACKLISTED - EBLACKLISTED1 - EBLACKLISTED2 - ENOCONN + TRIAL + BASIC + PLUS + PRO + STARTER + UNLEASHED + LIFETIME + EEXPIRED + EGUID + EGUID1 + ETRIAL + ENOKEYFILE + ENOKEYFILE1 + ENOKEYFILE2 + ENOFLASH + ENOFLASH1 + ENOFLASH2 + ENOFLASH3 + ENOFLASH4 + ENOFLASH5 + ENOFLASH6 + ENOFLASH7 + EBLACKLISTED + EBLACKLISTED1 + EBLACKLISTED2 + ENOCONN } type Vars implements Node { - id: PrefixedID! - - """Unraid version""" - version: String - maxArraysz: Int - maxCachesz: Int - - """Machine hostname""" - name: String - timeZone: String - comment: String - security: String - workgroup: String - domain: String - domainShort: String - hideDotFiles: Boolean - localMaster: Boolean - enableFruit: String - - """Should a NTP server be used for time sync?""" - useNtp: Boolean - - """NTP Server 1""" - ntpServer1: String - - """NTP Server 2""" - ntpServer2: String - - """NTP Server 3""" - ntpServer3: String - - """NTP Server 4""" - ntpServer4: String - domainLogin: String - sysModel: String - sysArraySlots: Int - sysCacheSlots: Int - sysFlashSlots: Int - useSsl: Boolean - - """Port for the webui via HTTP""" - port: Int - - """Port for the webui via HTTPS""" - portssl: Int - localTld: String - bindMgt: Boolean - - """Should telnet be enabled?""" - useTelnet: Boolean - porttelnet: Int - useSsh: Boolean - portssh: Int - startPage: String - startArray: Boolean - spindownDelay: String - queueDepth: String - spinupGroups: Boolean - defaultFormat: String - defaultFsType: String - shutdownTimeout: Int - luksKeyfile: String - pollAttributes: String - pollAttributesDefault: String - pollAttributesStatus: String - nrRequests: Int - nrRequestsDefault: Int - nrRequestsStatus: String - mdNumStripes: Int - mdNumStripesDefault: Int - mdNumStripesStatus: String - mdSyncWindow: Int - mdSyncWindowDefault: Int - mdSyncWindowStatus: String - mdSyncThresh: Int - mdSyncThreshDefault: Int - mdSyncThreshStatus: String - mdWriteMethod: Int - mdWriteMethodDefault: String - mdWriteMethodStatus: String - shareDisk: String - shareUser: String - shareUserInclude: String - shareUserExclude: String - shareSmbEnabled: Boolean - shareNfsEnabled: Boolean - shareAfpEnabled: Boolean - shareInitialOwner: String - shareInitialGroup: String - shareCacheEnabled: Boolean - shareCacheFloor: String - shareMoverSchedule: String - shareMoverLogging: Boolean - fuseRemember: String - fuseRememberDefault: String - fuseRememberStatus: String - fuseDirectio: String - fuseDirectioDefault: String - fuseDirectioStatus: String - shareAvahiEnabled: Boolean - shareAvahiSmbName: String - shareAvahiSmbModel: String - shareAvahiAfpName: String - shareAvahiAfpModel: String - safeMode: Boolean - startMode: String - configValid: Boolean - configError: ConfigErrorState - joinStatus: String - deviceCount: Int - flashGuid: String - flashProduct: String - flashVendor: String - regCheck: String - regFile: String - regGuid: String - regTy: registrationType - regState: RegistrationState - - """Registration owner""" - regTo: String - regTm: String - regTm2: String - regGen: String - sbName: String - sbVersion: String - sbUpdated: String - sbEvents: Int - sbState: String - sbClean: Boolean - sbSynced: Int - sbSyncErrs: Int - sbSynced2: Int - sbSyncExit: String - sbNumDisks: Int - mdColor: String - mdNumDisks: Int - mdNumDisabled: Int - mdNumInvalid: Int - mdNumMissing: Int - mdNumNew: Int - mdNumErased: Int - mdResync: Int - mdResyncCorr: String - mdResyncPos: String - mdResyncDb: String - mdResyncDt: String - mdResyncAction: String - mdResyncSize: Int - mdState: String - mdVersion: String - cacheNumDevices: Int - cacheSbNumDisks: Int - fsState: String - - """Human friendly string of array events happening""" - fsProgress: String - - """ - Percentage from 0 - 100 while upgrading a disk or swapping parity drives - """ - fsCopyPrcnt: Int - fsNumMounted: Int - fsNumUnmountable: Int - fsUnmountableMask: String - - """Total amount of user shares""" - shareCount: Int - - """Total amount shares with SMB enabled""" - shareSmbCount: Int - - """Total amount shares with NFS enabled""" - shareNfsCount: Int - - """Total amount shares with AFP enabled""" - shareAfpCount: Int - shareMoverActive: Boolean - csrfToken: String -} - -"""Possible error states for configuration""" + id: PrefixedID! + + """ + Unraid version + """ + version: String + maxArraysz: Int + maxCachesz: Int + + """ + Machine hostname + """ + name: String + timeZone: String + comment: String + security: String + workgroup: String + domain: String + domainShort: String + hideDotFiles: Boolean + localMaster: Boolean + enableFruit: String + + """ + Should a NTP server be used for time sync? + """ + useNtp: Boolean + + """ + NTP Server 1 + """ + ntpServer1: String + + """ + NTP Server 2 + """ + ntpServer2: String + + """ + NTP Server 3 + """ + ntpServer3: String + + """ + NTP Server 4 + """ + ntpServer4: String + domainLogin: String + sysModel: String + sysArraySlots: Int + sysCacheSlots: Int + sysFlashSlots: Int + useSsl: Boolean + + """ + Port for the webui via HTTP + """ + port: Int + + """ + Port for the webui via HTTPS + """ + portssl: Int + localTld: String + bindMgt: Boolean + + """ + Should telnet be enabled? + """ + useTelnet: Boolean + porttelnet: Int + useSsh: Boolean + portssh: Int + startPage: String + startArray: Boolean + spindownDelay: String + queueDepth: String + spinupGroups: Boolean + defaultFormat: String + defaultFsType: String + shutdownTimeout: Int + luksKeyfile: String + pollAttributes: String + pollAttributesDefault: String + pollAttributesStatus: String + nrRequests: Int + nrRequestsDefault: Int + nrRequestsStatus: String + mdNumStripes: Int + mdNumStripesDefault: Int + mdNumStripesStatus: String + mdSyncWindow: Int + mdSyncWindowDefault: Int + mdSyncWindowStatus: String + mdSyncThresh: Int + mdSyncThreshDefault: Int + mdSyncThreshStatus: String + mdWriteMethod: Int + mdWriteMethodDefault: String + mdWriteMethodStatus: String + shareDisk: String + shareUser: String + shareUserInclude: String + shareUserExclude: String + shareSmbEnabled: Boolean + shareNfsEnabled: Boolean + shareAfpEnabled: Boolean + shareInitialOwner: String + shareInitialGroup: String + shareCacheEnabled: Boolean + shareCacheFloor: String + shareMoverSchedule: String + shareMoverLogging: Boolean + fuseRemember: String + fuseRememberDefault: String + fuseRememberStatus: String + fuseDirectio: String + fuseDirectioDefault: String + fuseDirectioStatus: String + shareAvahiEnabled: Boolean + shareAvahiSmbName: String + shareAvahiSmbModel: String + shareAvahiAfpName: String + shareAvahiAfpModel: String + safeMode: Boolean + startMode: String + configValid: Boolean + configError: ConfigErrorState + joinStatus: String + deviceCount: Int + flashGuid: String + flashProduct: String + flashVendor: String + regCheck: String + regFile: String + regGuid: String + regTy: registrationType + regState: RegistrationState + + """ + Registration owner + """ + regTo: String + regTm: String + regTm2: String + regGen: String + sbName: String + sbVersion: String + sbUpdated: String + sbEvents: Int + sbState: String + sbClean: Boolean + sbSynced: Int + sbSyncErrs: Int + sbSynced2: Int + sbSyncExit: String + sbNumDisks: Int + mdColor: String + mdNumDisks: Int + mdNumDisabled: Int + mdNumInvalid: Int + mdNumMissing: Int + mdNumNew: Int + mdNumErased: Int + mdResync: Int + mdResyncCorr: String + mdResyncPos: String + mdResyncDb: String + mdResyncDt: String + mdResyncAction: String + mdResyncSize: Int + mdState: String + mdVersion: String + cacheNumDevices: Int + cacheSbNumDisks: Int + fsState: String + + """ + Human friendly string of array events happening + """ + fsProgress: String + + """ + Percentage from 0 - 100 while upgrading a disk or swapping parity drives + """ + fsCopyPrcnt: Int + fsNumMounted: Int + fsNumUnmountable: Int + fsUnmountableMask: String + + """ + Total amount of user shares + """ + shareCount: Int + + """ + Total amount shares with SMB enabled + """ + shareSmbCount: Int + + """ + Total amount shares with NFS enabled + """ + shareNfsCount: Int + + """ + Total amount shares with AFP enabled + """ + shareAfpCount: Int + shareMoverActive: Boolean + csrfToken: String +} + +""" +Possible error states for configuration +""" enum ConfigErrorState { - UNKNOWN_ERROR - INELIGIBLE - INVALID - NO_KEY_SERVER - WITHDRAWN + UNKNOWN_ERROR + INELIGIBLE + INVALID + NO_KEY_SERVER + WITHDRAWN } type Permission { - resource: Resource! + resource: Resource! - """Actions allowed on this resource""" - actions: [AuthAction!]! + """ + Actions allowed on this resource + """ + actions: [AuthAction!]! } -"""Available resources for permissions""" +""" +Available resources for permissions +""" enum Resource { - ACTIVATION_CODE - API_KEY - ARRAY - CLOUD - CONFIG - CONNECT - CONNECT__REMOTE_ACCESS - CUSTOMIZATIONS - DASHBOARD - DISK - DISPLAY - DOCKER - FLASH - INFO - LOGS - ME - NETWORK - NOTIFICATIONS - ONLINE - OS - OWNER - PERMISSION - REGISTRATION - SERVERS - SERVICES - SHARE - VARS - VMS - WELCOME -} - -"""Authentication actions with possession (e.g., create:any, read:own)""" -enum AuthAction { - """Create any resource""" - CREATE_ANY - - """Create own resource""" - CREATE_OWN - - """Read any resource""" - READ_ANY - - """Read own resource""" - READ_OWN - - """Update any resource""" - UPDATE_ANY - - """Update own resource""" - UPDATE_OWN - - """Delete any resource""" - DELETE_ANY + ACTIVATION_CODE + API_KEY + ARRAY + CLOUD + CONFIG + CONNECT + CONNECT__REMOTE_ACCESS + CUSTOMIZATIONS + DASHBOARD + DISK + DISPLAY + DOCKER + FLASH + INFO + LOGS + ME + NETWORK + NOTIFICATIONS + ONLINE + OS + OWNER + PERMISSION + REGISTRATION + SERVERS + SERVICES + SHARE + VARS + VMS + WELCOME +} - """Delete own resource""" - DELETE_OWN +""" +Authentication actions with possession (e.g., create:any, read:own) +""" +enum AuthAction { + """ + Create any resource + """ + CREATE_ANY + + """ + Create own resource + """ + CREATE_OWN + + """ + Read any resource + """ + READ_ANY + + """ + Read own resource + """ + READ_OWN + + """ + Update any resource + """ + UPDATE_ANY + + """ + Update own resource + """ + UPDATE_OWN + + """ + Delete any resource + """ + DELETE_ANY + + """ + Delete own resource + """ + DELETE_OWN } type ApiKey implements Node { - id: PrefixedID! - key: String! - name: String! - description: String - roles: [Role!]! - createdAt: String! - permissions: [Permission!]! + id: PrefixedID! + key: String! + name: String! + description: String + roles: [Role!]! + createdAt: String! + permissions: [Permission!]! } -"""Available roles for API keys and users""" +""" +Available roles for API keys and users +""" enum Role { - """Full administrative access to all resources""" - ADMIN + """ + Full administrative access to all resources + """ + ADMIN - """Internal Role for Unraid Connect""" - CONNECT + """ + Internal Role for Unraid Connect + """ + CONNECT - """Basic read access to user profile only""" - GUEST + """ + Basic read access to user profile only + """ + GUEST - """Read-only access to all resources""" - VIEWER + """ + Read-only access to all resources + """ + VIEWER } type SsoSettings implements Node { - id: PrefixedID! + id: PrefixedID! - """List of configured OIDC providers""" - oidcProviders: [OidcProvider!]! + """ + List of configured OIDC providers + """ + oidcProviders: [OidcProvider!]! } type UnifiedSettings implements Node & FormSchema { - id: PrefixedID! + id: PrefixedID! - """The data schema for the settings""" - dataSchema: JSON! + """ + The data schema for the settings + """ + dataSchema: JSON! - """The UI schema for the settings""" - uiSchema: JSON! + """ + The UI schema for the settings + """ + uiSchema: JSON! - """The current values of the settings""" - values: JSON! + """ + The current values of the settings + """ + values: JSON! } interface FormSchema { - """The data schema for the form""" - dataSchema: JSON! + """ + The data schema for the form + """ + dataSchema: JSON! - """The UI schema for the form""" - uiSchema: JSON! + """ + The UI schema for the form + """ + uiSchema: JSON! - """The current values of the form""" - values: JSON! + """ + The current values of the form + """ + values: JSON! } """ The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). """ -scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf") +scalar JSON + @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf") type ApiKeyFormSettings implements Node & FormSchema { - id: PrefixedID! + id: PrefixedID! - """The data schema for the API key form""" - dataSchema: JSON! + """ + The data schema for the API key form + """ + dataSchema: JSON! - """The UI schema for the API key form""" - uiSchema: JSON! + """ + The UI schema for the API key form + """ + uiSchema: JSON! - """The current values of the API key form""" - values: JSON! + """ + The current values of the API key form + """ + values: JSON! } type UpdateSettingsResponse { - """Whether a restart is required for the changes to take effect""" - restartRequired: Boolean! + """ + Whether a restart is required for the changes to take effect + """ + restartRequired: Boolean! - """The updated settings values""" - values: JSON! + """ + The updated settings values + """ + values: JSON! - """Warning messages about configuration issues found during validation""" - warnings: [String!] + """ + Warning messages about configuration issues found during validation + """ + warnings: [String!] } type Settings implements Node { - id: PrefixedID! + id: PrefixedID! - """A view of all settings""" - unified: UnifiedSettings! + """ + A view of all settings + """ + unified: UnifiedSettings! - """SSO settings""" - sso: SsoSettings! + """ + SSO settings + """ + sso: SsoSettings! - """The API setting values""" - api: ApiConfig! + """ + The API setting values + """ + api: ApiConfig! } type RCloneDrive { - """Provider name""" - name: String! + """ + Provider name + """ + name: String! - """Provider options and configuration schema""" - options: JSON! + """ + Provider options and configuration schema + """ + options: JSON! } type RCloneBackupConfigForm { - id: ID! - dataSchema: JSON! - uiSchema: JSON! + id: ID! + dataSchema: JSON! + uiSchema: JSON! } type RCloneBackupSettings { - configForm(formOptions: RCloneConfigFormInput): RCloneBackupConfigForm! - drives: [RCloneDrive!]! - remotes: [RCloneRemote!]! + configForm(formOptions: RCloneConfigFormInput): RCloneBackupConfigForm! + drives: [RCloneDrive!]! + remotes: [RCloneRemote!]! } input RCloneConfigFormInput { - providerType: String - showAdvanced: Boolean = false - parameters: JSON + providerType: String + showAdvanced: Boolean = false + parameters: JSON } type RCloneRemote { - name: String! - type: String! - parameters: JSON! + name: String! + type: String! + parameters: JSON! - """Complete remote configuration""" - config: JSON! + """ + Complete remote configuration + """ + config: JSON! } type ArrayMutations { - """Set array state""" - setState(input: ArrayStateInput!): UnraidArray! + """ + Set array state + """ + setState(input: ArrayStateInput!): UnraidArray! - """Add new disk to array""" - addDiskToArray(input: ArrayDiskInput!): UnraidArray! + """ + Add new disk to array + """ + addDiskToArray(input: ArrayDiskInput!): UnraidArray! - """ - Remove existing disk from array. NOTE: The array must be stopped before running this otherwise it'll throw an error. - """ - removeDiskFromArray(input: ArrayDiskInput!): UnraidArray! + """ + Remove existing disk from array. NOTE: The array must be stopped before running this otherwise it'll throw an error. + """ + removeDiskFromArray(input: ArrayDiskInput!): UnraidArray! - """Mount a disk in the array""" - mountArrayDisk(id: PrefixedID!): ArrayDisk! + """ + Mount a disk in the array + """ + mountArrayDisk(id: PrefixedID!): ArrayDisk! - """Unmount a disk from the array""" - unmountArrayDisk(id: PrefixedID!): ArrayDisk! + """ + Unmount a disk from the array + """ + unmountArrayDisk(id: PrefixedID!): ArrayDisk! - """Clear statistics for a disk in the array""" - clearArrayDiskStatistics(id: PrefixedID!): Boolean! + """ + Clear statistics for a disk in the array + """ + clearArrayDiskStatistics(id: PrefixedID!): Boolean! } input ArrayStateInput { - """Array state""" - desiredState: ArrayStateInputState! + """ + Array state + """ + desiredState: ArrayStateInputState! } enum ArrayStateInputState { - START - STOP + START + STOP } input ArrayDiskInput { - """Disk ID""" - id: PrefixedID! + """ + Disk ID + """ + id: PrefixedID! - """The slot for the disk""" - slot: Int + """ + The slot for the disk + """ + slot: Int } type DockerMutations { - """Start a container""" - start(id: PrefixedID!): DockerContainer! - - """Stop a container""" - stop(id: PrefixedID!): DockerContainer! - - """Pause (Suspend) a container""" - pause(id: PrefixedID!): DockerContainer! - - """Unpause (Resume) a container""" - unpause(id: PrefixedID!): DockerContainer! - - """Update auto-start configuration for Docker containers""" - updateAutostartConfiguration(entries: [DockerAutostartEntryInput!]!, persistUserPreferences: Boolean): Boolean! - - """Update a container to the latest image""" - updateContainer(id: PrefixedID!): DockerContainer! - - """Update multiple containers to the latest images""" - updateContainers(ids: [PrefixedID!]!): [DockerContainer!]! - - """Update all containers that have available updates""" - updateAllContainers: [DockerContainer!]! + """ + Start a container + """ + start(id: PrefixedID!): DockerContainer! + + """ + Stop a container + """ + stop(id: PrefixedID!): DockerContainer! + + """ + Pause (Suspend) a container + """ + pause(id: PrefixedID!): DockerContainer! + + """ + Unpause (Resume) a container + """ + unpause(id: PrefixedID!): DockerContainer! + + """ + Update auto-start configuration for Docker containers + """ + updateAutostartConfiguration( + entries: [DockerAutostartEntryInput!]! + persistUserPreferences: Boolean + ): Boolean! + + """ + Update a container to the latest image + """ + updateContainer(id: PrefixedID!): DockerContainer! + + """ + Update multiple containers to the latest images + """ + updateContainers(ids: [PrefixedID!]!): [DockerContainer!]! + + """ + Update all containers that have available updates + """ + updateAllContainers: [DockerContainer!]! } input DockerAutostartEntryInput { - """Docker container identifier""" - id: PrefixedID! + """ + Docker container identifier + """ + id: PrefixedID! - """Whether the container should auto-start""" - autoStart: Boolean! + """ + Whether the container should auto-start + """ + autoStart: Boolean! - """Number of seconds to wait after starting the container""" - wait: Int + """ + Number of seconds to wait after starting the container + """ + wait: Int } type VmMutations { - """Start a virtual machine""" - start(id: PrefixedID!): Boolean! - - """Stop a virtual machine""" - stop(id: PrefixedID!): Boolean! - - """Pause a virtual machine""" - pause(id: PrefixedID!): Boolean! - - """Resume a virtual machine""" - resume(id: PrefixedID!): Boolean! - - """Force stop a virtual machine""" - forceStop(id: PrefixedID!): Boolean! - - """Reboot a virtual machine""" - reboot(id: PrefixedID!): Boolean! - - """Reset a virtual machine""" - reset(id: PrefixedID!): Boolean! + """ + Start a virtual machine + """ + start(id: PrefixedID!): Boolean! + + """ + Stop a virtual machine + """ + stop(id: PrefixedID!): Boolean! + + """ + Pause a virtual machine + """ + pause(id: PrefixedID!): Boolean! + + """ + Resume a virtual machine + """ + resume(id: PrefixedID!): Boolean! + + """ + Force stop a virtual machine + """ + forceStop(id: PrefixedID!): Boolean! + + """ + Reboot a virtual machine + """ + reboot(id: PrefixedID!): Boolean! + + """ + Reset a virtual machine + """ + reset(id: PrefixedID!): Boolean! } -"""API Key related mutations""" +""" +API Key related mutations +""" type ApiKeyMutations { - """Create an API key""" - create(input: CreateApiKeyInput!): ApiKey! + """ + Create an API key + """ + create(input: CreateApiKeyInput!): ApiKey! - """Add a role to an API key""" - addRole(input: AddRoleForApiKeyInput!): Boolean! + """ + Add a role to an API key + """ + addRole(input: AddRoleForApiKeyInput!): Boolean! - """Remove a role from an API key""" - removeRole(input: RemoveRoleFromApiKeyInput!): Boolean! + """ + Remove a role from an API key + """ + removeRole(input: RemoveRoleFromApiKeyInput!): Boolean! - """Delete one or more API keys""" - delete(input: DeleteApiKeyInput!): Boolean! + """ + Delete one or more API keys + """ + delete(input: DeleteApiKeyInput!): Boolean! - """Update an API key""" - update(input: UpdateApiKeyInput!): ApiKey! + """ + Update an API key + """ + update(input: UpdateApiKeyInput!): ApiKey! } input CreateApiKeyInput { - name: String! - description: String - roles: [Role!] - permissions: [AddPermissionInput!] + name: String! + description: String + roles: [Role!] + permissions: [AddPermissionInput!] - """ - This will replace the existing key if one already exists with the same name, otherwise returns the existing key - """ - overwrite: Boolean + """ + This will replace the existing key if one already exists with the same name, otherwise returns the existing key + """ + overwrite: Boolean } input AddPermissionInput { - resource: Resource! - actions: [AuthAction!]! + resource: Resource! + actions: [AuthAction!]! } input AddRoleForApiKeyInput { - apiKeyId: PrefixedID! - role: Role! + apiKeyId: PrefixedID! + role: Role! } input RemoveRoleFromApiKeyInput { - apiKeyId: PrefixedID! - role: Role! + apiKeyId: PrefixedID! + role: Role! } input DeleteApiKeyInput { - ids: [PrefixedID!]! + ids: [PrefixedID!]! } input UpdateApiKeyInput { - id: PrefixedID! - name: String - description: String - roles: [Role!] - permissions: [AddPermissionInput!] + id: PrefixedID! + name: String + description: String + roles: [Role!] + permissions: [AddPermissionInput!] } """ Parity check related mutations, WIP, response types and functionaliy will change """ type ParityCheckMutations { - """Start a parity check""" - start(correct: Boolean!): JSON! + """ + Start a parity check + """ + start(correct: Boolean!): JSON! - """Pause a parity check""" - pause: JSON! + """ + Pause a parity check + """ + pause: JSON! - """Resume a parity check""" - resume: JSON! + """ + Resume a parity check + """ + resume: JSON! - """Cancel a parity check""" - cancel: JSON! + """ + Cancel a parity check + """ + cancel: JSON! } -"""RClone related mutations""" +""" +RClone related mutations +""" type RCloneMutations { - """Create a new RClone remote""" - createRCloneRemote(input: CreateRCloneRemoteInput!): RCloneRemote! + """ + Create a new RClone remote + """ + createRCloneRemote(input: CreateRCloneRemoteInput!): RCloneRemote! - """Delete an existing RClone remote""" - deleteRCloneRemote(input: DeleteRCloneRemoteInput!): Boolean! + """ + Delete an existing RClone remote + """ + deleteRCloneRemote(input: DeleteRCloneRemoteInput!): Boolean! } input CreateRCloneRemoteInput { - name: String! - type: String! - parameters: JSON! + name: String! + type: String! + parameters: JSON! } input DeleteRCloneRemoteInput { - name: String! + name: String! } type Config implements Node { - id: PrefixedID! - valid: Boolean - error: String + id: PrefixedID! + valid: Boolean + error: String } type PublicPartnerInfo { - partnerName: String + partnerName: String - """Indicates if a partner logo exists""" - hasPartnerLogo: Boolean! - partnerUrl: String + """ + Indicates if a partner logo exists + """ + hasPartnerLogo: Boolean! + partnerUrl: String - """ - The path to the partner logo image on the flash drive, relative to the activation code file - """ - partnerLogoUrl: String + """ + The path to the partner logo image on the flash drive, relative to the activation code file + """ + partnerLogoUrl: String } type ActivationCode { - code: String - partnerName: String - partnerUrl: String - serverName: String - sysModel: String - comment: String - header: String - headermetacolor: String - background: String - showBannerGradient: Boolean - theme: String + code: String + partnerName: String + partnerUrl: String + serverName: String + sysModel: String + comment: String + header: String + headermetacolor: String + background: String + showBannerGradient: Boolean + theme: String } type Customization { - activationCode: ActivationCode - partnerInfo: PublicPartnerInfo - theme: Theme! + activationCode: ActivationCode + partnerInfo: PublicPartnerInfo + theme: Theme! } type Theme { - """The theme name""" - name: ThemeName! - - """Whether to show the header banner image""" - showBannerImage: Boolean! - - """Whether to show the banner gradient""" - showBannerGradient: Boolean! - - """Whether to show the description in the header""" - showHeaderDescription: Boolean! - - """The background color of the header""" - headerBackgroundColor: String - - """The text color of the header""" - headerPrimaryTextColor: String - - """The secondary text color of the header""" - headerSecondaryTextColor: String + """ + The theme name + """ + name: ThemeName! + + """ + Whether to show the header banner image + """ + showBannerImage: Boolean! + + """ + Whether to show the banner gradient + """ + showBannerGradient: Boolean! + + """ + Whether to show the description in the header + """ + showHeaderDescription: Boolean! + + """ + The background color of the header + """ + headerBackgroundColor: String + + """ + The text color of the header + """ + headerPrimaryTextColor: String + + """ + The secondary text color of the header + """ + headerSecondaryTextColor: String } -"""The theme name""" +""" +The theme name +""" enum ThemeName { - azure - black - gray - white + azure + black + gray + white } type ExplicitStatusItem { - name: String! - updateStatus: UpdateStatus! + name: String! + updateStatus: UpdateStatus! } -"""Update status of a container.""" +""" +Update status of a container. +""" enum UpdateStatus { - UP_TO_DATE - UPDATE_AVAILABLE - REBUILD_READY - UNKNOWN + UP_TO_DATE + UPDATE_AVAILABLE + REBUILD_READY + UNKNOWN } type ContainerPort { - ip: String - privatePort: Port - publicPort: Port - type: ContainerPortType! + ip: String + privatePort: Port + publicPort: Port + type: ContainerPortType! } """ @@ -1105,1219 +1465,1644 @@ A field whose value is a valid TCP port within the range of 0 to 65535: https:// scalar Port enum ContainerPortType { - TCP - UDP + TCP + UDP } type DockerPortConflictContainer { - id: PrefixedID! - name: String! + id: PrefixedID! + name: String! } type DockerContainerPortConflict { - privatePort: Port! - type: ContainerPortType! - containers: [DockerPortConflictContainer!]! + privatePort: Port! + type: ContainerPortType! + containers: [DockerPortConflictContainer!]! } type DockerLanPortConflict { - lanIpPort: String! - publicPort: Port - type: ContainerPortType! - containers: [DockerPortConflictContainer!]! + lanIpPort: String! + publicPort: Port + type: ContainerPortType! + containers: [DockerPortConflictContainer!]! } type DockerPortConflicts { - containerPorts: [DockerContainerPortConflict!]! - lanPorts: [DockerLanPortConflict!]! + containerPorts: [DockerContainerPortConflict!]! + lanPorts: [DockerLanPortConflict!]! } type ContainerHostConfig { - networkMode: String! + networkMode: String! } type DockerContainer implements Node { - id: PrefixedID! - names: [String!]! - image: String! - imageId: String! - command: String! - created: Int! - ports: [ContainerPort!]! - - """List of LAN-accessible host:port values""" - lanIpPorts: [String!] - - """Total size of all files in the container (in bytes)""" - sizeRootFs: BigInt - - """Size of writable layer (in bytes)""" - sizeRw: BigInt - - """Size of container logs (in bytes)""" - sizeLog: BigInt - labels: JSON - state: ContainerState! - status: String! - hostConfig: ContainerHostConfig - networkSettings: JSON - mounts: [JSON!] - autoStart: Boolean! - - """Zero-based order in the auto-start list""" - autoStartOrder: Int - - """Wait time in seconds applied after start""" - autoStartWait: Int - templatePath: String - isUpdateAvailable: Boolean - isRebuildReady: Boolean + id: PrefixedID! + names: [String!]! + image: String! + imageId: String! + command: String! + created: Int! + ports: [ContainerPort!]! + + """ + List of LAN-accessible host:port values + """ + lanIpPorts: [String!] + + """ + Total size of all files in the container (in bytes) + """ + sizeRootFs: BigInt + + """ + Size of writable layer (in bytes) + """ + sizeRw: BigInt + + """ + Size of container logs (in bytes) + """ + sizeLog: BigInt + labels: JSON + state: ContainerState! + status: String! + hostConfig: ContainerHostConfig + networkSettings: JSON + mounts: [JSON!] + autoStart: Boolean! + + """ + Zero-based order in the auto-start list + """ + autoStartOrder: Int + + """ + Wait time in seconds applied after start + """ + autoStartWait: Int + templatePath: String + isUpdateAvailable: Boolean + isRebuildReady: Boolean } enum ContainerState { - RUNNING - PAUSED - EXITED + RUNNING + PAUSED + EXITED } type DockerNetwork implements Node { - id: PrefixedID! - name: String! - created: String! - scope: String! - driver: String! - enableIPv6: Boolean! - ipam: JSON! - internal: Boolean! - attachable: Boolean! - ingress: Boolean! - configFrom: JSON! - configOnly: Boolean! - containers: JSON! - options: JSON! - labels: JSON! + id: PrefixedID! + name: String! + created: String! + scope: String! + driver: String! + enableIPv6: Boolean! + ipam: JSON! + internal: Boolean! + attachable: Boolean! + ingress: Boolean! + configFrom: JSON! + configOnly: Boolean! + containers: JSON! + options: JSON! + labels: JSON! } type DockerContainerLogLine { - timestamp: DateTime! - message: String! + timestamp: DateTime! + message: String! } type DockerContainerLogs { - containerId: PrefixedID! - lines: [DockerContainerLogLine!]! + containerId: PrefixedID! + lines: [DockerContainerLogLine!]! - """ - Cursor that can be passed back through the since argument to continue streaming logs. - """ - cursor: DateTime + """ + Cursor that can be passed back through the since argument to continue streaming logs. + """ + cursor: DateTime } type DockerContainerStats { - id: PrefixedID! + id: PrefixedID! - """CPU Usage Percentage""" - cpuPercent: Float! + """ + CPU Usage Percentage + """ + cpuPercent: Float! - """Memory Usage String (e.g. 100MB / 1GB)""" - memUsage: String! + """ + Memory Usage String (e.g. 100MB / 1GB) + """ + memUsage: String! - """Memory Usage Percentage""" - memPercent: Float! + """ + Memory Usage Percentage + """ + memPercent: Float! - """Network I/O String (e.g. 100MB / 1GB)""" - netIO: String! + """ + Network I/O String (e.g. 100MB / 1GB) + """ + netIO: String! - """Block I/O String (e.g. 100MB / 1GB)""" - blockIO: String! + """ + Block I/O String (e.g. 100MB / 1GB) + """ + blockIO: String! } type Docker implements Node { - id: PrefixedID! - containers(skipCache: Boolean! = false): [DockerContainer!]! - networks(skipCache: Boolean! = false): [DockerNetwork!]! - portConflicts(skipCache: Boolean! = false): DockerPortConflicts! + id: PrefixedID! + containers(skipCache: Boolean! = false): [DockerContainer!]! + networks(skipCache: Boolean! = false): [DockerNetwork!]! + portConflicts(skipCache: Boolean! = false): DockerPortConflicts! - """ - Access container logs. Requires specifying a target container id through resolver arguments. - """ - logs(id: PrefixedID!, since: DateTime, tail: Int): DockerContainerLogs! - organizer(skipCache: Boolean! = false): ResolvedOrganizerV1! - containerUpdateStatuses: [ExplicitStatusItem!]! + """ + Access container logs. Requires specifying a target container id through resolver arguments. + """ + logs(id: PrefixedID!, since: DateTime, tail: Int): DockerContainerLogs! + organizer(skipCache: Boolean! = false): ResolvedOrganizerV1! + containerUpdateStatuses: [ExplicitStatusItem!]! } type DockerContainerOverviewForm { - id: ID! - dataSchema: JSON! - uiSchema: JSON! - data: JSON! + id: ID! + dataSchema: JSON! + uiSchema: JSON! + data: JSON! } type NotificationCounts { - info: Int! - warning: Int! - alert: Int! - total: Int! + info: Int! + warning: Int! + alert: Int! + total: Int! } type NotificationOverview { - unread: NotificationCounts! - archive: NotificationCounts! + unread: NotificationCounts! + archive: NotificationCounts! +} + +type NotificationSettings { + position: String! } type Notification implements Node { - id: PrefixedID! + id: PrefixedID! - """Also known as 'event'""" - title: String! - subject: String! - description: String! - importance: NotificationImportance! - link: String - type: NotificationType! + """ + Also known as 'event' + """ + title: String! + subject: String! + description: String! + importance: NotificationImportance! + link: String + type: NotificationType! - """ISO Timestamp for when the notification occurred""" - timestamp: String - formattedTimestamp: String + """ + ISO Timestamp for when the notification occurred + """ + timestamp: String + formattedTimestamp: String } enum NotificationImportance { - ALERT - INFO - WARNING + ALERT + INFO + WARNING } enum NotificationType { - UNREAD - ARCHIVE + UNREAD + ARCHIVE } type Notifications implements Node { - id: PrefixedID! + id: PrefixedID! - """A cached overview of the notifications in the system & their severity.""" - overview: NotificationOverview! - list(filter: NotificationFilter!): [Notification!]! + """ + A cached overview of the notifications in the system & their severity. + """ + overview: NotificationOverview! + list(filter: NotificationFilter!): [Notification!]! - """ - Deduplicated list of unread warning and alert notifications, sorted latest first. - """ - warningsAndAlerts: [Notification!]! + """ + Deduplicated list of unread warning and alert notifications, sorted latest first. + """ + warningsAndAlerts: [Notification!]! + settings: NotificationSettings! } input NotificationFilter { - importance: NotificationImportance - type: NotificationType! - offset: Int! - limit: Int! + importance: NotificationImportance + type: NotificationType! + offset: Int! + limit: Int! } type DockerTemplateSyncResult { - scanned: Int! - matched: Int! - skipped: Int! - errors: [String!]! + scanned: Int! + matched: Int! + skipped: Int! + errors: [String!]! } type ResolvedOrganizerView { - id: String! - name: String! - rootId: String! - flatEntries: [FlatOrganizerEntry!]! - prefs: JSON + id: String! + name: String! + rootId: String! + flatEntries: [FlatOrganizerEntry!]! + prefs: JSON } type ResolvedOrganizerV1 { - version: Float! - views: [ResolvedOrganizerView!]! + version: Float! + views: [ResolvedOrganizerView!]! } type FlatOrganizerEntry { - id: String! - type: String! - name: String! - parentId: String - depth: Float! - position: Float! - path: [String!]! - hasChildren: Boolean! - childrenIds: [String!]! - meta: DockerContainer - icon: String + id: String! + type: String! + name: String! + parentId: String + depth: Float! + position: Float! + path: [String!]! + hasChildren: Boolean! + childrenIds: [String!]! + meta: DockerContainer + icon: String } type FlashBackupStatus { - """Status message indicating the outcome of the backup initiation.""" - status: String! + """ + Status message indicating the outcome of the backup initiation. + """ + status: String! - """Job ID if available, can be used to check job status.""" - jobId: String + """ + Job ID if available, can be used to check job status. + """ + jobId: String } type Flash implements Node { - id: PrefixedID! - guid: String! - vendor: String! - product: String! + id: PrefixedID! + guid: String! + vendor: String! + product: String! } type InfoGpu implements Node { - id: PrefixedID! + id: PrefixedID! - """GPU type/manufacturer""" - type: String! + """ + GPU type/manufacturer + """ + type: String! - """GPU type identifier""" - typeid: String! + """ + GPU type identifier + """ + typeid: String! - """Whether GPU is blacklisted""" - blacklisted: Boolean! + """ + Whether GPU is blacklisted + """ + blacklisted: Boolean! - """Device class""" - class: String! + """ + Device class + """ + class: String! - """Product ID""" - productid: String! + """ + Product ID + """ + productid: String! - """Vendor name""" - vendorname: String + """ + Vendor name + """ + vendorname: String } type InfoNetwork implements Node { - id: PrefixedID! + id: PrefixedID! - """Network interface name""" - iface: String! + """ + Network interface name + """ + iface: String! - """Network interface model""" - model: String + """ + Network interface model + """ + model: String - """Network vendor""" - vendor: String + """ + Network vendor + """ + vendor: String - """MAC address""" - mac: String + """ + MAC address + """ + mac: String - """Virtual interface flag""" - virtual: Boolean + """ + Virtual interface flag + """ + virtual: Boolean - """Network speed""" - speed: String + """ + Network speed + """ + speed: String - """DHCP enabled flag""" - dhcp: Boolean + """ + DHCP enabled flag + """ + dhcp: Boolean } type InfoPci implements Node { - id: PrefixedID! + id: PrefixedID! - """Device type/manufacturer""" - type: String! + """ + Device type/manufacturer + """ + type: String! - """Type identifier""" - typeid: String! + """ + Type identifier + """ + typeid: String! - """Vendor name""" - vendorname: String + """ + Vendor name + """ + vendorname: String - """Vendor ID""" - vendorid: String! + """ + Vendor ID + """ + vendorid: String! - """Product name""" - productname: String + """ + Product name + """ + productname: String - """Product ID""" - productid: String! + """ + Product ID + """ + productid: String! - """Blacklisted status""" - blacklisted: String! + """ + Blacklisted status + """ + blacklisted: String! - """Device class""" - class: String! + """ + Device class + """ + class: String! } type InfoUsb implements Node { - id: PrefixedID! + id: PrefixedID! - """USB device name""" - name: String! + """ + USB device name + """ + name: String! - """USB bus number""" - bus: String + """ + USB bus number + """ + bus: String - """USB device number""" - device: String + """ + USB device number + """ + device: String } type InfoDevices implements Node { - id: PrefixedID! + id: PrefixedID! - """List of GPU devices""" - gpu: [InfoGpu!] + """ + List of GPU devices + """ + gpu: [InfoGpu!] - """List of network interfaces""" - network: [InfoNetwork!] + """ + List of network interfaces + """ + network: [InfoNetwork!] - """List of PCI devices""" - pci: [InfoPci!] + """ + List of PCI devices + """ + pci: [InfoPci!] - """List of USB devices""" - usb: [InfoUsb!] + """ + List of USB devices + """ + usb: [InfoUsb!] } type InfoDisplayCase implements Node { - id: PrefixedID! + id: PrefixedID! - """Case image URL""" - url: String! + """ + Case image URL + """ + url: String! - """Case icon identifier""" - icon: String! + """ + Case icon identifier + """ + icon: String! - """Error message if any""" - error: String! + """ + Error message if any + """ + error: String! - """Base64 encoded case image""" - base64: String! + """ + Base64 encoded case image + """ + base64: String! } type InfoDisplay implements Node { - id: PrefixedID! - - """Case display configuration""" - case: InfoDisplayCase! - - """UI theme name""" - theme: ThemeName! - - """Temperature unit (C or F)""" - unit: Temperature! - - """Enable UI scaling""" - scale: Boolean! - - """Show tabs in UI""" - tabs: Boolean! - - """Enable UI resize""" - resize: Boolean! - - """Show WWN identifiers""" - wwn: Boolean! - - """Show totals""" - total: Boolean! - - """Show usage statistics""" - usage: Boolean! - - """Show text labels""" - text: Boolean! - - """Warning temperature threshold""" - warning: Int! - - """Critical temperature threshold""" - critical: Int! - - """Hot temperature threshold""" - hot: Int! - - """Maximum temperature threshold""" - max: Int - - """Locale setting""" - locale: String + id: PrefixedID! + + """ + Case display configuration + """ + case: InfoDisplayCase! + + """ + UI theme name + """ + theme: ThemeName! + + """ + Temperature unit (C or F) + """ + unit: Temperature! + + """ + Enable UI scaling + """ + scale: Boolean! + + """ + Show tabs in UI + """ + tabs: Boolean! + + """ + Enable UI resize + """ + resize: Boolean! + + """ + Show WWN identifiers + """ + wwn: Boolean! + + """ + Show totals + """ + total: Boolean! + + """ + Show usage statistics + """ + usage: Boolean! + + """ + Show text labels + """ + text: Boolean! + + """ + Warning temperature threshold + """ + warning: Int! + + """ + Critical temperature threshold + """ + critical: Int! + + """ + Hot temperature threshold + """ + hot: Int! + + """ + Maximum temperature threshold + """ + max: Int + + """ + Locale setting + """ + locale: String } -"""Temperature unit""" +""" +Temperature unit +""" enum Temperature { - CELSIUS - FAHRENHEIT + CELSIUS + FAHRENHEIT } -"""CPU load for a single core""" +""" +CPU load for a single core +""" type CpuLoad { - """The total CPU load on a single core, in percent.""" - percentTotal: Float! - - """The percentage of time the CPU spent in user space.""" - percentUser: Float! - - """The percentage of time the CPU spent in kernel space.""" - percentSystem: Float! - - """ - The percentage of time the CPU spent on low-priority (niced) user space processes. - """ - percentNice: Float! - - """The percentage of time the CPU was idle.""" - percentIdle: Float! - - """The percentage of time the CPU spent servicing hardware interrupts.""" - percentIrq: Float! - - """The percentage of time the CPU spent running virtual machines (guest).""" - percentGuest: Float! - - """The percentage of CPU time stolen by the hypervisor.""" - percentSteal: Float! + """ + The total CPU load on a single core, in percent. + """ + percentTotal: Float! + + """ + The percentage of time the CPU spent in user space. + """ + percentUser: Float! + + """ + The percentage of time the CPU spent in kernel space. + """ + percentSystem: Float! + + """ + The percentage of time the CPU spent on low-priority (niced) user space processes. + """ + percentNice: Float! + + """ + The percentage of time the CPU was idle. + """ + percentIdle: Float! + + """ + The percentage of time the CPU spent servicing hardware interrupts. + """ + percentIrq: Float! + + """ + The percentage of time the CPU spent running virtual machines (guest). + """ + percentGuest: Float! + + """ + The percentage of CPU time stolen by the hypervisor. + """ + percentSteal: Float! } type CpuPackages implements Node { - id: PrefixedID! + id: PrefixedID! - """Total CPU package power draw (W)""" - totalPower: Float! + """ + Total CPU package power draw (W) + """ + totalPower: Float! - """Power draw per package (W)""" - power: [Float!]! + """ + Power draw per package (W) + """ + power: [Float!]! - """Temperature per package (°C)""" - temp: [Float!]! + """ + Temperature per package (°C) + """ + temp: [Float!]! } type CpuUtilization implements Node { - id: PrefixedID! + id: PrefixedID! - """Total CPU load in percent""" - percentTotal: Float! + """ + Total CPU load in percent + """ + percentTotal: Float! - """CPU load for each core""" - cpus: [CpuLoad!]! + """ + CPU load for each core + """ + cpus: [CpuLoad!]! } type InfoCpu implements Node { - id: PrefixedID! - - """CPU manufacturer""" - manufacturer: String - - """CPU brand name""" - brand: String - - """CPU vendor""" - vendor: String - - """CPU family""" - family: String - - """CPU model""" - model: String - - """CPU stepping""" - stepping: Int - - """CPU revision""" - revision: String - - """CPU voltage""" - voltage: String - - """Current CPU speed in GHz""" - speed: Float - - """Minimum CPU speed in GHz""" - speedmin: Float - - """Maximum CPU speed in GHz""" - speedmax: Float - - """Number of CPU threads""" - threads: Int - - """Number of CPU cores""" - cores: Int - - """Number of physical processors""" - processors: Int - - """CPU socket type""" - socket: String - - """CPU cache information""" - cache: JSON - - """CPU feature flags""" - flags: [String!] - - """ - Per-package array of core/thread pairs, e.g. [[[0,1],[2,3]], [[4,5],[6,7]]] - """ - topology: [[[Int!]!]!]! - packages: CpuPackages! + id: PrefixedID! + + """ + CPU manufacturer + """ + manufacturer: String + + """ + CPU brand name + """ + brand: String + + """ + CPU vendor + """ + vendor: String + + """ + CPU family + """ + family: String + + """ + CPU model + """ + model: String + + """ + CPU stepping + """ + stepping: Int + + """ + CPU revision + """ + revision: String + + """ + CPU voltage + """ + voltage: String + + """ + Current CPU speed in GHz + """ + speed: Float + + """ + Minimum CPU speed in GHz + """ + speedmin: Float + + """ + Maximum CPU speed in GHz + """ + speedmax: Float + + """ + Number of CPU threads + """ + threads: Int + + """ + Number of CPU cores + """ + cores: Int + + """ + Number of physical processors + """ + processors: Int + + """ + CPU socket type + """ + socket: String + + """ + CPU cache information + """ + cache: JSON + + """ + CPU feature flags + """ + flags: [String!] + + """ + Per-package array of core/thread pairs, e.g. [[[0,1],[2,3]], [[4,5],[6,7]]] + """ + topology: [[[Int!]!]!]! + packages: CpuPackages! } type MemoryLayout implements Node { - id: PrefixedID! - - """Memory module size in bytes""" - size: BigInt! - - """Memory bank location (e.g., BANK 0)""" - bank: String - - """Memory type (e.g., DDR4, DDR5)""" - type: String - - """Memory clock speed in MHz""" - clockSpeed: Int - - """Part number of the memory module""" - partNum: String - - """Serial number of the memory module""" - serialNum: String - - """Memory manufacturer""" - manufacturer: String - - """Form factor (e.g., DIMM, SODIMM)""" - formFactor: String - - """Configured voltage in millivolts""" - voltageConfigured: Int - - """Minimum voltage in millivolts""" - voltageMin: Int - - """Maximum voltage in millivolts""" - voltageMax: Int + id: PrefixedID! + + """ + Memory module size in bytes + """ + size: BigInt! + + """ + Memory bank location (e.g., BANK 0) + """ + bank: String + + """ + Memory type (e.g., DDR4, DDR5) + """ + type: String + + """ + Memory clock speed in MHz + """ + clockSpeed: Int + + """ + Part number of the memory module + """ + partNum: String + + """ + Serial number of the memory module + """ + serialNum: String + + """ + Memory manufacturer + """ + manufacturer: String + + """ + Form factor (e.g., DIMM, SODIMM) + """ + formFactor: String + + """ + Configured voltage in millivolts + """ + voltageConfigured: Int + + """ + Minimum voltage in millivolts + """ + voltageMin: Int + + """ + Maximum voltage in millivolts + """ + voltageMax: Int } type MemoryUtilization implements Node { - id: PrefixedID! - - """Total system memory in bytes""" - total: BigInt! - - """Used memory in bytes""" - used: BigInt! - - """Free memory in bytes""" - free: BigInt! - - """Available memory in bytes""" - available: BigInt! - - """Active memory in bytes""" - active: BigInt! - - """Buffer/cache memory in bytes""" - buffcache: BigInt! - - """Memory usage percentage""" - percentTotal: Float! - - """Total swap memory in bytes""" - swapTotal: BigInt! - - """Used swap memory in bytes""" - swapUsed: BigInt! - - """Free swap memory in bytes""" - swapFree: BigInt! - - """Swap usage percentage""" - percentSwapTotal: Float! + id: PrefixedID! + + """ + Total system memory in bytes + """ + total: BigInt! + + """ + Used memory in bytes + """ + used: BigInt! + + """ + Free memory in bytes + """ + free: BigInt! + + """ + Available memory in bytes + """ + available: BigInt! + + """ + Active memory in bytes + """ + active: BigInt! + + """ + Buffer/cache memory in bytes + """ + buffcache: BigInt! + + """ + Memory usage percentage + """ + percentTotal: Float! + + """ + Total swap memory in bytes + """ + swapTotal: BigInt! + + """ + Used swap memory in bytes + """ + swapUsed: BigInt! + + """ + Free swap memory in bytes + """ + swapFree: BigInt! + + """ + Swap usage percentage + """ + percentSwapTotal: Float! } type InfoMemory implements Node { - id: PrefixedID! + id: PrefixedID! - """Physical memory layout""" - layout: [MemoryLayout!]! + """ + Physical memory layout + """ + layout: [MemoryLayout!]! } type InfoOs implements Node { - id: PrefixedID! - - """Operating system platform""" - platform: String - - """Linux distribution name""" - distro: String - - """OS release version""" - release: String - - """OS codename""" - codename: String - - """Kernel version""" - kernel: String - - """OS architecture""" - arch: String - - """Hostname""" - hostname: String - - """Fully qualified domain name""" - fqdn: String - - """OS build identifier""" - build: String - - """Service pack version""" - servicepack: String - - """Boot time ISO string""" - uptime: String - - """OS logo name""" - logofile: String - - """OS serial number""" - serial: String - - """OS started via UEFI""" - uefi: Boolean + id: PrefixedID! + + """ + Operating system platform + """ + platform: String + + """ + Linux distribution name + """ + distro: String + + """ + OS release version + """ + release: String + + """ + OS codename + """ + codename: String + + """ + Kernel version + """ + kernel: String + + """ + OS architecture + """ + arch: String + + """ + Hostname + """ + hostname: String + + """ + Fully qualified domain name + """ + fqdn: String + + """ + OS build identifier + """ + build: String + + """ + Service pack version + """ + servicepack: String + + """ + Boot time ISO string + """ + uptime: String + + """ + OS logo name + """ + logofile: String + + """ + OS serial number + """ + serial: String + + """ + OS started via UEFI + """ + uefi: Boolean } type InfoSystem implements Node { - id: PrefixedID! + id: PrefixedID! - """System manufacturer""" - manufacturer: String + """ + System manufacturer + """ + manufacturer: String - """System model""" - model: String + """ + System model + """ + model: String - """System version""" - version: String + """ + System version + """ + version: String - """System serial number""" - serial: String + """ + System serial number + """ + serial: String - """System UUID""" - uuid: String + """ + System UUID + """ + uuid: String - """System SKU""" - sku: String + """ + System SKU + """ + sku: String - """Virtual machine flag""" - virtual: Boolean + """ + Virtual machine flag + """ + virtual: Boolean } type InfoBaseboard implements Node { - id: PrefixedID! + id: PrefixedID! - """Motherboard manufacturer""" - manufacturer: String + """ + Motherboard manufacturer + """ + manufacturer: String - """Motherboard model""" - model: String + """ + Motherboard model + """ + model: String - """Motherboard version""" - version: String + """ + Motherboard version + """ + version: String - """Motherboard serial number""" - serial: String + """ + Motherboard serial number + """ + serial: String - """Motherboard asset tag""" - assetTag: String + """ + Motherboard asset tag + """ + assetTag: String - """Maximum memory capacity in bytes""" - memMax: Float + """ + Maximum memory capacity in bytes + """ + memMax: Float - """Number of memory slots""" - memSlots: Float + """ + Number of memory slots + """ + memSlots: Float } type CoreVersions { - """Unraid version""" - unraid: String + """ + Unraid version + """ + unraid: String - """Unraid API version""" - api: String + """ + Unraid API version + """ + api: String - """Kernel version""" - kernel: String + """ + Kernel version + """ + kernel: String } type PackageVersions { - """OpenSSL version""" - openssl: String - - """Node.js version""" - node: String - - """npm version""" - npm: String - - """pm2 version""" - pm2: String - - """Git version""" - git: String - - """nginx version""" - nginx: String - - """PHP version""" - php: String - - """Docker version""" - docker: String + """ + OpenSSL version + """ + openssl: String + + """ + Node.js version + """ + node: String + + """ + npm version + """ + npm: String + + """ + pm2 version + """ + pm2: String + + """ + Git version + """ + git: String + + """ + nginx version + """ + nginx: String + + """ + PHP version + """ + php: String + + """ + Docker version + """ + docker: String } type InfoVersions implements Node { - id: PrefixedID! + id: PrefixedID! - """Core system versions""" - core: CoreVersions! + """ + Core system versions + """ + core: CoreVersions! - """Software package versions""" - packages: PackageVersions + """ + Software package versions + """ + packages: PackageVersions } type Info implements Node { - id: PrefixedID! - - """Current server time""" - time: DateTime! - - """Motherboard information""" - baseboard: InfoBaseboard! - - """CPU information""" - cpu: InfoCpu! - - """Device information""" - devices: InfoDevices! - - """Display configuration""" - display: InfoDisplay! - - """Machine ID""" - machineId: ID - - """Memory information""" - memory: InfoMemory! - - """Operating system information""" - os: InfoOs! - - """System information""" - system: InfoSystem! - - """Software versions""" - versions: InfoVersions! + id: PrefixedID! + + """ + Current server time + """ + time: DateTime! + + """ + Motherboard information + """ + baseboard: InfoBaseboard! + + """ + CPU information + """ + cpu: InfoCpu! + + """ + Device information + """ + devices: InfoDevices! + + """ + Display configuration + """ + display: InfoDisplay! + + """ + Machine ID + """ + machineId: ID + + """ + Memory information + """ + memory: InfoMemory! + + """ + Operating system information + """ + os: InfoOs! + + """ + System information + """ + system: InfoSystem! + + """ + Software versions + """ + versions: InfoVersions! } type LogFile { - """Name of the log file""" - name: String! + """ + Name of the log file + """ + name: String! - """Full path to the log file""" - path: String! + """ + Full path to the log file + """ + path: String! - """Size of the log file in bytes""" - size: Int! + """ + Size of the log file in bytes + """ + size: Int! - """Last modified timestamp""" - modifiedAt: DateTime! + """ + Last modified timestamp + """ + modifiedAt: DateTime! } type LogFileContent { - """Path to the log file""" - path: String! + """ + Path to the log file + """ + path: String! - """Content of the log file""" - content: String! + """ + Content of the log file + """ + content: String! - """Total number of lines in the file""" - totalLines: Int! + """ + Total number of lines in the file + """ + totalLines: Int! - """Starting line number of the content (1-indexed)""" - startLine: Int + """ + Starting line number of the content (1-indexed) + """ + startLine: Int } -"""System metrics including CPU and memory utilization""" +""" +System metrics including CPU and memory utilization +""" type Metrics implements Node { - id: PrefixedID! + id: PrefixedID! - """Current CPU utilization metrics""" - cpu: CpuUtilization + """ + Current CPU utilization metrics + """ + cpu: CpuUtilization - """Current memory utilization metrics""" - memory: MemoryUtilization + """ + Current memory utilization metrics + """ + memory: MemoryUtilization } type Owner { - username: String! - url: String! - avatar: String! + username: String! + url: String! + avatar: String! } type ProfileModel implements Node { - id: PrefixedID! - username: String! - url: String! - avatar: String! + id: PrefixedID! + username: String! + url: String! + avatar: String! } type Server implements Node { - id: PrefixedID! - owner: ProfileModel! - guid: String! - apikey: String! - name: String! - - """Whether this server is online or offline""" - status: ServerStatus! - wanip: String! - lanip: String! - localurl: String! - remoteurl: String! + id: PrefixedID! + owner: ProfileModel! + guid: String! + apikey: String! + name: String! + + """ + Whether this server is online or offline + """ + status: ServerStatus! + wanip: String! + lanip: String! + localurl: String! + remoteurl: String! } enum ServerStatus { - ONLINE - OFFLINE - NEVER_CONNECTED + ONLINE + OFFLINE + NEVER_CONNECTED } type ApiConfig { - version: String! - extraOrigins: [String!]! - sandbox: Boolean - ssoSubIds: [String!]! - plugins: [String!]! + version: String! + extraOrigins: [String!]! + sandbox: Boolean + ssoSubIds: [String!]! + plugins: [String!]! } type OidcAuthorizationRule { - """The claim to check (e.g., email, sub, groups, hd)""" - claim: String! + """ + The claim to check (e.g., email, sub, groups, hd) + """ + claim: String! - """The comparison operator""" - operator: AuthorizationOperator! + """ + The comparison operator + """ + operator: AuthorizationOperator! - """The value(s) to match against""" - value: [String!]! + """ + The value(s) to match against + """ + value: [String!]! } -"""Operators for authorization rule matching""" +""" +Operators for authorization rule matching +""" enum AuthorizationOperator { - EQUALS - CONTAINS - ENDS_WITH - STARTS_WITH + EQUALS + CONTAINS + ENDS_WITH + STARTS_WITH } type OidcProvider { - """The unique identifier for the OIDC provider""" - id: PrefixedID! - - """Display name of the OIDC provider""" - name: String! - - """OAuth2 client ID registered with the provider""" - clientId: String! - - """OAuth2 client secret (if required by provider)""" - clientSecret: String - - """ - OIDC issuer URL (e.g., https://accounts.google.com). Required for auto-discovery via /.well-known/openid-configuration - """ - issuer: String - - """ - OAuth2 authorization endpoint URL. If omitted, will be auto-discovered from issuer/.well-known/openid-configuration - """ - authorizationEndpoint: String - - """ - OAuth2 token endpoint URL. If omitted, will be auto-discovered from issuer/.well-known/openid-configuration - """ - tokenEndpoint: String - - """ - JSON Web Key Set URI for token validation. If omitted, will be auto-discovered from issuer/.well-known/openid-configuration - """ - jwksUri: String - - """OAuth2 scopes to request (e.g., openid, profile, email)""" - scopes: [String!]! - - """Flexible authorization rules based on claims""" - authorizationRules: [OidcAuthorizationRule!] - - """ - Mode for evaluating authorization rules - OR (any rule passes) or AND (all rules must pass). Defaults to OR. - """ - authorizationRuleMode: AuthorizationRuleMode - - """Custom text for the login button""" - buttonText: String - - """URL or base64 encoded icon for the login button""" - buttonIcon: String - - """ - Button variant style from Reka UI. See https://reka-ui.com/docs/components/button - """ - buttonVariant: String - - """ - Custom CSS styles for the button (e.g., "background: linear-gradient(to right, #4f46e5, #7c3aed); border-radius: 9999px;") - """ - buttonStyle: String + """ + The unique identifier for the OIDC provider + """ + id: PrefixedID! + + """ + Display name of the OIDC provider + """ + name: String! + + """ + OAuth2 client ID registered with the provider + """ + clientId: String! + + """ + OAuth2 client secret (if required by provider) + """ + clientSecret: String + + """ + OIDC issuer URL (e.g., https://accounts.google.com). Required for auto-discovery via /.well-known/openid-configuration + """ + issuer: String + + """ + OAuth2 authorization endpoint URL. If omitted, will be auto-discovered from issuer/.well-known/openid-configuration + """ + authorizationEndpoint: String + + """ + OAuth2 token endpoint URL. If omitted, will be auto-discovered from issuer/.well-known/openid-configuration + """ + tokenEndpoint: String + + """ + JSON Web Key Set URI for token validation. If omitted, will be auto-discovered from issuer/.well-known/openid-configuration + """ + jwksUri: String + + """ + OAuth2 scopes to request (e.g., openid, profile, email) + """ + scopes: [String!]! + + """ + Flexible authorization rules based on claims + """ + authorizationRules: [OidcAuthorizationRule!] + + """ + Mode for evaluating authorization rules - OR (any rule passes) or AND (all rules must pass). Defaults to OR. + """ + authorizationRuleMode: AuthorizationRuleMode + + """ + Custom text for the login button + """ + buttonText: String + + """ + URL or base64 encoded icon for the login button + """ + buttonIcon: String + + """ + Button variant style from Reka UI. See https://reka-ui.com/docs/components/button + """ + buttonVariant: String + + """ + Custom CSS styles for the button (e.g., "background: linear-gradient(to right, #4f46e5, #7c3aed); border-radius: 9999px;") + """ + buttonStyle: String } """ Mode for evaluating authorization rules - OR (any rule passes) or AND (all rules must pass) """ enum AuthorizationRuleMode { - OR - AND + OR + AND } type OidcConfiguration { - """List of configured OIDC providers""" - providers: [OidcProvider!]! + """ + List of configured OIDC providers + """ + providers: [OidcProvider!]! - """ - Default allowed redirect origins that apply to all OIDC providers (e.g., Tailscale domains) - """ - defaultAllowedOrigins: [String!] + """ + Default allowed redirect origins that apply to all OIDC providers (e.g., Tailscale domains) + """ + defaultAllowedOrigins: [String!] } type OidcSessionValidation { - valid: Boolean! - username: String + valid: Boolean! + username: String } type PublicOidcProvider { - id: ID! - name: String! - buttonText: String - buttonIcon: String - buttonVariant: String - buttonStyle: String + id: ID! + name: String! + buttonText: String + buttonIcon: String + buttonVariant: String + buttonStyle: String } type UPSBattery { - """ - Battery charge level as a percentage (0-100). Unit: percent (%). Example: 100 means battery is fully charged - """ - chargeLevel: Int! + """ + Battery charge level as a percentage (0-100). Unit: percent (%). Example: 100 means battery is fully charged + """ + chargeLevel: Int! - """ - Estimated runtime remaining on battery power. Unit: seconds. Example: 3600 means 1 hour of runtime remaining - """ - estimatedRuntime: Int! + """ + Estimated runtime remaining on battery power. Unit: seconds. Example: 3600 means 1 hour of runtime remaining + """ + estimatedRuntime: Int! - """ - Battery health status. Possible values: 'Good', 'Replace', 'Unknown'. Indicates if the battery needs replacement - """ - health: String! + """ + Battery health status. Possible values: 'Good', 'Replace', 'Unknown'. Indicates if the battery needs replacement + """ + health: String! } type UPSPower { - """ - Input voltage from the wall outlet/mains power. Unit: volts (V). Example: 120.5 for typical US household voltage - """ - inputVoltage: Float! + """ + Input voltage from the wall outlet/mains power. Unit: volts (V). Example: 120.5 for typical US household voltage + """ + inputVoltage: Float! - """ - Output voltage being delivered to connected devices. Unit: volts (V). Example: 120.5 - should match input voltage when on mains power - """ - outputVoltage: Float! + """ + Output voltage being delivered to connected devices. Unit: volts (V). Example: 120.5 - should match input voltage when on mains power + """ + outputVoltage: Float! - """ - Current load on the UPS as a percentage of its capacity. Unit: percent (%). Example: 25 means UPS is loaded at 25% of its maximum capacity - """ - loadPercentage: Int! + """ + Current load on the UPS as a percentage of its capacity. Unit: percent (%). Example: 25 means UPS is loaded at 25% of its maximum capacity + """ + loadPercentage: Int! } type UPSDevice { - """ - Unique identifier for the UPS device. Usually based on the model name or a generated ID - """ - id: ID! + """ + Unique identifier for the UPS device. Usually based on the model name or a generated ID + """ + id: ID! - """Display name for the UPS device. Can be customized by the user""" - name: String! + """ + Display name for the UPS device. Can be customized by the user + """ + name: String! - """UPS model name/number. Example: 'APC Back-UPS Pro 1500'""" - model: String! + """ + UPS model name/number. Example: 'APC Back-UPS Pro 1500' + """ + model: String! - """ - Current operational status of the UPS. Common values: 'Online', 'On Battery', 'Low Battery', 'Replace Battery', 'Overload', 'Offline'. 'Online' means running on mains power, 'On Battery' means running on battery backup - """ - status: String! + """ + Current operational status of the UPS. Common values: 'Online', 'On Battery', 'Low Battery', 'Replace Battery', 'Overload', 'Offline'. 'Online' means running on mains power, 'On Battery' means running on battery backup + """ + status: String! - """Battery-related information""" - battery: UPSBattery! + """ + Battery-related information + """ + battery: UPSBattery! - """Power-related information""" - power: UPSPower! + """ + Power-related information + """ + power: UPSPower! } type UPSConfiguration { - """ - UPS service state. Values: 'enable' or 'disable'. Controls whether the UPS monitoring service is running - """ - service: String - - """ - Type of cable connecting the UPS to the server. Common values: 'usb', 'smart', 'ether', 'custom'. Determines communication protocol - """ - upsCable: String - - """ - Custom cable configuration string. Only used when upsCable is set to 'custom'. Format depends on specific UPS model - """ - customUpsCable: String - - """ - UPS communication type. Common values: 'usb', 'net', 'snmp', 'dumb', 'pcnet', 'modbus'. Defines how the server communicates with the UPS - """ - upsType: String - - """ - Device path or network address for UPS connection. Examples: '/dev/ttyUSB0' for USB, '192.168.1.100:3551' for network. Depends on upsType setting - """ - device: String - - """ - Override UPS capacity for runtime calculations. Unit: volt-amperes (VA). Example: 1500 for a 1500VA UPS. Leave unset to use UPS-reported capacity - """ - overrideUpsCapacity: Int - - """ - Battery level threshold for shutdown. Unit: percent (%). Example: 10 means shutdown when battery reaches 10%. System will shutdown when battery drops to this level - """ - batteryLevel: Int - - """ - Runtime threshold for shutdown. Unit: minutes. Example: 5 means shutdown when 5 minutes runtime remaining. System will shutdown when estimated runtime drops below this - """ - minutes: Int - - """ - Timeout for UPS communications. Unit: seconds. Example: 0 means no timeout. Time to wait for UPS response before considering it offline - """ - timeout: Int - - """ - Kill UPS power after shutdown. Values: 'yes' or 'no'. If 'yes', tells UPS to cut power after system shutdown. Useful for ensuring complete power cycle - """ - killUps: String - - """ - Network Information Server (NIS) IP address. Default: '0.0.0.0' (listen on all interfaces). IP address for apcupsd network information server - """ - nisIp: String - - """ - Network server mode. Values: 'on' or 'off'. Enable to allow network clients to monitor this UPS - """ - netServer: String - - """ - UPS name for network monitoring. Used to identify this UPS on the network. Example: 'SERVER_UPS' - """ - upsName: String - - """ - Override UPS model name. Used for display purposes. Leave unset to use UPS-reported model - """ - modelName: String + """ + UPS service state. Values: 'enable' or 'disable'. Controls whether the UPS monitoring service is running + """ + service: String + + """ + Type of cable connecting the UPS to the server. Common values: 'usb', 'smart', 'ether', 'custom'. Determines communication protocol + """ + upsCable: String + + """ + Custom cable configuration string. Only used when upsCable is set to 'custom'. Format depends on specific UPS model + """ + customUpsCable: String + + """ + UPS communication type. Common values: 'usb', 'net', 'snmp', 'dumb', 'pcnet', 'modbus'. Defines how the server communicates with the UPS + """ + upsType: String + + """ + Device path or network address for UPS connection. Examples: '/dev/ttyUSB0' for USB, '192.168.1.100:3551' for network. Depends on upsType setting + """ + device: String + + """ + Override UPS capacity for runtime calculations. Unit: volt-amperes (VA). Example: 1500 for a 1500VA UPS. Leave unset to use UPS-reported capacity + """ + overrideUpsCapacity: Int + + """ + Battery level threshold for shutdown. Unit: percent (%). Example: 10 means shutdown when battery reaches 10%. System will shutdown when battery drops to this level + """ + batteryLevel: Int + + """ + Runtime threshold for shutdown. Unit: minutes. Example: 5 means shutdown when 5 minutes runtime remaining. System will shutdown when estimated runtime drops below this + """ + minutes: Int + + """ + Timeout for UPS communications. Unit: seconds. Example: 0 means no timeout. Time to wait for UPS response before considering it offline + """ + timeout: Int + + """ + Kill UPS power after shutdown. Values: 'yes' or 'no'. If 'yes', tells UPS to cut power after system shutdown. Useful for ensuring complete power cycle + """ + killUps: String + + """ + Network Information Server (NIS) IP address. Default: '0.0.0.0' (listen on all interfaces). IP address for apcupsd network information server + """ + nisIp: String + + """ + Network server mode. Values: 'on' or 'off'. Enable to allow network clients to monitor this UPS + """ + netServer: String + + """ + UPS name for network monitoring. Used to identify this UPS on the network. Example: 'SERVER_UPS' + """ + upsName: String + + """ + Override UPS model name. Used for display purposes. Leave unset to use UPS-reported model + """ + modelName: String } type VmDomain implements Node { - """The unique identifier for the vm (uuid)""" - id: PrefixedID! + """ + The unique identifier for the vm (uuid) + """ + id: PrefixedID! - """A friendly name for the vm""" - name: String + """ + A friendly name for the vm + """ + name: String - """Current domain vm state""" - state: VmState! + """ + Current domain vm state + """ + state: VmState! - """The UUID of the vm""" - uuid: String @deprecated(reason: "Use id instead") + """ + The UUID of the vm + """ + uuid: String @deprecated(reason: "Use id instead") } -"""The state of a virtual machine""" +""" +The state of a virtual machine +""" enum VmState { - NOSTATE - RUNNING - IDLE - PAUSED - SHUTDOWN - SHUTOFF - CRASHED - PMSUSPENDED + NOSTATE + RUNNING + IDLE + PAUSED + SHUTDOWN + SHUTOFF + CRASHED + PMSUSPENDED } type Vms implements Node { - id: PrefixedID! - domains: [VmDomain!] - domain: [VmDomain!] + id: PrefixedID! + domains: [VmDomain!] + domain: [VmDomain!] } type Uptime { - timestamp: String + timestamp: String } type Service implements Node { - id: PrefixedID! - name: String - online: Boolean - uptime: Uptime - version: String + id: PrefixedID! + name: String + online: Boolean + uptime: Uptime + version: String } type UserAccount implements Node { - id: PrefixedID! + id: PrefixedID! - """The name of the user""" - name: String! + """ + The name of the user + """ + name: String! - """A description of the user""" - description: String! + """ + A description of the user + """ + description: String! - """The roles of the user""" - roles: [Role!]! + """ + The roles of the user + """ + roles: [Role!]! - """The permissions of the user""" - permissions: [Permission!] + """ + The permissions of the user + """ + permissions: [Permission!] } type Plugin { - """The name of the plugin package""" - name: String! + """ + The name of the plugin package + """ + name: String! - """The version of the plugin package""" - version: String! + """ + The version of the plugin package + """ + version: String! - """Whether the plugin has an API module""" - hasApiModule: Boolean + """ + Whether the plugin has an API module + """ + hasApiModule: Boolean - """Whether the plugin has a CLI module""" - hasCliModule: Boolean + """ + Whether the plugin has a CLI module + """ + hasCliModule: Boolean } type AccessUrl { - type: URL_TYPE! - name: String - ipv4: URL - ipv6: URL + type: URL_TYPE! + name: String + ipv4: URL + ipv6: URL } enum URL_TYPE { - LAN - WIREGUARD - WAN - MDNS - OTHER - DEFAULT + LAN + WIREGUARD + WAN + MDNS + OTHER + DEFAULT } """ @@ -2326,475 +3111,601 @@ A field whose value conforms to the standard URL format as specified in RFC3986: scalar URL type AccessUrlObject { - ipv4: String - ipv6: String - type: URL_TYPE! - name: String + ipv4: String + ipv6: String + type: URL_TYPE! + name: String } type ApiKeyResponse { - valid: Boolean! - error: String + valid: Boolean! + error: String } type MinigraphqlResponse { - status: MinigraphStatus! - timeout: Int - error: String + status: MinigraphStatus! + timeout: Int + error: String } -"""The status of the minigraph""" +""" +The status of the minigraph +""" enum MinigraphStatus { - PRE_INIT - CONNECTING - CONNECTED - PING_FAILURE - ERROR_RETRYING + PRE_INIT + CONNECTING + CONNECTED + PING_FAILURE + ERROR_RETRYING } type CloudResponse { - status: String! - ip: String - error: String + status: String! + ip: String + error: String } type RelayResponse { - status: String! - timeout: String - error: String + status: String! + timeout: String + error: String } type Cloud { - error: String - apiKey: ApiKeyResponse! - relay: RelayResponse - minigraphql: MinigraphqlResponse! - cloud: CloudResponse! - allowedOrigins: [String!]! + error: String + apiKey: ApiKeyResponse! + relay: RelayResponse + minigraphql: MinigraphqlResponse! + cloud: CloudResponse! + allowedOrigins: [String!]! } type RemoteAccess { - """The type of WAN access used for Remote Access""" - accessType: WAN_ACCESS_TYPE! + """ + The type of WAN access used for Remote Access + """ + accessType: WAN_ACCESS_TYPE! - """The type of port forwarding used for Remote Access""" - forwardType: WAN_FORWARD_TYPE + """ + The type of port forwarding used for Remote Access + """ + forwardType: WAN_FORWARD_TYPE - """The port used for Remote Access""" - port: Int + """ + The port used for Remote Access + """ + port: Int } enum WAN_ACCESS_TYPE { - DYNAMIC - ALWAYS - DISABLED + DYNAMIC + ALWAYS + DISABLED } enum WAN_FORWARD_TYPE { - UPNP - STATIC + UPNP + STATIC } type DynamicRemoteAccessStatus { - """The type of dynamic remote access that is enabled""" - enabledType: DynamicRemoteAccessType! + """ + The type of dynamic remote access that is enabled + """ + enabledType: DynamicRemoteAccessType! - """The type of dynamic remote access that is currently running""" - runningType: DynamicRemoteAccessType! + """ + The type of dynamic remote access that is currently running + """ + runningType: DynamicRemoteAccessType! - """Any error message associated with the dynamic remote access""" - error: String + """ + Any error message associated with the dynamic remote access + """ + error: String } enum DynamicRemoteAccessType { - STATIC - UPNP - DISABLED + STATIC + UPNP + DISABLED } type ConnectSettingsValues { - """The type of WAN access used for Remote Access""" - accessType: WAN_ACCESS_TYPE! + """ + The type of WAN access used for Remote Access + """ + accessType: WAN_ACCESS_TYPE! - """The type of port forwarding used for Remote Access""" - forwardType: WAN_FORWARD_TYPE + """ + The type of port forwarding used for Remote Access + """ + forwardType: WAN_FORWARD_TYPE - """The port used for Remote Access""" - port: Int + """ + The port used for Remote Access + """ + port: Int } type ConnectSettings implements Node { - id: PrefixedID! + id: PrefixedID! - """The data schema for the Connect settings""" - dataSchema: JSON! + """ + The data schema for the Connect settings + """ + dataSchema: JSON! - """The UI schema for the Connect settings""" - uiSchema: JSON! + """ + The UI schema for the Connect settings + """ + uiSchema: JSON! - """The values for the Connect settings""" - values: ConnectSettingsValues! + """ + The values for the Connect settings + """ + values: ConnectSettingsValues! } type Connect implements Node { - id: PrefixedID! + id: PrefixedID! - """The status of dynamic remote access""" - dynamicRemoteAccess: DynamicRemoteAccessStatus! + """ + The status of dynamic remote access + """ + dynamicRemoteAccess: DynamicRemoteAccessStatus! - """The settings for the Connect instance""" - settings: ConnectSettings! + """ + The settings for the Connect instance + """ + settings: ConnectSettings! } type Network implements Node { - id: PrefixedID! - accessUrls: [AccessUrl!] + id: PrefixedID! + accessUrls: [AccessUrl!] } input AccessUrlObjectInput { - ipv4: String - ipv6: String - type: URL_TYPE! - name: String + ipv4: String + ipv6: String + type: URL_TYPE! + name: String } "\n### Description:\n\nID scalar type that prefixes the underlying ID with the server identifier on output and strips it on input.\n\nWe use this scalar type to ensure that the ID is unique across all servers, allowing the same underlying resource ID to be used across different server instances.\n\n#### Input Behavior:\n\nWhen providing an ID as input (e.g., in arguments or input objects), the server identifier prefix (':') is optional.\n\n- If the prefix is present (e.g., '123:456'), it will be automatically stripped, and only the underlying ID ('456') will be used internally.\n- If the prefix is absent (e.g., '456'), the ID will be used as-is.\n\nThis makes it flexible for clients, as they don't strictly need to know or provide the server ID.\n\n#### Output Behavior:\n\nWhen an ID is returned in the response (output), it will *always* be prefixed with the current server's unique identifier (e.g., '123:456').\n\n#### Example:\n\nNote: The server identifier is '123' in this example.\n\n##### Input (Prefix Optional):\n```graphql\n# Both of these are valid inputs resolving to internal ID '456'\n{\n someQuery(id: \"123:456\") { ... }\n anotherQuery(id: \"456\") { ... }\n}\n```\n\n##### Output (Prefix Always Added):\n```graphql\n# Assuming internal ID is '456'\n{\n \"data\": {\n \"someResource\": {\n \"id\": \"123:456\" \n }\n }\n}\n```\n " scalar PrefixedID type Query { - apiKeys: [ApiKey!]! - apiKey(id: PrefixedID!): ApiKey - - """All possible roles for API keys""" - apiKeyPossibleRoles: [Role!]! - - """All possible permissions for API keys""" - apiKeyPossiblePermissions: [Permission!]! - - """Get the actual permissions that would be granted by a set of roles""" - getPermissionsForRoles(roles: [Role!]!): [Permission!]! - - """ - Preview the effective permissions for a combination of roles and explicit permissions - """ - previewEffectivePermissions(roles: [Role!], permissions: [AddPermissionInput!]): [Permission!]! - - """Get all available authentication actions with possession""" - getAvailableAuthActions: [AuthAction!]! - - """Get JSON Schema for API key creation form""" - getApiKeyCreationFormSchema: ApiKeyFormSettings! - config: Config! - flash: Flash! - me: UserAccount! - - """Get all notifications""" - notifications: Notifications! - online: Boolean! - owner: Owner! - registration: Registration - server: Server - servers: [Server!]! - services: [Service!]! - shares: [Share!]! - vars: Vars! - isInitialSetup: Boolean! - - """Get information about all VMs on the system""" - vms: Vms! - parityHistory: [ParityCheck!]! - array: UnraidArray! - customization: Customization - publicPartnerInfo: PublicPartnerInfo - publicTheme: Theme! - docker: Docker! - dockerContainerOverviewForm(skipCache: Boolean! = false): DockerContainerOverviewForm! - disks: [Disk!]! - disk(id: PrefixedID!): Disk! - rclone: RCloneBackupSettings! - info: Info! - logFiles: [LogFile!]! - logFile(path: String!, lines: Int, startLine: Int): LogFileContent! - settings: Settings! - isSSOEnabled: Boolean! - - """Get public OIDC provider information for login buttons""" - publicOidcProviders: [PublicOidcProvider!]! - - """Get all configured OIDC providers (admin only)""" - oidcProviders: [OidcProvider!]! - - """Get a specific OIDC provider by ID""" - oidcProvider(id: PrefixedID!): OidcProvider - - """Get the full OIDC configuration (admin only)""" - oidcConfiguration: OidcConfiguration! - - """Validate an OIDC session token (internal use for CLI validation)""" - validateOidcSession(token: String!): OidcSessionValidation! - metrics: Metrics! - upsDevices: [UPSDevice!]! - upsDeviceById(id: String!): UPSDevice - upsConfiguration: UPSConfiguration! - - """List all installed plugins with their metadata""" - plugins: [Plugin!]! - remoteAccess: RemoteAccess! - connect: Connect! - network: Network! - cloud: Cloud! + apiKeys: [ApiKey!]! + apiKey(id: PrefixedID!): ApiKey + + """ + All possible roles for API keys + """ + apiKeyPossibleRoles: [Role!]! + + """ + All possible permissions for API keys + """ + apiKeyPossiblePermissions: [Permission!]! + + """ + Get the actual permissions that would be granted by a set of roles + """ + getPermissionsForRoles(roles: [Role!]!): [Permission!]! + + """ + Preview the effective permissions for a combination of roles and explicit permissions + """ + previewEffectivePermissions(roles: [Role!], permissions: [AddPermissionInput!]): [Permission!]! + + """ + Get all available authentication actions with possession + """ + getAvailableAuthActions: [AuthAction!]! + + """ + Get JSON Schema for API key creation form + """ + getApiKeyCreationFormSchema: ApiKeyFormSettings! + config: Config! + flash: Flash! + me: UserAccount! + + """ + Get all notifications + """ + notifications: Notifications! + online: Boolean! + owner: Owner! + registration: Registration + server: Server + servers: [Server!]! + services: [Service!]! + shares: [Share!]! + vars: Vars! + isInitialSetup: Boolean! + + """ + Get information about all VMs on the system + """ + vms: Vms! + parityHistory: [ParityCheck!]! + array: UnraidArray! + customization: Customization + publicPartnerInfo: PublicPartnerInfo + publicTheme: Theme! + docker: Docker! + dockerContainerOverviewForm(skipCache: Boolean! = false): DockerContainerOverviewForm! + disks: [Disk!]! + disk(id: PrefixedID!): Disk! + rclone: RCloneBackupSettings! + info: Info! + logFiles: [LogFile!]! + logFile(path: String!, lines: Int, startLine: Int): LogFileContent! + settings: Settings! + isSSOEnabled: Boolean! + + """ + Get public OIDC provider information for login buttons + """ + publicOidcProviders: [PublicOidcProvider!]! + + """ + Get all configured OIDC providers (admin only) + """ + oidcProviders: [OidcProvider!]! + + """ + Get a specific OIDC provider by ID + """ + oidcProvider(id: PrefixedID!): OidcProvider + + """ + Get the full OIDC configuration (admin only) + """ + oidcConfiguration: OidcConfiguration! + + """ + Validate an OIDC session token (internal use for CLI validation) + """ + validateOidcSession(token: String!): OidcSessionValidation! + metrics: Metrics! + upsDevices: [UPSDevice!]! + upsDeviceById(id: String!): UPSDevice + upsConfiguration: UPSConfiguration! + + """ + List all installed plugins with their metadata + """ + plugins: [Plugin!]! + remoteAccess: RemoteAccess! + connect: Connect! + network: Network! + cloud: Cloud! } type Mutation { - """Creates a new notification record""" - createNotification(input: NotificationData!): Notification! - deleteNotification(id: PrefixedID!, type: NotificationType!): NotificationOverview! - - """Deletes all archived notifications on server.""" - deleteArchivedNotifications: NotificationOverview! - - """Marks a notification as archived.""" - archiveNotification(id: PrefixedID!): Notification! - archiveNotifications(ids: [PrefixedID!]!): NotificationOverview! - - """ - Creates a notification if an equivalent unread notification does not already exist. - """ - notifyIfUnique(input: NotificationData!): Notification - archiveAll(importance: NotificationImportance): NotificationOverview! - - """Marks a notification as unread.""" - unreadNotification(id: PrefixedID!): Notification! - unarchiveNotifications(ids: [PrefixedID!]!): NotificationOverview! - unarchiveAll(importance: NotificationImportance): NotificationOverview! - - """Reads each notification to recompute & update the overview.""" - recalculateOverview: NotificationOverview! - array: ArrayMutations! - docker: DockerMutations! - vm: VmMutations! - parityCheck: ParityCheckMutations! - apiKey: ApiKeyMutations! - rclone: RCloneMutations! - createDockerFolder(name: String!, parentId: String, childrenIds: [String!]): ResolvedOrganizerV1! - setDockerFolderChildren(folderId: String, childrenIds: [String!]!): ResolvedOrganizerV1! - deleteDockerEntries(entryIds: [String!]!): ResolvedOrganizerV1! - moveDockerEntriesToFolder(sourceEntryIds: [String!]!, destinationFolderId: String!): ResolvedOrganizerV1! - moveDockerItemsToPosition(sourceEntryIds: [String!]!, destinationFolderId: String!, position: Float!): ResolvedOrganizerV1! - renameDockerFolder(folderId: String!, newName: String!): ResolvedOrganizerV1! - createDockerFolderWithItems(name: String!, parentId: String, sourceEntryIds: [String!], position: Float): ResolvedOrganizerV1! - updateDockerViewPreferences(viewId: String = "default", prefs: JSON!): ResolvedOrganizerV1! - syncDockerTemplatePaths: DockerTemplateSyncResult! - refreshDockerDigests: Boolean! - - """Initiates a flash drive backup using a configured remote.""" - initiateFlashBackup(input: InitiateFlashBackupInput!): FlashBackupStatus! - updateSettings(input: JSON!): UpdateSettingsResponse! - configureUps(config: UPSConfigInput!): Boolean! - - """ - Add one or more plugins to the API. Returns false if restart was triggered automatically, true if manual restart is required. - """ - addPlugin(input: PluginManagementInput!): Boolean! - - """ - Remove one or more plugins from the API. Returns false if restart was triggered automatically, true if manual restart is required. - """ - removePlugin(input: PluginManagementInput!): Boolean! - updateApiSettings(input: ConnectSettingsInput!): ConnectSettingsValues! - connectSignIn(input: ConnectSignInInput!): Boolean! - connectSignOut: Boolean! - setupRemoteAccess(input: SetupRemoteAccessInput!): Boolean! - enableDynamicRemoteAccess(input: EnableDynamicRemoteAccessInput!): Boolean! + """ + Creates a new notification record + """ + createNotification(input: NotificationData!): Notification! + deleteNotification(id: PrefixedID!, type: NotificationType!): NotificationOverview! + + """ + Deletes all archived notifications on server. + """ + deleteArchivedNotifications: NotificationOverview! + + """ + Marks a notification as archived. + """ + archiveNotification(id: PrefixedID!): Notification! + archiveNotifications(ids: [PrefixedID!]!): NotificationOverview! + + """ + Creates a notification if an equivalent unread notification does not already exist. + """ + notifyIfUnique(input: NotificationData!): Notification + archiveAll(importance: NotificationImportance): NotificationOverview! + + """ + Marks a notification as unread. + """ + unreadNotification(id: PrefixedID!): Notification! + unarchiveNotifications(ids: [PrefixedID!]!): NotificationOverview! + unarchiveAll(importance: NotificationImportance): NotificationOverview! + + """ + Reads each notification to recompute & update the overview. + """ + recalculateOverview: NotificationOverview! + array: ArrayMutations! + docker: DockerMutations! + vm: VmMutations! + parityCheck: ParityCheckMutations! + apiKey: ApiKeyMutations! + rclone: RCloneMutations! + createDockerFolder(name: String!, parentId: String, childrenIds: [String!]): ResolvedOrganizerV1! + setDockerFolderChildren(folderId: String, childrenIds: [String!]!): ResolvedOrganizerV1! + deleteDockerEntries(entryIds: [String!]!): ResolvedOrganizerV1! + moveDockerEntriesToFolder( + sourceEntryIds: [String!]! + destinationFolderId: String! + ): ResolvedOrganizerV1! + moveDockerItemsToPosition( + sourceEntryIds: [String!]! + destinationFolderId: String! + position: Float! + ): ResolvedOrganizerV1! + renameDockerFolder(folderId: String!, newName: String!): ResolvedOrganizerV1! + createDockerFolderWithItems( + name: String! + parentId: String + sourceEntryIds: [String!] + position: Float + ): ResolvedOrganizerV1! + updateDockerViewPreferences(viewId: String = "default", prefs: JSON!): ResolvedOrganizerV1! + syncDockerTemplatePaths: DockerTemplateSyncResult! + refreshDockerDigests: Boolean! + + """ + Initiates a flash drive backup using a configured remote. + """ + initiateFlashBackup(input: InitiateFlashBackupInput!): FlashBackupStatus! + updateSettings(input: JSON!): UpdateSettingsResponse! + configureUps(config: UPSConfigInput!): Boolean! + + """ + Add one or more plugins to the API. Returns false if restart was triggered automatically, true if manual restart is required. + """ + addPlugin(input: PluginManagementInput!): Boolean! + + """ + Remove one or more plugins from the API. Returns false if restart was triggered automatically, true if manual restart is required. + """ + removePlugin(input: PluginManagementInput!): Boolean! + updateApiSettings(input: ConnectSettingsInput!): ConnectSettingsValues! + connectSignIn(input: ConnectSignInInput!): Boolean! + connectSignOut: Boolean! + setupRemoteAccess(input: SetupRemoteAccessInput!): Boolean! + enableDynamicRemoteAccess(input: EnableDynamicRemoteAccessInput!): Boolean! } input NotificationData { - title: String! - subject: String! - description: String! - importance: NotificationImportance! - link: String + title: String! + subject: String! + description: String! + importance: NotificationImportance! + link: String } input InitiateFlashBackupInput { - """The name of the remote configuration to use for the backup.""" - remoteName: String! + """ + The name of the remote configuration to use for the backup. + """ + remoteName: String! - """Source path to backup (typically the flash drive).""" - sourcePath: String! + """ + Source path to backup (typically the flash drive). + """ + sourcePath: String! - """Destination path on the remote.""" - destinationPath: String! + """ + Destination path on the remote. + """ + destinationPath: String! - """ - Additional options for the backup operation, such as --dry-run or --transfers. - """ - options: JSON + """ + Additional options for the backup operation, such as --dry-run or --transfers. + """ + options: JSON } input UPSConfigInput { - """Enable or disable the UPS monitoring service""" - service: UPSServiceState - - """Type of cable connecting the UPS to the server""" - upsCable: UPSCableType - - """ - Custom cable configuration (only used when upsCable is CUSTOM). Format depends on specific UPS model - """ - customUpsCable: String - - """UPS communication protocol""" - upsType: UPSType - - """ - Device path or network address for UPS connection. Examples: '/dev/ttyUSB0' for USB, '192.168.1.100:3551' for network - """ - device: String - - """ - Override UPS capacity for runtime calculations. Unit: watts (W). Leave unset to use UPS-reported capacity - """ - overrideUpsCapacity: Int - - """ - Battery level percentage to initiate shutdown. Unit: percent (%) - Valid range: 0-100 - """ - batteryLevel: Int - - """Runtime left in minutes to initiate shutdown. Unit: minutes""" - minutes: Int - - """ - Time on battery before shutdown. Unit: seconds. Set to 0 to disable timeout-based shutdown - """ - timeout: Int - - """ - Turn off UPS power after system shutdown. Useful for ensuring complete power cycle - """ - killUps: UPSKillPower + """ + Enable or disable the UPS monitoring service + """ + service: UPSServiceState + + """ + Type of cable connecting the UPS to the server + """ + upsCable: UPSCableType + + """ + Custom cable configuration (only used when upsCable is CUSTOM). Format depends on specific UPS model + """ + customUpsCable: String + + """ + UPS communication protocol + """ + upsType: UPSType + + """ + Device path or network address for UPS connection. Examples: '/dev/ttyUSB0' for USB, '192.168.1.100:3551' for network + """ + device: String + + """ + Override UPS capacity for runtime calculations. Unit: watts (W). Leave unset to use UPS-reported capacity + """ + overrideUpsCapacity: Int + + """ + Battery level percentage to initiate shutdown. Unit: percent (%) - Valid range: 0-100 + """ + batteryLevel: Int + + """ + Runtime left in minutes to initiate shutdown. Unit: minutes + """ + minutes: Int + + """ + Time on battery before shutdown. Unit: seconds. Set to 0 to disable timeout-based shutdown + """ + timeout: Int + + """ + Turn off UPS power after system shutdown. Useful for ensuring complete power cycle + """ + killUps: UPSKillPower } -"""Service state for UPS daemon""" +""" +Service state for UPS daemon +""" enum UPSServiceState { - ENABLE - DISABLE + ENABLE + DISABLE } -"""UPS cable connection types""" +""" +UPS cable connection types +""" enum UPSCableType { - USB - SIMPLE - SMART - ETHER - CUSTOM + USB + SIMPLE + SMART + ETHER + CUSTOM } -"""UPS communication protocols""" +""" +UPS communication protocols +""" enum UPSType { - USB - APCSMART - NET - SNMP - DUMB - PCNET - MODBUS + USB + APCSMART + NET + SNMP + DUMB + PCNET + MODBUS } -"""Kill UPS power after shutdown option""" +""" +Kill UPS power after shutdown option +""" enum UPSKillPower { - YES - NO + YES + NO } input PluginManagementInput { - """Array of plugin package names to add or remove""" - names: [String!]! + """ + Array of plugin package names to add or remove + """ + names: [String!]! - """ - Whether to treat plugins as bundled plugins. Bundled plugins are installed to node_modules at build time and controlled via config only. - """ - bundled: Boolean! = false + """ + Whether to treat plugins as bundled plugins. Bundled plugins are installed to node_modules at build time and controlled via config only. + """ + bundled: Boolean! = false - """ - Whether to restart the API after the operation. When false, a restart has already been queued. - """ - restart: Boolean! = true + """ + Whether to restart the API after the operation. When false, a restart has already been queued. + """ + restart: Boolean! = true } input ConnectSettingsInput { - """The type of WAN access to use for Remote Access""" - accessType: WAN_ACCESS_TYPE + """ + The type of WAN access to use for Remote Access + """ + accessType: WAN_ACCESS_TYPE - """The type of port forwarding to use for Remote Access""" - forwardType: WAN_FORWARD_TYPE + """ + The type of port forwarding to use for Remote Access + """ + forwardType: WAN_FORWARD_TYPE - """ - The port to use for Remote Access. Not required for UPNP forwardType. Required for STATIC forwardType. Ignored if accessType is DISABLED or forwardType is UPNP. - """ - port: Int + """ + The port to use for Remote Access. Not required for UPNP forwardType. Required for STATIC forwardType. Ignored if accessType is DISABLED or forwardType is UPNP. + """ + port: Int } input ConnectSignInInput { - """The API key for authentication""" - apiKey: String! + """ + The API key for authentication + """ + apiKey: String! - """User information for the sign-in""" - userInfo: ConnectUserInfoInput + """ + User information for the sign-in + """ + userInfo: ConnectUserInfoInput } input ConnectUserInfoInput { - """The preferred username of the user""" - preferred_username: String! + """ + The preferred username of the user + """ + preferred_username: String! - """The email address of the user""" - email: String! + """ + The email address of the user + """ + email: String! - """The avatar URL of the user""" - avatar: String + """ + The avatar URL of the user + """ + avatar: String } input SetupRemoteAccessInput { - """The type of WAN access to use for Remote Access""" - accessType: WAN_ACCESS_TYPE! + """ + The type of WAN access to use for Remote Access + """ + accessType: WAN_ACCESS_TYPE! - """The type of port forwarding to use for Remote Access""" - forwardType: WAN_FORWARD_TYPE + """ + The type of port forwarding to use for Remote Access + """ + forwardType: WAN_FORWARD_TYPE - """ - The port to use for Remote Access. Not required for UPNP forwardType. Required for STATIC forwardType. Ignored if accessType is DISABLED or forwardType is UPNP. - """ - port: Int + """ + The port to use for Remote Access. Not required for UPNP forwardType. Required for STATIC forwardType. Ignored if accessType is DISABLED or forwardType is UPNP. + """ + port: Int } input EnableDynamicRemoteAccessInput { - """The AccessURL Input for dynamic remote access""" - url: AccessUrlInput! + """ + The AccessURL Input for dynamic remote access + """ + url: AccessUrlInput! - """Whether to enable or disable dynamic remote access""" - enabled: Boolean! + """ + Whether to enable or disable dynamic remote access + """ + enabled: Boolean! } input AccessUrlInput { - type: URL_TYPE! - name: String - ipv4: URL - ipv6: URL + type: URL_TYPE! + name: String + ipv4: URL + ipv6: URL } type Subscription { - notificationAdded: Notification! - notificationsOverview: NotificationOverview! - notificationsWarningsAndAlerts: [Notification!]! - ownerSubscription: Owner! - serversSubscription: Server! - parityHistorySubscription: ParityCheck! - arraySubscription: UnraidArray! - dockerContainerStats: DockerContainerStats! - logFile(path: String!): LogFileContent! - systemMetricsCpu: CpuUtilization! - systemMetricsCpuTelemetry: CpuPackages! - systemMetricsMemory: MemoryUtilization! - upsUpdates: UPSDevice! -} \ No newline at end of file + notificationAdded: Notification! + notificationsOverview: NotificationOverview! + notificationsWarningsAndAlerts: [Notification!]! + ownerSubscription: Owner! + serversSubscription: Server! + parityHistorySubscription: ParityCheck! + arraySubscription: UnraidArray! + dockerContainerStats: DockerContainerStats! + logFile(path: String!): LogFileContent! + systemMetricsCpu: CpuUtilization! + systemMetricsCpuTelemetry: CpuPackages! + systemMetricsMemory: MemoryUtilization! + upsUpdates: UPSDevice! +} diff --git a/api/src/unraid-api/graph/resolvers/notifications/notifications.model.ts b/api/src/unraid-api/graph/resolvers/notifications/notifications.model.ts index 64dd0893a1..614ee2e3a8 100644 --- a/api/src/unraid-api/graph/resolvers/notifications/notifications.model.ts +++ b/api/src/unraid-api/graph/resolvers/notifications/notifications.model.ts @@ -99,6 +99,14 @@ export class NotificationCounts { total!: number; } +@ObjectType('NotificationSettings') +export class NotificationSettings { + @Field() + @IsString() + @IsNotEmpty() + position!: string; +} + @ObjectType('NotificationOverview') export class NotificationOverview { @Field(() => NotificationCounts) @@ -170,4 +178,8 @@ export class Notifications extends Node { }) @IsNotEmpty() warningsAndAlerts!: Notification[]; + + @Field(() => NotificationSettings) + @IsNotEmpty() + settings!: NotificationSettings; } diff --git a/api/src/unraid-api/graph/resolvers/notifications/notifications.resolver.ts b/api/src/unraid-api/graph/resolvers/notifications/notifications.resolver.ts index d3e0c6797b..82ea38a7ef 100644 --- a/api/src/unraid-api/graph/resolvers/notifications/notifications.resolver.ts +++ b/api/src/unraid-api/graph/resolvers/notifications/notifications.resolver.ts @@ -13,6 +13,7 @@ import { NotificationImportance, NotificationOverview, Notifications, + NotificationSettings, NotificationType, } from '@app/unraid-api/graph/resolvers/notifications/notifications.model.js'; import { NotificationsService } from '@app/unraid-api/graph/resolvers/notifications/notifications.service.js'; @@ -41,6 +42,11 @@ export class NotificationsResolver { return this.notificationsService.getOverview(); } + @ResolveField(() => NotificationSettings) + public settings(): NotificationSettings { + return this.notificationsService.getSettings(); + } + @ResolveField(() => [Notification]) public async list( @Args('filter', { type: () => NotificationFilter }) diff --git a/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts b/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts index 8daa13a98a..ba0b597c96 100644 --- a/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts +++ b/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts @@ -25,6 +25,7 @@ import { NotificationFilter, NotificationImportance, NotificationOverview, + NotificationSettings, NotificationType, } from '@app/unraid-api/graph/resolvers/notifications/notifications.model.js'; import { validateObject } from '@app/unraid-api/graph/resolvers/validation.utils.js'; @@ -98,12 +99,12 @@ export class NotificationsService { } await NotificationsService.watcher?.close().catch((e) => this.logger.error(e)); - NotificationsService.watcher = watch(basePath, { usePolling: CHOKIDAR_USEPOLLING }).on( - 'add', - (path) => { - void this.handleNotificationAdd(path).catch((e) => this.logger.error(e)); - } - ); + NotificationsService.watcher = watch(basePath, { + usePolling: CHOKIDAR_USEPOLLING, + ignoreInitial: true, // Only watch for new files + }).on('add', (path) => { + void this.handleNotificationAdd(path).catch((e) => this.logger.error(e)); + }); return NotificationsService.watcher; } @@ -111,9 +112,39 @@ export class NotificationsService { private async handleNotificationAdd(path: string) { // The path looks like /{notification base path}/{type}/{notification id} const type = path.includes('/unread/') ? NotificationType.UNREAD : NotificationType.ARCHIVE; - // this.logger.debug(`Adding ${type} Notification: ${path}`); + this.logger.debug(`[handleNotificationAdd] Adding ${type} Notification: ${path}`); + + // Note: We intentionally track duplicate files (files in both unread and archive) + // because the frontend relies on (Archive Total - Unread Total) to calculate the + // "Archived Only" count. If we ignore duplicates here, the math breaks. - const notification = await this.loadNotificationFile(path, NotificationType[type]); + let notification: Notification | undefined; + let lastError: unknown; + + for (let i = 0; i < 5; i++) { + try { + notification = await this.loadNotificationFile(path, NotificationType[type]); + this.logger.debug( + `[handleNotificationAdd] Successfully loaded ${path} on attempt ${i + 1}` + ); + break; + } catch (error) { + lastError = error; + this.logger.warn( + `[handleNotificationAdd] Attempt ${i + 1} failed for ${path}: ${error}` + ); + // wait 100ms before retrying + await new Promise((resolve) => setTimeout(resolve, 100)); + } + } + + if (!notification) { + this.logger.error( + `[handleNotificationAdd] Failed to load notification after 5 retries: ${path}`, + lastError + ); + return; + } this.increment(notification.importance, NotificationsService.overview[type.toLowerCase()]); if (type === NotificationType.UNREAD) { @@ -123,6 +154,10 @@ export class NotificationsService { }); void this.publishWarningsAndAlerts(); } + // Also publish overview updates for archive adds, so counts stay in sync + if (type === NotificationType.ARCHIVE) { + this.publishOverview(); + } } /** @@ -137,6 +172,13 @@ export class NotificationsService { return structuredClone(NotificationsService.overview); } + public getSettings(): NotificationSettings { + const { notify } = getters.dynamix(); + return { + position: notify?.position ?? 'top-right', + }; + } + private publishOverview(overview = NotificationsService.overview) { return pubsub.publish(PUBSUB_CHANNEL.NOTIFICATION_OVERVIEW, { notificationsOverview: overview, @@ -216,10 +258,10 @@ export class NotificationsService { const fileData = this.makeNotificationFileData(data); try { - const [command, args] = this.getLegacyScriptArgs(fileData); + const [command, args] = this.getLegacyScriptArgs(fileData, id); await execa(command, args); } catch (error) { - // manually write the file if the script fails + // manually write the file if the script fails entirely this.logger.debug(`[createNotification] legacy notifier failed: ${error}`); this.logger.verbose(`[createNotification] Writing: ${JSON.stringify(fileData, null, 4)}`); @@ -243,7 +285,7 @@ export class NotificationsService { * @param notification The notification to be converted to command line arguments. * @returns A 2-element tuple containing the legacy notifier command and arguments. */ - public getLegacyScriptArgs(notification: NotificationIni): [string, string[]] { + public getLegacyScriptArgs(notification: NotificationIni, id?: string): [string, string[]] { const { event, subject, description, link, importance } = notification; const args = [ ['-i', importance], @@ -254,6 +296,9 @@ export class NotificationsService { if (link) { args.push(['-l', link]); } + if (id) { + args.push(['-u', id]); + } return ['/usr/local/emhttp/webGui/scripts/notify', args.flat()]; } @@ -431,6 +476,7 @@ export class NotificationsService { public async archiveNotification({ id }: Pick): Promise { const unreadPath = join(this.paths().UNREAD, id); + const archivePath = join(this.paths().ARCHIVE, id); // We expect to only archive 'unread' notifications, but it's possible that the notification // has already been archived or deleted (e.g. retry logic, spike in network latency). @@ -450,12 +496,32 @@ export class NotificationsService { *------------------------**/ const snapshot = this.getOverview(); const notification = await this.loadNotificationFile(unreadPath, NotificationType.UNREAD); - const moveToArchive = this.moveNotification({ - from: NotificationType.UNREAD, - to: NotificationType.ARCHIVE, - snapshot, - }); - await moveToArchive(notification); + + // Update stats + this.decrement(notification.importance, NotificationsService.overview.unread); + + if (snapshot) { + this.decrement(notification.importance, snapshot.unread); + } + + if (await fileExists(archivePath)) { + // File already in archive, just delete the unread one + await unlink(unreadPath); + + // CRITICAL FIX: If the file already existed in archive, it should have been counted + // by handleNotificationAdd (since we removed the ignore logic). + // Therefore, we do NOT increment the archive count here to avoid double counting. + } else { + // File not in archive, move it there + await rename(unreadPath, archivePath); + + // We moved a file to archive that wasn't there. + // We DO need to increment the stats. + this.increment(notification.importance, NotificationsService.overview.archive); + if (snapshot) { + this.increment(notification.importance, snapshot.archive); + } + } void this.publishWarningsAndAlerts(); @@ -499,18 +565,20 @@ export class NotificationsService { return { overview: NotificationsService.overview }; } - const overviewSnapshot = this.getOverview(); const unreads = await this.listFilesInFolder(UNREAD); const [notifications] = await this.loadNotificationsFromPaths(unreads, { importance }); - const archive = this.moveNotification({ - from: NotificationType.UNREAD, - to: NotificationType.ARCHIVE, - snapshot: overviewSnapshot, - }); - const stats = await batchProcess(notifications, archive); + const archiveAction = async (notification: Notification) => { + // Reuse archiveNotification which handles the "exists" check logic + await this.archiveNotification({ id: notification.id }); + }; + + const stats = await batchProcess(notifications, archiveAction); void this.publishWarningsAndAlerts(); - return { ...stats, overview: overviewSnapshot }; + + // Return the *actual* current state of the service, which is properly updated + // by the individual archiveNotification calls. + return { ...stats, overview: this.getOverview() }; } public async unarchiveAll(importance?: NotificationImportance) { @@ -682,6 +750,29 @@ export class NotificationsService { .map(({ path }) => path); } + private async *getNotificationsGenerator( + files: string[], + type: NotificationType + ): AsyncGenerator<{ success: true; value: Notification } | { success: false; reason: unknown }> { + const BATCH_SIZE = 10; + for (let i = 0; i < files.length; i += BATCH_SIZE) { + const batch = files.slice(i, i + BATCH_SIZE); + const promises = batch.map(async (file) => { + try { + const value = await this.loadNotificationFile(file, type); + return { success: true, value } as const; + } catch (reason) { + return { success: false, reason } as const; + } + }); + + const results = await Promise.all(promises); + for (const res of results) { + yield res; + } + } + } + /** * Given a an array of files, reads and filters all the files in the directory, * and attempts to parse each file as a Notification. @@ -699,27 +790,39 @@ export class NotificationsService { filters: Partial ): Promise<[Notification[], unknown[]]> { const { importance, type, offset = 0, limit = files.length } = filters; - - const fileReads = files - .slice(offset, limit + offset) - .map((file) => this.loadNotificationFile(file, type ?? NotificationType.UNREAD)); - const results = await Promise.allSettled(fileReads); + const notifications: Notification[] = []; + const errors: unknown[] = []; + let skipped = 0; // if the filter is defined & truthy, tests if the actual value matches the filter const passesFilter = (actual: T, filter?: unknown) => !filter || actual === filter; + const matches = (n: Notification) => + passesFilter(n.importance, importance) && + passesFilter(n.type, type ?? NotificationType.UNREAD); - return [ - results - .filter(isFulfilled) - .map((result) => result.value) - .filter( - (notification) => - passesFilter(notification.importance, importance) && - passesFilter(notification.type, type) - ) - .sort(this.sortLatestFirst), - results.filter(isRejected).map((result) => result.reason), - ]; + const generator = this.getNotificationsGenerator(files, type ?? NotificationType.UNREAD); + + for await (const result of generator) { + if (!result.success) { + errors.push(result.reason); + continue; + } + + const notification = result.value; + + if (matches(notification)) { + if (skipped < offset) { + skipped++; + } else { + notifications.push(notification); + if (notifications.length >= limit) { + break; + } + } + } + } + + return [notifications.sort(this.sortLatestFirst), errors]; } /** diff --git a/plugin/plugins/dynamix.unraid.net.plg b/plugin/plugins/dynamix.unraid.net.plg index eeed6411c8..3822c4fdb6 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -181,6 +181,7 @@ echo "Backing up original files..." # Define files to backup in a shell variable FILES_TO_BACKUP=( + "/usr/local/emhttp/plugins/dynamix/scripts/notify" "/usr/local/emhttp/plugins/dynamix/DisplaySettings.page" "/usr/local/emhttp/plugins/dynamix/Registration.page" "/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php" @@ -324,6 +325,7 @@ exit 0 # Define files to restore in a shell variable - must match backup list FILES_TO_RESTORE=( + "/usr/local/emhttp/plugins/dynamix/scripts/notify" "/usr/local/emhttp/plugins/dynamix/DisplaySettings.page" "/usr/local/emhttp/plugins/dynamix/Registration.page" "/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php" diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix/scripts/notify b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix/scripts/notify new file mode 100644 index 0000000000..1205d6f961 --- /dev/null +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix/scripts/notify @@ -0,0 +1,350 @@ +#!/usr/bin/php -q + +", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}"]; + $string = trim(str_replace($special_chars, "", $string)); + $string = preg_replace('~[^0-9a-z \-_.]~i', '', $string); + $string = preg_replace('~[- ]~i', '_', $string); + // limit filename length to $maxLength characters + return substr(trim($string), 0, $maxLength); +} + +/* + Call this when using the subject field in email or agents. Do not use when showing the subject in a browser. + Removes all HTML entities from subject line, is specifically targetting the my_temp() function, which adds ' °' +*/ +function clean_subject($subject) +{ + $subject = preg_replace("/&#?[a-z0-9]{2,8};/i", " ", $subject); + return $subject; +} + +/** + * Wrap string values in double quotes for INI compatibility and escape quotes/backslashes. + * Numeric types remain unquoted so they can be parsed as-is. + */ +function ini_encode_value($value) +{ + if (is_int($value) || is_float($value)) return $value; + if (is_bool($value)) return $value ? 'true' : 'false'; + $value = (string)$value; + return '"' . strtr($value, ["\\" => "\\\\", '"' => '\\"']) . '"'; +} + +function build_ini_string(array $data) +{ + $lines = []; + foreach ($data as $key => $value) { + $lines[] = "{$key}=" . ini_encode_value($value); + } + return implode("\n", $lines) . "\n"; +} + +/** + * Trims and unescapes strings (eg quotes, backslashes) if necessary. + */ +function ini_decode_value($value) +{ + $value = trim($value); + $length = strlen($value); + if ($length >= 2 && $value[0] === '"' && $value[$length - 1] === '"') { + return stripslashes(substr($value, 1, -1)); + } + return $value; +} + +// start +if ($argc == 1) exit(usage()); + +extract(parse_plugin_cfg("dynamix", true)); + +$path = _var($notify, 'path', '/tmp/notifications'); +$unread = "$path/unread"; +$archive = "$path/archive"; +$agents_dir = "/boot/config/plugins/dynamix/notifications/agents"; +if (is_dir($agents_dir)) { + $agents = []; + foreach (array_diff(scandir($agents_dir), ['.', '..']) as $p) { + if (file_exists("{$agents_dir}/{$p}")) $agents[] = "{$agents_dir}/{$p}"; + } +} else { + $agents = NULL; +} + +switch ($argv[1][0] == '-' ? 'add' : $argv[1]) { + case 'init': + $files = glob("$unread/*.notify", GLOB_NOSORT); + foreach ($files as $file) if (!is_readable($file)) chmod($file, 0666); + break; + + case 'smtp-init': + @mkdir($unread, 0755, true); + @mkdir($archive, 0755, true); + $conf = []; + $conf[] = "# Generated settings:"; + $conf[] = "Root={$ssmtp['root']}"; + $domain = strtok($ssmtp['root'], '@'); + $domain = strtok('@'); + $conf[] = "rewriteDomain=$domain"; + $conf[] = "FromLineOverride=YES"; + $conf[] = "Mailhub={$ssmtp['server']}:{$ssmtp['port']}"; + $conf[] = "UseTLS={$ssmtp['UseTLS']}"; + $conf[] = "UseSTARTTLS={$ssmtp['UseSTARTTLS']}"; + if ($ssmtp['AuthMethod'] != "none") { + $conf[] = "AuthMethod={$ssmtp['AuthMethod']}"; + $conf[] = "AuthUser={$ssmtp['AuthUser']}"; + $conf[] = "AuthPass=" . base64_decrypt($ssmtp['AuthPass']); + } + $conf[] = ""; + file_put_contents("/etc/ssmtp/ssmtp.conf", implode("\n", $conf)); + break; + + case 'cron-init': + @mkdir($unread, 0755, true); + @mkdir($archive, 0755, true); + $text = empty($notify['status']) ? "" : "# Generated array status check schedule:\n{$notify['status']} $docroot/plugins/dynamix/scripts/statuscheck &> /dev/null\n\n"; + parse_cron_cfg("dynamix", "status-check", $text); + $text = empty($notify['unraidos']) ? "" : "# Generated Unraid OS update check schedule:\n{$notify['unraidos']} $docroot/plugins/dynamix.plugin.manager/scripts/unraidcheck &> /dev/null\n\n"; + parse_cron_cfg("dynamix", "unraid-check", $text); + $text = empty($notify['version']) ? "" : "# Generated plugins version check schedule:\n{$notify['version']} $docroot/plugins/dynamix.plugin.manager/scripts/plugincheck &> /dev/null\n\n"; + parse_cron_cfg("dynamix", "plugin-check", $text); + $text = empty($notify['system']) ? "" : "# Generated system monitoring schedule:\n{$notify['system']} $docroot/plugins/dynamix/scripts/monitor &> /dev/null\n\n"; + parse_cron_cfg("dynamix", "monitor", $text); + $text = empty($notify['docker_update']) ? "" : "# Generated docker monitoring schedule:\n{$notify['docker_update']} $docroot/plugins/dynamix.docker.manager/scripts/dockerupdate check &> /dev/null\n\n"; + parse_cron_cfg("dynamix", "docker-update", $text); + $text = empty($notify['language_update']) ? "" : "# Generated languages version check schedule:\n{$notify['language_update']} $docroot/plugins/dynamix.plugin.manager/scripts/languagecheck &> /dev/null\n\n"; + parse_cron_cfg("dynamix", "language-check", $text); + break; + + case 'add': + $event = 'Unraid Status'; + $subject = 'Notification'; + $description = 'No description'; + $importance = 'normal'; + $message = $recipients = $link = $fqdnlink = ''; + $timestamp = time(); + $ticket = $timestamp; + $mailtest = false; + $overrule = false; + $noBrowser = false; + $customFilename = false; + + $options = getopt("l:e:s:d:i:m:r:u:xtb"); + foreach ($options as $option => $value) { + switch ($option) { + case 'e': + $event = $value; + break; + case 's': + $subject = $value; + break; + case 'd': + $description = $value; + break; + case 'i': + $importance = strtok($value, ' '); + $overrule = strtok(' '); + break; + case 'm': + $message = $value; + break; + case 'r': + $recipients = $value; + break; + case 'x': + $ticket = 'ticket'; + break; + case 't': + $mailtest = true; + break; + case 'b': + $noBrowser = true; + break; + case 'l': + $nginx = (array)@parse_ini_file('/var/local/emhttp/nginx.ini'); + $link = $value; + $fqdnlink = (strpos($link, "http") === 0) ? $link : ($nginx['NGINX_DEFAULTURL'] ?? '') . $link; + break; + case 'u': + $customFilename = $value; + break; + } + } + + if ($customFilename) { + $filename = safe_filename($customFilename); + } else { + // suffix length: _{timestamp}.notify = 1+10+7 = 18 chars. + $suffix = "_{$ticket}.notify"; + $max_name_len = 255 - strlen($suffix); + // sanitize event, truncating it to leave room for suffix + $clean_name = safe_filename($event, $max_name_len); + // construct filename with suffix (underscore separator matches safe_filename behavior) + $filename = "{$clean_name}{$suffix}"; + } + + $unread = "{$unread}/{$filename}"; + $archive = "{$archive}/{$filename}"; + if (file_exists($archive)) break; + $entity = $overrule === false ? $notify[$importance] : $overrule; + $cleanSubject = clean_subject($subject); + $archiveData = [ + 'timestamp' => $timestamp, + 'event' => $event, + 'subject' => $cleanSubject, + 'description' => $description, + 'importance' => $importance, + ]; + if ($message) $archiveData['message'] = str_replace('\n', '
', $message); + if (!$mailtest) file_put_contents($archive, build_ini_string($archiveData)); + if (($entity & 1) == 1 && !$mailtest && !$noBrowser) { + $unreadData = [ + 'timestamp' => $timestamp, + 'event' => $event, + 'subject' => $cleanSubject, + 'description' => $description, + 'importance' => $importance, + 'link' => $link, + ]; + file_put_contents($unread, build_ini_string($unreadData)); + } + if (($entity & 2) == 2 || $mailtest) generate_email($event, $cleanSubject, str_replace('
', '. ', $description), $importance, $message, $recipients, $fqdnlink); + if (($entity & 4) == 4 && !$mailtest) { + if (is_array($agents)) { + foreach ($agents as $agent) { + exec("TIMESTAMP='$timestamp' EVENT=" . escapeshellarg($event) . " SUBJECT=" . escapeshellarg($cleanSubject) . " DESCRIPTION=" . escapeshellarg($description) . " IMPORTANCE=" . escapeshellarg($importance) . " CONTENT=" . escapeshellarg($message) . " LINK=" . escapeshellarg($fqdnlink) . " bash " . $agent); + }; + } + }; + break; + + case 'get': + $output = []; + $json = []; + $files = glob("$unread/*.notify", GLOB_NOSORT); + usort($files, function ($a, $b) { + return filemtime($a) - filemtime($b); + }); + $i = 0; + foreach ($files as $file) { + $fields = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + $time = true; + $output[$i]['file'] = basename($file); + $output[$i]['show'] = (fileperms($file) & 0x0FFF) == 0400 ? 0 : 1; + foreach ($fields as $field) { + if (!$field) continue; + # limit the explode('=', …) used during reads to two pieces so values containing = remain intact + [$key, $val] = array_pad(explode('=', $field, 2), 2, ''); + if ($time) { + $val = date($notify['date'] . ' ' . $notify['time'], $val); + $time = false; + } + # unescape the value before emitting JSON, so the browser UI + # and any scripts calling `notify get` still see plain strings + $output[$i][trim($key)] = ini_decode_value($val); + } + $i++; + } + echo json_encode($output, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + break; + + case 'archive': + if ($argc != 3) exit(usage()); + $file = $argv[2]; + if (strpos(realpath("$unread/$file"), $unread . '/') === 0) @unlink("$unread/$file"); + break; +} + +exit(0); +?> \ No newline at end of file diff --git a/unraid-ui/src/global.d.ts b/unraid-ui/src/global.d.ts deleted file mode 100644 index c9108b0ce1..0000000000 --- a/unraid-ui/src/global.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable no-var */ -declare global { - /** loaded by Toaster.vue */ - var toast: (typeof import('vue-sonner'))['toast']; -} - -// an export or import statement is required to make this file a module -export {}; diff --git a/web/.vscode/settings.json b/web/.vscode/settings.json index 2c4388375f..fb65bd8d40 100644 --- a/web/.vscode/settings.json +++ b/web/.vscode/settings.json @@ -1,3 +1,16 @@ { - "prettier.configPath": "./.prettierrc.mjs" + "prettier.configPath": "./.prettierrc.mjs", + + "files.associations": { + "*.css": "tailwindcss" + }, + "editor.quickSuggestions": { + "strings": "on" + }, + "tailwindCSS.classAttributes": ["class", "ui"], + "tailwindCSS.experimental.classRegex": [ + ["ui:\\s*{([^)]*)\\s*}", "(?:'|\"|`)([^']*)(?:'|\"|`)"] + ] + + } \ No newline at end of file diff --git a/web/app.config.ts b/web/app.config.ts index 45fde7df2b..68823c31e5 100644 --- a/web/app.config.ts +++ b/web/app.config.ts @@ -1,13 +1,62 @@ +// Objective: avoid hard-coded custom colors wherever possible, letting our theme system manage +// styling consistently. During the migration from the legacy WebGUI, some components still depend +// on specific colors to maintain visual continuity. This config file centralizes all temporary +// overrides required for that transition. +// +// Pending migration cleanup: +// - Notifications/Sidebar.vue → notification bell has temporary custom hover color to match legacy styles. + export default { ui: { colors: { - primary: 'blue', - neutral: 'gray', + // overrided by tailwind-shared/css-variables.css + // these shared tailwind styles and colors are imported in src/assets/main.css + }, + + // https://ui.nuxt.com/docs/components/button#theme + button: { + //keep in mind, there is a "variant" AND a "variants" property + variants: { + variant: { + ghost: '', + link: 'hover:underline focus:underline', + }, + }, + }, + + // https://ui.nuxt.com/docs/components/tabs#theme + tabs: { + variants: { + pill: {}, + }, + }, + + // https://ui.nuxt.com/docs/components/slideover#theme + slideover: { + slots: { + // title: 'text-3xl font-normal', + }, + variants: { + right: {}, + }, + }, + + //css theming/style-overrides for the toast component + // https://ui.nuxt.com/docs/components/toast#theme + toast: { + slots: { + title: 'truncate', // can also use break-words instead of truncating + description: 'truncate', + }, + }, + + // Also, for toasts, BUT this is imported in the Root UApp in mount-engine.ts + // https://ui.nuxt.com/docs/components/toast#examples + toaster: { + position: 'top-right' as const, + // expand: false, --> buggy + duration: 5000, + // max: 3, --> not added yet in 4.0.0-alpha.0. Needs to be upgraded to 4.2.1 or later. }, - }, - toaster: { - position: 'bottom-right' as const, - expand: true, - duration: 5000, }, }; diff --git a/web/components.d.ts b/web/components.d.ts index 9fa66194e9..55f5d2f9b1 100644 --- a/web/components.d.ts +++ b/web/components.d.ts @@ -53,6 +53,7 @@ declare module 'vue' { DockerContainerOverview: typeof import('./src/components/Docker/DockerContainerOverview.vue')['default'] 'DockerContainerOverview.standalone': typeof import('./src/components/Docker/DockerContainerOverview.standalone.vue')['default'] DockerContainersTable: typeof import('./src/components/Docker/DockerContainersTable.vue')['default'] + DockerContainerStatCell: typeof import('./src/components/Docker/DockerContainerStatCell.vue')['default'] DockerPortConflictsAlert: typeof import('./src/components/Docker/DockerPortConflictsAlert.vue')['default'] DockerSidebarTree: typeof import('./src/components/Docker/DockerSidebarTree.vue')['default'] Downgrade: typeof import('./src/components/UpdateOs/Downgrade.vue')['default'] @@ -129,7 +130,6 @@ declare module 'vue' { UInput: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Input.vue')['default'] UModal: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Modal.vue')['default'] UNavigationMenu: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/NavigationMenu.vue')['default'] - UnraidToaster: typeof import('./src/components/UnraidToaster.vue')['default'] Update: typeof import('./src/components/UpdateOs/Update.vue')['default'] UpdateExpiration: typeof import('./src/components/Registration/UpdateExpiration.vue')['default'] UpdateExpirationAction: typeof import('./src/components/Registration/UpdateExpirationAction.vue')['default'] @@ -140,9 +140,11 @@ declare module 'vue' { USelectMenu: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/SelectMenu.vue')['default'] 'UserProfile.standalone': typeof import('./src/components/UserProfile.standalone.vue')['default'] USkeleton: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Skeleton.vue')['default'] + USlideover: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Slideover.vue')['default'] USwitch: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Switch.vue')['default'] UTable: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Table.vue')['default'] UTabs: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Tabs.vue')['default'] + UTooltip: typeof import('./../node_modules/.pnpm/@nuxt+ui@4.0.0-alpha.0_@babel+parser@7.28.4_@netlify+blobs@9.1.2_change-case@5.4.4_db0@_655bac6707ae017754653173419b3890/node_modules/@nuxt/ui/dist/runtime/components/Tooltip.vue')['default'] 'WanIpCheck.standalone': typeof import('./src/components/WanIpCheck.standalone.vue')['default'] 'WelcomeModal.standalone': typeof import('./src/components/Activation/WelcomeModal.standalone.vue')['default'] } diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs index cda36533e3..91a4d721c9 100644 --- a/web/eslint.config.mjs +++ b/web/eslint.config.mjs @@ -144,6 +144,7 @@ export default [ rules: { ...commonRules, ...vueRules, + 'no-undef': 'off', // Allow TypeScript to handle global variable validation (fixes auto-import false positives) }, }, // Ignores { diff --git a/web/scripts/deploy-dev.sh b/web/scripts/deploy-dev.sh index 1e740264d8..abacd70a48 100755 --- a/web/scripts/deploy-dev.sh +++ b/web/scripts/deploy-dev.sh @@ -10,6 +10,28 @@ fi # Set server name from command-line argument server_name="$1" +# Common SSH options for reliability +SSH_OPTS='-o ConnectTimeout=5 -o ConnectionAttempts=3 -o ServerAliveInterval=5 -o ServerAliveCountMax=2' + +# Simple retry helper: retry +retry() { + local attempts="$1"; shift + local delay_seconds="$1"; shift + local try=1 + while true; do + "$@" + local exit_code=$? + if [ $exit_code -eq 0 ]; then + return 0 + fi + if [ $try -ge $attempts ]; then + return $exit_code + fi + sleep "$delay_seconds" + try=$((try + 1)) + done +} + # Source directory paths standalone_directory="dist/" @@ -33,11 +55,11 @@ exit_code=0 if [ "$has_standalone" = true ]; then echo "Deploying standalone apps..." # Ensure remote directory exists - ssh root@"${server_name}" "mkdir -p /usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/standalone/" + retry 3 2 ssh $SSH_OPTS root@"${server_name}" "mkdir -p /usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/standalone/" # Clear the remote standalone directory before rsyncing - ssh root@"${server_name}" "rm -rf /usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/*" + retry 3 2 ssh $SSH_OPTS root@"${server_name}" "rm -rf /usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/*" # Run rsync with proper quoting - rsync -avz --delete -e "ssh" "$standalone_directory" "root@${server_name}:/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/standalone/" + retry 3 2 rsync -avz --delete --timeout=20 -e "ssh $SSH_OPTS" "$standalone_directory" "root@${server_name}:/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/standalone/" standalone_exit_code=$? # If standalone rsync failed, update exit_code if [ "$standalone_exit_code" -ne 0 ]; then @@ -49,7 +71,7 @@ fi update_auth_request() { local server_name="$1" # SSH into server and update auth-request.php - ssh "root@${server_name}" /bin/bash -s << 'EOF' + retry 3 2 ssh $SSH_OPTS "root@${server_name}" /bin/bash -s << 'EOF' set -euo pipefail set -o errtrace AUTH_REQUEST_FILE='/usr/local/emhttp/auth-request.php' diff --git a/web/src/assets/main.css b/web/src/assets/main.css index 6978e6b089..1ecf6cc29d 100644 --- a/web/src/assets/main.css +++ b/web/src/assets/main.css @@ -1,4 +1,4 @@ -/* +/* * Tailwind v4 configuration with Nuxt UI v3 * Using scoped selectors to prevent breaking Unraid WebGUI */ @@ -9,7 +9,7 @@ /* Import theme and utilities only - no global preflight */ @import "tailwindcss/theme.css" layer(theme); @import "tailwindcss/utilities.css" layer(utilities); -@import "@nuxt/ui"; +@import "@nuxt/ui"; @import 'tw-animate-css'; @import '../../../@tailwind-shared/index.css'; @@ -17,7 +17,7 @@ @source "../**/*.{vue,ts,js,tsx,jsx}"; @source "../../../unraid-ui/src/**/*.{vue,ts,js,tsx,jsx}"; -/* +/* * Scoped base styles for .unapi elements only * Import Tailwind's preflight into our custom layer and scope it */ @@ -28,164 +28,13 @@ @import "tailwindcss/preflight.css"; } - /* Override Unraid's button styles for Nuxt UI components */ - .unapi button { - /* Reset Unraid's button styles */ - margin: 0 !important; - padding: 0; - border: none; - background: none; - } - - /* Reset button-like controls back to UA defaults so Nuxt UI styles win */ - .unapi button, - .unapi button[type='button'], - .unapi button:hover, - .unapi button:hover[disabled], - .unapi input[type='button'], - .unapi input[type='button']:hover, - .unapi input[type='button']:hover[disabled], - .unapi input[type='reset'], - .unapi input[type='submit'], - .unapi a.button { - box-sizing: border-box; - font: inherit; - min-width: revert; - text-transform: revert; - background: revert; - color: revert; - } - - /* Reset text inputs so Nuxt UI field styles render correctly */ - .unapi input[type='text'], - .unapi input[type='password'], - .unapi input[type='number'], - .unapi input[type='url'], - .unapi input[type='email'], - .unapi input[type='date'], - .unapi input[type='file'], - .unapi textarea, - .unapi .textarea { - box-sizing: border-box; - font: inherit; - color: inherit; - } - - /* Clear global table row sizing that fights the tree table layout */ - .unapi table thead td, - .unapi table thead th, - .unapi table tbody td, - .unapi table tbody th { - all: revert; - box-sizing: border-box; - } - /* Accessible focus styles for keyboard navigation */ .unapi button:focus-visible { outline: 2px solid #ff8c2f; outline-offset: 2px; } - - /* Restore button functionality while removing Unraid's forced styles */ - .unapi button:not([role="switch"]) { - /* display: inline-flex; */ - align-items: center; - justify-content: center; - cursor: pointer; - transition: all 0.2s; - } - - /* Ensure Nuxt UI modal/slideover close buttons work properly */ - .unapi [role="dialog"] button, - .unapi [data-radix-collection-item] button { - margin: 0 !important; - /* background: transparent !important; */ - border: none !important; - } - - /* Focus styles for dialog buttons */ - .unapi [role="dialog"] button:focus-visible, - .unapi [data-radix-collection-item] button:focus-visible { - outline: 2px solid #ff8c2f; - outline-offset: 2px; - } - - /* Reset figure element for logo */ - .unapi figure { - margin: 0; - padding: 0; - } - - /* Reset heading elements - only margin/padding */ - .unapi h1, - .unapi h2, - .unapi h3, - .unapi h4, - .unapi h5 { - margin: 0; - padding: 0; - } - - /* Reset paragraph element */ - .unapi p { - margin: 0; - padding: 0; - text-align: unset; - } - - /* Reset UL styles to prevent default browser styling */ - .unapi ul { - padding-inline-start: 0; - list-style-type: none; - } - - /* Reset toggle/switch button backgrounds */ - .unapi button[role="switch"], - .unapi button[role="switch"][data-state="checked"], - .unapi button[role="switch"][data-state="unchecked"] { - background-color: transparent; - background: transparent; - } - - /* Style for checked state */ - .unapi button[role="switch"][data-state="checked"] { - background-color: #ff8c2f; /* Unraid orange */ - } - - /* Style for unchecked state */ - .unapi button[role="switch"][data-state="unchecked"] { - background-color: #e5e5e5; - } - - /* Dark mode toggle styles */ - .unapi.dark button[role="switch"][data-state="unchecked"], - .dark .unapi button[role="switch"][data-state="unchecked"] { - background-color: #333; - border-color: #555; - } - - /* Toggle thumb/handle */ - .unapi button[role="switch"] span { - background-color: white; - } -} - -/* Override link styles inside .unapi */ -.unapi a, -.unapi a:link, -.unapi a:visited { - color: inherit; - text-decoration: none; -} - -.unapi a:hover, -.unapi a:focus { - text-decoration: underline; - color: inherit; } -/* Note: Tailwind utilities will apply globally but should be used with .unapi prefix in HTML */ - /* Ensure unraid-modals container has extremely high z-index */ unraid-modals.unapi { position: relative; @@ -236,4 +85,4 @@ iframe#progressFrame { .has-banner-gradient #header.image > * { position: relative; z-index: 1; -} +} \ No newline at end of file diff --git a/web/src/components/Activation/store/activationCodeModal.ts b/web/src/components/Activation/store/activationCodeModal.ts index 4e8bb83a1e..96e0add940 100644 --- a/web/src/components/Activation/store/activationCodeModal.ts +++ b/web/src/components/Activation/store/activationCodeModal.ts @@ -3,6 +3,7 @@ import { defineStore, storeToRefs } from 'pinia'; import { useSessionStorage } from '@vueuse/core'; import { ACTIVATION_CODE_MODAL_HIDDEN_STORAGE_KEY } from '~/consts'; +import { navigate } from '~/helpers/external-navigation'; import { useActivationCodeDataStore } from '~/components/Activation/store/activationCodeData'; import { useCallbackActionsStore } from '~/store/callbackActions'; @@ -66,7 +67,7 @@ export const useActivationCodeModalStore = defineStore('activationCodeModal', () if (sequenceIndex === keySequence.length) { setIsHidden(true); // Redirect only if explicitly hidden via konami code, not just closed normally - window.location.href = '/Tools/Registration'; + navigate('/Tools/Registration'); } }; diff --git a/web/src/components/ApiKey/ApiKeyManager.vue b/web/src/components/ApiKey/ApiKeyManager.vue index 78b31c6c58..1b98f6b38b 100644 --- a/web/src/components/ApiKey/ApiKeyManager.vue +++ b/web/src/components/ApiKey/ApiKeyManager.vue @@ -35,6 +35,7 @@ import { TooltipProvider, TooltipTrigger, } from '@unraid/ui'; +import { navigate } from '~/helpers/external-navigation'; import { extractGraphQLErrorMessage } from '~/helpers/functions'; import type { ApiKeyFragment, AuthAction, Role } from '~/composables/gql/graphql'; @@ -165,7 +166,7 @@ function applyTemplate() { params.forEach((value, key) => { authUrl.searchParams.append(key, value); }); - window.location.href = authUrl.toString(); + navigate(authUrl.toString()); cancelTemplateInput(); } catch (_err) { diff --git a/web/src/components/ApiKeyAuthorize.standalone.vue b/web/src/components/ApiKeyAuthorize.standalone.vue index ecd56af7a9..74abfda7fd 100644 --- a/web/src/components/ApiKeyAuthorize.standalone.vue +++ b/web/src/components/ApiKeyAuthorize.standalone.vue @@ -4,6 +4,7 @@ import { storeToRefs } from 'pinia'; import { ClipboardDocumentIcon, EyeIcon, EyeSlashIcon } from '@heroicons/vue/24/outline'; import { Button, Input } from '@unraid/ui'; +import { navigate } from '~/helpers/external-navigation'; import ApiKeyCreate from '~/components/ApiKey/ApiKeyCreate.vue'; import { useAuthorizationLink } from '~/composables/useAuthorizationLink.js'; @@ -93,12 +94,12 @@ const deny = () => { if (hasValidRedirectUri.value) { try { const url = buildCallbackUrl(undefined, 'access_denied'); - window.location.href = url; + navigate(url); } catch { - window.location.href = '/'; + navigate('/'); } } else { - window.location.href = '/'; + navigate('/'); } }; @@ -108,7 +109,7 @@ const returnToApp = () => { try { const url = buildCallbackUrl(createdApiKey.value, undefined); - window.location.href = url; + navigate(url); } catch (_err) { error.value = 'Failed to redirect back to application'; } diff --git a/web/src/components/ConnectSettings/ConnectSettings.standalone.vue b/web/src/components/ConnectSettings/ConnectSettings.standalone.vue index 5ac4eb0a43..805906b554 100644 --- a/web/src/components/ConnectSettings/ConnectSettings.standalone.vue +++ b/web/src/components/ConnectSettings/ConnectSettings.standalone.vue @@ -27,6 +27,7 @@ defineOptions({ }); const { connectPluginInstalled } = storeToRefs(useServerStore()); +const toast = useToast(); /**-------------------------------------------- * Settings State & Form definition @@ -75,10 +76,12 @@ watchDebounced( // show a toast when the update is done onMutateSettingsDone((result) => { actualRestartRequired.value = result.data?.updateSettings?.restartRequired ?? false; - globalThis.toast.success(t('connectSettings.updatedApiSettingsToast'), { + toast.add({ + title: t('connectSettings.updatedApiSettingsToast'), description: actualRestartRequired.value ? t('connectSettings.apiRestartingToastDescription') : undefined, + color: 'success', }); }); diff --git a/web/src/components/Docker/DockerContainerManagement.vue b/web/src/components/Docker/DockerContainerManagement.vue index 8815746eb0..25dfce6593 100644 --- a/web/src/components/Docker/DockerContainerManagement.vue +++ b/web/src/components/Docker/DockerContainerManagement.vue @@ -14,6 +14,7 @@ import DockerLogs from '@/components/Docker/Logs.vue'; import DockerOverview from '@/components/Docker/Overview.vue'; import DockerPreview from '@/components/Docker/Preview.vue'; import { useDockerEditNavigation } from '@/composables/useDockerEditNavigation'; +import { navigate } from '@/helpers/external-navigation'; import type { ContainerPortConflict, @@ -253,7 +254,7 @@ function handleAddContainerClick() { const sanitizedPath = rawPath.replace(/\?.*$/, '').replace(/\/+$/, ''); const withoutAdd = sanitizedPath.replace(/\/AddContainer$/i, ''); const targetPath = withoutAdd ? `${withoutAdd}/AddContainer` : '/AddContainer'; - window.location.assign(targetPath); + navigate(targetPath); } async function refreshContainers() { @@ -467,7 +468,7 @@ const isDetailsDisabled = computed(() => props.disabled || isSwitching.value); v-if="isDetailsLoading" class="absolute inset-0 grid place-items-center bg-white/60 dark:bg-gray-900/60" > - + @@ -500,7 +501,7 @@ const isDetailsDisabled = computed(() => props.disabled || isSwitching.value);
- +
diff --git a/web/src/components/Docker/DockerContainersTable.vue b/web/src/components/Docker/DockerContainersTable.vue index 50870d8f31..b249a9efe9 100644 --- a/web/src/components/Docker/DockerContainersTable.vue +++ b/web/src/components/Docker/DockerContainersTable.vue @@ -99,6 +99,7 @@ const emit = defineEmits<{ (e: 'update:selectedIds', value: string[]): void; }>(); const { client: apolloClient } = useApolloClient(); +const toast = useToast(); const containerStats = reactive(new Map()); @@ -1084,17 +1085,12 @@ const { mutate: updateAllContainersMutation, loading: updatingAllContainers } = const { mutate: refreshDockerDigestsMutation, loading: checkingForUpdates } = useMutation(REFRESH_DOCKER_DIGESTS); -declare global { - interface Window { - toast?: { - success: (title: string, options: { description?: string }) => void; - error?: (title: string, options: { description?: string }) => void; - }; - } -} - -function showToast(message: string) { - window.toast?.success(message); +function showToast(message: string, type: 'success' | 'error' = 'success', description?: string) { + toast.add({ + title: message, + description, + color: type === 'error' ? 'error' : 'success', + }); } function getContainerRows(ids: string[]): TreeRow[] { @@ -1154,9 +1150,11 @@ async function handleCheckForUpdates(rows: TreeRow[]) { const count = rows.length; showToast(`Checked updates for ${count} container${count === 1 ? '' : 's'}`); } catch (error) { - window.toast?.error?.('Failed to check for updates', { - description: error instanceof Error ? error.message : 'Unknown error', - }); + showToast( + 'Failed to check for updates', + 'error', + error instanceof Error ? error.message : 'Unknown error' + ); } finally { setRowsBusy(entryIds, false); } @@ -1178,9 +1176,11 @@ async function handleUpdateContainer(row: TreeRow) { ); showToast(`Successfully updated ${row.name}`); } catch (error) { - window.toast?.error?.(`Failed to update ${row.name}`, { - description: error instanceof Error ? error.message : 'Unknown error', - }); + showToast( + `Failed to update ${row.name}`, + 'error', + error instanceof Error ? error.message : 'Unknown error' + ); } finally { setRowsBusy([row.id], false); setRowsUpdating([row], false); @@ -1210,9 +1210,11 @@ async function handleBulkUpdateContainers(rows: TreeRow[]) { const count = containerIds.length; showToast(`Successfully updated ${count} container${count === 1 ? '' : 's'}`); } catch (error) { - window.toast?.error?.('Failed to update containers', { - description: error instanceof Error ? error.message : 'Unknown error', - }); + showToast( + 'Failed to update containers', + 'error', + error instanceof Error ? error.message : 'Unknown error' + ); } finally { setRowsBusy(entryIds, false); setRowsUpdating(rows, false); @@ -1242,9 +1244,11 @@ async function handleUpdateAllContainers() { showToast('No containers had updates available'); } } catch (error) { - window.toast?.error?.('Failed to update containers', { - description: error instanceof Error ? error.message : 'Unknown error', - }); + showToast( + 'Failed to update containers', + 'error', + error instanceof Error ? error.message : 'Unknown error' + ); } finally { if (rows.length) { setRowsBusy(entryIds, false); diff --git a/web/src/components/HeaderOsVersion.standalone.vue b/web/src/components/HeaderOsVersion.standalone.vue index 5e87b60653..73d2aa6e16 100644 --- a/web/src/components/HeaderOsVersion.standalone.vue +++ b/web/src/components/HeaderOsVersion.standalone.vue @@ -21,6 +21,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@unraid/ui'; +import { navigate } from '~/helpers/external-navigation'; import { getReleaseNotesUrl, WEBGUI_TOOLS_DOWNGRADE, WEBGUI_TOOLS_UPDATE } from '~/helpers/urls'; import { useActivationCodeDataStore } from '~/components/Activation/store/activationCodeData'; @@ -126,7 +127,7 @@ const handleUpdateStatusClick = () => { if (updateOsStatus.value.click) { updateOsStatus.value.click(); } else if (updateOsStatus.value.href) { - window.location.href = updateOsStatus.value.href; + navigate(updateOsStatus.value.href); } }; diff --git a/web/src/components/Notifications/CriticalNotifications.standalone.vue b/web/src/components/Notifications/CriticalNotifications.standalone.vue index 783f7a099a..6ebe0a6b30 100644 --- a/web/src/components/Notifications/CriticalNotifications.standalone.vue +++ b/web/src/components/Notifications/CriticalNotifications.standalone.vue @@ -2,7 +2,7 @@ import { computed, reactive, ref, watch } from 'vue'; import { useMutation, useQuery, useSubscription } from '@vue/apollo-composable'; -import { AlertTriangle, Octagon } from 'lucide-vue-next'; +import { navigate } from '~/helpers/external-navigation'; import type { FragmentType } from '~/composables/gql'; import type { @@ -11,6 +11,7 @@ import type { WarningAndAlertNotificationsQueryVariables, } from '~/composables/gql/graphql'; +import { NOTIFICATION_ICONS, NOTIFICATION_TOAST_COLORS } from '~/components/Notifications/constants'; import { archiveNotification, NOTIFICATION_FRAGMENT, @@ -23,6 +24,8 @@ import { import { useFragment } from '~/composables/gql'; import { NotificationImportance } from '~/composables/gql/graphql'; +const toast = useToast(); + const { result, loading, error, refetch } = useQuery< WarningAndAlertNotificationsQuery, WarningAndAlertNotificationsQueryVariables @@ -88,24 +91,24 @@ const formatTimestamp = (notification: NotificationFragmentFragment) => { const importanceMeta: Record< NotificationImportance, - { label: string; badge: string; icon: typeof AlertTriangle; accent: string } + { label: string; badge: string; icon: string; accent: string } > = { [NotificationImportance.ALERT]: { label: 'Alert', badge: 'bg-red-100 text-red-700 border border-red-300', - icon: Octagon, + icon: NOTIFICATION_ICONS[NotificationImportance.ALERT], accent: 'text-red-600', }, [NotificationImportance.WARNING]: { label: 'Warning', badge: 'bg-amber-100 text-amber-700 border border-amber-300', - icon: AlertTriangle, + icon: NOTIFICATION_ICONS[NotificationImportance.WARNING], accent: 'text-amber-600', }, [NotificationImportance.INFO]: { label: 'Info', badge: 'bg-blue-100 text-blue-700 border border-blue-300', - icon: AlertTriangle, + icon: NOTIFICATION_ICONS[NotificationImportance.INFO], accent: 'text-blue-600', }, }; @@ -156,30 +159,24 @@ onNotificationAdded(({ data }) => { void refetch(); - if (!globalThis.toast) { - return; - } - if (notification.timestamp) { // Trigger the global toast in tandem with the subscription update. - const funcMapping: Record< - NotificationImportance, - (typeof globalThis)['toast']['info' | 'error' | 'warning'] - > = { - [NotificationImportance.ALERT]: globalThis.toast.error, - [NotificationImportance.WARNING]: globalThis.toast.warning, - [NotificationImportance.INFO]: globalThis.toast.info, - }; - const toast = funcMapping[notification.importance]; + const color = NOTIFICATION_TOAST_COLORS[notification.importance]; const createOpener = () => ({ label: 'Open', - onClick: () => notification.link && window.open(notification.link, '_blank', 'noopener'), + onClick: () => { + if (notification.link) { + navigate(notification.link); + } + }, }); requestAnimationFrame(() => - toast(notification.title, { + toast.add({ + title: notification.title, description: notification.subject, - action: notification.link ? createOpener() : undefined, + color, + actions: notification.link ? [createOpener()] : undefined, }) ); } @@ -190,7 +187,11 @@ onNotificationAdded(({ data }) => {
-
{
-
@@ -217,9 +218,9 @@ onNotificationAdded(({ data }) => { class="grid gap-2 rounded-md border border-gray-200 p-3 transition hover:border-amber-300" >
-