Closed ckline-tryptic closed 1 year ago
The question of whether to migrate CORGI over to Svelte vs sticking with Vue should be resolved sooner rather than later.
Here are a few items for consideration:
I also wanted to write down my opinion.
Good and helpful comparison of this two frameworks https://www.vuemastery.com/blog/vue-vs-svelte-comparing-framework-internals/
I don't think the vue code is that much harder to read in comparison to Svelte. It's only more explicit where things live in a vue centric World (e.g. internal value store, events and VirtualDOM update process) and Svelte does some of this things magically in their compiler (that's were the magic in Svelte lies and why it looks like it needs less code). Overall our frontend is not a very big project. What is really missing is better (re)structure and separate things into components and a major rewrite with Svelte can lead to the same results there.
I haven't had a chance to compare Nuxt & Svelte yet but:
Notes: Unit tests in Jest, Code coverage on all the files, debugging examples (to see how much the auto-injected code and compilation impacts devs)
As I was playing around with the UI, I noticed that it might be useful to have a clear button to empty all the fields. It's not super important and mainly for convenience. That's something that I can try and implement.
Working on job submission / form validation now.
My opinion:
If you want to try this yourself, go to svelte.dev and use the editor on the home page.
<script>
let ticker = false
let interval = -1
let timeout = 1000
$: if (timeout > 0) {
clearInterval(interval)
interval = setInterval(() => ticker = !ticker, timeout)
}
</script>
{@debug interval}
<h1>{ticker ? 'Tick' : 'Tock'}</h1>
Timeout: <input type="number" bind:value={timeout}/>
The interval will be cleared and set again every time because ticker
is in the scope of the $:
, even though it is not directly in scope (it's in an arrow function). The point is that you need to be careful what you include in the scope of one of these $:
things because it will run when any global variable in any sub-scope of the $:
scope changes.
You can see the problem more clearly in the 'compiled js' output:
/* App.svelte generated by Svelte v3.49.0 */
/* -- snip -- */
$$self.$$.update = () => {
if ($$self.$$.dirty & /*timeout, interval, ticker*/ 7) {
$: if (timeout > 0) {
clearInterval(interval);
$$invalidate(1, interval = setInterval(() => $$invalidate(0, ticker = !ticker), timeout));
}
}
};
/* -- snip -- */
It shows that the bit that represents ticker is included in the binary AND that is used to determine if an update is required.
Use a function to remove ticker
from the scope.
<script>
let ticker = false
let interval = -1
let timeout = 1000
function startTicker() {
interval = setInterval(() => ticker = !ticker, timeout)
}
$: if (timeout > 0) {
clearInterval(interval)
startTicker()
}
</script>
{@debug interval}
<h1>{ticker ? 'Tick' : 'Tock'}</h1>
Timeout: <input type="number" bind:value={timeout}/>
First, thanks to those before me who submitted such detailed comments. I've been waiting to leave my comments to try and not tilt the balance in any direction, so I'm focusing on the positives.
I don't think Svelte will make or break the CORGI frontend. I can see clear advantages to why Svelte is a perfect framework for CORGI. Marvin's referenced article states, "Svelte will shine only when you’re building something like a spreadsheet application where thousands of reactive values are interconnected." I think this statement marks an important point about the strengths of Svelte, which is making reactive sites simple. CORGI is a lot like a spreadsheet application, and it may benefit us to remove all the extra things we don't use in nuxt.js. Removing extra features keeps us from having to maintain them over time. Lastly, the feedback from the community is extremely positive and hard to ignore.
As a manager, I must seriously consider why we want to rewrite software. The "secret sauce" of LEAN software development is being purely iterative. By always chasing the next kaizen card, we transform the software we use to what the customer needs. If we didn't determine through experimentation that we need to rewrite the front-end, how do we know we need to rewrite it? Additionally, I have experience working on the front-end, and while there was a small learning curve, I enjoyed the process and felt nuxt.js provided a lot of flexibility we can still leverage into the future. I feel like we could have chosen Svelte or nuxt.js (both released in 2016).
No updates to the issue since my last comment (?). It's really hard to tell where this is at w/o digging further.
Unfortunately I cannot join the meeting today but I'm biased to Vue personally (partly also because I have written large parts of current CORGI UI). Reasons are mostly that it's an iterative approach as Mike pointed out (we have something running and tested which needs refinement, upgrade and separation of concerns with more components) and Vue can be sprinkled into other possible projects we may have in future. The community is also bigger which is proven e.g. by the more advanced UI framework we currently use.
I think the biggest PRO for Svelte currently is that mainly Chris and partly Tyler are basically owning it and making amazing progress on it. There is currently no bigger effort going on on upgrading our Vue/Nuxt system (I wished I had time for it but there were other high priority things to do). If we continue using Vue it may slow them down in their progress. I definitely do NOT want to slow Chris and Tyler down just because I think that Vue has a little bit more flexibility (no compiler necessarily needed, tooling etc.), bigger community (more libraries like Vuetify) and is more "battle proven" by our users in the last years. I can imagine getting up to speed in a new Svelte CORGI project too.
Fixed Icons, added details / actions dialog, fixed elapsed time, hooked up api for buttons. added login redirect. Working on autocomplete.
I finished altering the corgi-concourse-resource so that it will be able to translate to/from the old and new schema. It works locally. Next I would like to see if it will work in a PR environment.
I ran into some problems because I was working on a branch that was based on a branch that I later squash merged into the main branch of Enki. Incase other people run into this problem, I found what I think is the ideal solution (backup your branch before you try this):
git rebase <commit_sha> --onto main
<commit_sha>
applied on top of the tip of main (like this one) 🎉.Last Friday, 10/28/22, we managed to get this working an a PR pipeline here. It works better than expected for the first deploy. Building books works; the status of each job is updated as a book is built; aborting jobs works; and GitHub OAuth mostly works. Honestly, there are only a few problems.
SESSION_SECRET
to encrypt session cookies. They should all use the same secret incase there is more than one instance of the backend server running.~ Temporary solution was to create a shared secret in deploy-corgi-pr-stack
. Book
, Repo
, and Version
text inputs do not let you enter values that are not in the database.~Book
field should be a required field until we can update Enki to build multiple books.created_at
and updated_at
fields in the database do not store timezone information.~puts
the pdf_url
. (If artifact_urls is a str, it sets the artifact url for the first book in the job).target="_blank"
)~Repo
input field were wide enough to fit the entire repo name.Initial testing results of the new corgi ui - https://corgi-514.ce.openstax.org/
Can the pdf (job artifacts) be open in a separate tab? At the moment it opens in the same tab as the corgi is - I see this is already mentioned
Is there enough space to expand the selection fields to maybe see the complete repo and book text (or as much as possible)?
webview does not run a job
select a repo and book, then delete (clear) book selection and after that clear repo. select a different repo and click the book field. the selection in the book field will show the books for the previously selected repo. I have to refresh browser to make it work correctly again.
epub job does not work - getting fetch-utils.ts:11 POST https://corgi-514.ce.openstax.org/api/jobs/ 500
I am able to start a job for some repos (not all) while nothing is entered into the book field. Job starts with correct book entry and that book style is added to the book dropdown (even though it was not there before)
we used to mark aborted jobs with brown colour. Maybe we could distinguish aborted and failed jobs with colours too (red ! - failed, brown x - aborted)?
when all books in the bundle are processed, the resulting link to artifact looks a bit disorganised and only one of the titles is clickable. Maybe they could be listed in separate rows?
I think most of the issues documented here have either been fixed or have a clear path to being fixed. We still need to fix the remaining issues, update all the tests, figure out how authentication and authorization should work in the first release, and get some more feedback from users.
Some feedback that I thought of:
Elapsed
values, you can see when a job is created. I wonder if this should be reversed. In my opinion, the date/time a job was started is more useful, at a glance, than the elapsed time./api/jobs
endpoint. When the error occurs, the backend takes > 50 seconds to respond.~ (Something was causing the proxy service to restart at a seemingly random interval. Restarting all the services fixed the issue)Most of the issues listed previously have been addressed, so I found some more.
@omehes
I am able to start a job for some repos (not all) while nothing is entered into the book field. Job starts with correct book entry and that book style is added to the book dropdown (even though it was not there before)
You should be able to build any repo without supplying a book because the backend fetches all the book metadata when you submit a job. Granted, in the initial release, the book field will be. It's possible that an authentication issue interfered with your ability to submit a job. Do you remember which repository you could not build?
we used to mark aborted jobs with brown colour. Maybe we could distinguish aborted and failed jobs with colours too (red ! - failed, brown x - aborted)?
I have done that, but I have not pushed the change to github yet. Same thing with the links.
I think everything else you mentioned has been fixed.
Icon colors have been adjusted, and element ids have been added for testing purposes.
select a repo and book, then delete (clear) book selection and after that clear repo. select a different repo and click the book field. the selection in the book field will show the books for the previously selected repo. I have to refresh browser to make it work correctly again.
Changed status icons to Larissa's.
We were unknowingly using node version 14 in our frontend image. When I tried to install something using node version 16 (and its npm version) it caused a plethora of problems. We could have sidestepped this issue by installing node dependencies with node version 14; however, there were also several vulnerabilities in the old, outdated package versions we were using. Consequently, it made sense to update node and all of our dependencies.
node:16-alpine
imageSome notes/observations:
1. When incorrect sha or other accepted data is entered into version field, we get a 500 error with not error explanation. Should we add some error text?
2. In the old corgi I used to copy/paste the repo names from the job raws. Don't know how much is this done by other users. It's a bit more difficult to do it in the new corgi UI because the (repeat, approve close) box pops up, then it has to be dismissed and then the highlighted selection can be copied. One word entries can be copy/pasted via simple right-click easier but multi word entries no.
Reply from Tyler: ...that bugs me too. I wonder if it would be better to have a specific clickable region of the row (maybe the ID)
3. New icons: at first sight they look very similar, especially the queued and processing ones. Maybe distinguish them more? also, the jobs which are successful, could the icons be static (like the Abort ones)? That would clearly distinguish them from all the others.
4. I was wondering. Can we handle multi error cases with multi error messages? Like in this case: incorrect book title in Book field and incorrect sha in Version field. Currently, it only shows error for one of them (incorrect sha)...
null
instead of an error message when an object id that does not exist is used. I added a custom error for this situation. It should be ready for the next deploy. In addition to the above:
elapsed
tooltip more readablerepo
field was auto filled by a book selection (additional details below)
Ottó: I have a situation - steps: click any job type or all select a book in the Book field repo will be automatically filled Create New Job button wont be enabled
Yea, I agree on point 3 above - team discussion (parking for Thursday)
I finished the data migration for the ABL and noticed a small usability problem that we will want to address later. If, for example, you select astronomy
as the book to build, the osbooks-astronomy
repo is selected automatically, however, the 1e
branch is not selected as the version. In this case, it will use main
as the version and will not find the old book edition on the main branch because a new edition is on main
.
Additionally, there was one error in the ABL data:
repo_name: osbooks-college-algebra-bundle
sha: ebc5beb15766e5a72d4d5085c1d470ae868007fb
In repository: {'slug': 'college-algebra-coreq', 'style': 'precalculus-coreq'}
In ABL: {'slug': 'college-algebra-corequisite-support', 'style': 'precalculus-coreq'}
I am making one more change to the way that jobs are cached to squeeze out a bit more performance. Other than that, we are ready to merge our changes, release to staging/proc, and wait for the inevitable issues to arise; however, we decided it would be best to wait until after the holidays to deploy.
Before we release, we should, "[...] let Alina know, as she’ll need to send the new documentation to the vendors and let them know it’ll be changing."
Description
Since we are retiring Archive and moving fully to GitHub, CORGI needs to change to accommodate this new workflow, and require GitHub authentication. This opportunity is also being taken to update CORGI to V2.
Acceptance Criteria
TODO
job_type
checkbox (PDF, Web Preview, EPUB, Docx)repo
fieldbook
fieldversion
fieldrepo
book
job_type
collection_id
intorepo
andbook
github_user
style
pdf_url
intostatus
updated
toelapsed
Canceled / Deferred
user
~rex_preview
into details pane~worker_version
into details pane~