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

refactor: move settings in app #18729

Merged
merged 37 commits into from
Nov 4, 2021
Merged

Conversation

elevatebart
Copy link
Contributor

@elevatebart elevatebart commented Nov 1, 2021

User facing changelog

  • Move the "settings" page to the app
  • Polish all the screens connected
  • Wire it to all the available GraphQL data

Additional details

  • I also took the liberty to wire the record keys to the "empty runs" page

How has the user experience changed?

Screen Shot 2021-11-02 at 5 49 45 PM

Screen Shot 2021-11-02 at 5 49 36 PM

Screen Shot 2021-11-02 at 5 49 27 PM

Screen Shot 2021-11-02 at 5 49 09 PM

Screen Shot 2021-11-02 at 5 49 02 PM

To test it

  • yarn dev
  • open the "app" project in the cypress repo
  • open component testing
  • open __vite__/#/
  • navigate to the settings with the left navigation bar.

Caveats

  • The device settings are not wired up to GQL since the gql values don't exist
  • specPatterns don't exist yet so the value is there just for show
  • experiments are not wired either

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 1, 2021

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Nov 1, 2021



Test summary

4803 0 52 2Flakiness 1


Run details

Project cypress
Status Passed
Commit acde4aa
Started Nov 4, 2021 2:43 AM
Ended Nov 4, 2021 2:55 AM
Duration 11:43 💡
OS Linux Debian - 10.9
Browser Electron 93

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/commands/navigation_spec.js Flakiness
1 src/cy/commands/navigation > #visit > window immediately resolves and doesn't reload when visiting the same URL with hashes

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@elevatebart elevatebart marked this pull request as ready for review November 2, 2021 23:31
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Some comments!

It looks great, verified it:

image

const firstRecordKey = computed(() => {
const allRecordKeys = props.gql.cloudProject?.recordKeys

return allRecordKeys?.length ? allRecordKeys[0] : '<record-key>'
Copy link
Contributor

Choose a reason for hiding this comment

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

If you like to be concise you can do something like

  return allRecordKeys?.[0] ?? '<record-key>'

Copy link
Contributor Author

@elevatebart elevatebart Nov 3, 2021

Choose a reason for hiding this comment

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

Done in e7a1872

@@ -12,7 +12,7 @@ describe('<SettingsCard />', () => {

cy.mount(() => (
<div class="">
<SettingsCard title={title} description={description} icon={IconLaptop}>
<SettingsCard title={title} description={description} icon={IconLaptop} maxHeight="800px">
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this just be passed as style and inherited by the first node in the SettingsCard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I really don't want the whole style to be modifiable here. This is only an attribute meant to enable the smooth expansion of the collapsible.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion, happy to go with this if you think it makes sense!


<script lang="ts" setup>
// eslint-disable-next-line no-duplicate-imports
import type { FunctionalComponent, SVGAttributes } from 'vue'
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have duplicate imports, can remove this eslint disable

edit: this might be to do with script setup adding import { defineComponent } from 'vue', if so ignore this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can and did remove it

@@ -85,5 +85,5 @@ const externalEditors = [
]

const { t } = useI18n()
const selectedEditor = ref()
const selectedEditor = ref<Record<string, any>>()
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this be the type defined above?

const externalEditors = [
  {
    name: 'Visual Studio Code',
    key: 'vscode',
    icon: VSCode,
  },

So Record<String, Editor> or something to that meaning, where Editor is an interface with those three keys.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but I figured these types should all come from GQL anyway so I left it as the simplest iteration.

}>
}>()

// a bug in vite ddemands that we do this passthrough
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// a bug in vite ddemands that we do this passthrough
// a bug in vite demands that we do this passthrough

<div>
<div
class="flex items-center w-full text-left rounded py-12px"
:class="props.class"
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 we can get this for free (along with any other attrs we might add in the future, like id) with

<script lang="ts">
export default {
  inheritAttrs: true
}
</script>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't even think we need the inheritAttrs.
This was an artifact of when the class was passed to a lower-level item.

Removed in d6dc8a7

<div
class="flex items-center w-full text-left rounded py-12px"
:class="props.class"
v-if="$slots.right"
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 we should stick to composition API consistently, that would mean doing

const slots = useSlots()

I wonder if we can strongly type this yet 🤔

Copy link
Contributor Author

@elevatebart elevatebart Nov 3, 2021

Choose a reason for hiding this comment

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

Done in 35da101

@@ -44,5 +41,9 @@ const props = defineProps<{
class?: string | string[] | Record<string, any>
description?: string
icon?: FunctionalComponent<SVGAttributes>
gray?: boolean
bigHeader?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have a default value?

cy.get('[href="#/settings"]').click()
cy.findByText('Project Settings').click()

cy.findByText('projectId')
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure coupling our e2e tests to the DOM hierarchy is ideal, is there really no other way to do this? Maybe just a data-cy="setting-projectid" would be more clear and less brittle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit f89aab5

"check-more-types",
"cli-cursor",
"cli-table3",
"commander",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did all of these get added? This really doesn't seem correct. Some may make sense but things like commander and execa and fs-extra (and a bunch of others) are Node.js only, they don't make sense here.

Copy link
Contributor Author

@elevatebart elevatebart Nov 3, 2021

Choose a reason for hiding this comment

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

Probably a mistake at some point made all the node stuff go through vite. I removed it in d455ca9

@marktnoonan
Copy link
Contributor

I added a couple of style tweaks to this branch, looks great when I run it, did not get to do a full code review.

@lmiller1990 lmiller1990 merged commit 5f77c15 into unified-desktop-gui Nov 4, 2021
@lmiller1990 lmiller1990 deleted the refactor/move-settings branch November 4, 2021 02:52
tgriesser added a commit that referenced this pull request Nov 4, 2021
* unified-desktop-gui:
  chore: add percy to app and launchpad package (#18781)
  chore: update test
  refactor: move settings in app (#18729)
  feat: setup launchpad lifecycle (#18734)
tgriesser added a commit that referenced this pull request Nov 4, 2021
…ve-activeProject

* unified-desktop-gui: (57 commits)
  chore: Add e2e tests for global mode (#18719)
  chore: add percy to app and launchpad package (#18781)
  chore: update test
  refactor: move settings in app (#18729)
  feat: setup launchpad lifecycle (#18734)
  feat(app): decouple event manager from driver (#18695)
  chore: Force single resolution for core modules, infinite loop guard (#18764)
  fix(driver): Sticky elements within a fixed container will not prevent an element from being scrolled to (#18441)
  chore: cleaning up the runner container pattern (#18741)
  feat: Use .config files (#18578)
  chore(app): basic style and example to stop scrollIntoView bug (#18736)
  chore: make `create` function on server.ts obsolete (#18615)
  feat: add codegen utility (#18708)
  docs: Add instructions to squash commits to develop in Contributing (#18728)
  fix(@cypress/react): throw if using Next.js swc-loader without nodeVersion=system (#18686)
  refactor: remove Ramda (#18723)
  fix: support using create-cypress-tests as part of build process (#18714)
  chore: Increase paralleled machines for desktop-gui tests (#18725)
  fix(app): do not cache graphql (#18716)
  chore: Update Chrome (stable) to 95.0.4638.69 (#18696)
  ...
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.

None yet

3 participants