Skip to content

Commit

Permalink
Fix display_screen and GraphEditItemDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Dec 19, 2024
1 parent e9ecd6e commit d66a09c
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1706,25 +1706,25 @@ export default {
}
index += 1
}
this.$set(definition, 'target', data.target_name)
this.$set(definition, 'screen', data.screen_name)
this.$set(definition, 'definition', data.definition)
definition.target = data.target_name
definition.screen = data.screen_name
definition.definition = data.definition
if (data.x) {
this.$set(definition, 'left', data.x)
definition.left = data.x
} else {
this.$set(definition, 'left', 0)
definition.left = 0
}
if (data.y) {
this.$set(definition, 'top', data.y)
definition.top = data.y
} else {
this.$set(definition, 'top', 0)
definition.top = 0
}
this.$set(definition, 'count', this.updateCounter++)
definition.count = this.updateCounter++
if (!found) {
this.$set(definition, 'id', this.idCounter++)
this.$set(this.screens, this.screens.length, definition)
definition.id = this.idCounter++
this.screens[this.screens.length] = definition
} else {
this.$set(this.screens, index, definition)
this.screens[index] = definition
}
break
case 'clearscreen':
Expand Down Expand Up @@ -2593,6 +2593,10 @@ class TestSuite(Suite):
z-index: 20;
opacity: 0.35;
}
.ace_gutter {
/* Screens have a default z-index of 3 so get below that */
z-index: 2;
}
.ace_gutter-cell.ace_breakpoint {
border-radius: 20px 0px 0px 20px;
box-shadow: 0px 0px 1px 1px red inset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
hide-details
label="Reduced Type"
:items="reducedTypes"
:disabled="currentReduced === 'DECOM'"
:disabled="editItem.reduced === 'DECOM'"
v-model="editItem.reducedType"
class="mb-2"
/>
Expand Down Expand Up @@ -104,10 +104,10 @@ export default {
valueTypes: ['CONVERTED', 'RAW'],
reduction: [
// Map NONE to DECOM for clarity
{ text: 'NONE', value: 'DECOM' },
{ text: 'REDUCED_MINUTE', value: 'REDUCED_MINUTE' },
{ text: 'REDUCED_HOUR', value: 'REDUCED_HOUR' },
{ text: 'REDUCED_DAY', value: 'REDUCED_DAY' },
{ title: 'NONE', value: 'DECOM' },
{ title: 'REDUCED_MINUTE', value: 'REDUCED_MINUTE' },
{ title: 'REDUCED_HOUR', value: 'REDUCED_HOUR' },
{ title: 'REDUCED_DAY', value: 'REDUCED_DAY' },
],
reducedTypes: ['MIN', 'MAX', 'AVG', 'STDDEV'],
}
Expand All @@ -127,14 +127,12 @@ export default {
},
async created() {
this.editItem = { ...this.item }
await this.api
this.api = new OpenC3Api()
new OpenC3Api()
.get_item(this.item.targetName, this.item.packetName, this.item.itemName)
.then((details) => {
for (const [key, value] of Object.entries(details.limits)) {
if (Object.keys(value).includes('red_low')) {
// Must call this.$set to allow Vue to make the limits object reactive
this.$set(this.limits, key, Object.values(value))
this.limits[key] = Object.values(value)
}
}
// Locate the key for the value array that we pass in
Expand Down
47 changes: 47 additions & 0 deletions playwright/tests/script-runner/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,53 @@ test('test python metadata apis', async ({ page, utils }) => {
)
})

async function testScreenApis(page, utils, filename) {
await openFile(page, utils, filename)
await page.locator('[data-test=start-button]').click()
await expect(page.locator('[data-test=state] input')).toHaveValue(
'Connecting...',
{
timeout: 5000,
},
)
await expect(page.locator('[data-test=state] input')).toHaveValue('running')
// script displays INST ADCS
await page.getByText('INST ADCS', { exact: true }).toBeVisible()
// script displays INST HS
await page.getByText('INST HS', { exact: true }).toBeVisible()
// script calls clear_screen("INST", "ADCS")
await page.getByText('INST ADCS', { exact: true }).not.toBeVisible()
// script displays INST IMAGE
await page.getByText('INST IMAGE', { exact: true }).toBeVisible()
// script calls clear_all_screens()
await page.getByText('INST HS', { exact: true }).not.toBeVisible()
await page.getByText('INST IMAGE', { exact: true }).not.toBeVisible()
// script creates local screen "TEST"
await page.getByText('LOCAL TEST', { exact: true }).toBeVisible()
// script calls clear_all_screens()
await page.getByText('LOCAL TEST', { exact: true }).not.toBeVisible()
// script creates local screen "INST TEST"
await page.getByText('INST TEST', { exact: true }).toBeVisible()
// script calls clear_all_screens()
await page.getByText('INST TEST', { exact: true }).not.toBeVisible()
// script deletes INST TEST and tries to display it which results in error
await expect(page.locator('[data-test=state] input')).toHaveValue('error', {
timeout: 20000,
})
await page.locator('[data-test=go-button]').click()
await expect(page.locator('[data-test=state] input')).toHaveValue('stopped', {
timeout: 20000,
})
}

test.only('test ruby screen apis', async ({ page, utils }) => {
await testScreenApis(page, utils, 'screens.rb')
})

test('test python screen apis', async ({ page, utils }) => {
await testScreenApis(page, utils, 'screens.py')
})

test('test python numpy import', async ({ page, utils }) => {
await openFile(page, utils, 'numpy.py')
await page.locator('[data-test=start-button]').click()
Expand Down

0 comments on commit d66a09c

Please sign in to comment.