Skip to content

Commit

Permalink
Feature add GScan refresh button (#1472)
Browse files Browse the repository at this point in the history
added button for manually calling scan mutation

---------

Co-authored-by: Mark Dawson <[email protected]>
Co-authored-by: Ronnie Dutta <[email protected]>
  • Loading branch information
3 people authored Sep 22, 2023
1 parent 3bf9539 commit 3c36618
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ creating a new release entry be sure to copy & paste the span tag with the
`actions:bind` attribute, which is used by a regex to find the text to be
updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->

-------------------------------------------------------------------------------
## __cylc-ui-2.2.0 (<span actions:bind='release-date'>Upcoming</span>)__

### Enhancements

[#1472](https://github.com/cylc/cylc-ui/pull/1472) -
Added GScan refresh button

-------------------------------------------------------------------------------
## __cylc-ui-2.1.0 (<span actions:bind='release-date'>Released 2023-09-07</span>)__

Expand Down
25 changes: 22 additions & 3 deletions src/components/cylc/gscan/GScan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
type="list-item-three-line"
class=" d-flex flex-column h-100"
> -->
<!-- filters -->
<div class="d-flex flex-row mx-4 mb-2 flex-grow-0">
<!-- filters -->
<v-text-field
v-model="searchWorkflows"
clearable
Expand Down Expand Up @@ -79,6 +79,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</v-list>
</v-card>
</v-menu>
<!-- scan -->
<v-btn
icon
id="c-gscan-scan-tooltip-btn"
variant="text"
size="small"
data-cy="gscan-scan-btn"
@click="scanFilesystem()"
>
<v-icon size="x-large">{{ $options.icons.mdiFolderRefresh }}</v-icon>
<v-tooltip text="Refresh workflows list" />
</v-btn>
</div>
<!-- data -->
<v-progress-linear
Expand Down Expand Up @@ -174,14 +186,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</template>

<script>
import { mdiFilter } from '@mdi/js'
import { mdiFilter, mdiFolderRefresh } from '@mdi/js'
import TaskState, { TaskStateUserOrder } from '@/model/TaskState.model'
import { WorkflowState } from '@/model/WorkflowState.model'
import Job from '@/components/cylc/Job.vue'
import Tree from '@/components/cylc/tree/Tree.vue'
import WorkflowIcon from '@/components/cylc/gscan/WorkflowIcon.vue'
import { filterHierarchically } from '@/components/cylc/gscan/filters'
import { sortedWorkflowTree } from '@/components/cylc/gscan/sort.js'
import { mutate } from '@/utils/aotf'

export default {
name: 'GScan',
Expand Down Expand Up @@ -293,6 +306,11 @@ export default {
}
},
methods: {

scanFilesystem () {
mutate({ name: 'scan', args: [] }, {}, this.$workflowService.apolloClient)
},

filterWorkflows () {
this.filteredWorkflows = filterHierarchically(
this.workflows,
Expand Down Expand Up @@ -378,7 +396,8 @@ export default {

// Misc options
icons: {
mdiFilter
mdiFilter,
mdiFolderRefresh
},
/**
* Lists of all the possible workflow and task states
Expand Down
11 changes: 11 additions & 0 deletions src/utils/aotf.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,17 @@ export function argumentSignature (arg) {
* @returns {string} A mutation string for a client to send to the server.
*/
export function constructMutation (mutation) {
// the scan mutation has no arguments
if (!mutation.args.length) {
return dedent`
mutation ${mutation.name} {
${mutation.name} {
result
}
}
`.trim()
}

const argNames = []
const argTypes = []
for (const arg of mutation.args) {
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/utils/aotf.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,19 @@ describe('aotf (Api On The Fly)', () => {
}
`.trim())
})
it('handles mutation objects with no arguments', () => {
const mutation = {
name: 'MyMutation',
args: []
}
expect(aotf.constructMutation(mutation)).to.equal(dedent`
mutation MyMutation {
MyMutation {
result
}
}
`.trim())
})
})

describe('getMutationArgsFromTokens', () => {
Expand Down

0 comments on commit 3c36618

Please sign in to comment.