Files
cms_thermo_active/Step/wwwroot/src/services/fileService.ts
T
Alessandro Francia 603e07cd7e fix move element list
2018-09-20 16:19:00 +02:00

70 lines
2.1 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 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){
var result = await this.Put<any>(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<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();