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

Placeholder pull request for project-wide code review #30

Open
wants to merge 74 commits into
base: initial
Choose a base branch
from

Conversation

pauline2k
Copy link
Contributor

See #29 for some candidate areas of interest.

gmerritt and others added 30 commits January 30, 2024 14:31
Getting synced with my latest; will use ets authoritative going forward
Catching up to latest changes
Helping Elastic Beanstalk get the paths right to find js & css files
Removing "temporary code to debug the elastic beanstalk run context"
Leading and trailing blank space are now removed from user gs:// url …
Clear contents of input, output fields when clicking back into input field
source venv/bin/activate
export HARTSFIELD_LOCAL_CONFIGS=/Users/gregm/rip_hartsfield/hartsfield_config
source .env.development
export HARTSFIELD_LOCAL_CONFIGS=/Volumes/XYZ/hartsfield_config
export HARTSFIELD_ENV=development
npm run serve-vue
```
Copy link
Contributor

Choose a reason for hiding this comment

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

source .env.development seems unnecessary in both instances above. Vite should pick it up automatically when npm run serve-vue

if not re.match(r'gs://.{3,}/.+', gs_source_url):
error_message = 'The submitted data \"' + gs_source_url + '\" is not a valid gs_source_url.'
v = {'response': error_message, 'status': 'error'}
return tolerant_jsonify(v)
Copy link
Contributor

Choose a reason for hiding this comment

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

The above looks good. Although I suggest the following for line 58:

return tolerant_jsonify(
    {'message': error_message},
    500,
)

This will make for more standard front-end code (eg, checking HTTP status code).

error_message = 'There was an exception trying to do the GCP storage operation with the submitted data \"' + \
gs_source_url + \
'\'. When GCP tried, it told us: \"' + \
str(e) + '\"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor code style concern: Use f-string with triple quotes when string is multi-line.

m = f"""
     Hello world. My name is {name}.
"""

'id': uid,
'isActive': is_active,
'isAdmin': is_active,
'isAnonymous': not is_active,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this line should be: 'isAnonymous': not uid. An inactive user with a UID is not anonymous.

"eslint-plugin-vue-scoped-css": "^2.5.1",
"sass": "^1.69.5",
"typescript": "5.2.2",
"vite": "^4.5.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Fyi, the latest vite is v5.*

settings.json Outdated
},
"javascript.suggest.includeAutomaticOptionalChainCompletions": false,
"debug.saveBeforeStart": "none"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: Files should have trailing line breaks so we don't get these annoying little warning symbols. 😛


export function fetchUrl(gs_source_url: string) {

return utils.post('/api/fetch_url_direct', {gs_source_url}, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor code style: we typically use camelCase when posting query args.

}
}
}
</script>
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation fix needed above. (Would the front-end linter catch this?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would love for the linter to fix this for me! I guess the way I used it, it did not catch this? gmerritt/hartsfield-from-ripley@a44aa2a

Copy link
Contributor

@johncrossman johncrossman Apr 9, 2024

Choose a reason for hiding this comment

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

@gmerritt - Maybe this eslint rule will make the check and fix?! https://eslint.vuejs.org/rules/script-indent

},
methods: {
...mapActions(useContextStore, [
'alertScreenReader',
'loadingComplete',
'loadingStart'
])
Copy link
Contributor

Choose a reason for hiding this comment

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

Having this "mixin" makes sense and most of our other tools follow this pattern. However, in the Vue 3 world, mixins are discouraged. I don't think you should refactor (yet). Maybe down the road. 😄 See https://vuejs.org/api/options-composition.html

image

VSwitch,
VTextarea,
VTextField,
VTooltip
Copy link
Contributor

Choose a reason for hiding this comment

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

As probably you know, the list above should be limited to components actually used by Hartsfield. Perhaps we trim the list when all Hartsfield features are implemented.

@@ -1,4 +1,7 @@
import { useContextStore } from '@/stores/context'
import Vuex from 'vuex'

Vue.use(Vuex)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hartsfield uses Pinia and not Vuex, right? The lines above should be dropped.

placeholder="gs://"
/>
</v-col>
<div v-if="!currentUser" class="pt-2 page-fetch-url">
Copy link
Contributor

Choose a reason for hiding this comment

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

currentUser should NEVER be null. Thus, !currentUser will always be false. Do we want !currentUser.isAuthenticated




</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Your call on front-end code style. I prefer a two-space indentation, enforced by the linter. And one empty-line max.

Copy link
Collaborator

Choose a reason for hiding this comment

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

[comment as above re: linter] -- Would love for the linter to fix this for me! I guess the way I used it, it did not catch this? gmerritt/hartsfield-from-ripley@a44aa2a

Copy link
Collaborator

Choose a reason for hiding this comment

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

ohhh maybe I'm needing 'indent': ['error', 2], in my .eslintrc.js!

font-weight: 400;
}
}
</style>
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're building this Vue 3 app from scratch, you can use Vue's Composition API. DevOps is still behind the curve in this respect because we're most familiar with the old "Options API" syntax. Our two Vue3 apps (BOA and Ripley) were migrated from Vue 2 and inherited a bunch of the old syntax. For the record, I do find the Composition API cleaner.

@johncrossman
Copy link
Contributor

@gmerritt @pauline2k - My code review is done. Let me know if any of my comments are unclear. Thanks!

@gmerritt
Copy link
Collaborator

gmerritt commented Apr 3, 2024

Super cool, thank you for all of the help @johncrossman!

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

Successfully merging this pull request may close these issues.

4 participants