Skip to content

Conversation

Nateowami
Copy link
Collaborator

@Nateowami Nateowami commented Oct 9, 2025

This PR:

  • Cleans up the lower portion of the Serval project admin page
  • Adds warnings from Serval to the page
  • Adds the raw Serval build to the page (so any properties added by Serval can be seen)
  • Adds a JSON viewer component, and starts using it everywhere we render JSON

Here's what the warnings look like (you can only see them by hard-coding them; Serval hasn't shipped the warnings yet):
Screenshot from 2025-10-09 17-12-16

Here's what the bottom of the page ends up looking like, with detailed information moved into an accordion:
Screenshot from 2025-10-09 17-06-13

And here's a snippet of the JSON viewer:

Screenshot from 2025-10-09 17-06-47

...which also supports dark mode:

Screenshot from 2025-10-09 17-07-14

This change is Reviewable

@Nateowami Nateowami force-pushed the feature/SF-3593-show-serval-build-on-admin-page branch from 23f983e to 1893d1a Compare October 9, 2025 21:42
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 53.70370% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.20%. Comparing base (1f65cc9) to head (98302d4).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...orge.Scripture/Controllers/MachineApiController.cs 0.00% 24 Missing ⚠️
...SIL.XForge.Scripture/Services/MachineApiService.cs 0.00% 18 Missing ⚠️
...slate/draft-generation/draft-generation.service.ts 0.00% 5 Missing ⚠️
.../serval-administration/serval-project.component.ts 0.00% 2 Missing ⚠️
...rc/app/shared/json-viewer/json-viewer.component.ts 98.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3503      +/-   ##
==========================================
- Coverage   82.29%   82.20%   -0.09%     
==========================================
  Files         614      615       +1     
  Lines       36885    36986     +101     
  Branches     6046     6064      +18     
==========================================
+ Hits        30353    30403      +50     
- Misses       5635     5686      +51     
  Partials      897      897              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nateowami Nateowami force-pushed the feature/SF-3593-show-serval-build-on-admin-page branch from 1893d1a to 184fbbe Compare October 10, 2025 20:01
@pmachapman pmachapman self-requested a review October 12, 2025 21:46
Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just a comment on whether we need the new rawBuild endpoint or not.

@pmachapman reviewed 19 of 19 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Nateowami)


src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation.service.ts line 142 at r1 (raw file):

      catchError(() => of(undefined))
    );
  }

I don't think you need this additional raw build API endpoint?

If you feed a build id directly into MachineApiController.GetBuildAsync() (i.e. translation/builds/id:${buildId}?pretranslate=true), then the build is returned directly from Serval.

You should be able to change this function to something like:

  getBuild(buildId: string): Observable<Object | undefined> {
    if (!this.onlineStatusService.isOnline) {
      return of(undefined);
    }
    return this.httpClient.get<Object>(`translation/builds/id:${buildId}?pretranslate=true`).pipe(
      map(res => res.data),
      catchError(() => of(undefined))
    );
  }

Code quote:

  getRawBuild(buildId: string): Observable<Object | undefined> {
    if (!this.onlineStatusService.isOnline) {
      return of(undefined);
    }
    return this.httpClient.get<Object>(`translation/rawBuilds/id:${buildId}?pretranslate=true`).pipe(
      map(res => res.data),
      catchError(() => of(undefined))
    );
  }

@pmachapman pmachapman self-assigned this Oct 12, 2025
Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see why you did the raw build endpoint. Just one comment about a better endpoint URL for it.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Nateowami)


src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation.service.ts line 142 at r1 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

I don't think you need this additional raw build API endpoint?

If you feed a build id directly into MachineApiController.GetBuildAsync() (i.e. translation/builds/id:${buildId}?pretranslate=true), then the build is returned directly from Serval.

You should be able to change this function to something like:

  getBuild(buildId: string): Observable<Object | undefined> {
    if (!this.onlineStatusService.isOnline) {
      return of(undefined);
    }
    return this.httpClient.get<Object>(`translation/builds/id:${buildId}?pretranslate=true`).pipe(
      map(res => res.data),
      catchError(() => of(undefined))
    );
  }

Oh, I see now - you wanted to retrieve the build but not with the DTO modifications. I think I was thrown off by the raw builds moniker. Retracted!


src/SIL.XForge.Scripture/Models/MachineApi.cs line 13 at r1 (raw file):

    public const string StartBuild = "translation/builds";
    public const string GetBuild = "translation/builds/id:{sfProjectId}.{buildId?}";
    public const string GetRawBuild = "translation/rawBuilds/id:{sfProjectId}.{buildId}";

I think this might be clearer if the endpoint was named something like:

public const string GetRawBuild = "translation/builds/id:{sfProjectId}.{buildId}/raw";

Code quote:

public const string GetRawBuild = "translation/rawBuilds/id:{sfProjectId}.{buildId}";

@Nateowami Nateowami force-pushed the feature/SF-3593-show-serval-build-on-admin-page branch from 184fbbe to 98302d4 Compare October 13, 2025 20:29
Copy link
Collaborator Author

@Nateowami Nateowami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 17 of 19 files reviewed, 1 unresolved discussion (waiting on @pmachapman)


src/SIL.XForge.Scripture/Models/MachineApi.cs line 13 at r1 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

I think this might be clearer if the endpoint was named something like:

public const string GetRawBuild = "translation/builds/id:{sfProjectId}.{buildId}/raw";

Done.

Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@pmachapman reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Nateowami)

@Nateowami Nateowami merged commit 3939f5b into master Oct 13, 2025
23 checks passed
@Nateowami Nateowami deleted the feature/SF-3593-show-serval-build-on-admin-page branch October 13, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants