Skip to content

Commit

Permalink
Fixed tabs on the home page
Browse files Browse the repository at this point in the history
Buttons on the home page not working #409
  • Loading branch information
gcnabeel committed Jun 23, 2023
1 parent 369dd48 commit 9ed3cc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
25 changes: 7 additions & 18 deletions Portal/src/Datahub.Portal/Pages/Landing/Tabs/DatabricksTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@inject IStringLocalizer<DataLabels> DataLocalizer
@inject NavigationManager NavigationManager
@inject IJSRuntime JsInterop
@implements IDisposable
@inject IDbContextFactory<DatahubProjectDBContext> _dbContextFactory
@inject IUserInformationService UserInformationService

Expand Down Expand Up @@ -44,14 +43,13 @@
private IPageableComponent _myTable;

private List<Datahub_Project> _projects;
DatahubProjectDBContext Context;

private int _lastClicked = 0;


private void OnPageClick(int pageIndex)
{
_lastClicked = pageIndex;
_lastClicked = pageIndex;
}

protected override void OnAfterRender(bool firstRender)
Expand All @@ -64,16 +62,11 @@
{
var currentUserId = await UserInformationService.GetUserIdString();
await using var context = await _dbContextFactory.CreateDbContextAsync();

var databricksTemplateName = RequestManagementService.GetTerraformServiceType(IRequestManagementService.DATABRICKS);

_projects = Context.Project_Users
.Where(u => u.User_ID == currentUserId)
.Select(u => u.Project)
.Include(p => p.Resources
.Where(r => r.ResourceType == databricksTemplateName))
.Distinct()
.ToList();

var databricksTemplateName = RequestManagementService.GetTerraformServiceType(IRequestManagementService.DATABRICKS);

_projects = context.Projects
.Where(p => p.Users.Any(u => u.User_ID == currentUserId) && p.Resources.Any(r => r.ResourceType == databricksTemplateName)).ToList();

FillAccessorFunctions();

Expand Down Expand Up @@ -108,9 +101,5 @@
new Func<Datahub_Project, string>(Datahub_Project => { return Datahub_Project?.ProjectDescription; }),
};
}

public void Dispose()
{
Context.Dispose();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public async Task HandleRequestService(Datahub_Project project, string serviceTy
await RequestServiceWithDefaults(serviceRequest);
}

public static string GetTerraformServiceType(string templateName) => $"terraform:{templateName}";
public static string GetTerraformServiceType(string templateName) => $"{templateName}";

public async Task<bool> HandleTerraformRequestServiceAsync(Datahub_Project project, string terraformTemplate)
{
Expand Down

0 comments on commit 9ed3cc9

Please # to comment.