Compare commits
1 Commits
aa38d17daf
...
feature-13
| Author | SHA1 | Date | |
|---|---|---|---|
| e020ec8c01 |
105
Fab2ApprovalSystem-Development.yml
Normal file
105
Fab2ApprovalSystem-Development.yml
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- Development
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- "Fab2ApprovalSystem/*"
|
||||||
|
exclude:
|
||||||
|
- "**/*.yaml"
|
||||||
|
- "**/*.yml"
|
||||||
|
- "SQL/*"
|
||||||
|
- "references/*"
|
||||||
|
- "packages/*"
|
||||||
|
- "Kendo/*"
|
||||||
|
|
||||||
|
pool:
|
||||||
|
name: Mesa-IIS
|
||||||
|
demands: Fab2ApprovalSystem-Development
|
||||||
|
|
||||||
|
variables:
|
||||||
|
# solution: '**/*.sln'
|
||||||
|
# buildPlatform: 'Any CPU'
|
||||||
|
buildConfiguration: "Debug"
|
||||||
|
ASPNETCORE_ENVIRONMENT: "Development"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
set assemblyTitle=Fab2ApprovalSystem
|
||||||
|
echo %assemblyTitle%
|
||||||
|
echo ##vso[task.setvariable variable=AssemblyTitle;]%assemblyTitle%
|
||||||
|
echo $(AssemblyTitle)
|
||||||
|
displayName: AssemblyTitle
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set targetFrameworkVersion=v4.8
|
||||||
|
echo %targetFrameworkVersion%
|
||||||
|
echo ##vso[task.setvariable variable=TargetFrameworkVersion;]%targetFrameworkVersion%
|
||||||
|
echo $(TargetFrameworkVersion)
|
||||||
|
displayName: TargetFrameworkVersion
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set coreVersion=na
|
||||||
|
echo %coreVersion%
|
||||||
|
echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion%
|
||||||
|
echo $(CoreVersion)
|
||||||
|
displayName: CoreVersion
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set configuration=Debug
|
||||||
|
echo %configuration%
|
||||||
|
echo ##vso[task.setvariable variable=Configuration;]%configuration%
|
||||||
|
echo $(Configuration)
|
||||||
|
displayName: Configuration
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
REM set nugetSource=https://messa017.infineon.com/v3/index.json
|
||||||
|
set nugetSource=https://eaf-prod.mes.infineon.com/v3/index.json
|
||||||
|
echo %nugetSource%
|
||||||
|
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
||||||
|
echo $(NugetSource)
|
||||||
|
displayName: NugetSource
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
set gitCommit=$(Build.SourceVersion)
|
||||||
|
set gitCommitSeven=%gitCommit:~0,7%
|
||||||
|
echo %gitCommitSeven%
|
||||||
|
echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven%
|
||||||
|
echo $(GitCommitSeven)
|
||||||
|
displayName: GitCommitSeven
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
echo $(AssemblyTitle)
|
||||||
|
echo $(Build.BuildId)
|
||||||
|
echo $(Build.Reason)
|
||||||
|
echo $(Build.Repository.Id)
|
||||||
|
echo $(Build.Repository.Name)
|
||||||
|
echo $(Build.SourceVersion)
|
||||||
|
echo $(CoreVersion)
|
||||||
|
echo $(Configuration)
|
||||||
|
echo $(NugetSource)
|
||||||
|
echo $(GitCommitSeven)
|
||||||
|
echo $(TargetFrameworkVersion)
|
||||||
|
REM echo $(pipelinePassword)
|
||||||
|
displayName: "Echo Check"
|
||||||
|
|
||||||
|
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj'
|
||||||
|
workingDirectory: Fab2ApprovalSystem
|
||||||
|
displayName: "Framework Restore"
|
||||||
|
|
||||||
|
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj'
|
||||||
|
workingDirectory: Fab2ApprovalSystem
|
||||||
|
displayName: "Framework Build"
|
||||||
|
|
||||||
|
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:DebugSymbols=false /p:DeleteExistingFiles=true /p:DeployOnBuild=true /p:EnableUpdateAble=true /p:ExcludeApp_Data=true /p:LastUsedBuildConfiguration=$(Configuration) /p:LastUsedPlatform="Any CPU" /p:LaunchSiteAfterPublish=true /p:OutputPath="D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" /p:PreCompileBeforePublish=true /p:PublishProvider=FileSystem /p:PublishUrl="D:/PublishUrl" /p:SiteUrlToLaunchAfterPublish="" /p:WDPMergeOption=DoNotMerge /p:WebPublishMethod=FileSystem $(AssemblyTitle).csproj'
|
||||||
|
workingDirectory: Fab2ApprovalSystem
|
||||||
|
displayName: "Framework Pack"
|
||||||
|
|
||||||
|
- script: '"C:/Program Files (x86)/IIS/Microsoft Web Deploy V3/MSDeploy.exe" -AllowUntrusted -dest:auto -disableLink:AppPoolExtension -disableLink:CertificateExtension -disableLink:ContentExtension -setParam:name="IIS Web Application Name",value=$(Build.Repository.Name) -setParamFile:"D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" "/_PublishedWebsites/$(Build.Repository.Name)_Package/$(Build.Repository.Name).SetParameters.xml" -source:package="D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" "/_PublishedWebsites/$(AssemblyTitle)_Package/$(AssemblyTitle).zip" -verb:sync'
|
||||||
|
workingDirectory: Fab2ApprovalSystem
|
||||||
|
displayName: "Framework Deploy"
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
|
||||||
|
displayName: "Force Fail"
|
||||||
|
enabled: false
|
||||||
@ -53,36 +53,4 @@ public class ECNController : ControllerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("ecn/allNumbers")]
|
|
||||||
public async Task<IActionResult> GetAllECNNumbers() {
|
|
||||||
DateTime start = DateTime.Now;
|
|
||||||
bool isInternalError = false;
|
|
||||||
string errorMessage = "";
|
|
||||||
|
|
||||||
try {
|
|
||||||
_logger.LogInformation($"Attempting to get all ECN#s");
|
|
||||||
|
|
||||||
IEnumerable<int> allEcnNumbers = await _ecnService.GetAllECNNumbers();
|
|
||||||
|
|
||||||
return Ok(allEcnNumbers);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
isInternalError = true;
|
|
||||||
errorMessage = $"Cannot get all ECN#s, because {ex.Message}";
|
|
||||||
return Problem(errorMessage);
|
|
||||||
} finally {
|
|
||||||
string metricName = "GetAllECNNumbers";
|
|
||||||
DateTime end = DateTime.Now;
|
|
||||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
|
||||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
|
||||||
|
|
||||||
if (isInternalError) {
|
|
||||||
_logger.LogError(errorMessage);
|
|
||||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
|
||||||
} else {
|
|
||||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -265,7 +265,6 @@ public class PCRBController : ControllerBase {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("pcrb/attachment")]
|
[Route("pcrb/attachment")]
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public async Task<IActionResult> UploadAttachment([FromForm] IFormFile file, [FromForm] PCRBAttachment attachment) {
|
public async Task<IActionResult> UploadAttachment([FromForm] IFormFile file, [FromForm] PCRBAttachment attachment) {
|
||||||
DateTime start = DateTime.Now;
|
DateTime start = DateTime.Now;
|
||||||
bool isArgumentError = false;
|
bool isArgumentError = false;
|
||||||
|
|||||||
@ -132,6 +132,9 @@ builder.Services.AddSwaggerGen(c => {
|
|||||||
|
|
||||||
WebApplication app = builder.Build();
|
WebApplication app = builder.Build();
|
||||||
|
|
||||||
|
if (Debugger.IsAttached)
|
||||||
|
app.Services.GetRequiredService<IApprovalService>();
|
||||||
|
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|||||||
@ -219,10 +219,7 @@ public class ApprovalService : IApprovalService {
|
|||||||
queryBuilder.Append($"select a.*, src.SubRoleCategoryItem from Approval a ");
|
queryBuilder.Append($"select a.*, src.SubRoleCategoryItem from Approval a ");
|
||||||
queryBuilder.Append("join SubRole sr on a.SubRoleID=sr.SubRoleID ");
|
queryBuilder.Append("join SubRole sr on a.SubRoleID=sr.SubRoleID ");
|
||||||
queryBuilder.Append("join SubRoleCategory src on sr.SubRoleCategoryID=src.SubRoleCategoryID ");
|
queryBuilder.Append("join SubRoleCategory src on sr.SubRoleCategoryID=src.SubRoleCategoryID ");
|
||||||
queryBuilder.Append($"where UserID={userId} and ItemStatus=0 and ");
|
queryBuilder.Append($"where UserID={userId} and ");
|
||||||
queryBuilder.Append($"(AssignedDate is not null and ");
|
|
||||||
queryBuilder.Append($"AssignedDate <= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' and ");
|
|
||||||
queryBuilder.Append($"AssignedDate > '{DateTimeOffset.Now.AddYears(-2).DateTime.ToString("yyyy-MM-dd HH:mm:ss")}') and ");
|
|
||||||
queryBuilder.Append($"((CompletedDate >= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}') or ");
|
queryBuilder.Append($"((CompletedDate >= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}') or ");
|
||||||
queryBuilder.Append($"(CompletedDate is null));");
|
queryBuilder.Append($"(CompletedDate is null));");
|
||||||
string sql = queryBuilder.ToString();
|
string sql = queryBuilder.ToString();
|
||||||
|
|||||||
@ -4,7 +4,6 @@ namespace MesaFabApproval.API.Services;
|
|||||||
|
|
||||||
public interface IECNService {
|
public interface IECNService {
|
||||||
Task<bool> IsValidECNNumber(int number);
|
Task<bool> IsValidECNNumber(int number);
|
||||||
Task<IEnumerable<int>> GetAllECNNumbers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNService : IECNService {
|
public class ECNService : IECNService {
|
||||||
@ -44,19 +43,4 @@ public class ECNService : IECNService {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<int>> GetAllECNNumbers() {
|
|
||||||
try {
|
|
||||||
_logger.LogInformation("Attempting to get all ECN#s");
|
|
||||||
|
|
||||||
string sql = "select ECNNumber from ECN where Deleted=0 and Cancelled=0";
|
|
||||||
|
|
||||||
IEnumerable<int> allEcnNumbers = await _dalService.QueryAsync<int>(sql);
|
|
||||||
|
|
||||||
return allEcnNumbers;
|
|
||||||
} catch (Exception ex) {
|
|
||||||
_logger.LogError($"Unable to get all ECN#s, because {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -852,8 +852,8 @@ public class MRBService : IMRBService {
|
|||||||
convertToPart += partStr;
|
convertToPart += partStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
dt.Rows.Add(action.Action, convertFromCustomer, convertFromPart, action.LotNumber,
|
dt.Rows.Add(action.Action, convertFromCustomer, convertFromPart, action.Quantity.ToString(),
|
||||||
action.Quantity.ToString(), convertToCustomer, convertToPart,
|
convertToCustomer, convertToPart,
|
||||||
DateTimeUtilities.GetDateAsStringMinDefault(action.AssignedDate),
|
DateTimeUtilities.GetDateAsStringMinDefault(action.AssignedDate),
|
||||||
DateTimeUtilities.GetDateAsStringMaxDefault(action.CompletedDate),
|
DateTimeUtilities.GetDateAsStringMaxDefault(action.CompletedDate),
|
||||||
action.CompletedByUser is null ? "" : action.CompletedByUser.GetFullName());
|
action.CompletedByUser is null ? "" : action.CompletedByUser.GetFullName());
|
||||||
|
|||||||
@ -485,20 +485,6 @@ public class PCRBService : IPCRBService {
|
|||||||
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
||||||
|
|
||||||
if (rowsAffected <= 0) throw new Exception("update failed in database");
|
if (rowsAffected <= 0) throw new Exception("update failed in database");
|
||||||
|
|
||||||
IEnumerable<PCRBAttendee>? attendees = _cache.Get<IEnumerable<PCRBAttendee>>($"pcrbAttendees{attendee.PlanNumber}");
|
|
||||||
if (attendees is not null) {
|
|
||||||
foreach (PCRBAttendee cachedAttendee in attendees) {
|
|
||||||
if (cachedAttendee.ID == attendee.ID) {
|
|
||||||
cachedAttendee.Location = attendee.Location;
|
|
||||||
cachedAttendee.Attended = attendee.Attended;
|
|
||||||
cachedAttendee.JobTitle = attendee.JobTitle;
|
|
||||||
cachedAttendee.AttendeeID = attendee.AttendeeID;
|
|
||||||
cachedAttendee.Step = attendee.Step;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_cache.Set($"pcrbAttendees{attendee.PlanNumber}", attendees, DateTimeOffset.Now.AddMinutes(15));
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
_logger.LogError($"Unable to update attendee, because {ex.Message}");
|
_logger.LogError($"Unable to update attendee, because {ex.Message}");
|
||||||
throw;
|
throw;
|
||||||
|
|||||||
@ -1,84 +0,0 @@
|
|||||||
trigger:
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
include:
|
|
||||||
- MesaFabApproval.API
|
|
||||||
- MesaFabApproval.Shared
|
|
||||||
|
|
||||||
variables:
|
|
||||||
buildConfiguration: "Release"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: Test
|
|
||||||
displayName: "Test"
|
|
||||||
pool:
|
|
||||||
name: MesaFabApproval
|
|
||||||
demands: Fab2ApprovalSystem-Dev
|
|
||||||
jobs:
|
|
||||||
- job: BuildPublish
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
echo build configuration: $(BuildConfiguration)
|
|
||||||
displayName: "Echo Check"
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Build"
|
|
||||||
inputs:
|
|
||||||
command: "build"
|
|
||||||
configuration: $(BuildConfiguration)
|
|
||||||
projects: MesaFabApproval.API
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Publish"
|
|
||||||
inputs:
|
|
||||||
command: "publish"
|
|
||||||
publishWebProjects: false
|
|
||||||
projects: MesaFabApproval.API
|
|
||||||
zipAfterPublish: true
|
|
||||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: "Copy Files"
|
|
||||||
inputs:
|
|
||||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
|
||||||
TargetFolder: 'D:\$(Build.Repository.Name)\API\$(Build.BuildId)\$(BuildConfiguration)'
|
|
||||||
CleanTargetFolder: true
|
|
||||||
retryCount: "3"
|
|
||||||
|
|
||||||
- stage: Prod
|
|
||||||
displayName: "Prod"
|
|
||||||
pool:
|
|
||||||
name: MesaFabApproval
|
|
||||||
demands: Fab2ApprovalSystem
|
|
||||||
jobs:
|
|
||||||
- job: BuildPublish
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
echo build configuration: $(BuildConfiguration)
|
|
||||||
displayName: "Echo Check"
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Build"
|
|
||||||
inputs:
|
|
||||||
command: "build"
|
|
||||||
configuration: $(BuildConfiguration)
|
|
||||||
projects: MesaFabApproval.API
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Publish"
|
|
||||||
inputs:
|
|
||||||
command: "publish"
|
|
||||||
publishWebProjects: false
|
|
||||||
projects: MesaFabApproval.API
|
|
||||||
zipAfterPublish: true
|
|
||||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: "Copy Files"
|
|
||||||
inputs:
|
|
||||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
|
||||||
TargetFolder: 'D:\$(Build.Repository.Name)\API\$(Build.BuildId)\$(BuildConfiguration)'
|
|
||||||
CleanTargetFolder: true
|
|
||||||
retryCount: "3"
|
|
||||||
@ -1,2 +1,65 @@
|
|||||||
@page "/redirect"
|
@page "/redirect"
|
||||||
@attribute [AllowAnonymous]
|
@attribute [AllowAnonymous]
|
||||||
|
@inject MesaFabApprovalAuthStateProvider authStateProvider
|
||||||
|
@inject IAuthenticationService authService
|
||||||
|
@inject IUserService userService
|
||||||
|
@inject ISnackbar snackbar
|
||||||
|
@inject MesaFabApprovalAuthStateProvider authStateProvider
|
||||||
|
@inject NavigationManager navigationManager
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private string? _jwt;
|
||||||
|
private string? _refreshToken;
|
||||||
|
private string? _redirectPath;
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync() {
|
||||||
|
try {
|
||||||
|
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
|
||||||
|
|
||||||
|
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("jwt", out var jwt)) {
|
||||||
|
_jwt = System.Net.WebUtility.UrlDecode(jwt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("refreshToken", out var refreshToken)) {
|
||||||
|
_refreshToken = System.Net.WebUtility.UrlDecode(refreshToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("redirectPath", out var redirectPath)) {
|
||||||
|
_redirectPath = redirectPath.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_jwt) && !string.IsNullOrWhiteSpace(_refreshToken)) {
|
||||||
|
await authService.SetTokens(_jwt, _refreshToken);
|
||||||
|
|
||||||
|
ClaimsPrincipal principal = authService.GetClaimsPrincipalFromJwt(_jwt);
|
||||||
|
|
||||||
|
string loginId = userService.GetLoginIdFromClaimsPrincipal(principal);
|
||||||
|
|
||||||
|
await authService.ClearCurrentUser();
|
||||||
|
await authService.ClearTokens();
|
||||||
|
|
||||||
|
await authService.SetLoginId(loginId);
|
||||||
|
await authService.SetTokens(_jwt, _refreshToken);
|
||||||
|
await authService.SetCurrentUser(null);
|
||||||
|
|
||||||
|
await authStateProvider.StateHasChanged(principal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (authStateProvider.CurrentUser is not null && !string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||||
|
navigationManager.NavigateTo(_redirectPath);
|
||||||
|
} else {
|
||||||
|
await authStateProvider.Logout();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||||
|
navigationManager.NavigateTo($"login/{_redirectPath}");
|
||||||
|
} else {
|
||||||
|
navigationManager.NavigateTo("login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
snackbar.Add($"Redirect failed, because {ex.Message}", Severity.Error);
|
||||||
|
navigationManager.NavigateTo("login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,77 +0,0 @@
|
|||||||
using MesaFabApproval.Client.Services;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.AspNetCore.WebUtilities;
|
|
||||||
|
|
||||||
using MudBlazor;
|
|
||||||
|
|
||||||
using System.Security.Claims;
|
|
||||||
|
|
||||||
namespace MesaFabApproval.Client.Pages;
|
|
||||||
|
|
||||||
public partial class AuthenticatedRedirect {
|
|
||||||
[Inject] MesaFabApprovalAuthStateProvider authStateProvider { get; set; }
|
|
||||||
[Inject] IAuthenticationService authService { get; set; }
|
|
||||||
[Inject] IUserService userService { get; set; }
|
|
||||||
[Inject] ISnackbar snackbar { get; set; }
|
|
||||||
[Inject] NavigationManager navigationManager { get; set; }
|
|
||||||
|
|
||||||
private string? _jwt;
|
|
||||||
private string? _refreshToken;
|
|
||||||
private string? _redirectPath;
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync() {
|
|
||||||
try {
|
|
||||||
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
|
|
||||||
|
|
||||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("jwt", out var jwt)) {
|
|
||||||
_jwt = System.Net.WebUtility.UrlDecode(jwt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("refreshToken", out var refreshToken)) {
|
|
||||||
_refreshToken = System.Net.WebUtility.UrlDecode(refreshToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("redirectPath", out var redirectPath)) {
|
|
||||||
_redirectPath = redirectPath.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_jwt) && !string.IsNullOrWhiteSpace(_refreshToken)) {
|
|
||||||
await authService.SetTokens(_jwt, _refreshToken);
|
|
||||||
|
|
||||||
ClaimsPrincipal principal = authService.GetClaimsPrincipalFromJwt(_jwt);
|
|
||||||
|
|
||||||
string loginId = userService.GetLoginIdFromClaimsPrincipal(principal);
|
|
||||||
|
|
||||||
await authService.ClearCurrentUser();
|
|
||||||
await authService.ClearTokens();
|
|
||||||
|
|
||||||
await authService.SetLoginId(loginId);
|
|
||||||
await authService.SetTokens(_jwt, _refreshToken);
|
|
||||||
await authService.SetCurrentUser(null);
|
|
||||||
|
|
||||||
await authStateProvider.StateHasChanged(principal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (authStateProvider.CurrentUser is not null && !string.IsNullOrWhiteSpace(_redirectPath)) {
|
|
||||||
navigationManager.NavigateTo(_redirectPath);
|
|
||||||
} else {
|
|
||||||
await authStateProvider.Logout();
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
|
||||||
navigationManager.NavigateTo($"login/{_redirectPath}");
|
|
||||||
} else {
|
|
||||||
navigationManager.NavigateTo("login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
await authStateProvider.Logout();
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
|
||||||
navigationManager.NavigateTo($"login/{_redirectPath}");
|
|
||||||
} else {
|
|
||||||
navigationManager.NavigateTo("login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -215,7 +215,9 @@
|
|||||||
bool actionIsValid = mrbAction.Action.Equals("Block") || mrbAction.Action.Equals("Convert") ||
|
bool actionIsValid = mrbAction.Action.Equals("Block") || mrbAction.Action.Equals("Convert") ||
|
||||||
mrbAction.Action.Equals("Other") || mrbAction.Action.Equals("Recall") || mrbAction.Action.Equals("Scrap") ||
|
mrbAction.Action.Equals("Other") || mrbAction.Action.Equals("Recall") || mrbAction.Action.Equals("Scrap") ||
|
||||||
mrbAction.Action.Equals("Unblock") || mrbAction.Action.Equals("Waiver");
|
mrbAction.Action.Equals("Unblock") || mrbAction.Action.Equals("Waiver");
|
||||||
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.LotNumber);
|
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.Customer) &&
|
||||||
|
!string.IsNullOrWhiteSpace(mrbAction.PartNumber) &&
|
||||||
|
!string.IsNullOrWhiteSpace(mrbAction.LotNumber);
|
||||||
actionIsValid = actionIsValid && mrbAction.Quantity > 0;
|
actionIsValid = actionIsValid && mrbAction.Quantity > 0;
|
||||||
|
|
||||||
if (mrbAction.Action.Equals("Convert", StringComparison.InvariantCultureIgnoreCase)) {
|
if (mrbAction.Action.Equals("Convert", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
@ -223,9 +225,6 @@
|
|||||||
!string.IsNullOrWhiteSpace(convertFromPart) &&
|
!string.IsNullOrWhiteSpace(convertFromPart) &&
|
||||||
!string.IsNullOrWhiteSpace(convertToCustomer) &&
|
!string.IsNullOrWhiteSpace(convertToCustomer) &&
|
||||||
!string.IsNullOrWhiteSpace(convertToPart);
|
!string.IsNullOrWhiteSpace(convertToPart);
|
||||||
} else {
|
|
||||||
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.Customer) &&
|
|
||||||
!string.IsNullOrWhiteSpace(mrbAction.PartNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mrbAction.Action.Equals("Scrap", StringComparison.InvariantCultureIgnoreCase))
|
if (mrbAction.Action.Equals("Scrap", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
|||||||
@ -31,16 +31,16 @@
|
|||||||
Immediate
|
Immediate
|
||||||
AutoGrow />
|
AutoGrow />
|
||||||
} else {
|
} else {
|
||||||
<MudAutocomplete @bind-Value="@document.ECNNumber"
|
<MudTextField @bind-Value="@document.ECNNumber"
|
||||||
T="int"
|
Required
|
||||||
SearchFunc="Search"
|
RequiredError="You must provide a valid ECN#"
|
||||||
Required
|
Clearable
|
||||||
Clearable
|
Variant="Variant.Outlined"
|
||||||
RequiredError="You must provide a valid ECN#"
|
InputType="@InputType.Number"
|
||||||
Variant="Variant.Outlined"
|
Validation="@(new Func<int, Task<string>>(ECNNoIsValid))"
|
||||||
Validation="@(new Func<int, Task<string>>(ECNNoIsValid))"
|
Label="ECN#"
|
||||||
Label="ECN#"
|
Immediate
|
||||||
Immediate />
|
AutoGrow />
|
||||||
}
|
}
|
||||||
<MudCheckBox Label="Complete"
|
<MudCheckBox Label="Complete"
|
||||||
Color="Color.Tertiary"
|
Color="Color.Tertiary"
|
||||||
@ -79,8 +79,6 @@
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public required PCR3Document document { get; set; }
|
public required PCR3Document document { get; set; }
|
||||||
|
|
||||||
private IEnumerable<int> allEcnNumbers = new List<int>();
|
|
||||||
|
|
||||||
private string[] errors = { };
|
private string[] errors = { };
|
||||||
|
|
||||||
private bool complete = false;
|
private bool complete = false;
|
||||||
@ -91,8 +89,6 @@
|
|||||||
|
|
||||||
protected override async Task OnParametersSetAsync() {
|
protected override async Task OnParametersSetAsync() {
|
||||||
complete = document.CompletedByID > 0;
|
complete = document.CompletedByID > 0;
|
||||||
|
|
||||||
allEcnNumbers = await ecnService.GetAllECNNumbers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Save() {
|
private async Task Save() {
|
||||||
@ -147,8 +143,6 @@
|
|||||||
document.DocNumbers.ToLower().Equals("n/a") ||
|
document.DocNumbers.ToLower().Equals("n/a") ||
|
||||||
document.DocNumbers.ToLower().Equals("n a") ||
|
document.DocNumbers.ToLower().Equals("n a") ||
|
||||||
document.DocNumbers.ToLower().Equals("not applicable")) {
|
document.DocNumbers.ToLower().Equals("not applicable")) {
|
||||||
if (string.IsNullOrWhiteSpace(document.Comment))
|
|
||||||
document.Comment = "Not required";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -161,13 +155,4 @@
|
|||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<int>> Search(string searchValue, CancellationToken token) {
|
|
||||||
if (string.IsNullOrWhiteSpace(searchValue))
|
|
||||||
return allEcnNumbers;
|
|
||||||
|
|
||||||
return allEcnNumbers
|
|
||||||
.Where(x => x.ToString().StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
.Order();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,16 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
@page "/Dashboard"
|
@page "/Dashboard"
|
||||||
|
@inject IConfiguration Configuration
|
||||||
|
@inject MesaFabApprovalAuthStateProvider stateProvider
|
||||||
|
@inject IApprovalService approvalService
|
||||||
|
@inject IMemoryCache cache
|
||||||
|
@inject NavigationManager navigationManager
|
||||||
|
@inject ISnackbar snackbar
|
||||||
|
@inject IMRBService mrbService
|
||||||
|
@inject IPCRBService pcrbService
|
||||||
|
@inject IECNService ecnService
|
||||||
|
@inject ICAService caService
|
||||||
|
@inject IJSRuntime jsRuntime
|
||||||
|
|
||||||
<PageTitle>Dashboard</PageTitle>
|
<PageTitle>Dashboard</PageTitle>
|
||||||
|
|
||||||
@ -215,3 +226,138 @@
|
|||||||
</MudTabPanel>
|
</MudTabPanel>
|
||||||
</MudTabs>
|
</MudTabs>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private IEnumerable<Approval> approvalList = new List<Approval>();
|
||||||
|
private IEnumerable<MRB> myMRBs = new List<MRB>();
|
||||||
|
private IEnumerable<PCRB> myPCRBs = new List<PCRB>();
|
||||||
|
|
||||||
|
private IEnumerable<int> ecnNumbers = new HashSet<int>();
|
||||||
|
private IEnumerable<int> caNumbers = new HashSet<int>();
|
||||||
|
private IEnumerable<int> mrbNumbers = new HashSet<int>();
|
||||||
|
private IEnumerable<int> pcrbNumbers = new HashSet<int>();
|
||||||
|
|
||||||
|
private bool myApprovalsProcessing = false;
|
||||||
|
private bool myMrbsProcessing = false;
|
||||||
|
private bool myPcrbsProcessing = false;
|
||||||
|
|
||||||
|
private string mrbSearchString = "";
|
||||||
|
private string pcrbSearchString = "";
|
||||||
|
|
||||||
|
protected async override Task OnParametersSetAsync() {
|
||||||
|
try {
|
||||||
|
if (stateProvider.CurrentUser is not null) {
|
||||||
|
myApprovalsProcessing = true;
|
||||||
|
approvalList = (await approvalService.GetApprovalsForUserId(stateProvider.CurrentUser.UserID, true))
|
||||||
|
.Where(a => a.CompletedDate > DateTime.Now && a.ItemStatus == 0)
|
||||||
|
.ToList()
|
||||||
|
.OrderByDescending(x => x.AssignedDate);
|
||||||
|
myApprovalsProcessing = false;
|
||||||
|
|
||||||
|
myMrbsProcessing = true;
|
||||||
|
myMRBs = (await mrbService.GetAllMRBs(false)).Where(m => m.OriginatorID == stateProvider.CurrentUser.UserID)
|
||||||
|
.ToList()
|
||||||
|
.OrderByDescending(x => x.SubmittedDate);
|
||||||
|
myMrbsProcessing = false;
|
||||||
|
|
||||||
|
myPcrbsProcessing = true;
|
||||||
|
myPCRBs = (await pcrbService.GetAllPCRBs(false)).Where(p => p.OwnerID == stateProvider.CurrentUser.UserID)
|
||||||
|
.ToList()
|
||||||
|
.OrderByDescending(p => p.InsertTimeStamp);
|
||||||
|
myPcrbsProcessing = false;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
myApprovalsProcessing = false;
|
||||||
|
myMrbsProcessing = false;
|
||||||
|
myPcrbsProcessing = false;
|
||||||
|
snackbar.Add($"Unable to load the dashboard, because {ex.Message}", Severity.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task FollowLink(int issueId) {
|
||||||
|
HashSet<Task> tasks = new();
|
||||||
|
|
||||||
|
bool isEcn = false;
|
||||||
|
bool isCa = false;
|
||||||
|
bool isMrb = false;
|
||||||
|
bool isPcrb = false;
|
||||||
|
if (ecnNumbers.Contains(issueId))
|
||||||
|
isEcn = true;
|
||||||
|
if (caNumbers.Contains(issueId))
|
||||||
|
isCa = true;
|
||||||
|
if (mrbNumbers.Contains(issueId))
|
||||||
|
isMrb = true;
|
||||||
|
if (pcrbNumbers.Contains(issueId))
|
||||||
|
isPcrb = true;
|
||||||
|
|
||||||
|
if (!isEcn && !isCa && !isMrb) {
|
||||||
|
Task<bool> isEcnTask = ecnService.ECNNumberIsValid(issueId);
|
||||||
|
tasks.Add(isEcnTask);
|
||||||
|
|
||||||
|
Task<bool> isCaTask = caService.CANumberIsValid(issueId);
|
||||||
|
tasks.Add(isCaTask);
|
||||||
|
|
||||||
|
Task<bool> isMrbTask = mrbService.NumberIsValid(issueId);
|
||||||
|
tasks.Add(isMrbTask);
|
||||||
|
|
||||||
|
Task<bool> isPcrbTask = pcrbService.IdIsValid(issueId);
|
||||||
|
tasks.Add(isPcrbTask);
|
||||||
|
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
|
||||||
|
if (isEcnTask.Result) {
|
||||||
|
isEcn = true;
|
||||||
|
} else if (isCaTask.Result) {
|
||||||
|
isCa = true;
|
||||||
|
} else if (isMrbTask.Result) {
|
||||||
|
isMrb = true;
|
||||||
|
} else if (isPcrbTask.Result) {
|
||||||
|
isPcrb = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEcn) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/ECN/Edit?IssueID={issueId}", "");
|
||||||
|
if (isCa) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/CorrectiveAction/Edit?IssueID={issueId}", "");
|
||||||
|
if (isMrb) GoTo($"mrb/{issueId}");
|
||||||
|
if (isPcrb) GoTo($"pcrb/{issueId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GoTo(string page) {
|
||||||
|
cache.Set("redirectUrl", page);
|
||||||
|
navigationManager.NavigateTo("/" + page);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task GoToExternal(string url, string content) {
|
||||||
|
IJSObjectReference windowModule = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/OpenInNewWindow.js");
|
||||||
|
await windowModule.InvokeAsync<object>("OpenInNewWindow", url, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterFuncForMRBTable(MRB mrb) => MRBFilterFunc(mrb, mrbSearchString);
|
||||||
|
|
||||||
|
private bool MRBFilterFunc(MRB mrb, string searchString) {
|
||||||
|
if (string.IsNullOrWhiteSpace(searchString))
|
||||||
|
return true;
|
||||||
|
if (mrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||||
|
return true;
|
||||||
|
if (mrb.MRBNumber.ToString().Contains(searchString.Trim()))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterFuncForPCRBTable(PCRB pcrb) => PCRBFilterFunc(pcrb, pcrbSearchString);
|
||||||
|
|
||||||
|
private bool PCRBFilterFunc(PCRB pcrb, string searchString) {
|
||||||
|
if (string.IsNullOrWhiteSpace(searchString))
|
||||||
|
return true;
|
||||||
|
if (pcrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||||
|
return true;
|
||||||
|
if (pcrb.PlanNumber.ToString().Contains(searchString.Trim()))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetCurrentPCRBStep(int step) {
|
||||||
|
if (step < 0 || step > (PCRB.Stages.Length - 1)) return string.Empty;
|
||||||
|
else return PCRB.Stages[step];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,157 +0,0 @@
|
|||||||
using MesaFabApproval.Client.Services;
|
|
||||||
using MesaFabApproval.Shared.Models;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
using Microsoft.JSInterop;
|
|
||||||
|
|
||||||
using MudBlazor;
|
|
||||||
|
|
||||||
namespace MesaFabApproval.Client.Pages;
|
|
||||||
|
|
||||||
public partial class Dashboard {
|
|
||||||
[Inject] IConfiguration Configuration { get; set; }
|
|
||||||
[Inject] MesaFabApprovalAuthStateProvider stateProvider { get; set; }
|
|
||||||
[Inject] IApprovalService approvalService { get; set; }
|
|
||||||
[Inject] IMemoryCache cache { get; set; }
|
|
||||||
[Inject] NavigationManager navigationManager { get; set; }
|
|
||||||
[Inject] ISnackbar snackbar { get; set; }
|
|
||||||
[Inject] IMRBService mrbService { get; set; }
|
|
||||||
[Inject] IPCRBService pcrbService { get; set; }
|
|
||||||
[Inject] IECNService ecnService { get; set; }
|
|
||||||
[Inject] ICAService caService { get; set; }
|
|
||||||
[Inject] IJSRuntime jsRuntime { get; set; }
|
|
||||||
|
|
||||||
private IEnumerable<Approval> approvalList = new List<Approval>();
|
|
||||||
private IEnumerable<MRB> myMRBs = new List<MRB>();
|
|
||||||
private IEnumerable<PCRB> myPCRBs = new List<PCRB>();
|
|
||||||
|
|
||||||
private IEnumerable<int> ecnNumbers = new HashSet<int>();
|
|
||||||
private IEnumerable<int> caNumbers = new HashSet<int>();
|
|
||||||
private IEnumerable<int> mrbNumbers = new HashSet<int>();
|
|
||||||
private IEnumerable<int> pcrbNumbers = new HashSet<int>();
|
|
||||||
|
|
||||||
private bool myApprovalsProcessing = false;
|
|
||||||
private bool myMrbsProcessing = false;
|
|
||||||
private bool myPcrbsProcessing = false;
|
|
||||||
|
|
||||||
private string mrbSearchString = "";
|
|
||||||
private string pcrbSearchString = "";
|
|
||||||
|
|
||||||
protected async override Task OnParametersSetAsync() {
|
|
||||||
try {
|
|
||||||
if (stateProvider.CurrentUser is not null) {
|
|
||||||
myApprovalsProcessing = true;
|
|
||||||
approvalList = (await approvalService.GetApprovalsForUserId(stateProvider.CurrentUser.UserID, true))
|
|
||||||
.Where(a => a.CompletedDate > DateTime.Now && a.ItemStatus == 0)
|
|
||||||
.ToList()
|
|
||||||
.OrderByDescending(x => x.AssignedDate);
|
|
||||||
myApprovalsProcessing = false;
|
|
||||||
|
|
||||||
myMrbsProcessing = true;
|
|
||||||
myMRBs = (await mrbService.GetAllMRBs(false)).Where(m => m.OriginatorID == stateProvider.CurrentUser.UserID)
|
|
||||||
.ToList()
|
|
||||||
.OrderByDescending(x => x.SubmittedDate);
|
|
||||||
myMrbsProcessing = false;
|
|
||||||
|
|
||||||
myPcrbsProcessing = true;
|
|
||||||
myPCRBs = (await pcrbService.GetAllPCRBs(false)).Where(p => p.OwnerID == stateProvider.CurrentUser.UserID)
|
|
||||||
.ToList()
|
|
||||||
.OrderByDescending(p => p.InsertTimeStamp);
|
|
||||||
myPcrbsProcessing = false;
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
myApprovalsProcessing = false;
|
|
||||||
myMrbsProcessing = false;
|
|
||||||
myPcrbsProcessing = false;
|
|
||||||
snackbar.Add(ex.Message, Severity.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task FollowLink(int issueId) {
|
|
||||||
HashSet<Task> tasks = new();
|
|
||||||
|
|
||||||
bool isEcn = false;
|
|
||||||
bool isCa = false;
|
|
||||||
bool isMrb = false;
|
|
||||||
bool isPcrb = false;
|
|
||||||
if (ecnNumbers.Contains(issueId))
|
|
||||||
isEcn = true;
|
|
||||||
if (caNumbers.Contains(issueId))
|
|
||||||
isCa = true;
|
|
||||||
if (mrbNumbers.Contains(issueId))
|
|
||||||
isMrb = true;
|
|
||||||
if (pcrbNumbers.Contains(issueId))
|
|
||||||
isPcrb = true;
|
|
||||||
|
|
||||||
if (!isEcn && !isCa && !isMrb) {
|
|
||||||
Task<bool> isEcnTask = ecnService.ECNNumberIsValid(issueId);
|
|
||||||
tasks.Add(isEcnTask);
|
|
||||||
|
|
||||||
Task<bool> isCaTask = caService.CANumberIsValid(issueId);
|
|
||||||
tasks.Add(isCaTask);
|
|
||||||
|
|
||||||
Task<bool> isMrbTask = mrbService.NumberIsValid(issueId);
|
|
||||||
tasks.Add(isMrbTask);
|
|
||||||
|
|
||||||
Task<bool> isPcrbTask = pcrbService.IdIsValid(issueId);
|
|
||||||
tasks.Add(isPcrbTask);
|
|
||||||
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
|
|
||||||
if (isEcnTask.Result) {
|
|
||||||
isEcn = true;
|
|
||||||
} else if (isCaTask.Result) {
|
|
||||||
isCa = true;
|
|
||||||
} else if (isMrbTask.Result) {
|
|
||||||
isMrb = true;
|
|
||||||
} else if (isPcrbTask.Result) {
|
|
||||||
isPcrb = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEcn) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/ECN/Edit?IssueID={issueId}", "");
|
|
||||||
if (isCa) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/CorrectiveAction/Edit?IssueID={issueId}", "");
|
|
||||||
if (isMrb) GoTo($"mrb/{issueId}");
|
|
||||||
if (isPcrb) GoTo($"pcrb/{issueId}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GoTo(string page) {
|
|
||||||
cache.Set("redirectUrl", page);
|
|
||||||
navigationManager.NavigateTo("/" + page);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task GoToExternal(string url, string content) {
|
|
||||||
IJSObjectReference windowModule = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/OpenInNewWindow.js");
|
|
||||||
await windowModule.InvokeAsync<object>("OpenInNewWindow", url, content);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool FilterFuncForMRBTable(MRB mrb) => MRBFilterFunc(mrb, mrbSearchString);
|
|
||||||
|
|
||||||
private bool MRBFilterFunc(MRB mrb, string searchString) {
|
|
||||||
if (string.IsNullOrWhiteSpace(searchString))
|
|
||||||
return true;
|
|
||||||
if (mrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
|
||||||
return true;
|
|
||||||
if (mrb.MRBNumber.ToString().Contains(searchString.Trim()))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool FilterFuncForPCRBTable(PCRB pcrb) => PCRBFilterFunc(pcrb, pcrbSearchString);
|
|
||||||
|
|
||||||
private bool PCRBFilterFunc(PCRB pcrb, string searchString) {
|
|
||||||
if (string.IsNullOrWhiteSpace(searchString))
|
|
||||||
return true;
|
|
||||||
if (pcrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
|
||||||
return true;
|
|
||||||
if (pcrb.PlanNumber.ToString().Contains(searchString.Trim()))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetCurrentPCRBStep(int step) {
|
|
||||||
if (step < 0 || step > (PCRB.Stages.Length - 1)) return string.Empty;
|
|
||||||
else return PCRB.Stages[step];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ namespace MesaFabApproval.Client.Services;
|
|||||||
public interface IECNService {
|
public interface IECNService {
|
||||||
Task<string> ECNNumberIsValidStr(int ecnNumber);
|
Task<string> ECNNumberIsValidStr(int ecnNumber);
|
||||||
Task<bool> ECNNumberIsValid(int number);
|
Task<bool> ECNNumberIsValid(int number);
|
||||||
Task<IEnumerable<int>> GetAllECNNumbers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNService : IECNService {
|
public class ECNService : IECNService {
|
||||||
@ -50,32 +49,4 @@ public class ECNService : IECNService {
|
|||||||
throw new Exception($"Unable to determine if {number} is a valid ECN#, because {ex.Message}");
|
throw new Exception($"Unable to determine if {number} is a valid ECN#, because {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<int>> GetAllECNNumbers() {
|
|
||||||
try {
|
|
||||||
HttpClient httpClient = _httpClientFactory.CreateClient("API");
|
|
||||||
|
|
||||||
HttpRequestMessage requestMessage = new(HttpMethod.Get, $"ecn/allNumbers");
|
|
||||||
|
|
||||||
HttpResponseMessage responseMessage = await httpClient.SendAsync(requestMessage);
|
|
||||||
|
|
||||||
if (responseMessage.IsSuccessStatusCode) {
|
|
||||||
string responseContent = await responseMessage.Content.ReadAsStringAsync();
|
|
||||||
|
|
||||||
JsonSerializerOptions jsonSerializerOptions = new() {
|
|
||||||
PropertyNameCaseInsensitive = true
|
|
||||||
};
|
|
||||||
|
|
||||||
IEnumerable<int> allEcnNumbers =
|
|
||||||
JsonSerializer.Deserialize<IEnumerable<int>>(responseContent, jsonSerializerOptions) ??
|
|
||||||
new List<int>();
|
|
||||||
|
|
||||||
return allEcnNumbers;
|
|
||||||
} else {
|
|
||||||
throw new Exception(responseMessage.ReasonPhrase);
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new Exception($"Unable to get all ECN#s, because {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,84 +0,0 @@
|
|||||||
trigger:
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
include:
|
|
||||||
- MesaFabApproval.Client
|
|
||||||
- MesaFabApproval.Shared
|
|
||||||
|
|
||||||
variables:
|
|
||||||
buildConfiguration: "Release"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: Test
|
|
||||||
displayName: "Test"
|
|
||||||
pool:
|
|
||||||
name: MesaFabApproval
|
|
||||||
demands: Fab2ApprovalSystem-Dev
|
|
||||||
jobs:
|
|
||||||
- job: BuildPublish
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
echo build configuration: $(BuildConfiguration)
|
|
||||||
displayName: "Echo Check"
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Build"
|
|
||||||
inputs:
|
|
||||||
command: "build"
|
|
||||||
configuration: $(BuildConfiguration)
|
|
||||||
projects: MesaFabApproval.Client
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Publish"
|
|
||||||
inputs:
|
|
||||||
command: "publish"
|
|
||||||
publishWebProjects: false
|
|
||||||
projects: MesaFabApproval.Client
|
|
||||||
zipAfterPublish: true
|
|
||||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: "Copy Files"
|
|
||||||
inputs:
|
|
||||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
|
||||||
TargetFolder: 'D:\$(Build.Repository.Name)\Client\$(Build.BuildId)\$(BuildConfiguration)'
|
|
||||||
CleanTargetFolder: true
|
|
||||||
retryCount: "3"
|
|
||||||
|
|
||||||
- stage: Prod
|
|
||||||
displayName: "Prod"
|
|
||||||
pool:
|
|
||||||
name: MesaFabApproval
|
|
||||||
demands: Fab2ApprovalSystem
|
|
||||||
jobs:
|
|
||||||
- job: BuildPublish
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
echo build configuration: $(BuildConfiguration)
|
|
||||||
displayName: "Echo Check"
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Build"
|
|
||||||
inputs:
|
|
||||||
command: "build"
|
|
||||||
configuration: $(BuildConfiguration)
|
|
||||||
projects: MesaFabApproval.Client
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: "Publish"
|
|
||||||
inputs:
|
|
||||||
command: "publish"
|
|
||||||
publishWebProjects: false
|
|
||||||
projects: MesaFabApproval.Client
|
|
||||||
zipAfterPublish: true
|
|
||||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: "Copy Files"
|
|
||||||
inputs:
|
|
||||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
|
||||||
TargetFolder: 'D:\$(Build.Repository.Name)\Client\$(Build.BuildId)\$(BuildConfiguration)'
|
|
||||||
CleanTargetFolder: true
|
|
||||||
retryCount: "3"
|
|
||||||
@ -25,7 +25,7 @@ stages:
|
|||||||
- stage: Development
|
- stage: Development
|
||||||
displayName: Development
|
displayName: Development
|
||||||
pool:
|
pool:
|
||||||
name: MesaFabApproval
|
name: Mesa-FabApproval
|
||||||
demands: Fab2ApprovalSystem-Dev
|
demands: Fab2ApprovalSystem-Dev
|
||||||
variables:
|
variables:
|
||||||
ASPNETCORE_ENVIRONMENT: "Development"
|
ASPNETCORE_ENVIRONMENT: "Development"
|
||||||
|
|||||||
Reference in New Issue
Block a user