ViisonCommonApp.addSnippetNamespaces({"backend\/viison_common_compatibility_check\/main":{"check\/notification\/additionalinformation":"Mehr Informationen","check\/notification\/message":"Das Plugin [0] erfordert Version >= [1] des Plugins [2]. Bitte aktualisieren Sie das Plugin.","check\/notification\/title":"Plugin Kompatibilit\u00e4t"}});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonCompatibilityCheck.view.Menu', {
override: 'Shopware.apps.Index.view.Menu',
/* @Override */
initComponent: function () {
// Trigger the compatibility check 500 ms after the menu was created
this.on('menu-created', function () {
window.setTimeout(this.viisonCommonPerformCompatibilityCheck.bind(this), 500);
}, this);
return this.callParent(arguments);
},
/**
* Checks for any plugin compatibility issues and displays them
* as growl messages.
*/
viisonCommonPerformCompatibilityCheck: function () {
Ext.Ajax.request({
url: ViisonCommonApp.assembleBackendUrl('ViisonCommonCompatibilityCheck/getCompatibilityIssues'),
scope: this,
success: function (response) {
var responseData = Ext.JSON.decode(response.responseText, true);
if (!responseData.success) {
return;
}
// Display compatibility issues as growl message.
// Each issue is displayed in its own growl message
var compatibilityIssues = responseData.data;
if (compatibilityIssues !== null) {
Ext.Array.forEach(compatibilityIssues, function (growl) {
Shopware.Notification.createStickyGrowlMessage({
title: ViisonCommonApp.getSnippet('check/notification/title', 'backend/viison_common_compatibility_check/main'),
text: growl.message,
// Add additional button if link and title are given
btnDetail: (growl.detailButton) ? {
text: growl.detailButton.title,
callback: function () {
// Open the link
window.open(growl.detailButton.link, '_blank');
},
} : '',
});
}, this);
}
},
});
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonCompatibilityCheck', {
/**
* Extends from the general sub-application controller, which handles
* the sub-application behavior and the event bus.
*/
extend: 'Enlight.app.SubApplication',
/**
* The name of the module.
*/
name: 'Shopware.apps.ViisonCommonCompatibilityCheck',
});
ViisonCommonApp.addSnippetNamespaces({"backend\/viison_common_migration\/main":{"dialog\/error\/body":"Folgender unerwarteter Fehler ist aufgetreten:","dialog\/error\/title":"Ein unerwarteter Fehler ist aufgetreten","errorWindow\/button\/disablePlugins\/confirmation\/text":"Wollen Sie wirklich die Migrationen \u00fcberspringen und damit die betroffenen Plugins deaktivieren?","errorWindow\/button\/disablePlugins\/confirmation\/title":"Plugins wirklich deaktivieren?","errorWindow\/button\/disablePlugins\/text":"Abbrechen und Plugins deaktivieren","errorWindow\/button\/reloadBackend\/text":"Backend neuladen","errorWindow\/button\/retry\/text":"Erneut versuchen","errorWindow\/description\/header":"Migrationsfehler aufgetreten!","errorWindow\/description\/paragraph":"F\u00fcr mindestens ein Plugin sind Migrationen fehlgeschlagen:","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/error\/text":"Kopieren der Fehlerdetails in diesem Browser nicht m\u00f6glich. Bitte klicken Sie auf die Lupe und kopieren Sie die Details manuell in die Zwischenablage.","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/error\/title":"Fehler","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/success\/text":"Fehlerdetails wurden in die Zwischenablage kopiert.","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/growlMessage\/success\/title":"Details in Zwischenablage kopiert","errorWindow\/migrationSetList\/actionColumn\/copyDetails\/toolTip":"Fehlerdetails in die Zwischenablage kopieren","errorWindow\/migrationSetList\/actionColumn\/showDetails\/dialog\/title":"Fehlerdetails","errorWindow\/migrationSetList\/actionColumn\/showDetails\/toolTip":"Fehlerdetails anzeigen","errorWindow\/migrationSetList\/column\/errorMessage\/text":"Fehlermeldung","errorWindow\/migrationSetList\/column\/errorMessage\/value\/noError":"Kein Fehler aufgetreten\/i>","errorWindow\/migrationSetList\/column\/pluginName\/text":"Plugin","errorWindow\/migrationSetList\/column\/remaining\/text":"Ausstehend","errorWindow\/migrationSetList\/column\/remaining\/toolTip":"Anzahl noch ausstehender Migrationen","errorWindow\/migrationSetList\/column\/successful\/text":"Erfolgreich","errorWindow\/migrationSetList\/column\/successful\/toolTip":"Anzahl erfolgreicher Migrationen","errorWindow\/migrationSetList\/header":"Hinweise zu den durchgef\u00fchrten Migrationen","errorWindow\/title":"Shopware-Update erkannt","growlMessage\/successfulMigration\/text":"Dadurch ergeben sich \u00c4nderungen an ihren Plugins","growlMessage\/successfulMigration\/title":"Shopware Update erkannt","loadMask\/disablingPlugins":"Deaktiviere betroffene Plugins ...","loadMask\/reloadingBackend":"Lade Backend neu ...","migrationLog\/clearedCaches":"Geleerte Caches:","migrationLog\/disabledPlugins":"Meldungen von deaktivierten Plugins:","successWindow\/button\/close\/text":"Schlie\u00dfen","successWindow\/description\/header":"Migrationen wurden erfolgreich durchgef\u00fchrt!","successWindow\/description\/paragraph":"Bitte beachten Sie dazu folgende Hinweise:","successWindow\/title":"Shopware-Update erkannt"}});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.component.MigrationLog', {
extend: 'Ext.form.field.TextArea',
mixins: [
'Shopware.apps.ViisonCommonApp.Mixin',
],
viisonSnippetNamespace: 'backend/viison_common_migration/main',
readOnly: true,
cls: 'is--viison-common--textarea viison_common_migration-component-migration_log',
style: {
fontFamily: 'Arial, Verdana, sans-serif',
},
migrationExecutionResult: null,
initComponent: function () {
this.callParent(arguments);
this.setValueFromMigrationExecutionResult(this.migrationExecutionResult);
},
/**
* Fills the content with the log for a MigrationExecutionResult
*
* @param {Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult} migrationExecutionResult
*/
setValueFromMigrationExecutionResult: function (migrationExecutionResult) {
if (!migrationExecutionResult) {
this.setValue('');
}
var log = '';
log += migrationExecutionResult.getMessages().join('\n\n');
log += '\n\n' + this.getViisonSnippet('migrationLog/clearedCaches') + '\n';
log += migrationExecutionResult.getInvalidatedCaches().join(', ');
this.setValue(log);
},
/**
* Extends the content with the log for a pluginDisablingResult
*
* @param {object} pluginDisablingResultData
*/
appendPluginDisablingResultData: function (pluginDisablingResultData) {
var log = this.getValue();
log += '\n\n' + this.getViisonSnippet('migrationLog/disabledPlugins') + '\n';
log += pluginDisablingResultData.messages.join('\n');
log += '\n\n' + this.getViisonSnippet('migrationLog/clearedCaches') + '\n';
log += pluginDisablingResultData.invalidatedCaches.join(', ');
this.setValue(log);
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.controller.Main', {
extend: 'Ext.app.Controller',
mixins: [
'Shopware.apps.ViisonCommonApp.Mixin',
],
viisonSnippetNamespace: 'backend/viison_common_migration/main',
/**
* @Override
*/
init: function () {
this.callParent(arguments);
this.control({
'viison_common_migration-error_window': {
clickDisablePluginsButton: this.onClickDisablePluginsButton,
clickReloadBackendButton: this.onClickReloadBackendButton,
retry: this.onRetry,
},
});
this.executeMigrations();
},
/**
* Sends a request to the server to execute all executable migrations
*/
executeMigrations: function () {
var fiveMinutesInMilliseconds = 5 * 60 * 1000;
var tenSecondsInMilliseconds = 10 * 1000;
// The max execution time of the migration framework is 5 minutes. Therefore allow 5 minutes plus 10 seconds
// (to handle the request/response boilerplate) for the request.
var timeoutInMilliseconds = fiveMinutesInMilliseconds + tenSecondsInMilliseconds;
Ext.Ajax.request({
url: ViisonCommonApp.assembleBackendUrl('ViisonCommonMigration/executeMigrations'),
scope: this,
timeout: timeoutInMilliseconds,
success: function (response) {
var responseData = Ext.JSON.decode(response.responseText, true);
if (!responseData || !responseData.success) {
this.showErrorDialogForFailedRequest(response);
}
var migrationExecutionResultStore = Ext.create('Shopware.apps.ViisonCommonMigration.store.MigrationExecutionResult');
migrationExecutionResultStore.loadData([responseData.data]);
var migrationExecutionResult = migrationExecutionResultStore.first();
this.clearCaches(migrationExecutionResult.getInvalidatedCaches());
if (migrationExecutionResult.hasExecutableMigrations()) {
// If the migration store has executable migrations AFTER the execution, it means there went s.th.
// wrong
this.showErrorWindow(migrationExecutionResult);
return;
}
if (migrationExecutionResult.getMessages().length === 0) {
// The sub app should be absolutely quiet if no migrations has a message to be shown to the user
return;
}
Shopware.Notification.createStickyGrowlMessage({
title: this.getViisonSnippet('growlMessage/successfulMigration/title'),
text: this.getViisonSnippet('growlMessage/successfulMigration/text'),
btnDetail: {
callback: function () {
this.showSuccessWindow(migrationExecutionResult);
},
scope: this,
},
});
},
failure: function (response) {
this.showErrorDialogForFailedRequest(response);
},
});
},
/**
* Sends a requests to the server to clear Shopware caches.
*
* @param {string[]} caches The names of the caches to clear
*/
clearCaches: function (caches) {
if (caches.length === 0) {
return;
}
var requestParams = {};
caches.forEach(function (cache) {
requestParams[cache] = 'on';
});
Ext.Ajax.request({
url: ViisonCommonApp.assembleBackendUrl('Cache/clearCache'),
method: 'post',
params: caches,
success: function (response) {
var responseData = Ext.JSON.decode(response.responseText);
if (!responseData.success) {
this.showErrorDialogForFailedRequest(response);
}
if (caches.indexOf('theme') >= 0 || caches.indexOf('frontend') >= 0) {
Shopware.app.Application.fireEvent('shopware-theme-cache-warm-up-request');
}
},
failure: function (response) {
this.showErrorDialogForFailedRequest(response);
},
scope: this,
});
},
/**
* Shows the error window for a MigrationExecutionResult
*
* @param {Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult} migrationExecutionResult
*/
showErrorWindow: function (migrationExecutionResult) {
Ext.create('Shopware.apps.ViisonCommonMigration.view.error.Window', {
migrationExecutionResult: migrationExecutionResult,
subApp: this.subApplication,
});
},
/**
* Shows the success window for a MigrationExecutionResult
*
* @param {Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult} migrationExecutionResult
*/
showSuccessWindow: function (migrationExecutionResult) {
Ext.create('Shopware.apps.ViisonCommonMigration.view.success.Window', {
migrationExecutionResult: migrationExecutionResult,
});
},
/**
* Handles event when the user clicks the 'disable plugins' button
*
* @param {Shopware.apps.ViisonCommonMigration.view.error.Window} migrationWindow
*/
onClickDisablePluginsButton: function (migrationWindow) {
this.getViisonSnippet('loadMask/disablingPlugins');
Ext.Ajax.request({
url: ViisonCommonApp.assembleBackendUrl('ViisonCommonMigration/disablePluginsWithExecutableMigrations'),
success: function (response) {
var responseData = Ext.JSON.decode(response.responseText, true);
if (!responseData.success) {
this.showError(responseData.message);
}
this.clearCaches(responseData.data.invalidatedCaches);
migrationWindow.migrationLog.appendPluginDisablingResultData(responseData.data);
migrationWindow.reloadBackendButton.show();
migrationWindow.disablePluginsButton.hide();
migrationWindow.retryButton.hide();
},
failure: function (response) {
this.showError(response.statusText);
},
callback: function () {
migrationWindow.setLoading(false);
},
scope: this,
});
},
/**
* Handles event when the user clicks the 'reload backend' button
*
* @param {Shopware.apps.ViisonCommonMigration.view.error.Window} migrationWindow
*/
onClickReloadBackendButton: function (migrationWindow) {
this.reloadBackend(migrationWindow);
},
/**
* Handles event when the user clicks the 'retry' button
*
* @param {Shopware.apps.ViisonCommonMigration.view.error.Window} migrationWindow
*/
onRetry: function (migrationWindow) {
// When the backend is reloaded, all failed migrations will be retried
this.reloadBackend(migrationWindow);
},
/**
* Reloads the backend and shows a loading mask about that in the given window.
*
* @param {Ext.window.Window} window
*/
reloadBackend: function (window) {
window.setLoading(this.getViisonSnippet('loadMask/reloadingBackend'));
// eslint-disable-next-line no-restricted-globals
location.reload();
},
/**
* @param {XMLHttpRequest} XMLHttpRequest
*/
showErrorDialogForFailedRequest: function (XMLHttpRequest) {
var errorMessage = this.getErrorMessageFromXMLHttpRequest(XMLHttpRequest);
var dialogMessage = this.getViisonSnippet('dialog/error/body') + '\n\n' + errorMessage;
Ext.Msg.show({
title: this.getViisonSnippet('dialog/error/title'),
msg: dialogMessage,
buttons: Ext.Msg.OK,
icon: Ext.Msg.ERROR,
});
},
/**
* @param {XMLHttpRequest} XMLHttpRequest
*/
getErrorMessageFromXMLHttpRequest: function (XMLHttpRequest) {
var json = Ext.JSON.decode(XMLHttpRequest.responseText, true);
if (json) {
if (json.success) {
return '';
}
return json.message;
}
return XMLHttpRequest.statusText + '\n\n' + XMLHttpRequest.responseText;
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.model.ManifestedMigration', {
extend: 'Ext.data.Model',
alternateClassName: 'ViisonManifestedMigration',
statics: {
STATUS_COMPLETED: 'completed',
STATUS_FAILED: 'failed',
STATUS_PENDING: 'pending',
},
fields: [
{ name: 'migrationSetId', type: 'int' },
{ name: 'name', type: 'string' },
{ name: 'status', type: 'string' },
{ name: 'canExecute', type: 'boolean' },
{ name: 'exceptionMessage', type: 'string', useNull: true },
{ name: 'exceptionDetails', type: 'string', useNull: true },
],
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'int' },
{ name: 'migrationTranscript', type: 'auto' },
],
associations: [{
type: 'hasMany',
model: 'Shopware.apps.ViisonCommonMigration.model.MigrationSet',
associationKey: 'migrationSets',
name: 'getMigrationSets',
foreignKey: 'migrationExecutionResultId',
primaryKey: 'id',
}],
/**
* @returns {string[]}
*/
getInvalidatedCaches: function () {
return this.get('migrationTranscript').invalidatedCaches;
},
/**
* @returns {string[]}
*/
getMessages: function () {
return this.get('migrationTranscript').messages;
},
/**
* @returns {boolean}
*/
hasExecutableMigrations: function () {
var migrationSets = this.getMigrationSets();
for (var i = 0; i migrationSets.count(); i += 1) {
if (migrationSets.getAt(i).get('hasExecutableMigrations')) {
return true;
}
}
return false;
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.model.MigrationSet', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'int' },
{ name: 'migrationExecutionResultId', type: 'int', useNull: true, default: null },
{ name: 'name', type: 'string' },
{ name: 'hasExecutableMigrations', type: 'boolean' },
],
associations: [{
type: 'hasMany',
model: 'Shopware.apps.ViisonCommonMigration.model.ManifestedMigration',
associationKey: 'migrations',
name: 'getMigrations',
foreignKey: 'migrationSetId',
primaryKey: 'id',
}],
/**
* @returns {Shopware.apps.ViisonCommonMigration.model.ManifestedMigration[]}
*/
getExecutableMigrations: function () {
return this.getMigrations().getRange().filter(function (migration) {
return migration.get('canExecute');
});
},
/**
* @returns {Shopware.apps.ViisonCommonMigration.model.ManifestedMigration}
*/
getFailedMigration: function () {
var failedMigration = null;
this.getMigrations().getRange().forEach(function (migration) {
if (migration.get('status') === ViisonManifestedMigration.STATUS_FAILED) {
failedMigration = migration;
return false;
}
return true;
});
return failedMigration;
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.store.MigrationExecutionResult', {
extend: 'Ext.data.Store',
model: 'Shopware.apps.ViisonCommonMigration.model.MigrationExecutionResult',
/**
* @override
*/
loadData: function (MigrationExecutionResultData, append) {
if (!append) {
this.removeAll();
}
MigrationExecutionResultData.forEach(function (migrationExecutionResultData) {
var migrationExecutionResult = Ext.create(this.model, migrationExecutionResultData);
migrationExecutionResult.getMigrationSetsStore = Ext.create(
'Shopware.apps.ViisonCommonMigration.store.MigrationSet'
);
migrationExecutionResult.getMigrationSets().loadData(migrationExecutionResultData.migrationSets);
this.add(migrationExecutionResult);
}, this);
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.store.MigrationSet', {
extend: 'Ext.data.Store',
model: 'Shopware.apps.ViisonCommonMigration.model.MigrationSet',
sorters: [
{ property: 'name' },
],
/**
* @override
*/
loadData: function (migrationSetsData, append) {
if (!append) {
this.removeAll();
}
migrationSetsData.forEach(function (migrationSetData) {
var migrationSet = Ext.create(this.model, migrationSetData);
migrationSet.getMigrations().loadData(migrationSetData.migrations);
this.add(migrationSet);
}, this);
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.view.error.List', {
extend: 'Ext.grid.Panel',
mixins: [
'Shopware.apps.ViisonCommonApp.Mixin',
],
viisonSnippetNamespace: 'backend/viison_common_migration/main',
cls: 'viison-common--grid',
/**
* @override
*/
initComponent: function () {
this.columns = this.createColumns();
this.callParent(arguments);
},
/**
* @returns {object[]}
*/
createColumns: function () {
return [
{
text: this.getViisonSnippet('errorWindow/migrationSetList/column/pluginName/text'),
dataIndex: 'name',
width: 150,
sortable: false,
},
{
text: this.getViisonSnippet('errorWindow/migrationSetList/column/successful/text'),
width: 75,
tooltip: this.getViisonSnippet('errorWindow/migrationSetList/column/successful/toolTip'),
sortable: false,
renderer: function (value, meta, record) {
return record.getMigrations().count() - record.getExecutableMigrations().length;
},
},
{
text: this.getViisonSnippet('errorWindow/migrationSetList/column/remaining/text'),
width: 75,
tooltip: this.getViisonSnippet('errorWindow/migrationSetList/column/remaining/toolTip'),
sortable: false,
renderer: function (value, meta, record) {
return record.getExecutableMigrations().length;
},
},
{
text: this.getViisonSnippet('errorWindow/migrationSetList/column/errorMessage/text'),
dataIndex: 'exceptionMessage',
flex: 1,
sortable: false,
renderer: function (value, meta, record) {
var failedMigration = record.getFailedMigration();
if (failedMigration) {
return failedMigration.get('exceptionMessage');
}
return this.getViisonSnippet('errorWindow/migrationSetList/column/errorMessage/value/noError');
},
scope: this,
},
{
xtype: 'actioncolumn',
width: 48,
items: this.createActionColumnItems(),
},
];
},
/**
* @returns {object[]}
*/
createActionColumnItems: function () {
var getClassFunction = function (value, metadata, record) {
if (record.getFailedMigration()) {
return '';
}
return 'x-hidden';
};
return [{
iconCls: 'sprite-magnifier',
tooltip: this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/showDetails/toolTip'),
getClass: getClassFunction,
handler: function (view, rowIndex, colIndex, item, ops, record) {
Ext.Msg.alert(
this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/showDetails/dialog/title'),
record.getFailedMigration().get('exceptionDetails')
);
},
scope: this,
}, {
iconCls: 'sprite-document-copy',
tooltip: this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/showDetails/toolTip'),
getClass: getClassFunction,
handler: function (view, rowIndex, colIndex, item, ops, record) {
var textArea = document.createElement('textarea');
textArea.value = record.getFailedMigration().get('exceptionDetails');
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
Shopware.Msg.createGrowlMessage(
this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/success/title'),
this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/success/text'),
'Pickware'
);
} catch (err) {
Shopware.Msg.createGrowlMessage(
this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/error/title'),
this.getViisonSnippet('errorWindow/migrationSetList/actionColumn/copyDetails/growlMessage/error/text'),
'Pickware'
);
}
document.body.removeChild(textArea);
},
scope: this,
}];
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.view.error.Window', {
extend: 'Enlight.app.Window',
alias: 'widget.viison_common_migration-error_window',
mixins: [
'Shopware.apps.ViisonCommonApp.Mixin',
],
viisonSnippetNamespace: 'backend/viison_common_migration/main',
autoShow: true,
minimizable: false,
layout: {
type: 'vbox',
align: 'stretch',
pack: 'start',
},
height: '70%',
width: 900,
modal: true,
migrationExecutionResult: null,
/**
* @override
*/
initComponent: function () {
this.title = this.getViisonSnippet('errorWindow/title');
this.items = [
this.createHelpContainer(),
this.createMigrationsList(),
this.createMigrationLogContainer(),
];
this.buttons = this.createButtons();
this.callParent(arguments);
},
/**
* @returns {(Ext.button.Button)[]}
*/
createButtons: function () {
this.disablePluginsButton = Ext.create('Ext.button.Button', {
text: this.getViisonSnippet('errorWindow/button/disablePlugins/text'),
cls: 'secondary',
handler: function () {
Ext.Msg.confirm(
this.getViisonSnippet('errorWindow/button/disablePlugins/confirmation/title'),
this.getViisonSnippet('errorWindow/button/disablePlugins/confirmation/text'),
function (selection) {
if (selection === 'yes') {
this.fireEvent('clickDisablePluginsButton', this);
}
},
this
);
},
scope: this,
});
this.reloadBackendButton = Ext.create('Ext.button.Button', {
text: this.getViisonSnippet('errorWindow/button/reloadBackend/text'),
cls: 'primary',
hidden: true,
handler: function () {
this.fireEvent('clickReloadBackendButton', this);
},
scope: this,
});
this.retryButton = Ext.create('Ext.button.Button', {
text: this.getViisonSnippet('errorWindow/button/retry/text'),
cls: 'primary',
handler: function () {
this.fireEvent('retry', this);
},
scope: this,
});
return [
this.disablePluginsButton,
this.reloadBackendButton,
this.retryButton,
];
},
/**
* @returns {object}
*/
createHelpContainer: function () {
return {
xtype: 'container',
cls: 'viison-common--explanation-area',
anchor: '100%',
items: [
{
xtype: 'container',
cls: 'is--header',
html: this.getViisonSnippet('errorWindow/description/header'),
},
{
xtype: 'container',
cls: 'is--paragraph',
html: this.getViisonSnippet('errorWindow/description/paragraph'),
},
],
};
},
/**
* @returns {Shopware.apps.ViisonCommonMigration.view.error.List}
*/
createMigrationsList: function () {
this.migrationsList = Ext.create('Shopware.apps.ViisonCommonMigration.view.error.List', {
store: this.migrationExecutionResult.getMigrationSets(),
height: 100,
anchor: '100%',
});
return this.migrationsList;
},
/**
* @returns {object}
*/
createMigrationLogContainer: function () {
return {
xtype: 'container',
flex: 1,
anchor: '100%',
layout: 'border',
items: [
{
xtype: 'container',
region: 'north',
cls: 'viison-common--explanation-area',
items: [
{
xtype: 'container',
cls: 'is--header is--last',
html: this.getViisonSnippet('errorWindow/migrationSetList/header'),
},
],
},
this.createMigrationLog(),
],
};
},
/**
* @returns {Shopware.apps.ViisonCommonMigration.component.MigrationLog}
*/
createMigrationLog: function () {
this.migrationLog = Ext.create('Shopware.apps.ViisonCommonMigration.component.MigrationLog', {
region: 'center',
migrationExecutionResult: this.migrationExecutionResult,
});
return this.migrationLog;
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration.view.success.Window', {
extend: 'Enlight.app.Window',
mixins: [
'Shopware.apps.ViisonCommonApp.Mixin',
],
viisonSnippetNamespace: 'backend/viison_common_migration/main',
autoShow: true,
layout: 'border',
height: '60%',
width: 900,
migrationExecutionResult: null,
/**
* @Override
*/
initComponent: function () {
this.title = this.getViisonSnippet('successWindow/title');
this.items = [
this.createHelpContainer(),
this.createMigrationLog(),
];
this.buttons = this.createButtons();
this.callParent(arguments);
},
/**
* @returns {object}
*/
createHelpContainer: function () {
return {
xtype: 'container',
cls: 'viison-common--explanation-area',
region: 'north',
items: [
{
xtype: 'container',
cls: 'is--header',
html: this.getViisonSnippet('successWindow/description/header'),
},
{
xtype: 'container',
cls: 'is--paragraph',
html: this.getViisonSnippet('successWindow/description/paragraph'),
},
],
};
},
/**
* @returns {object[]}
*/
createButtons: function () {
return [{
xtype: 'button',
text: this.getViisonSnippet('successWindow/button/close/text'),
cls: 'primary',
handler: function () {
this.close();
},
scope: this,
}];
},
/**
* @returns {Shopware.apps.ViisonCommonMigration.component.MigrationLog}
*/
createMigrationLog: function () {
this.migrationLog = Ext.create('Shopware.apps.ViisonCommonMigration.component.MigrationLog', {
region: 'center',
width: '100%',
migrationExecutionResult: this.migrationExecutionResult,
});
return this.migrationLog;
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonCommonMigration', {
override: 'Shopware.apps.Index',
/**
* @Override
*/
init: function () {
this.callParent(arguments);
window.setTimeout(function () {
this.addController({
name: 'Shopware.apps.ViisonCommonMigration.controller.Main',
});
}.bind(this), 1000);
},
});
ViisonCommonApp.addSnippetNamespaces({"backend\/viison_datev_delivery_thresholds_notification\/main":{"confirm\/hide_delivery_threshold_warning\/areaMessage":"M\u00f6chten Sie die Lieferschwellenwarnung f\u00fcr [0] dauerhaft nicht mehr anzeigen?
Sie k\u00f6nnen die Warnung jederzeit in den Grundeinstellungen wieder aktivieren.","confirm\/hide_delivery_threshold_warning\/message":"M\u00f6chten Sie die Lieferschwellenwarnung f\u00fcr [0] dauerhaft nicht mehr anzeigen?
Sie k\u00f6nnen die Warnung jederzeit in den L\u00e4ndereinstellungen wieder aktivieren.","confirm\/hide_delivery_threshold_warning\/title":"Lieferschwellenwarnung nicht mehr anzeigen","notification\/areaMessage":"Sie haben die Lieferschwelle f\u00fcr folgende Zone bald erreicht:","notification\/hidePermanentlyButton":"Nicht mehr anzeigen","notification\/message":"Sie haben die Lieferschwelle f\u00fcr folgende L\u00e4nder bald erreicht:","notification\/title":"Lieferschwelle bald erreicht"}});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonDATEVDeliveryThresholdsNotification.controller.Main', {
extend: 'Ext.app.Controller',
mixins: [
'Shopware.apps.ViisonCommonApp.Mixin',
],
viisonSnippetNamespace: 'backend/viison_datev_delivery_thresholds_notification/main',
init: function () {
Ext.Ajax.request({
url: ViisonCommonApp.assembleBackendUrl('ViisonDATEVDeliveryThresholdsNotification/getDeliveryThresholdAnalysis'),
timeout: 30000, // 5 minutes
success: function (response) {
var result = Ext.JSON.decode(response.responseText);
if (result.success === false || !result.data || result.data.length 1) {
return;
}
var criticalDeliveryThresholds = {};
result.data.forEach(function (threshold) {
if (threshold.delivery_threshold_percentage > result.warningPercentage) {
criticalDeliveryThresholds[threshold.countryId] = [
threshold.countryname,
threshold.reportType,
];
}
});
if (criticalDeliveryThresholds.length 1) {
return;
}
Object.keys(criticalDeliveryThresholds).forEach(function (countryId) {
var countryName = criticalDeliveryThresholds[countryId][0];
var reportType = criticalDeliveryThresholds[countryId][1];
var notificationText = this.getViisonSnippet('notification/message') + '
' + countryName;
if (reportType === 'area') {
notificationText = this.getViisonSnippet('notification/areaMessage') + '
' + countryName;
}
Shopware.Notification.createStickyGrowlMessage({
title: this.getViisonSnippet('notification/title'),
text: notificationText,
width: 460, // Same width as Shopware's Community Store notification
btnDetail: {
text: this.getViisonSnippet('notification/hidePermanentlyButton'),
callback: function () {
this.doNotShowDeliveryThresholdWarningForCountry(countryId, countryName, reportType);
}.bind(this),
},
});
}.bind(this));
}.bind(this),
});
},
/**
* @param {int} countryId
* @param {string} countryName
* @param {string} reportType
*/
doNotShowDeliveryThresholdWarningForCountry: function (countryId, countryName, reportType) {
var message = Ext.String.format(
this.getViisonSnippet('confirm/hide_delivery_threshold_warning/message'),
countryName
);
if (reportType === 'area') {
message = Ext.String.format(
this.getViisonSnippet('confirm/hide_delivery_threshold_warning/areaMessage'),
countryName
);
}
Ext.MessageBox.confirm(
this.getViisonSnippet('confirm/hide_delivery_threshold_warning/title'),
message,
function (confirmValue) {
if (confirmValue !== 'yes') {
return;
}
Ext.Ajax.request({
url: ViisonCommonApp.assembleBackendUrl('ViisonDATEVDeliveryThresholdsNotification/doNotShowDeliveryThresholdAnalysis'),
jsonData: {
countryId: countryId,
reportType: reportType,
},
timeout: 30000, // 5 minutes
});
}
);
},
});
// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.
Ext.define('Shopware.apps.ViisonDATEVDeliveryThresholdsNotification', {
override: 'Shopware.apps.Index',
/**
* @Override
*/
init: function () {
this.callParent(arguments);
window.setTimeout(function () {
this.addController({
name: 'Shopware.apps.ViisonDATEVDeliveryThresholdsNotification.controller.Main',
});
}.bind(this), 1000);
},
});