Skip to content

Commit

Permalink
PHRAS-4069: Prod - expose-cli - search publication and parent publica…
Browse files Browse the repository at this point in the history
…tion (#4515)

* expose cli fix parent publication

* translate and yarn.lock file

* some css fix

* expose search publication title filter

* display nb items

* trigger only from more than 3 character

* do not display publication in to his parent list

* trigger search publication on empty search
  • Loading branch information
aynsix authored Jun 6, 2024
1 parent 45e8f29 commit 80d5c40
Show file tree
Hide file tree
Showing 26 changed files with 1,126 additions and 1,002 deletions.
2 changes: 1 addition & 1 deletion Phraseanet-production-client/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ module.exports = {
setupDir: _root + 'tests/setup/node.js',
karmaConf: _root + 'config/karma.conf.js',
// change this version when you change JS file for lazy loading
assetFileVersion: 105
assetFileVersion: 106
};
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=105";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=106";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/authenticate.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=105";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=106";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=105";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=106";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/commons.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=105";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=106";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
15 changes: 14 additions & 1 deletion Phraseanet-production-client/dist/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -10081,6 +10081,14 @@ var workzone = function workzone(services) {
updatePublicationList(exposeName);
});

(0, _jquery2.default)('#expose_title_filter').on('keyup', function (event) {
if ((0, _jquery2.default)(this).val().length > 2 || (0, _jquery2.default)(this).val().length === 0) {
var exposeName = (0, _jquery2.default)('#expose_list').val();
(0, _jquery2.default)('.publication-list').empty().html('<div style="text-align: center;"><img src="/assets/common/images/icons/main-loader.gif" alt="loading"/></div>');
updatePublicationList(exposeName);
}
});

(0, _jquery2.default)('.refresh-list').on('click', function (event) {
var exposeName = (0, _jquery2.default)('#expose_list').val();
(0, _jquery2.default)('.publication-list').empty().html('<div style="text-align: center;"><img src="/assets/common/images/icons/main-loader.gif" alt="loading"/></div>');
Expand Down Expand Up @@ -11071,7 +11079,8 @@ var workzone = function workzone(services) {
url: '/prod/expose/list-publication/?exposeName=' + exposeName + '&page=' + page,
data: {
mine: (0, _jquery2.default)("#expose_mine_only").is(':checked') ? 1 : 0,
editable: (0, _jquery2.default)("#expose_editable_only").is(':checked') ? 1 : 0
editable: (0, _jquery2.default)("#expose_editable_only").is(':checked') ? 1 : 0,
title: (0, _jquery2.default)("#expose_title_filter").val()
},
success: function success(data) {
if ('twig' in data) {
Expand Down Expand Up @@ -11111,12 +11120,14 @@ var workzone = function workzone(services) {
(0, _jquery2.default)('.expose_connected').empty().text(loggedMessage);
(0, _jquery2.default)('.expose_logout_link').removeClass('hidden');
(0, _jquery2.default)('.expose_field_mapping').removeClass('hidden');
(0, _jquery2.default)('.add_publication').removeClass('hidden');
(0, _jquery2.default)('.add_expose_block').removeClass('hidden');
(0, _jquery2.default)('.expose-pagination').removeClass('hidden');
} else {
(0, _jquery2.default)('.expose_connected').empty();
(0, _jquery2.default)('.expose_logout_link').addClass('hidden');
(0, _jquery2.default)('.expose_field_mapping').addClass('hidden');
(0, _jquery2.default)('.add_publication').addClass('hidden');
(0, _jquery2.default)('.add_expose_block').addClass('hidden');
(0, _jquery2.default)('.expose-pagination').addClass('hidden');
}
Expand Down Expand Up @@ -11146,6 +11157,8 @@ var workzone = function workzone(services) {
if ('error' in data) {
(0, _jquery2.default)('.publication-list').empty().html(data.error);
}

(0, _jquery2.default)('#expose_workzone .nb_item').text(data.nbItems);
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
Expand Down
15 changes: 14 additions & 1 deletion Phraseanet-production-client/dist/production.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -10081,6 +10081,14 @@ var workzone = function workzone(services) {
updatePublicationList(exposeName);
});

(0, _jquery2.default)('#expose_title_filter').on('keyup', function (event) {
if ((0, _jquery2.default)(this).val().length > 2 || (0, _jquery2.default)(this).val().length === 0) {
var exposeName = (0, _jquery2.default)('#expose_list').val();
(0, _jquery2.default)('.publication-list').empty().html('<div style="text-align: center;"><img src="/assets/common/images/icons/main-loader.gif" alt="loading"/></div>');
updatePublicationList(exposeName);
}
});

(0, _jquery2.default)('.refresh-list').on('click', function (event) {
var exposeName = (0, _jquery2.default)('#expose_list').val();
(0, _jquery2.default)('.publication-list').empty().html('<div style="text-align: center;"><img src="/assets/common/images/icons/main-loader.gif" alt="loading"/></div>');
Expand Down Expand Up @@ -11071,7 +11079,8 @@ var workzone = function workzone(services) {
url: '/prod/expose/list-publication/?exposeName=' + exposeName + '&page=' + page,
data: {
mine: (0, _jquery2.default)("#expose_mine_only").is(':checked') ? 1 : 0,
editable: (0, _jquery2.default)("#expose_editable_only").is(':checked') ? 1 : 0
editable: (0, _jquery2.default)("#expose_editable_only").is(':checked') ? 1 : 0,
title: (0, _jquery2.default)("#expose_title_filter").val()
},
success: function success(data) {
if ('twig' in data) {
Expand Down Expand Up @@ -11111,12 +11120,14 @@ var workzone = function workzone(services) {
(0, _jquery2.default)('.expose_connected').empty().text(loggedMessage);
(0, _jquery2.default)('.expose_logout_link').removeClass('hidden');
(0, _jquery2.default)('.expose_field_mapping').removeClass('hidden');
(0, _jquery2.default)('.add_publication').removeClass('hidden');
(0, _jquery2.default)('.add_expose_block').removeClass('hidden');
(0, _jquery2.default)('.expose-pagination').removeClass('hidden');
} else {
(0, _jquery2.default)('.expose_connected').empty();
(0, _jquery2.default)('.expose_logout_link').addClass('hidden');
(0, _jquery2.default)('.expose_field_mapping').addClass('hidden');
(0, _jquery2.default)('.add_publication').addClass('hidden');
(0, _jquery2.default)('.add_expose_block').addClass('hidden');
(0, _jquery2.default)('.expose-pagination').addClass('hidden');
}
Expand Down Expand Up @@ -11146,6 +11157,8 @@ var workzone = function workzone(services) {
if ('error' in data) {
(0, _jquery2.default)('.publication-list').empty().html(data.error);
}

(0, _jquery2.default)('#expose_workzone .nb_item').text(data.nbItems);
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
Expand Down
17 changes: 15 additions & 2 deletions Phraseanet-production-client/src/components/ui/workzone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ const workzone = (services) => {
updatePublicationList(exposeName);
});

$('#expose_title_filter').on('keyup', function (event) {
if ($(this).val().length > 2 || $(this).val().length === 0) {
let exposeName = $('#expose_list').val();
$('.publication-list').empty().html('<div style="text-align: center;"><img src="/assets/common/images/icons/main-loader.gif" alt="loading"/></div>');
updatePublicationList(exposeName);
}
});

$('.refresh-list').on('click',function (event) {
let exposeName = $('#expose_list').val();
$('.publication-list').empty().html('<div style="text-align: center;"><img src="/assets/common/images/icons/main-loader.gif" alt="loading"/></div>');
Expand Down Expand Up @@ -1129,8 +1137,9 @@ const workzone = (services) => {
type: 'GET',
url: '/prod/expose/list-publication/?exposeName=' + exposeName + '&page=' + page,
data:{
mine : $("#expose_mine_only").is(':checked') ? 1 : 0,
editable: $("#expose_editable_only").is(':checked') ? 1 : 0
mine: $("#expose_mine_only").is(':checked') ? 1 : 0,
editable: $("#expose_editable_only").is(':checked') ? 1 : 0,
title: $("#expose_title_filter").val()
},
success: function (data) {
if ('twig' in data) {
Expand Down Expand Up @@ -1171,12 +1180,14 @@ const workzone = (services) => {
$('.expose_connected').empty().text(loggedMessage);
$('.expose_logout_link').removeClass('hidden');
$('.expose_field_mapping').removeClass('hidden');
$('.add_publication').removeClass('hidden');
$('.add_expose_block').removeClass('hidden');
$('.expose-pagination').removeClass('hidden');
} else {
$('.expose_connected').empty();
$('.expose_logout_link').addClass('hidden');
$('.expose_field_mapping').addClass('hidden');
$('.add_publication').addClass('hidden');
$('.add_expose_block').addClass('hidden');
$('.expose-pagination').addClass('hidden');
}
Expand Down Expand Up @@ -1206,6 +1217,8 @@ const workzone = (services) => {
if ('error' in data) {
$('.publication-list').empty().html(data.error);
}

$('#expose_workzone .nb_item').text(data.nbItems);
},
error: function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function listPublicationAction(PhraseaApplication $app, Request $request)
{
$exposeName = $request->get('exposeName');
$page = empty($request->get('page')) ? 1 : $request->get('page');
$title = urlencode($request->get('title'));

if ($exposeName == null) {
return $app->json([
Expand Down Expand Up @@ -240,7 +241,8 @@ public function listPublicationAction(PhraseaApplication $app, Request $request)
$exposeClient = $proxyConfig->getClientWithOptions($clientOptions);

try {
$uri = '/publications?flatten=true&order[createdAt]=desc&page=' . $page;
$uri = '/publications?flatten=true&order[createdAt]=desc&page=' . $page . '&title=' . $title;

if ($request->get('mine') && $exposeConfiguration['connection_kind'] === 'password') {
$uri .= '&mine=true';
}
Expand Down Expand Up @@ -294,9 +296,27 @@ public function listPublicationAction(PhraseaApplication $app, Request $request)
$exposeFrontBasePath = \p4string::addEndSlash($exposeConfiguration['expose_front_uri']);

if ($request->get('format') == 'pub-list') {
$publicationsList = [];
$excludePublication = $request->get('exclude');

$key = 0;
foreach ($publications as $publication) {
if ($excludePublication != $publication['id']) {
$publicationsList[$key]['id'] = $basePath . '/' . $publication['id'];
$publicationsList[$key]['text'] = $publication['title'];
$key++;
}
}

$pagination = ['more' => false];
if ($nextPage) {
$pagination = ['more' => true];
}

return $app->json([
'publications' => $publications,
'basePath' => $basePath
'publications' => $publicationsList,
'basePath' => $basePath,
'pagination' => $pagination
]);
}

Expand All @@ -318,7 +338,8 @@ public function listPublicationAction(PhraseaApplication $app, Request $request)
'exposeLogin' => $session->get($this->getLoginSessionName($exposeName)),
'basePath' => $basePath,
'previousPage' => $previousPage,
'nextPage' => $nextPage
'nextPage' => $nextPage,
'nbItems' => count($publications) . ' / ' . $totalItems
]);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getGlobals()
{
return [
// change this version when you change JS file to force the navigation to reload js file
'assetFileVersion' => 105
'assetFileVersion' => 106
];

}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"npm-modernizr": "^2.8.3",
"pusher-js": "^8.3.0",
"requirejs": "^2.3.5",
"select2": "^4.1.0-rc.0",
"tinymce": "^4.0.28",
"underscore": "^1.8.3",
"zxcvbn": "^4.4.2"
Expand Down
3 changes: 2 additions & 1 deletion resources/gulp/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ gulp.task('build-vendors', [
'build-jquery-test-paths',
'build-simple-colorpicker',
'build-jquery-datetimepicker',
'build-pusher-js'
'build-pusher-js',
'build-select2'
], function () {
});
8 changes: 8 additions & 0 deletions resources/gulp/components/vendors/select2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var gulp = require('gulp');
var config = require('../../config.js');
var utils = require('../../utils.js');

gulp.task('build-select2', [], function(){
return gulp.src([config.paths.nodes + 'select2/**'])
.pipe(gulp.dest(config.paths.build + 'vendors/select2'));
});
Loading

0 comments on commit 80d5c40

Please sign in to comment.