+
{{ data.repoId }}
{{ data.title }}
{{ data.domain }}
-
+
maven
name {{ gradleId }}
url {{ data.domain }}
-
+
maven
name = {{ gradleId }}
url = uri{{ data.domain }}
-
+
resolvers +=
{{data.repoId}}
at {{data.domain}}
diff --git a/reposilite-frontend/src/components/card/SnippetsCard.vue b/reposilite-frontend/src/components/card/SnippetsCard.vue
index be6c389e3..f15229029 100644
--- a/reposilite-frontend/src/components/card/SnippetsCard.vue
+++ b/reposilite-frontend/src/components/card/SnippetsCard.vue
@@ -19,7 +19,6 @@ import { ref, watch, watchEffect } from 'vue'
import { useClipboard } from '@vueuse/core'
import { createToast } from 'mosha-vue-toastify'
import { useSession } from '../../store/session'
-import useArtifacts from '../../store/maven/artifact'
import useRepository from '../../store/maven/repository'
import useMetadata from '../../store/maven/metadata'
import CopyIcon from '../icons/CopyIcon.vue'
@@ -42,8 +41,7 @@ const configurations = [
{ name: 'SBT', lang: 'scala' }
]
const data = ref({})
-const { createRepositories, createRepositorySnippet } = useRepository()
-const { createArtifactSnippet } = useArtifacts()
+const { createRepositories } = useRepository()
const { parseMetadata } = useMetadata()
const { client } = useSession()
const { copy: copyText, isSupported: isCopySupported } = useClipboard()
@@ -96,13 +94,10 @@ watch(selectedTab, (to, from) => {
transitionName.value = toIndex - fromIndex < 0 ? 'slide-left' : 'slide-right'
})
+const snippetRef = ref()
+
const copy = async () => {
- let snippet = ''
- if (data.value.type === 'artifact') {
- snippet = createArtifactSnippet(selectedTab.value, data.value)
- } else if (data.value.type === 'repository') {
- snippet = createRepositorySnippet(selectedTab.value, data.value)
- }
+ let snippet = snippetRef.value[0].content.trim()
await copyText(snippet)
return createToast('Snippet copied', { type: 'info', timeout: '2000' })
}
@@ -136,11 +131,13 @@ const selectTab = (tab) =>
diff --git a/reposilite-frontend/src/store/maven/artifact.js b/reposilite-frontend/src/store/maven/artifact.js
deleted file mode 100644
index 516ecbb73..000000000
--- a/reposilite-frontend/src/store/maven/artifact.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2023 dzikoysk
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default function useArtifact() {
- const createArtifactSnippet = (lang, { groupId, artifactId, version }) => {
- switch (lang) {
- case "Maven": return `
-
- ${groupId}
- ${artifactId}
- ${version}
-`.trim()
- case "Gradle Groovy": return `implementation "${groupId}:${artifactId}:${version}"`
- case "Gradle Kotlin": return `implementation("${groupId}:${artifactId}:${version}")`
- case "SBT": return `"${groupId}" %% "${artifactId}" %% "${version}"`
- default: return ""
- }
- }
-
- return {
- createArtifactSnippet
- }
-}
\ No newline at end of file
diff --git a/reposilite-frontend/src/store/maven/repository.js b/reposilite-frontend/src/store/maven/repository.js
index 6698499b7..528305ce3 100644
--- a/reposilite-frontend/src/store/maven/repository.js
+++ b/reposilite-frontend/src/store/maven/repository.js
@@ -34,24 +34,7 @@ export default function useRepository() {
return { type: "repository", repoId, title, domain }
}
- const createRepositorySnippet = (name, { repoId, title, domain }) => {
- switch (name) {
- case "Maven": return `
-
- ${repoId}
- ${title}
- ${domain}
-`.trim()
- case "Gradle Groovy": return `maven {\n url "${domain}"\n}`
- case "Gradle Kotlin": return `maven {\n url = uri("${domain}")\n}`
- case "SBT": return `resolvers +=\n "${repoId}" \n at "${domain}"`
- default: return ""
- }
- }
-
-
return {
- createRepositories,
- createRepositorySnippet
+ createRepositories
}
}