Switched frontend urls to env variables and fixed bug in module creation
This commit is contained in:
parent
e44c7001a4
commit
06c4acf4fb
@ -1,6 +1,7 @@
|
|||||||
@using ApexCharts
|
@using ApexCharts
|
||||||
@using System.Collections.Generic
|
@using System.Collections.Generic
|
||||||
@using PanoptesFrontend.Data;
|
@using PanoptesFrontend.Data;
|
||||||
|
@using System
|
||||||
@using System.Timers
|
@using System.Timers
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
@inject IHttpService httpService
|
@inject IHttpService httpService
|
||||||
@ -55,7 +56,8 @@
|
|||||||
|
|
||||||
private async Task UpdateChartSeries()
|
private async Task UpdateChartSeries()
|
||||||
{
|
{
|
||||||
var response = await httpService.GetAsync<GraphComponent>($"http://localhost:10000/component/{module}/{ChartId}");
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
var response = await httpService.GetAsync<GraphComponent>($"http://{panoptesHost}/component/{module}/{ChartId}");
|
||||||
StatsList = response.Stats;
|
StatsList = response.Stats;
|
||||||
await chart.UpdateSeriesAsync(true);
|
await chart.UpdateSeriesAsync(true);
|
||||||
await InvokeAsync(() => StateHasChanged());
|
await InvokeAsync(() => StateHasChanged());
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
@using System.Linq.Dynamic.Core
|
@using System.Linq.Dynamic.Core
|
||||||
@inject IHttpService httpService
|
@inject IHttpService httpService
|
||||||
@using PanoptesFrontend.Services
|
@using PanoptesFrontend.Services
|
||||||
|
@using System
|
||||||
|
|
||||||
<RadzenDataGrid @bind-Value=@selectedItems Data="@data" TItem="IDictionary<string, object>" ColumnWidth="200px"
|
<RadzenDataGrid @bind-Value=@selectedItems Data="@data" TItem="IDictionary<string, object>" ColumnWidth="200px"
|
||||||
AllowFiltering="true" FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterMode="FilterMode.Advanced" AllowPaging="true" AllowSorting="true">
|
AllowFiltering="true" FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterMode="FilterMode.Advanced" AllowPaging="true" AllowSorting="true">
|
||||||
@ -65,7 +66,8 @@
|
|||||||
|
|
||||||
private async Task Update()
|
private async Task Update()
|
||||||
{
|
{
|
||||||
var response = await httpService.GetAsync<TableComponent>($"http://localhost:10000/component/{module}/{TableId}");
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
var response = await httpService.GetAsync<TableComponent>($"http://{panoptesHost}/component/{module}/{TableId}");
|
||||||
|
|
||||||
if (response.Data != null)
|
if (response.Data != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,8 @@
|
|||||||
@using Newtonsoft.Json
|
@using Newtonsoft.Json
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@using Microsoft.JSInterop
|
@using Microsoft.JSInterop
|
||||||
@using System.Net;
|
@using System
|
||||||
|
@using System.Net
|
||||||
@using PanoptesFrontend.Data
|
@using PanoptesFrontend.Data
|
||||||
@using PanoptesFrontend.Services
|
@using PanoptesFrontend.Services
|
||||||
@inject IHttpService httpService
|
@inject IHttpService httpService
|
||||||
@ -148,7 +149,8 @@
|
|||||||
var config = JsonConvert.SerializeObject(ModuleConfig);
|
var config = JsonConvert.SerializeObject(ModuleConfig);
|
||||||
Console.WriteLine(config);
|
Console.WriteLine(config);
|
||||||
var payload = new StringContent(config, Encoding.UTF8, "application/json");
|
var payload = new StringContent(config, Encoding.UTF8, "application/json");
|
||||||
await httpService.PostAsync("http://localhost:10000/create_module", ModuleConfig);
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
await httpService.PostAsync($"http://{panoptesHost}/create_module", ModuleConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
@using System.Net;
|
@using System.Net;
|
||||||
@using PanoptesFrontend.Data
|
@using PanoptesFrontend.Data
|
||||||
@using PanoptesFrontend.Services
|
@using PanoptesFrontend.Services
|
||||||
@using System.Text.Json;
|
@using System
|
||||||
|
@using System.Text.Json
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@inject IHttpService httpService
|
@inject IHttpService httpService
|
||||||
@inject IJSRuntime JSRuntime
|
@inject IJSRuntime JSRuntime
|
||||||
@ -77,7 +78,8 @@
|
|||||||
|
|
||||||
protected async override Task OnInitializedAsync()
|
protected async override Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var schema = await httpService.GetAsync<Schema>("http://localhost:10000/" + moduleId + "/schema");
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
var schema = await httpService.GetAsync<Schema>($"http://{panoptesHost}/{moduleId}/schema");
|
||||||
tables = schema.tables;
|
tables = schema.tables;
|
||||||
graphs = schema.graphs;
|
graphs = schema.graphs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
@inject IHttpService httpService
|
@inject IHttpService httpService
|
||||||
@using PanoptesFrontend.Services
|
@using PanoptesFrontend.Services
|
||||||
|
@using System
|
||||||
|
|
||||||
<RadzenTextArea @bind-Value="sqlQuery" Style="width: 100%; height: 300px" />
|
<RadzenTextArea @bind-Value="sqlQuery" Style="width: 100%; height: 300px" />
|
||||||
<button class="btn btn-primary" @onclick="ExecuteSqlQuery">Execute Query</button>
|
<button class="btn btn-primary" @onclick="ExecuteSqlQuery">Execute Query</button>
|
||||||
@ -10,7 +11,8 @@
|
|||||||
private async Task ExecuteSqlQuery()
|
private async Task ExecuteSqlQuery()
|
||||||
{
|
{
|
||||||
// Send the SQL query to your backend and handle the response
|
// Send the SQL query to your backend and handle the response
|
||||||
var response = await httpService.PostAsync($"http://localhost:10000/sqlquery", sqlQuery);
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
var response = await httpService.PostAsync($"http://{panoptesHost}/sqlquery", sqlQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@ using PanoptesFrontend.Data.Account;
|
|||||||
using PanoptesFrontend.Data;
|
using PanoptesFrontend.Data;
|
||||||
using Blazored.LocalStorage;
|
using Blazored.LocalStorage;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace PanoptesFrontend.Services;
|
namespace PanoptesFrontend.Services;
|
||||||
|
|
||||||
@ -26,11 +27,13 @@ public class AccountService : IAccountService
|
|||||||
|
|
||||||
|
|
||||||
public async Task Register(AddUser model){
|
public async Task Register(AddUser model){
|
||||||
await httpService.PostAsync("http://localhost:10000/user/register", model);
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
await httpService.PostAsync($"http://{panoptesHost}/user/register", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Login(LoginUser model){
|
public async Task Login(LoginUser model){
|
||||||
var response = await httpService.PostAsync("http://localhost:10000/user/login", model);
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
var response = await httpService.PostAsync($"http://panoptesHost/user/login", model);
|
||||||
|
|
||||||
var jsonDoc = JsonDocument.Parse(response);
|
var jsonDoc = JsonDocument.Parse(response);
|
||||||
var token = jsonDoc.RootElement.GetProperty("token").GetString();
|
var token = jsonDoc.RootElement.GetProperty("token").GetString();
|
||||||
@ -43,7 +46,8 @@ public class AccountService : IAccountService
|
|||||||
|
|
||||||
var authtoken = await localStorage.GetItemAsStringAsync("authToken");
|
var authtoken = await localStorage.GetItemAsStringAsync("authToken");
|
||||||
|
|
||||||
await httpService.PostAsync("http://localhost:10000/user/logout", authtoken);
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
await httpService.PostAsync($"http://{panoptesHost}/user/logout", authtoken);
|
||||||
await localStorage.RemoveItemAsync("authToken");
|
await localStorage.RemoveItemAsync("authToken");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
@using PanoptesFrontend.Data;
|
@using PanoptesFrontend.Data;
|
||||||
@using PanoptesFrontend.Services;
|
@using PanoptesFrontend.Services;
|
||||||
|
@using System
|
||||||
@using System.Text.Json;
|
@using System.Text.Json;
|
||||||
@inject IHttpService httpService
|
@inject IHttpService httpService
|
||||||
|
|
||||||
@ -38,7 +39,8 @@
|
|||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
response = await httpService.GetAsync<Module[]>("http://localhost:10000/modules");
|
var panoptesHost = Environment.GetEnvironmentVariable("PANOPTESHOST");
|
||||||
|
response = await httpService.GetAsync<Module[]>($"http://{panoptesHost}/modules");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool collapseNavMenu = true;
|
private bool collapseNavMenu = true;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
"github.com/google/uuid"
|
||||||
"gitlab.computing.dcu.ie/murphg62/2023-ca400-murphg62-byrnm257/src/backend/pkg/database"
|
"gitlab.computing.dcu.ie/murphg62/2023-ca400-murphg62-byrnm257/src/backend/pkg/database"
|
||||||
"gitlab.computing.dcu.ie/murphg62/2023-ca400-murphg62-byrnm257/src/backend/pkg/docker"
|
"gitlab.computing.dcu.ie/murphg62/2023-ca400-murphg62-byrnm257/src/backend/pkg/docker"
|
||||||
_ "golang.org/x/mod/module"
|
_ "golang.org/x/mod/module"
|
||||||
@ -216,6 +217,7 @@ func CreateModule(c echo.Context) error {
|
|||||||
if err := c.Bind(&module); err != nil {
|
if err := c.Bind(&module); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
module.ID = uuid.New().String()
|
||||||
s, _ := json.MarshalIndent(module, "", " ")
|
s, _ := json.MarshalIndent(module, "", " ")
|
||||||
fmt.Println(string(s))
|
fmt.Println(string(s))
|
||||||
mod_id := docker.CreateModule(module)
|
mod_id := docker.CreateModule(module)
|
||||||
|
|||||||
@ -19,6 +19,7 @@ require (
|
|||||||
github.com/docker/go-connections v0.4.0 // indirect
|
github.com/docker/go-connections v0.4.0 // indirect
|
||||||
github.com/docker/go-units v0.5.0 // indirect
|
github.com/docker/go-units v0.5.0 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
github.com/labstack/gommon v0.4.0 // indirect
|
github.com/labstack/gommon v0.4.0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
|
|||||||
@ -17,6 +17,8 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
|
|||||||
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user