Skip to content
Snippets Groups Projects
Commit 492acd82 authored by ml bonhomme's avatar ml bonhomme :bee: Committed by Erwan Rouchet
Browse files

Remove Repository Processes

parent 6319d678
No related branches found
No related tags found
1 merge request!1647Remove Repository Processes
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)
......
......@@ -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 }} &middot; <small>{{ process.revision.author }}</small><br />
</div>
<div class="column" v-if="process.farm">
<strong>Farm</strong><br />{{ process.farm.name }}
</div>
......
......@@ -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',
......
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)
......
......@@ -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',
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment