Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get FLEx model version from repo and store in metadata #1082

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

rmunn
Copy link
Contributor

@rmunn rmunn commented Sep 26, 2024

Fix #1022.

This PR adds a command to our command runner to extract the FLEx project's model version from the repo and store it in the FlexProjectMetadata table. It also adds a GraphQL mutation to update the model version; that mutation returns the project, so that the frontend calling that mutation can also query flexProjectMetadata { flexModelVersion } as part of the mutation results, and get the updated model version in a single step.

@rmunn rmunn requested a review from hahn-kev September 26, 2024 09:46
@rmunn rmunn self-assigned this Sep 26, 2024
Copy link

github-actions bot commented Sep 26, 2024

UI unit Tests

12 tests   12 ✅  0s ⏱️
 4 suites   0 💤
 1 files     0 ❌

Results for commit 21d089e.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Sep 26, 2024

C# Unit Tests

71 tests  +71   71 ✅ +71   6s ⏱️ +6s
12 suites +12    0 💤 ± 0 
 1 files   + 1    0 ❌ ± 0 

Results for commit 21d089e. ± Comparison against base commit 13d70f2.

♻️ This comment has been updated with latest results.

@rmunn
Copy link
Contributor Author

rmunn commented Sep 26, 2024

Haven't added any frontend changes yet, because I'm not certain how we actually want to expose this on the project page. That should probably happen before I actually ask for a code review, so let me withdraw my review request and mark this one as draft.

@rmunn rmunn marked this pull request as draft September 26, 2024 09:51
@rmunn rmunn removed the request for review from hahn-kev September 26, 2024 09:51
@rmunn rmunn force-pushed the feat/flex-metadata-for-modelversion branch from 7d65f5e to 3b5ee77 Compare September 27, 2024 04:40
Regular users won't be shown the model version because it's a little too
technical, but project managers (and org & site admins) can see it.
}
catch
{
if (int.TryParse(text, out var num)) return num;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fallback in case a future FLEx or Chorus update decides to make this a simple text file containing the number instead of JSON. Probably not needed; can remove if you think I should remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah let's remove it as it's planning for something that might never happen

@rmunn rmunn marked this pull request as ready for review September 27, 2024 05:11
@rmunn rmunn requested review from hahn-kev and removed request for hahn-kev September 27, 2024 05:11
@rmunn rmunn marked this pull request as draft September 27, 2024 08:14
@rmunn
Copy link
Contributor Author

rmunn commented Sep 27, 2024

Converted to draft because requirements just changed: frontend should now present FW version numbers (e.g. 7000068 is FW 8.2, 7000069 is FW 8.3, and so on). Will implement on Monday.

@rmunn
Copy link
Contributor Author

rmunn commented Sep 28, 2024

A list of all unique model versions in all FLEx repos in prod, which took all of 2 minutes 23 seconds to generate (plus a couple more minutes to test the script on staging):

{"modelversion": 7000058}
{"modelversion": 7000059}
{"modelversion": 7000060}
{"modelversion": 7000063}
{"modelversion": 7000064}
{"modelversion": 7000066}
{"modelversion": 7000067}
{"modelversion": 7000068}
{"modelversion": 7000069}
{"modelversion": 7000070}
{"modelversion": 7000072}

So I won't have very many model versions to put in the table. The project counts for each model version:

58 - 1 project
59 - 2 projects
60 - 1 project
63 - 3 projects
64 - 2 projects
66 - 11 projects
67 - 27 projects
68 - 335 projects
69 - 4 projects
70 - 439 projects
72 - 1,289 projects

According to the MasterLCModel.xml file in liblcm, the models have the following dates:

17 January 2018 (7000072)
16 March 2015 (7000071) (NOTE: this was never part of a release)
05 December 2016 (7000070)
08 August 2016 (7000069)
9 July 2013 (7000068)
7 May 2013 (7000067)
22 March 2013 (7000066)
15 March 2013 (7000065)
15 February 2013 (7000064)
15 October 2012 (7000063)
12 October 2012 (7000062)
13 September 2012 (7000061)
16 August 2012 (7000060)
29 May 2012 (7000059)
25 April 2012 (7000058)

Looking through the Git tags for various FieldWorks releases, I find the following dates:

7.2.3: 16 March 2012 (before 58)
7.2.4: 25 April 2012 (after 58, before 59)
7.2.5: 26 June 0212 (after 59, before 60)
7.2.6: 1 August 2012 (before 60)
7.2.7: 11 October 2012 (after 60, after 61, before 62)
7.3-gial: 27 March 2013 (after 65)
8.0.2: 18 April 2013 (after 66)
8.0.3-beta4: 11 July 2013 (just after 68)
...
8.2.8: 19 May 2016 (before 69)
8.2.9: 18 October 2016 (after 69)
8.3.5-beta: 2 March 2017 (after 70)
8.3.11: 8 December 2017 (after 70, before 72)
9.0.0-alpha1: 9 January 2018 (just before 72)
9.0.1-alpha2: 14 May 2018 (after 72)

So I'm going to use the following model - version number table for display purposes:

58 - FW 7.2
59 - FW 7.2
60 - FW 7.2
61 - FW 7.2
62 - FW 7.3
63 - FW 7.3
64 - FW 7.3
65 - FW 7.3
66 - FW 8.0
67 - FW 8.0
68 - FW 8.0-8.2
69 - FW 8.2
70 - FW 8.3
71 - FW 8.3 (never released, but why not have it in the table?)
72 - FW 9

@rmunn rmunn marked this pull request as ready for review September 30, 2024 04:00
@rmunn rmunn requested a review from hahn-kev September 30, 2024 04:00
Copy link
Collaborator

@hahn-kev hahn-kev left a comment

Choose a reason for hiding this comment

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

Reviewed, turns out I forgot some older review comments, sorry they didn't get submitted.

var projectId = await projectService.LookupProjectId(code);
await permissionService.AssertCanManageProject(projectId);
var project = await dbContext.Projects.FindAsync(projectId);
NotFoundException.ThrowIfNull(project);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is needed as we already know the project exists because we were able to find a project ID from the code. Which means we can skip the project query entirely

}
catch
{
if (int.TryParse(text, out var num)) return num;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah let's remove it as it's planning for something that might never happen

$: fwModel = versionLookupTable[modelVersion] ?? 'Unknown FieldWorks version';
</script>

<span class={extraClass}>{fwModel}</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like a tooltip on this to see the modelVersion, just using the title attribute should be fine

@@ -379,6 +389,22 @@
</AdminContent>
</DetailItem>
{/if}
<!-- Only show model version to project managers and admins, too technical to show to regular members -->
{#if project.type === ProjectType.FlEx}
Copy link
Collaborator

Choose a reason for hiding this comment

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

your comment doesn't match the condition, is this missing or is the comment no longer valid since it's the flex version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the check, so I should remove the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pull fwdata model version from repo
2 participants