var Bizgaze;
(function (Bizgaze) {
let Apps;
(function (Apps) {
let Hyperfusion;
(function (Hyperfusion) {
let Components;
(function (Components) {
class Virtualmachine extends Unibase.Platform.Core.BaseComponent {
constructor() {
super();
this.pageIndex = 0;
}
cssFiles() {
throw new Error("Method not implemented.");
}
jsFiles() {
return ["apps/hyperfusion/managers/hyperfusionmanager.js", "libs/jquery/pagination/jquery.pagination.js"];
;
}
html(id, containerid) {
return null;
}
load(id, containerid, callback) { }
loadForm(FormId, Pk_Value, AppConfigurationId, Callback, PortletWidgetId) { }
init(containerid) {
let instance = this;
instance.fileCacheHelper.loadJsFiles(["libs/jquery/pagination/jquery.pagination.js"], null);
$(`.${containerid}`).append(`
`);
instance.virtualMeachine(containerid);
var url = _appsettings.server_url() + '/apis/v4/hyperfusion/hireserver/machines/serversautocomplete';
AutoCompleteHelper.getHelper().Create("#txtserver", "#hf_Autocomplete_Services", url, function (response) {
var data = response;
$("#div_server").find('.select2ErrorClass').addClass('w-200p');
});
url = _appsettings.server_url() + '/apis/v4/hyperfusion/hireserver/machines/locationsautocomplete';
AutoCompleteHelper.getHelper().Create($("#txtlocation"), "#hfAutocomplete_Plant", url, function (response) {
var data = response;
$("#div_Location").find('.select2ErrorClass').addClass('w-200p');
});
}
loadPagination(totalRecords) {
var instance = this;
let element = $('#ItemsListPagination');
element.pagination(totalRecords, 20, {
items_per_page: 20,
callback: function (page, component) {
instance.pageIndex = page;
instance.loadData();
}, current_page: instance.pageIndex
});
}
virtualMeachine(containerid) {
var instance = this;
let html = '';
html += `
Machine Name
VM Stage
HS Stage
Created Date
Contact Name
Location
Server Name
`;
$(".hyperfunction_" + containerid).append(html);
instance.loadData();
}
loadData() {
var instance = this;
let datetimeIns = Unibase.Platform.Helpers.DateTimeHelper.Instance();
var instance = this;
var Serverid = $('#txtserver option:selected').val();
var Branchid = $('#txtlocation option:selected').val();
var postData = {
ServerId: Serverid,
BranchId: Branchid,
Page: instance.pageIndex,
Rows: 20,
FromDate: $("#txt_fromDate").val(),
ToDate: $("#txt_toDate").val(),
Stage: $('#txtAutocomplete_log option:selected').text()
};
if (($("#txt_fromDate").val() == "" && $("#txt_toDate").val() != "" && $("#txt_toDate").val() != undefined)) {
MessageHelper.Instance().showError("Please select FromDate", "Unibase_ValidationSummary");
}
else if ($("#txt_fromDate").val() != "" && $("#txt_fromDate").val() != undefined && $("#txt_toDate").val() == "") {
MessageHelper.Instance().showError("Please select ToDate", "Unibase_ValidationSummary");
}
else if (($("#txt_fromDate").val() > $("#txt_toDate").val())) {
MessageHelper.Instance().showError("ToDate is lessthan FromDate", "Unibase_ValidationSummary");
}
else {
$(".divlog").html(Unibase.Themes.Compact.Components.Nav_Template.Instance().skelTonHorizontal());
}
instance.fileCacheHelper.loadJsFiles(["apps/hyperfusion/managers/hyperfusionmanager.js"], () => {
Hyperfusion.Managers.HyperfusionManager.Instance().getMachinesDataforfilter(postData).then((response) => {
let html = '';
if (response.result.length == 0) {
$(".divlog").hide();
$("#totalcount").hide();
}
else {
$(".divlog").show();
$("#totalcount").show();
if (response.result != null) {
for (let i = 0; i < response.result.length; i++) {
let data = response.result[i];
let machine_name = data.MachineName;
let contact_name = data.ContactName;
let stage_name = data.StageName;
var date = Unibase.Platform.Helpers.DateTimeHelper.Instance().FormatDateTime(data.CreatedDate);
html += `
- ${data.MachineName}
- ${data.ActualStage}
- ${data.StageName}
- ${date}
- ${data.ContactName}
- ${data.BranchName}
- ${data.ServerName}
`;
}
}
}
if (response.totalRecords > 20) {
$("#ItemsListPagination").removeClass("hidden");
instance.loadPagination(response.totalRecords);
}
else {
$("#ItemsListPagination").addClass("hidden");
}
$('#getcount').text(response.totalRecords);
$("#lblintegratelogRecords").text(response.result.length);
$(".divlog").html(html);
});
});
}
downloadServersReport() {
let datetimeIns = Unibase.Platform.Helpers.DateTimeHelper.Instance();
var instance = this;
var ServerId = $('#txtserver option:selected').val();
var BranchId = $('#txtlocation option:selected').val();
var postData = {
ServerId: ServerId,
BranchId: BranchId,
Page: instance.pageIndex,
Rows: 20,
FromDate: $("#txt_fromDate").val(),
ToDate: $("#txt_toDate").val(),
Stage: $('#txtAutocomplete_log option:selected').text()
};
if (($("#txt_fromDate").val() == "" && $("#txt_toDate").val() != "" && $("#txt_toDate").val() != undefined)) {
MessageHelper.Instance().showError("Please select FromDate", "Unibase_ValidationSummary");
}
else if ($("#txt_fromDate").val() != "" && $("#txt_fromDate").val() != undefined && $("#txt_toDate").val() == "") {
MessageHelper.Instance().showError("Please select ToDate", "Unibase_ValidationSummary");
}
else if (($("#txt_fromDate").val() > $("#txt_toDate").val())) {
MessageHelper.Instance().showError("ToDate is lessthan FromDate", "Unibase_ValidationSummary");
}
else {
}
this.fileCacheHelper.loadJsFiles(['apps/Hyperfusion/manager/hyperfusionmanager.js'], () => {
Hyperfusion.Managers.HyperfusionManager.Instance().downloadData(postData).then((response) => {
Unibase.Platform.Helpers.FileHelper.Instance().convertBase64tofile(response.result);
});
});
}
refreshData() {
$('#txt_fromDate').val('');
$('#txt_toDate').val('');
$('#txtAutocomplete_log').val(1);
$('#txtserver').text('');
$('#txtlocation').text('');
this.loadData();
}
static Instance() {
return new Virtualmachine();
}
}
Components.Virtualmachine = Virtualmachine;
})(Components = Hyperfusion.Components || (Hyperfusion.Components = {}));
})(Hyperfusion = Apps.Hyperfusion || (Apps.Hyperfusion = {}));
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
})(Bizgaze || (Bizgaze = {}));