1d29a97384
Added Active file info API
80 lines
2.3 KiB
TypeScript
80 lines
2.3 KiB
TypeScript
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<Array<any>> {
|
|
return await this.Get<any>(this.BASE_URL + "files", true, {
|
|
filePath: path
|
|
});
|
|
}
|
|
|
|
async getFileInfo(path: string) {
|
|
var result = await this.Get<any>(this.BASE_URL + "file/info", true, {
|
|
filePath: path
|
|
});
|
|
|
|
result.AbsolutePath = path;
|
|
|
|
return result;
|
|
}
|
|
|
|
async getActiveFileInfo(path: string) {
|
|
var result = await this.Get<any>(this.BASE_URL + "file/active/info", true, {
|
|
filePath: path
|
|
});
|
|
|
|
result.AbsolutePath = path;
|
|
|
|
return result;
|
|
}
|
|
|
|
async activateProgram(path: string) {
|
|
return await this.Put<any>(this.BASE_URL + "file/active?filePath=" + path, null);
|
|
}
|
|
|
|
async deactivateProgram() {
|
|
return await this.Put<any>(this.BASE_URL + "file/deactivate", null);
|
|
}
|
|
|
|
async deleteQueue(processId) {
|
|
var result = await this.Delete<any>(this.BASE_URL + "queue/" + processId + "/empty", true);
|
|
productionActions.deletePartPrograms(store);
|
|
return result;
|
|
}
|
|
|
|
async deleteItemQueue(processId, model) {
|
|
var result = await this.Delete<any>(this.BASE_URL + "queue/" + processId + "/remove/" + model.id, true);
|
|
productionActions.deletePartProgram(store, model);
|
|
return result;
|
|
}
|
|
|
|
async moveItemsQueue(processId, position, model) {
|
|
productionActions.movePartProgram(store, { model, position });
|
|
var result = await this.Put<any>(this.BASE_URL + "queue/" + processId + "/move", position, true);
|
|
// productionActions.movePartProgram(store, { model: result, position });
|
|
return result;
|
|
}
|
|
|
|
async startQueue(processId) {
|
|
var result = await this.Post<any>(this.BASE_URL + "queue/start?processId=" + processId, null);
|
|
return result;
|
|
}
|
|
|
|
async stopQueue(processId) {
|
|
var result = await this.Post<any>(this.BASE_URL + "queue/stop?processId=" + processId, null);
|
|
return result;
|
|
}
|
|
|
|
async changeReps(processId, model) {
|
|
var result = await this.Put<any>(this.BASE_URL + "queue/" + processId + "/edit/" + model.id, { reps: model.reps });
|
|
productionActions.updatePartProgram(store, result);
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
export const fileService = new FileService();
|