diff --git a/changelog/unreleased/enhancement-cern-links b/changelog/unreleased/enhancement-cern-links
new file mode 100644
index 00000000000..daaf5ef8588
--- /dev/null
+++ b/changelog/unreleased/enhancement-cern-links
@@ -0,0 +1,5 @@
+Enhancement: Update CERN links
+
+We've updated the links displayed in the sidebar for CERN's deployment.
+
+https://github.com/owncloud/web/pull/8473
diff --git a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue
index 559f045fefb..dd3ec9169e8 100644
--- a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue
+++ b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue
@@ -87,8 +87,8 @@
/>
-
|
@@ -194,6 +222,7 @@ export default defineComponent({
const copiedDirect = ref(false)
const copiedEos = ref(false)
+ const copiedSamba = ref(false)
const {
copy,
copied,
@@ -207,20 +236,43 @@ export default defineComponent({
const preview = ref(undefined)
const directLink = computed(() => {
- return `${store.getters.configuration.server}files/spaces/personal/home${encodePath(
- unref(resource).path
- )}`
+ return !unref(isPublicLinkContext)
+ ? `${store.getters.configuration.server}files/spaces${encodePath(unref(resource).path)}`
+ : `${store.getters.configuration.server.replace(/\/+$/, '')}${unref(resource).downloadURL}`
})
const copyEosPathToClipboard = () => {
copy(unref(resource).path)
copiedEos.value = unref(copied)
store.dispatch('showMessage', {
- title: $gettext('EOS path copied'),
- desc: $gettext('The EOS path has been copied to your clipboard.')
+ title: $gettext('FUSE path copied'),
+ desc: $gettext('The FUSE path has been copied to your clipboard.')
+ })
+ }
+
+ const copySambaPathToClipboard = () => {
+ copy(getSambaPath(unref(resource).path))
+ copiedSamba.value = unref(copied)
+ store.dispatch('showMessage', {
+ title: $gettext('Windows path copied'),
+ desc: $gettext('The Windows path has been copied to your clipboard.')
})
}
+ const getSambaPath = (path) => {
+ const pathMappings = {
+ user: '\\\\cernbox-smb\\eos\\user\\',
+ project: '\\\\eosproject-smb\\eos\\project\\',
+ public: '\\\\eospublic-smb\\eos\\',
+ media: '\\\\eosmedia-smb\\eos\\'
+ }
+ const pathComponents = path?.split('/').filter(Boolean)
+ if (pathComponents.length > 1 && pathComponents[0] === 'eos') {
+ const translated = pathMappings[pathComponents[1]]
+ return translated && `${translated}${pathComponents.slice(2).join('\\')}`
+ }
+ }
+
const copyDirectLinkToClipboard = () => {
copy(unref(directLink))
copiedDirect.value = unref(copied)
@@ -280,6 +332,8 @@ export default defineComponent({
copiedEos,
preview,
copyEosPathToClipboard,
+ copySambaPathToClipboard,
+ getSambaPath,
copiedDirect,
copyDirectLinkToClipboard,
isClipboardCopySupported,
@@ -305,6 +359,9 @@ export default defineComponent({
runningOnEos() {
return !!this.configuration?.options?.runningOnEos
},
+ cernFeatures() {
+ return !!this.configuration?.options?.cernFeatures
+ },
hasContent() {
return (
this.hasTimestamp ||
@@ -363,7 +420,10 @@ export default defineComponent({
return this.$gettext('Copy direct link')
},
copyEosPathLabel() {
- return this.$gettext('Copy EOS path')
+ return this.$gettext('Copy FUSE path')
+ },
+ copySambaPathLabel() {
+ return this.$gettext('Copy Windows path')
},
resourceSize() {
return formatFileSize(this.resource.size, this.$language.current)
@@ -406,6 +466,9 @@ export default defineComponent({
},
sharedByDisplayName() {
return this.resource.share?.fileOwner.displayName
+ },
+ sambaPath() {
+ return this.getSambaPath(this.resource.path)
}
},
methods: {
diff --git a/packages/web-app-files/tests/unit/components/SideBar/Details/FileDetails.spec.ts b/packages/web-app-files/tests/unit/components/SideBar/Details/FileDetails.spec.ts
index b22de659b64..6c51958307f 100644
--- a/packages/web-app-files/tests/unit/components/SideBar/Details/FileDetails.spec.ts
+++ b/packages/web-app-files/tests/unit/components/SideBar/Details/FileDetails.spec.ts
@@ -15,7 +15,8 @@ const getResourceMock = ({
tags = [],
thumbnail = null,
shareTypes = [],
- share = null
+ share = null,
+ path = '/somePath/someResource'
} = {}) =>
mock({
id: '1',
@@ -26,7 +27,7 @@ const getResourceMock = ({
mdate: 'Wed, 21 Oct 2015 07:28:00 GMT',
tags,
size: '740',
- path: '/somePath/someResource',
+ path,
thumbnail,
shareTypes,
share
@@ -35,6 +36,7 @@ const getResourceMock = ({
const selectors = {
eosPath: '[data-testid="eosPath"]',
eosDirectLink: '[data-testid="eosDirectLink"]',
+ sambaPath: '[data-testid="sambaPath"]',
ownerDisplayName: '[data-testid="ownerDisplayName"]',
preview: '[data-testid="preview"]',
resourceIcon: '.details-icon',
@@ -138,6 +140,13 @@ describe('Details SideBar Panel', () => {
expect(wrapper.find(selectors.eosDirectLink).exists()).toBeTruthy()
})
})
+ describe('CERN features', () => {
+ it('show samba link', () => {
+ const resource = getResourceMock({ path: '/eos/user/t/test/123.png' })
+ const { wrapper } = createWrapper({ resource, cernFeatures: true })
+ expect(wrapper.find(selectors.sambaPath).exists()).toBeTruthy()
+ })
+ })
describe('tags', () => {
it('show if given', () => {
const resource = getResourceMock({ tags: ['moon', 'mars'] })
@@ -160,6 +169,7 @@ describe('Details SideBar Panel', () => {
function createWrapper({
resource = null,
runningOnEos = false,
+ cernFeatures = false,
isPublicLinkContext = false,
ancestorMetaData = {},
user = { id: 'marie' },
@@ -167,7 +177,7 @@ function createWrapper({
} = {}) {
const storeOptions = defaultStoreMockOptions
storeOptions.getters.user.mockReturnValue(user)
- storeOptions.getters.configuration.mockReturnValue({ options: { runningOnEos } })
+ storeOptions.getters.configuration.mockReturnValue({ options: { runningOnEos, cernFeatures } })
storeOptions.modules.Files.getters.versions.mockReturnValue(versions)
storeOptions.getters.capabilities.mockReturnValue({ files: { tags: true } })
storeOptions.modules.Files.getters.ancestorMetaData.mockReturnValue(ancestorMetaData)
|