Skip to content

Commit

Permalink
Merge pull request #1334 from nextcloud/artonge/feat/location_groupin…
Browse files Browse the repository at this point in the history
…g_views

Add location grouping views
  • Loading branch information
skjnldsv authored Feb 24, 2023
2 parents 680bbff + 77df935 commit 541a388
Show file tree
Hide file tree
Showing 61 changed files with 1,503 additions and 179 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,20 @@ jobs:
uses: actions/upload-artifact@v3
if: always()
with:
name: snapshots
name: snapshots_${{ matrix.containers }}
path: cypress/snapshots

- name: Extract NC logs
if: always()
run: docker-compose --project-directory cypress logs > nextcloud.log

- name: Upload NC logs
uses: actions/upload-artifact@v3
if: always()
with:
name: nc_logs_${{ matrix.containers }}
path: nextcloud.log

summary:
runs-on: ubuntu-latest
needs: [init, cypress]
Expand Down
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<commands>
<command>OCA\Photos\Command\UpdateReverseGeocodingFilesCommand</command>
<command>OCA\Photos\Command\MapMediaToLocationCommand</command>
<command>OCA\Photos\Command\MapMediaToPlaceCommand</command>
</commands>

<sabre>
Expand All @@ -46,6 +46,6 @@
</sabre>

<background-jobs>
<job>OCA\Photos\Jobs\AutomaticLocationMapperJob</job>
<job>OCA\Photos\Jobs\AutomaticPlaceMapperJob</job>
</background-jobs>
</info>
8 changes: 8 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
'path' => '',
]
],
['name' => 'page#index', 'url' => '/places/{path}', 'verb' => 'GET', 'postfix' => 'places',
'requirements' => [
'path' => '.*',
],
'defaults' => [
'path' => '',
]
],
[ 'name' => 'publicAlbum#get', 'url' => '/public/{token}', 'verb' => 'GET',
'requirements' => [
'token' => '.*',
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/albums.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ describe('Manage albums', () => {
cy.contains('Save').click()
})

it('Edit an album\'s location', () => {
it('Edit an album\'s place', () => {
cy.get('[aria-label="Open actions menu"]').click()
cy.contains('Edit album details').click()
cy.get('form [name="location"]').clear().type('New location')
cy.get('form [name="place"]').clear().type('New place')
cy.contains('Save').click()

cy.contains('New location')
cy.contains('New place')

cy.reload()

cy.contains('New location')
cy.contains('New place')

cy.get('[aria-label="Open actions menu"]').click()
cy.contains('Edit album details').click()
cy.get('form [name="location"]').clear()
cy.get('form [name="place"]').clear()
cy.contains('Save').click()
})
})
56 changes: 56 additions & 0 deletions cypress/e2e/places.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* @copyright Copyright (c) 2022 Louis Chmn <louis@chmn.me>
*
* @author Louis Chmn <louis@chmn.me>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { uploadTestMedia } from './photosUtils'
import { navigateToPlace, runOccCommand } from './placesUtils'

const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
Cypress.on('uncaught:exception', (err) => {
/* returning false here prevents Cypress from failing the test */
if (resizeObserverLoopErrRe.test(err.message)) {
return false
}
})

describe('Manage places', () => {
before(function() {
cy.createRandomUser()
.then((user) => {
uploadTestMedia(user)
runOccCommand(`photos:map-media-to-place --user ${user.userId}`)
cy.login(user)
cy.visit('/apps/photos')
})
})

beforeEach(() => {
cy.visit('apps/photos/places')
})

it('Check that we detect some places out of the existing files', () => {
cy.get('ul.collections__list li').should('have.length', 4)
})

it('Navigate to place and check that it contains some files', () => {
navigateToPlace('Lauris')
cy.get('[data-test="media"]').should('have.length', 1)
})
})
34 changes: 34 additions & 0 deletions cypress/e2e/placesUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @copyright Copyright (c) 2023 Louis Chmn <louis@chmn.me>
*
* @author Louis Chmn <louis@chmn.me>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

export function navigateToCollection(collectionType: string, collectionName: string) {
cy.get('.app-navigation__list').contains(collectionType).click()
cy.get('ul.collections__list').contains(collectionName).click()
}

export function navigateToPlace(locationName: string) {
navigateToCollection('Places', locationName)
}

export function runOccCommand(command: string) {
cy.exec(`docker exec --user www-data nextcloud-cypress-tests-photos php ./occ ${command}`)
}
4 changes: 0 additions & 4 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,3 @@ Cypress.Commands.add('uploadContent', (user, blob, mimeType, target) => {
}
})
})

Cypress.Commands.add('runOccCommand', (command: string) => {
cy.exec(`docker exec --user www-data nextcloud-cypress-tests-server php ./occ ${command}`)
})
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>
*
* @author Louis Chemineau <louis@chmn.me>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>
*
* @author Louis Chemineau <louis@chmn.me>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_AlbumContent_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_AlbumContent_vue.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions js/photos-src_views_Places_vue.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions js/photos-src_views_Places_vue.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @copyright Copyright (c) 2022 Louis Chemineau <louis@chmn.me>
*
* @author Louis Chemineau <louis@chmn.me>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
Loading

0 comments on commit 541a388

Please sign in to comment.