From 1efa7b4c1d8d85bbf951566372999368f5eed68e Mon Sep 17 00:00:00 2001 From: aina esokia Date: Tue, 5 Jan 2021 15:51:24 +0300 Subject: [PATCH 1/4] PHRAS-3322 add basket action --- .../src/components/record/addToBasket.js | 2 +- .../src/components/ui/workzone/index.js | 43 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Phraseanet-production-client/src/components/record/addToBasket.js b/Phraseanet-production-client/src/components/record/addToBasket.js index 95a31f9b5a..c898896b02 100644 --- a/Phraseanet-production-client/src/components/record/addToBasket.js +++ b/Phraseanet-production-client/src/components/record/addToBasket.js @@ -11,7 +11,7 @@ const addToBasket = (services) => { let dbId = $el.data('db-id'); let recordId = $el.data('record-id'); appEvents.emit('workzone.doAddToBasket', { - dbId, recordId, event: event.currentTarget + dbId, recordId, event: event.currentTarget, singleSelection: true }); }); }; diff --git a/Phraseanet-production-client/src/components/ui/workzone/index.js b/Phraseanet-production-client/src/components/ui/workzone/index.js index 4a399757ff..20a5a4df53 100644 --- a/Phraseanet-production-client/src/components/ui/workzone/index.js +++ b/Phraseanet-production-client/src/components/ui/workzone/index.js @@ -214,11 +214,11 @@ const workzone = (services) => { selection: new Selectable(services, $('#baskets'), {selector: '.CHIM'}), refresh: refreshBaskets, addElementToBasket: function (options) { - let {sbas_id, record_id, event, singleSelection} = options; + let {dbId, recordId, event, singleSelection} = options; singleSelection = !!singleSelection || false; if ($('#baskets .SSTT.active').length === 1) { - return dropOnBask(event, $('#IMGT_' + sbas_id + '_' + record_id), $('#baskets .SSTT.active'), singleSelection); + return dropOnBask(event, $('#IMGT_' + dbId + '_' + recordId), $('#baskets .SSTT.active'), singleSelection); } else { humane.info(localeService.t('noActiveBasket')); } @@ -1129,26 +1129,29 @@ const workzone = (services) => { let publicationId = destKey.attr('data-publication-id'); let exposeName = $('#expose_list').val(); let assetsContainer = destKey.find('.expose_item_deployed'); - assetsContainer.empty().addClass('loading'); - $.ajax({ - type: 'POST', - url: '/prod/expose/publication/add-assets', - data: { - publicationId: publicationId, - exposeName: exposeName, - lst: data.lst - }, - dataType: 'json', - success: function (data) { - setTimeout(function(){ - getPublicationAssetsList(publicationId, exposeName, assetsContainer, 1); - } - , 6000); + if (publicationId !== undefined) { + assetsContainer.empty().addClass('loading'); - console.log(data.message); - } - }); + $.ajax({ + type: 'POST', + url: '/prod/expose/publication/add-assets', + data: { + publicationId: publicationId, + exposeName: exposeName, + lst: data.lst + }, + dataType: 'json', + success: function (data) { + setTimeout(function(){ + getPublicationAssetsList(publicationId, exposeName, assetsContainer, 1); + } + , 6000); + + console.log(data.message); + } + }); + } } } From 56d1374db57f55610af8d2523e77011b5b695c8f Mon Sep 17 00:00:00 2001 From: aina esokia Date: Tue, 5 Jan 2021 15:52:34 +0300 Subject: [PATCH 2/4] PHRAS-3268 delete record from basket --- .../src/components/ui/workzone/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phraseanet-production-client/src/components/ui/workzone/index.js b/Phraseanet-production-client/src/components/ui/workzone/index.js index 20a5a4df53..e347169fef 100644 --- a/Phraseanet-production-client/src/components/ui/workzone/index.js +++ b/Phraseanet-production-client/src/components/ui/workzone/index.js @@ -373,7 +373,7 @@ const workzone = (services) => { }); function WorkZoneElementRemover(el, confirm) { - var context = el.data('context'); + var context = $(el).data('context'); if (confirm !== true && $(el).hasClass('groupings') && warnOnRemove) { var buttons = {}; From b9f07b99645ff586325fa8ec4cadd43d5d5473fa Mon Sep 17 00:00:00 2001 From: aina esokia Date: Tue, 5 Jan 2021 15:55:38 +0300 Subject: [PATCH 3/4] PHRAS-3322 generate dist --- .../dist/production.js | 47 ++++++++++--------- .../dist/production.min.js | 47 ++++++++++--------- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index 2b1c8ef5b3..18b0217bd0 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -10230,15 +10230,15 @@ var workzone = function workzone(services) { selection: new _selectable2.default(services, (0, _jquery2.default)('#baskets'), { selector: '.CHIM' }), refresh: refreshBaskets, addElementToBasket: function addElementToBasket(options) { - var sbas_id = options.sbas_id, - record_id = options.record_id, + var dbId = options.dbId, + recordId = options.recordId, event = options.event, singleSelection = options.singleSelection; singleSelection = !!singleSelection || false; if ((0, _jquery2.default)('#baskets .SSTT.active').length === 1) { - return dropOnBask(event, (0, _jquery2.default)('#IMGT_' + sbas_id + '_' + record_id), (0, _jquery2.default)('#baskets .SSTT.active'), singleSelection); + return dropOnBask(event, (0, _jquery2.default)('#IMGT_' + dbId + '_' + recordId), (0, _jquery2.default)('#baskets .SSTT.active'), singleSelection); } else { humane.info(localeService.t('noActiveBasket')); } @@ -10397,7 +10397,7 @@ var workzone = function workzone(services) { }); function WorkZoneElementRemover(el, confirm) { - var context = el.data('context'); + var context = (0, _jquery2.default)(el).data('context'); if (confirm !== true && (0, _jquery2.default)(el).hasClass('groupings') && warnOnRemove) { var buttons = {}; @@ -11125,25 +11125,28 @@ var workzone = function workzone(services) { var publicationId = destKey.attr('data-publication-id'); var exposeName = (0, _jquery2.default)('#expose_list').val(); var assetsContainer = destKey.find('.expose_item_deployed'); - assetsContainer.empty().addClass('loading'); - _jquery2.default.ajax({ - type: 'POST', - url: '/prod/expose/publication/add-assets', - data: { - publicationId: publicationId, - exposeName: exposeName, - lst: data.lst - }, - dataType: 'json', - success: function success(data) { - setTimeout(function () { - getPublicationAssetsList(publicationId, exposeName, assetsContainer, 1); - }, 6000); + if (publicationId !== undefined) { + assetsContainer.empty().addClass('loading'); - console.log(data.message); - } - }); + _jquery2.default.ajax({ + type: 'POST', + url: '/prod/expose/publication/add-assets', + data: { + publicationId: publicationId, + exposeName: exposeName, + lst: data.lst + }, + dataType: 'json', + success: function success(data) { + setTimeout(function () { + getPublicationAssetsList(publicationId, exposeName, assetsContainer, 1); + }, 6000); + + console.log(data.message); + } + }); + } } } @@ -63419,7 +63422,7 @@ var addToBasket = function addToBasket(services) { var dbId = $el.data('db-id'); var recordId = $el.data('record-id'); appEvents.emit('workzone.doAddToBasket', { - dbId: dbId, recordId: recordId, event: event.currentTarget + dbId: dbId, recordId: recordId, event: event.currentTarget, singleSelection: true }); }); }; diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index 2b1c8ef5b3..18b0217bd0 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -10230,15 +10230,15 @@ var workzone = function workzone(services) { selection: new _selectable2.default(services, (0, _jquery2.default)('#baskets'), { selector: '.CHIM' }), refresh: refreshBaskets, addElementToBasket: function addElementToBasket(options) { - var sbas_id = options.sbas_id, - record_id = options.record_id, + var dbId = options.dbId, + recordId = options.recordId, event = options.event, singleSelection = options.singleSelection; singleSelection = !!singleSelection || false; if ((0, _jquery2.default)('#baskets .SSTT.active').length === 1) { - return dropOnBask(event, (0, _jquery2.default)('#IMGT_' + sbas_id + '_' + record_id), (0, _jquery2.default)('#baskets .SSTT.active'), singleSelection); + return dropOnBask(event, (0, _jquery2.default)('#IMGT_' + dbId + '_' + recordId), (0, _jquery2.default)('#baskets .SSTT.active'), singleSelection); } else { humane.info(localeService.t('noActiveBasket')); } @@ -10397,7 +10397,7 @@ var workzone = function workzone(services) { }); function WorkZoneElementRemover(el, confirm) { - var context = el.data('context'); + var context = (0, _jquery2.default)(el).data('context'); if (confirm !== true && (0, _jquery2.default)(el).hasClass('groupings') && warnOnRemove) { var buttons = {}; @@ -11125,25 +11125,28 @@ var workzone = function workzone(services) { var publicationId = destKey.attr('data-publication-id'); var exposeName = (0, _jquery2.default)('#expose_list').val(); var assetsContainer = destKey.find('.expose_item_deployed'); - assetsContainer.empty().addClass('loading'); - _jquery2.default.ajax({ - type: 'POST', - url: '/prod/expose/publication/add-assets', - data: { - publicationId: publicationId, - exposeName: exposeName, - lst: data.lst - }, - dataType: 'json', - success: function success(data) { - setTimeout(function () { - getPublicationAssetsList(publicationId, exposeName, assetsContainer, 1); - }, 6000); + if (publicationId !== undefined) { + assetsContainer.empty().addClass('loading'); - console.log(data.message); - } - }); + _jquery2.default.ajax({ + type: 'POST', + url: '/prod/expose/publication/add-assets', + data: { + publicationId: publicationId, + exposeName: exposeName, + lst: data.lst + }, + dataType: 'json', + success: function success(data) { + setTimeout(function () { + getPublicationAssetsList(publicationId, exposeName, assetsContainer, 1); + }, 6000); + + console.log(data.message); + } + }); + } } } @@ -63419,7 +63422,7 @@ var addToBasket = function addToBasket(services) { var dbId = $el.data('db-id'); var recordId = $el.data('record-id'); appEvents.emit('workzone.doAddToBasket', { - dbId: dbId, recordId: recordId, event: event.currentTarget + dbId: dbId, recordId: recordId, event: event.currentTarget, singleSelection: true }); }); }; From 576c18c5063d57179df29e08b0d2ececb359297e Mon Sep 17 00:00:00 2001 From: aina esokia Date: Wed, 6 Jan 2021 15:52:14 +0300 Subject: [PATCH 4/4] fix selection in workzone --- Phraseanet-production-client/dist/production.js | 2 ++ Phraseanet-production-client/dist/production.min.js | 2 ++ .../src/components/ui/workzone/index.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index 18b0217bd0..d317a58648 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -10519,7 +10519,9 @@ var workzone = function workzone(services) { uiactive.addClass('ui-state-focus active'); + // reset selection when opening a basket type workzoneOptions.selection.empty(); + appEvents.emit('broadcast.workzoneResultSelection', { asArray: [], serialized: "" }); getContent(uiactive); }, diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index 18b0217bd0..d317a58648 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -10519,7 +10519,9 @@ var workzone = function workzone(services) { uiactive.addClass('ui-state-focus active'); + // reset selection when opening a basket type workzoneOptions.selection.empty(); + appEvents.emit('broadcast.workzoneResultSelection', { asArray: [], serialized: "" }); getContent(uiactive); }, diff --git a/Phraseanet-production-client/src/components/ui/workzone/index.js b/Phraseanet-production-client/src/components/ui/workzone/index.js index e347169fef..d675265329 100644 --- a/Phraseanet-production-client/src/components/ui/workzone/index.js +++ b/Phraseanet-production-client/src/components/ui/workzone/index.js @@ -500,7 +500,9 @@ const workzone = (services) => { uiactive.addClass('ui-state-focus active'); + // reset selection when opening a basket type workzoneOptions.selection.empty(); + appEvents.emit('broadcast.workzoneResultSelection', {asArray:[], serialized:""}); getContent(uiactive);