-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch config and datasets from backend + run sync (#25)
* Fetch config and datasets from backend * Filter out havested metadata * Run synchronize and show logs * Remove changing primevue locale as it does not works See: primefaces/primevue#6872 * Add route copy_preview * Add confirmation step * Add readonly source platform field * Use dev_config.yaml * Mock vue-i18n * Add spinner and disable button * Rename involvedResources to copyPreview * Skip failing test which dpends on external data
- Loading branch information
1 parent
7c9bdd4
commit 58fda1d
Showing
20 changed files
with
679 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import type { Log } from '@/services/synchronize.service' | ||
defineProps<{ logs: Log[] }>() | ||
const logClass = (status_code: number) => { | ||
if (status_code >= 200 && status_code < 300) { | ||
return 'log-success' | ||
} else { | ||
return 'log-error' | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="mb-4 font-semibold">Logs</div> | ||
<div v-for="(log, index) in logs" :key="index"> | ||
<div v-if="['POST', 'PUT'].includes(log.method!)" :class="logClass(log.status_code!)"> | ||
{{ log.method }} {{ log.url }} | ||
</div> | ||
<div v-if="log.operation" class="log-info">{{ log.operation }}</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.log-info { | ||
background-color: #e0f7fa; /* Bleu clair */ | ||
border-left: 5px solid #039be5; | ||
padding: 10px; | ||
margin-bottom: 5px; | ||
border-radius: 5px; | ||
} | ||
.log-success { | ||
background-color: #e8f5e9; /* Vert pâle */ | ||
border-left: 5px solid #43a047; /* Bordure vert plus foncé */ | ||
padding: 10px; | ||
margin-bottom: 5px; | ||
border-radius: 5px; | ||
} | ||
.log-error { | ||
background-color: #ffebee; /* Rouge clair */ | ||
border-left: 5px solid #d32f2f; | ||
padding: 10px; | ||
margin-bottom: 5px; | ||
border-radius: 5px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { describe, it, expect } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
import LogsReport from '../LogsReport.vue' | ||
|
||
describe('LogsReport', () => { | ||
it('renders properly', () => { | ||
const wrapper = mount(LogsReport, { | ||
props: { | ||
logs: [ | ||
{ | ||
method: 'PUT', | ||
status_code: 200, | ||
url: 'http://proxy:8080/geoserver/rest/styles/point.sld', | ||
}, | ||
], | ||
}, | ||
}) | ||
expect(wrapper.text()).toContain('http://proxy:8080/geoserver/rest/styles/point.sld') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export type Source = { | ||
name: string | ||
url: string | ||
} | ||
|
||
export type Destination = { | ||
name: string | ||
gn_url: string | ||
gs_url: string | ||
} | ||
|
||
export const configService = { | ||
async getSources(): Promise<Source[]> { | ||
const response = await fetch('/maelstro-backend/sources') | ||
return await response.json() | ||
}, | ||
|
||
async getDestinations(): Promise<Destination[]> { | ||
const response = await fetch('/maelstro-backend/destinations') | ||
return await response.json() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
export type SearchResult = { | ||
uuid: string | ||
resourceTitleObject: { | ||
default: string | ||
} | ||
resourceAbstractObject: { | ||
default: string | ||
} | ||
} | ||
|
||
interface GnSource { | ||
uuid: string | ||
resourceTitleObject: { | ||
default: string | ||
} | ||
resourceAbstractObject: { | ||
default: string | ||
} | ||
} | ||
|
||
interface GnHit { | ||
_source: GnSource | ||
} | ||
|
||
export const geonetworkSearchService = { | ||
async search(sourceName: string, query: string): Promise<SearchResult[]> { | ||
// const url = | ||
// 'https://demo.georchestra.org/geonetwork/srv/api/search/records/_search?bucket=bucket' | ||
|
||
const url = `/maelstro-backend/search/${sourceName}` | ||
|
||
const searchResponse = await fetch(url, { | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
query: { | ||
bool: { | ||
must: [ | ||
{ terms: { isTemplate: ['n'] } }, | ||
{ | ||
multi_match: { | ||
query: query, | ||
type: 'bool_prefix', | ||
fields: [ | ||
'resourceTitleObject.*', | ||
'resourceAbstractObject.*', | ||
'tag', | ||
'resourceIdentifier', | ||
], | ||
}, | ||
}, | ||
], | ||
must_not: [ | ||
{ | ||
terms: { | ||
resourceType: ['service', 'map', 'map/static', 'mapDigital'], | ||
}, | ||
}, | ||
{ term: { isHarvested: true } }, | ||
], | ||
}, | ||
}, | ||
_source: ['resourceTitleObject', 'resourceAbstractObject', 'uuid'], | ||
from: 0, | ||
size: 20, | ||
}), | ||
}) | ||
|
||
const hits = (await searchResponse.json()).hits.hits | ||
if (!hits) return [] | ||
|
||
return hits.map((hit: GnHit) => ({ | ||
uuid: hit._source.uuid, | ||
resourceTitleObject: hit._source.resourceTitleObject, | ||
resourceAbstractObject: hit._source.resourceAbstractObject, | ||
})) | ||
}, | ||
} |
Oops, something went wrong.