From 492acd824ff4fa12b712ed106ed1cfeb53df68b5 Mon Sep 17 00:00:00 2001 From: mlbonhomme <bonhomme@teklia.com> Date: Fri, 1 Mar 2024 15:57:25 +0100 Subject: [PATCH] Remove Repository Processes --- src/api/repository.js | 5 -- src/components/Process/Status/Status.vue | 5 -- src/config.ts | 1 - src/store/repos.js | 19 +------- tests/unit/samples.js | 8 ---- tests/unit/store/repos.spec.js | 61 ++---------------------- 6 files changed, 6 insertions(+), 93 deletions(-) diff --git a/src/api/repository.js b/src/api/repository.js index 2859c164b..741b68f5c 100644 --- a/src/api/repository.js +++ b/src/api/repository.js @@ -1,11 +1,6 @@ import axios from 'axios' import { unique } from '.' -// List or search available repositories for given credentials -export const listAvailableRepositories = unique( - async (credential, search = null) => (await axios.get(`/process/repos/search/${credential}/`, { params: { search } })).data -) - // List repositories imported on Arkindex export const listRepositories = unique(async params => (await axios.get('/process/repos/', { params })).data) diff --git a/src/components/Process/Status/Status.vue b/src/components/Process/Status/Status.vue index 0b33cb8a9..c962c4482 100644 --- a/src/components/Process/Status/Status.vue +++ b/src/components/Process/Status/Status.vue @@ -14,11 +14,6 @@ <div class="column"> <strong>Mode</strong><br />{{ processMode }} </div> - <div class="column" v-if="process.revision"> - <strong>Revision</strong><br /> - <a :href="process.revision.commit_url" target="_blank"><samp>{{ process.revision.hash.substr(0, 8) }}</samp></a> - {{ process.revision.message }} · <small>{{ process.revision.author }}</small><br /> - </div> <div class="column" v-if="process.farm"> <strong>Farm</strong><br />{{ process.farm.name }} </div> diff --git a/src/config.ts b/src/config.ts index af597d024..f5fb10cce 100644 --- a/src/config.ts +++ b/src/config.ts @@ -165,7 +165,6 @@ export const PROCESS_FINAL_STATES: Array<keyof typeof PROCESS_STATES> = ['comple export const PROCESS_MODES = { files: 'Files', - repository: 'Git', iiif: 'IIIF', workers: 'Workers', template: 'Template', diff --git a/src/store/repos.js b/src/store/repos.js index 9eb99af40..e24317eef 100644 --- a/src/store/repos.js +++ b/src/store/repos.js @@ -1,13 +1,10 @@ -import { clone, assign } from 'lodash' +import { assign } from 'lodash' import * as api from '@/api' -import { errorParser } from '@/helpers' import { useWorkerStore } from '@/stores' export const initialState = () => ({ // { [repoId]: repo } - repositories: {}, - // Available but not yet imported repositories (from user credentials) - available: null + repositories: {} }) export const mutations = { @@ -20,9 +17,6 @@ export const mutations = { removeRepo (state, id) { delete state.repositories[id] }, - setAvailable (state, available) { - state.available = clone(available) - }, reset (state) { assign(state, initialState()) } @@ -49,15 +43,6 @@ export const actions = { return data }, - async listAvailable ({ commit }, { credential, search = null }) { - try { - commit('setAvailable', await api.listAvailableRepositories(credential, search)) - } catch (err) { - commit('setAvailable', null) - commit('notifications/notify', { type: 'error', text: errorParser(err) }, { root: true }) - } - }, - async delete ({ commit }, id) { const data = await api.deleteRepository(id) commit('removeRepo', id) diff --git a/tests/unit/samples.js b/tests/unit/samples.js index 4245fb1f0..b04af15a7 100644 --- a/tests/unit/samples.js +++ b/tests/unit/samples.js @@ -224,14 +224,6 @@ export const repoSample = { export const reposSample = makeSampleResults([repoSample]) -export const availableReposSample = makeSampleResults([ - { - id: 'repoid', - url: 'http://repo', - name: 'user / repo' - } -]) - export const providersSample = [ { name: 'GitLabProvider', diff --git a/tests/unit/store/repos.spec.js b/tests/unit/store/repos.spec.js index 2782542ee..6061a4f01 100644 --- a/tests/unit/store/repos.spec.js +++ b/tests/unit/store/repos.spec.js @@ -4,7 +4,7 @@ import { initialState, mutations } from '@/store/repos.js' import store from './index.spec.js' import { useWorkerStore } from '@/stores' import { createPinia, setActivePinia } from 'pinia' -import { repoSample, reposSample, availableReposSample } from '../samples.js' +import { repoSample, reposSample } from '../samples.js' import { FakeAxios } from '../testhelpers.js' describe('repos', () => { @@ -29,14 +29,10 @@ describe('repos', () => { assert.deepStrictEqual(state.repositories, {}) }) - it('setAvailable', () => { - const state = initialState() - mutations.setAvailable(state, availableReposSample) - assert.deepStrictEqual(state.available, availableReposSample) - }) - it('reset', () => { - const state = { available: availableReposSample } + const state = { + repositories: { repoid: repoSample } + } mutations.reset(state) assert.deepStrictEqual(state, initialState()) }) @@ -95,55 +91,6 @@ describe('repos', () => { }) }) - describe('listAvailable', () => { - it('lists available repositories', async () => { - mock.onGet('/process/repos/search/credid/').reply(200, availableReposSample) - - await store.dispatch('repos/listAvailable', { credential: 'credid' }) - - assert.deepStrictEqual(store.history, [ - { - action: 'repos/listAvailable', - payload: { credential: 'credid' } - }, - { - mutation: 'repos/setAvailable', - payload: availableReposSample - } - ]) - - assert.deepStrictEqual(store.state.repos, { - repositories: {}, - available: availableReposSample - }) - }) - - it('searches with search terms', async () => { - mock.onGet('/process/repos/search/credid/', { params: { search: 'blah' } }).reply(200, availableReposSample) - - await store.dispatch('repos/listAvailable', { credential: 'credid', search: 'blah' }) - - assert.deepStrictEqual(store.history, [ - { - action: 'repos/listAvailable', - payload: { - credential: 'credid', - search: 'blah' - } - }, - { - mutation: 'repos/setAvailable', - payload: availableReposSample - } - ]) - - assert.deepStrictEqual(store.state.repos, { - repositories: {}, - available: availableReposSample - }) - }) - }) - describe('delete', () => { it('deletes a repo', async () => { mock.onDelete('/process/repos/repoid/').reply(204) -- GitLab