diff --git a/src/api/documentation/documentation.js b/src/api/documentation/documentation.js index bd63dc3b..415fd287 100644 --- a/src/api/documentation/documentation.js +++ b/src/api/documentation/documentation.js @@ -20,10 +20,12 @@ import request from '@/utils/request' import { config } from '@/utils/ADempiere/config' const baseURL = config.documentation.api.url // Fetch releases from repository -export function fetchReleasesList() { +export function fetchReleasesList({ + repository +}) { return request({ baseURL, - url: '/adempiere-vue/releases', + url: repository + '/releases', method: 'get', headers: { 'Accept': 'application/vnd.github.v3+json' diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index cbb660b0..bf51fea3 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -98,7 +98,12 @@ export default { documentation: { documentation: 'Documentation', github: 'Github Repository', - releases: 'Releases' + releases: 'Releases', + branches: 'Branches', + code: 'Code', + issues: 'Issues', + downloadZip: 'Download Zip', + releaseNotes: 'Release Notes' }, permission: { addRole: 'New Role', diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index 2b9d6593..493fbd78 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -98,7 +98,13 @@ export default { documentation: { documentation: 'Documentación', github: 'Repositorio Github', - releases: 'Liberaciones' + releases: 'Liberaciones', + branches: 'Ramas', + code: 'Código', + issues: 'Solicitudes de extracción', + downloadZip: 'descargar Zip', + releaseNotes: 'Nota de Liberaciones' + }, permission: { addRole: 'Nuevo rol', diff --git a/src/router/index.js b/src/router/index.js index 4a2539d9..f3f19f46 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -13,6 +13,7 @@ import tableRouter from './modules/table' import nestedRouter from './modules/nested' import enrollmentRoute from './modules/ADempiere/enrollment.js' +import language from '@/lang' /** * Note: sub-menu only appear when route children.length >= 1 @@ -97,7 +98,7 @@ export const constantRoutes = [ path: 'index', component: () => import('@/views/documentation/index'), name: 'Documentation', - meta: { title: 'documentation', icon: 'documentation', affix: true, isIndex: true } + meta: { title: language.t('documentation.releaseNotes'), icon: 'documentation', affix: true, isIndex: true } } ] }, diff --git a/src/views/documentation/index.vue b/src/views/documentation/index.vue index e598f4a2..10bff1d7 100644 --- a/src/views/documentation/index.vue +++ b/src/views/documentation/index.vue @@ -1,88 +1,332 @@ @@ -99,13 +343,20 @@ export default { return { releasesList: [], activeNames: ['1'], + activeName: 'HTTPS', icon: 'M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z', releaseNotes: { body: '' }, releasesLabel: this.$t('documentation.releases'), - readmeRepositoryGithub: {}, - readmeDocument: {} + proxyDocument: {}, + RepositoryADVue: {}, + RepositoryProxyApi: {}, + RepositorygRPC: {}, + RepositoryADVueSite: {}, + releasesListADVue: [], + releasesListProxyApi: [], + releasesListgRPC: [] } }, computed: { @@ -122,52 +373,46 @@ export default { return 'margin-top: 2%;padding: 0.5%;' }, stopper() { - return this.releasesList.length - 1 + return this.releasesListADVue.length - 1 }, activeListReleases() { - const active = this.releasesList.findIndex(releases => this.releaseNotes.title === releases.title) + const active = this.releasesListADVue.findIndex(releases => this.releaseNotes.title === releases.title) return active }, linkReleases() { - return this.readmeRepositoryGithub.href + '/releases' + return this.RepositoryADVue.href + '/releases' } }, created() { this.loadReleasesList() }, methods: { - fetchDocument() { - fetchReadme({ - repository: 'adempiere-vue-site' - }) - .then(response => { - this.readmeDocument = { - title: response.name, - href: response.html_url, - description: response.description, - avatar: response.organization.avatar_url - } - }) - }, - fetchRepository() { + // ADempiere Vue + fetchRepositoryADVue() { fetchReadme({ repository: 'adempiere-vue' }) .then(response => { - this.readmeRepositoryGithub = { + this.RepositoryADVue = { title: response.name, href: response.html_url, description: response.description, - avatar: response.organization.avatar_url + avatar: response.organization.avatar_url, + clone: response.clone_url, + sshUrl: response.ssh_url, + branches: response.branches_url, + downloadZip: response.html_url + '/archive/refs/heads/' + response.default_branch + '.zip' } }) }, fechReleases() { - fetchReleasesList() + fetchReleasesList({ + repository: '/adempiere-vue' + }) .then(response => { if (response) { response.forEach(release => { - this.releasesList.push({ + this.releasesListADVue.push({ title: release.name, href: release.html_url, author: release.author.login, @@ -177,21 +422,145 @@ export default { titleDownload: release.assets[0].name }) }) - if (config.repository.releaseNo !== undefined && this.releasesList.length > 0) { - this.releaseNotes = this.releasesList.find(release => { + if (config.repository.releaseNo !== undefined && this.releasesListADVue.length > 0) { + this.releaseNotes = this.releasesListADVue.find(release => { return release.title === config.repository.releaseNo }) if (!this.releaseNotes) { - this.releaseNotes = this.releasesList[0] + this.releaseNotes = this.releasesListADVue[0] + } + } + } + }) + console.log(this.releasesListADVue) + }, + // Proxy Adempiere Api + fetchRepositoryProxy() { + fetchReadme({ + repository: 'proxy-adempiere-api' + }) + .then(response => { + this.RepositoryProxyApi = { + title: response.name, + href: response.html_url, + description: response.description, + avatar: response.organization.avatar_url, + clone: response.clone_url, + sshUrl: response.ssh_url, + branches: response.branches_url, + downloadZip: response.html_url + '/archive/refs/heads/' + response.default_branch + '.zip' + } + }) + }, + fechReleasesProxy() { + fetchReleasesList({ + repository: '/proxy-adempiere-api' + }) + .then(response => { + if (response) { + response.forEach(release => { + this.releasesListProxyApi.push({ + title: release.name, + href: release.html_url, + author: release.author.login, + body: release.body, + created_at: release.created_at, + download: this.isEmptyValue(release.assets) ? release.assets : release.assets[0].browser_download_url, + titleDownload: this.isEmptyValue(release.assets) ? release.assets : release.assets[0].name + }) + }) + if (config.repository.releaseNo !== undefined && this.releasesListProxyApi.length > 0) { + this.releaseNotes = this.releasesListProxyApi.find(release => { + return release.title === config.repository.releaseNo + }) + if (!this.releaseNotes) { + this.releaseNotes = this.releasesListProxyApi[0] } } } }) }, + // Adempiere gRPC Server + fetchRepositoryGRPC() { + fetchReadme({ + repository: 'adempiere-gRPC-Server' + }) + .then(response => { + this.RepositorygRPC = { + title: response.name, + href: response.html_url, + description: response.description, + avatar: response.organization.avatar_url, + clone: response.clone_url, + sshUrl: response.ssh_url, + branches: response.branches_url, + downloadZip: response.html_url + '/archive/refs/heads/' + response.default_branch + '.zip' + } + }) + }, + fechReleasesgRPC() { + fetchReleasesList({ + repository: '/adempiere-gRPC-Server' + }) + .then(response => { + if (response) { + response.forEach(release => { + this.releasesListgRPC.push({ + title: this.isEmptyValue(release.name) ? release.tag_name : release.name, + href: release.html_url, + author: release.author.login, + body: release.body, + created_at: release.created_at, + download: release.assets[0].browser_download_url, + titleDownload: release.assets[0].name + }) + }) + if (config.repository.releaseNo !== undefined && this.releasesListgRPC.length > 0) { + this.releaseNotes = this.releasesListgRPC.find(release => { + return release.title === config.repository.releaseNo + }) + if (!this.releaseNotes) { + this.releaseNotes = this.releasesListgRPC[0] + } + } + } + }) + }, + // load loadReleasesList() { - this.fetchDocument() - this.fetchRepository() + // Repository + this.fetchRepositoryADVue() + this.fetchRepositoryProxy() + this.fetchRepositoryGRPC() + // Releases this.fechReleases() + this.fechReleasesProxy() + this.fechReleasesgRPC() + }, + // fallback Copy Text To Clip board + fallbackCopyTextToClipboard(text) { + const textArea = document.createElement('textarea') + textArea.value = text + document.body.appendChild(textArea) + textArea.focus() + textArea.select() + try { + if (document.execCommand('copy')) { + this.clipboardMessage(this.$t('notifications.copySuccessful')) + } + } catch (err) { + this.clipboardMessage(this.$t('notifications.copyUnsuccessful')) + } + document.body.removeChild(textArea) + }, + // Notification Message when Copying TextNotification Message when Copying Text + clipboardMessage(message) { + this.$message({ + message: message, + type: 'success', + showClose: true, + duration: 1500 + }) } } }