chore: rebase cleanup

cleaning up some incorrectly rebased files (don't remember if it was automatic or manual...either way)
This commit is contained in:
Ajit Mehrotra
2025-12-30 15:07:32 -05:00
parent 8ef00ce27f
commit 9ed71e5df9
2 changed files with 1 additions and 123 deletions

View File

@@ -25,7 +25,6 @@ vi.mock('@nestjs/common', async () => {
debug: vi.fn(),
error: vi.fn(),
log: vi.fn(),
verbose: vi.fn(),
})),
};
});
@@ -61,23 +60,12 @@ vi.mock('./utils/docker-client.js', () => ({
// Mock DockerService
vi.mock('./docker.service.js', () => ({
DockerService: vi.fn().mockImplementation(() => ({
getDockerClient: vi.fn(),
clearContainerCache: vi.fn(),
getAppInfo: vi.fn().mockResolvedValue({ info: { apps: { installed: 1, running: 1 } } }),
})),
}));
const { mockDockerClientInstance } = vi.hoisted(() => {
const mock = {
getEvents: vi.fn(),
} as unknown as Docker;
return { mockDockerClientInstance: mock };
});
// Mock the docker client util
vi.mock('@app/unraid-api/graph/resolvers/docker/utils/docker-client.js', () => ({
getDockerClient: vi.fn().mockReturnValue(mockDockerClientInstance),
}));
describe('DockerEventService', () => {
let service: DockerEventService;
let dockerService: DockerService;

View File

@@ -1,110 +0,0 @@
import { Injectable } from '@nestjs/common';
import { type UISchemaElement } from '@jsonforms/core';
import { DockerContainerOverviewForm } from '@app/unraid-api/graph/resolvers/docker/docker.model.js';
import { DockerService } from '@app/unraid-api/graph/resolvers/docker/docker.service.js';
import { DataSlice } from '@app/unraid-api/types/json-forms.js';
@Injectable()
export class DockerFormService {
constructor(private readonly dockerService: DockerService) {}
async getContainerOverviewForm(skipCache = false): Promise<DockerContainerOverviewForm> {
const containers = await this.dockerService.getContainers({ skipCache });
// Transform containers data for table display
const tableData = containers.map((container) => ({
id: container.id,
name: container.names[0]?.replace(/^\//, '') || 'Unknown',
state: container.state,
status: container.status,
image: container.image,
ports: container.ports
.map((p) => {
if (p.publicPort && p.privatePort) {
return `${p.publicPort}:${p.privatePort}/${p.type}`;
} else if (p.privatePort) {
return `${p.privatePort}/${p.type}`;
}
return '';
})
.filter(Boolean)
.join(', '),
autoStart: container.autoStart,
network: container.hostConfig?.networkMode || 'default',
}));
const dataSchema = this.createDataSchema();
const uiSchema = this.createUiSchema();
return {
id: 'docker-container-overview',
dataSchema: {
type: 'object',
properties: dataSchema,
},
uiSchema: {
type: 'VerticalLayout',
elements: [uiSchema],
},
data: tableData,
};
}
private createDataSchema(): DataSlice {
return {
containers: {
type: 'array',
items: {
type: 'object',
properties: {
id: {
type: 'string',
title: 'ID',
},
name: {
type: 'string',
title: 'Name',
},
state: {
type: 'string',
title: 'State',
enum: ['RUNNING', 'EXITED'],
},
status: {
type: 'string',
title: 'Status',
},
image: {
type: 'string',
title: 'Image',
},
ports: {
type: 'string',
title: 'Ports',
},
autoStart: {
type: 'boolean',
title: 'Auto Start',
},
network: {
type: 'string',
title: 'Network',
},
},
},
},
};
}
private createUiSchema(): UISchemaElement {
return {
type: 'Control',
scope: '#',
options: {
variant: 'table',
},
};
}
}