diff --git a/src/components/Process/Agents/InLineAgent.vue b/src/components/Process/Agents/InLineAgent.vue index c408ff8692f5c6a1b34b3d140a8fc78e55c5cbec..09912582e8c2b8208d8a32d6d4b6fa683a22f75d 100644 --- a/src/components/Process/Agents/InLineAgent.vue +++ b/src/components/Process/Agents/InLineAgent.vue @@ -50,10 +50,10 @@ <li v-if="loading" class="loader"></li> <li v-else-if="hasTasks && 'running_tasks' in agent && Array.isArray(agent.running_tasks)" - v-for="(task, index) in agent.running_tasks" - :key="task.id" + v-for="(taskSlug, index) in agent.running_tasks" + :key="taskSlug" > - <b>{{ index + 1 }} </b> {{ task.slug }} + <b>{{ index + 1 }} </b> {{ taskSlug }} </li> <li v-else>—</li> </ul> diff --git a/src/router/index.js b/src/router/index.js index dd88aba776dfdf60d81fef5355e5c40f7b689392..0d3a1ae0f88d69ab6b16f5eed31377657b833b60 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -201,7 +201,7 @@ const routes = [ path: '/process/agents', name: 'ponos-agents', component: PonosAgents, - meta: { requiresLogin: true, requiresVerified: true } + meta: { requiresLogin: true, requiresVerified: true, requiresFeatures: ['enterprise'] } }, // URL of the previous template details page, which has been merged with the process status into ProcessDetails { diff --git a/src/types/ponos.ts b/src/types/ponos.ts index 27d1a2f4a99095d23dfc32e2a2ee3794712fe83d..9290059a7ff1f97ecb448388397fc16a774fbe30 100644 --- a/src/types/ponos.ts +++ b/src/types/ponos.ts @@ -12,17 +12,6 @@ export interface GPU { ram_total: number } -export interface TaskLight { - id: UUID - run: number - depth: number - slug: string - state: ProcessState - parents: UUID[] - tags: string[] - shm_size: string -} - type AgentLight = { id: UUID farm: Farm @@ -47,10 +36,18 @@ export type AgentState = AgentLight & { } export type AgentDetails = AgentLight & { - running_tasks: TaskLight[] + running_tasks: string[] } -export interface Task extends TaskLight { +export interface Task { + id: UUID + run: number + depth: number + slug: string + state: ProcessState + parents: UUID[] + tags: string[] + shm_size: string logs: string full_log: string agent: AgentLight | null @@ -67,4 +64,4 @@ export interface Artifact { s3_put_url: string | null created: string updated: string -} \ No newline at end of file +} diff --git a/src/views/Imports/ImportFromBucket.vue b/src/views/Imports/ImportFromBucket.vue index 66982b679fa3226d4e17b4281e2283685c7d87d3..2991ed1fa2bfe29448f3b4daa88536aa256f216f 100644 --- a/src/views/Imports/ImportFromBucket.vue +++ b/src/views/Imports/ImportFromBucket.vue @@ -127,7 +127,10 @@ </p> </template> </div> - <div class="field"> + <div + v-if="hasFeature('enterprise')" + class="field" + > <label class="label"> Agents farm </label> @@ -214,7 +217,7 @@ export default { fieldErrors: {} }), computed: { - ...mapVuexGetters('auth', ['isVerified']), + ...mapVuexGetters('auth', ['isVerified', 'hasFeature']), ...mapState(useIngestStore, ['buckets']), ...mapState(usePonosStore, ['farms']), canImport () { @@ -376,7 +379,7 @@ export default { folderType () { this.helperText.folderType = null }, advancedSettings: { handler (open) { - if (open && !this.farms) this.listFarms() + if (this.hasFeature('enterprise') && open && !this.farms) this.listFarms() }, immediate: true } diff --git a/src/views/Imports/ImportFromFiles.vue b/src/views/Imports/ImportFromFiles.vue index 68bf5be8cd7e032e63f81a830d7ac16e4cc07e37..e49d36b2f7c0787ab84c55725e47679eef471dba 100644 --- a/src/views/Imports/ImportFromFiles.vue +++ b/src/views/Imports/ImportFromFiles.vue @@ -81,7 +81,10 @@ </p> </template> </div> - <div class="field"> + <div + v-if="hasFeature('enterprise')" + class="field" + > <label class="label"> Agents farm </label> @@ -163,7 +166,7 @@ export default { fieldErrors: {} }), computed: { - ...mapVuexGetters('auth', ['isVerified']), + ...mapVuexGetters('auth', ['isVerified', 'hasFeature']), ...mapVuexGetters('files', ['selectedFiles']), ...mapState(usePonosStore, ['farms']), isIIIF () { @@ -293,7 +296,7 @@ export default { folder: 'checkFolder', advancedSettings: { handler (open) { - if (open && !this.farms) this.listFarms() + if (this.hasFeature('enterprise') && open && !this.farms) this.listFarms() }, immediate: true } diff --git a/src/views/Process/Configure.vue b/src/views/Process/Configure.vue index a3a2a020325dcccc8bdf6222cd9a1443734b4a1f..22c09ea8f60a4292a3833d7e0ae9d0d73f9734d2 100644 --- a/src/views/Process/Configure.vue +++ b/src/views/Process/Configure.vue @@ -146,7 +146,11 @@ </p> </template> </div> - <div class="field" title="Select the Ponos agent farm for this process"> + <div + v-if="hasFeature('enterprise')" + class="field" + title="Select the Ponos agent farm for this process" + > <label class="label"> Agents farm </label> @@ -271,7 +275,7 @@ <script> import { mapState, mapActions } from 'pinia' -import { mapState as mapVuexState, mapActions as mapVuexActions } from 'vuex' +import { mapState as mapVuexState, mapActions as mapVuexActions, mapGetters as mapVuexGetters } from 'vuex' import { ensureArray, errorParser } from '@/helpers' import { useNotificationStore, usePonosStore, useWorkerStore } from '@/stores' @@ -322,6 +326,7 @@ export default { this.getProcess() }, computed: { + ...mapVuexGetters('auth', ['hasFeature']), ...mapVuexState('process', [ 'processes', 'processDatasets', @@ -529,7 +534,7 @@ export default { } }, advancedSettings (open) { - if (open && !this.farms) this.listFarms() + if (this.hasFeature('enterprise') && open && !this.farms) this.listFarms() }, hasWorkerRuns (workers) { if (!workers) { diff --git a/src/views/Process/List.vue b/src/views/Process/List.vue index 5aaad50906fc1e8345fbda0ab404d1cee11f35b6..ce88fd4a21f720410609ff6e139f722c57b5c5f5 100644 --- a/src/views/Process/List.vue +++ b/src/views/Process/List.vue @@ -1,6 +1,12 @@ <template> <main class="container is-fluid"> - <router-link class="button is-info is-pulled-right" :to="{ name: 'ponos-agents' }">View agents</router-link> + <router-link + v-if="hasFeature('enterprise')" + class="button is-info is-pulled-right" + :to="{ name: 'ponos-agents' }" + > + View agents + </router-link> <h1 class="title">Processes</h1> <h2 class="subtitle">List all processes</h2> @@ -114,7 +120,7 @@ </template> <script> -import { mapState, mapActions, mapMutations } from 'vuex' +import { mapState, mapActions, mapMutations, mapGetters } from 'vuex' import { PROCESS_MODES, PROCESS_STATES } from '@/config' import { corporaMixin } from '@/mixins.js' import { errorParser, removeEmptyStrings } from '@/helpers' @@ -149,7 +155,8 @@ export default { }, computed: { ...mapState('auth', ['user']), - ...mapState('process', ['processPage', 'processes']) + ...mapState('process', ['processPage', 'processes']), + ...mapGetters('auth', ['hasFeature']) }, methods: { ...mapActions('process', ['listProcesses']),