import { baseRestService } from "src/_base/baseRestService"; import { productionActions } from "../store/production.store"; import { store } from "../store"; export class FileService extends baseRestService { BASE_URL = "api/file_manager/"; async getFiles(path: string): Promise> { return await this.Get(this.BASE_URL + "files", true, { filePath: path }); } async getFileInfo(path: string) { var result = await this.Get(this.BASE_URL + "file/info", true, { filePath: path }); result.AbsolutePath = path; return result; } async activateProgram(path: string) { return await this.Put(this.BASE_URL + "file/active?filePath=" + path, null); } async deactivateProgram() { return await this.Put(this.BASE_URL + "file/deactivate", null); } async deleteQueue(processId){ var result = await this.Delete(this.BASE_URL + "queue/" + processId + "/empty", true); productionActions.deletePartPrograms(store); return result; } async deleteItemQueue(processId, model){ var result = await this.Delete(this.BASE_URL + "queue/" + processId + "/remove/" + model.id, true); productionActions.deletePartProgram(store,model); return result; } async moveItemsQueue(processId, position, model){ var result = await this.Put(this.BASE_URL + "queue/" + processId + "/move", position, true); model = result; productionActions.movePartProgram(store,{model,position}); return result; } async startQueue(processId){ var result = await this.Post(this.BASE_URL + "queue/start?processId=" + processId, null); return result; } async stopQueue(processId){ var result = await this.Post(this.BASE_URL + "queue/stop?processId=" + processId, null); return result; } async changeReps(processId,model){ var result = await this.Put(this.BASE_URL + "queue/" + processId + "/edit/" + model.id, {reps: model.reps}); productionActions.updatePartProgram(store, result); return result; } } export const fileService = new FileService();