mirror of
https://github.com/unraid/api.git
synced 2026-01-03 06:59:50 -06:00
fix: makes array updates work again
This commit is contained in:
2346
package-lock.json
generated
2346
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,7 @@ import GraphQLJSON from 'graphql-type-json';
|
||||
import GraphQLLong from 'graphql-type-long';
|
||||
import GraphQLUUID from 'graphql-type-uuid';
|
||||
import { run, publish } from '../../run';
|
||||
import { cache } from '../../cache';
|
||||
import { hasSubscribedToChannel, canPublishToChannel } from '../../ws';
|
||||
|
||||
const { pluginManager, pubsub, utils, log, bus, errors, states } = core;
|
||||
@@ -19,8 +20,8 @@ const { ensurePermission } = utils;
|
||||
const { usersState } = states;
|
||||
const { AppError, PluginError } = errors;
|
||||
|
||||
// Update array values when disks change
|
||||
bus.on('disks', async () => {
|
||||
// Update array values when slots change
|
||||
bus.on('slots', async () => {
|
||||
// @todo: Create a system user for this
|
||||
const user = usersState.findOne({ name: 'root' });
|
||||
|
||||
@@ -93,7 +94,15 @@ const createSubscription = (channel, resource?) => ({
|
||||
export const resolvers = {
|
||||
Query: {
|
||||
info: () => ({}),
|
||||
vms: () => ({})
|
||||
vms: () => ({}),
|
||||
server(name: string) {
|
||||
// Single server
|
||||
// return cache.get();
|
||||
},
|
||||
servers() {
|
||||
// All servers
|
||||
return cache.data;
|
||||
}
|
||||
},
|
||||
Subscription: {
|
||||
apikeys: {
|
||||
@@ -125,6 +134,9 @@ export const resolvers = {
|
||||
services: {
|
||||
...createSubscription('services')
|
||||
},
|
||||
servers: {
|
||||
...createSubscription('servers')
|
||||
},
|
||||
shares: {
|
||||
...createSubscription('shares')
|
||||
},
|
||||
|
||||
28
src/graphql/schema/types/servers/server.graphql
Normal file
28
src/graphql/schema/types/servers/server.graphql
Normal file
@@ -0,0 +1,28 @@
|
||||
type Query {
|
||||
server(name: String!): Server @func(module: "servers/name/get-server")
|
||||
servers: [Server] @func(module: "getServers")
|
||||
}
|
||||
|
||||
type ServerSubscription {
|
||||
mutation: UpdateOnlyMutationType!
|
||||
node: Server!
|
||||
}
|
||||
type ServersSubscription {
|
||||
mutation: UpdateOnlyMutationType!
|
||||
node: [Server!]
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
server(name: String!): ServerSubscription
|
||||
servers: ServersSubscription
|
||||
}
|
||||
|
||||
type Status = 'Online' | 'Offline';
|
||||
|
||||
type Server {
|
||||
name: String!
|
||||
status: Status!
|
||||
wanIp: String!
|
||||
localUrl: String!
|
||||
remoteUrl: String!
|
||||
}
|
||||
@@ -14,7 +14,7 @@ type ServicesSubscription {
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
service(id: ID!): ServiceSubscription
|
||||
service(name: String!): ServiceSubscription
|
||||
services: ServicesSubscription
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user