Mat Dialog not displayed after upgrading to angular 13 - upgrade

I'm getting below 2 errors while trying to open mat dialog component. All the configuration is completely used as per the guidelines. But I'm not able to solve this error.
core.mjs:6485 ERROR Error: NG0203: inject() must be called from an injection context
at injectInjectorOnly (core.mjs:4759:1)
at ɵɵinject (core.mjs:4769:1)
at NodeInjectorFactory.InfoDialogComponent_Factory [as factory] (ɵfac.js? [sm]:1:1)
at getNodeInjectable (core.mjs:3565:1)
at instantiateRootComponent (core.mjs:10181:1)
at createRootComponent (core.mjs:12285:1)
at ComponentFactory.create (core.mjs:21638:1)
at ViewContainerRef.createComponent (core.mjs:22902:1)
at CdkPortalOutlet.attachComponentPortal (portal.mjs:535:38)
at MatDialogContainer.attachComponentPortal (dialog.mjs:174:35)
core.mjs:6485 ERROR TypeError: Cannot read properties of undefined (reading 'focusInitialElementWhenReady')
at MatDialogContainer._trapFocus (dialog.mjs:248:33)
at MatDialogContainer._onAnimationDone (dialog.mjs:338:22)
at MatDialogContainer_animation_dialogContainer_done_HostBindingHandler (dialog.mjs:371:100)
at executeListenerWithErrorHandling (core.mjs:15019:1)
at wrapListenerIn_markDirtyAndPreventDefault (core.mjs:15057:1)
at animations.mjs:189:34
at _ZoneDelegate.invoke (zone.js:372:1)
at Object.onInvoke (core.mjs:25592:1)
at _ZoneDelegate.invoke (zone.js:371:1)
at Zone.run (zone.js:134:1)

Related

Moto testing not raising proper exception

I have the following function I wish to test:
def download(self):
s3 = boto3.client('s3')
try:
with open(self.flow_cells +'.tar', 'wb') as data:
s3.download_fileobj(
self.source_s3_bucket,
self.source_key,
data
)
return True
except botocore.exceptions.ClientError as error:
print(error.response['Error']['Code'])
I am using pytest to test code with moto. All other tests and botocore exceptions are getting flagged except for this one. I am capturing in standard out that it is getting to the exception function and printing the correct code, but moto is not flagging it as an Exception
Here is my testing code.
def test_download(parse_args, file_test):
with moto.mock_s3():
s3 = boto3.resource('s3')
s3.create_bucket(Bucket=parse_args.glacier_s3_bucket, CreateBucketConfiguration={
'LocationConstraint': 'us-east-1'
})
s3.create_bucket(Bucket=parse_args.output_s3_bucket, CreateBucketConfiguration={
'LocationConstraint': 'us-east-1'
})
bucket_version = s3.BucketVersioning(parse_args.glacier_s3_bucket)
bucket_version.enable()
s3.Object(parse_args.glacier_s3_bucket, 'flowcells/flowcell-testing.tar').put\
(Body=open(file_test, 'rb'))
glacier_client = GlacierRestoreClient(parse_args)
assert glacier_client.download() is True
s3.Object(glacier_client.source_s3_bucket, glacier_client.source_key).delete()
with pytest.raises(Exception) as error:
glacier_client.download()
assert 'Error' in error
Inside except clause the exception is silenced and not propagated, so you need to re-raise it:
except botocore.exceptions.ClientError as error:
print(error.response['Error']['Code'])
raise
Bare raise re-raises exception that was just caught.
PS. Shameless plug: I was one of those who asked Guido 20 years ago to add bare raise! :-)

Magento 2.1.7: Unable to process binding "attr: function (){return {id:'billing-address-same-as-shipping-'+ getCode($parent)} }"

I get an error on my checkout payment page:
knockout.js:3012 Uncaught ReferenceError: Unable to process binding "attr: function (){return {id:'billing-address-same-as-shipping-'+ getCode($parent)} }"
Message: getCode is not defined
at attr (eval at createBindingsStringEvaluator (knockout.js:2624), <anonymous>:3:158)
at update (knockout.js:3659)
at ko.dependentObservable.disposeWhenNodeIsRemoved (knockout.js:3004)
at evaluateImmediate (knockout.js:1737)
at Object.ko.computed.ko.dependentObservable (knockout.js:1946)
at knockout.js:3002
at Object.arrayForEach (knockout.js:151)
at applyBindingsToNodeInternal (knockout.js:2974)
at applyBindingsToNodeAndDescendantsInternal (knockout.js:2854)
at applyBindingsToDescendantsInternal (knockout.js:2836)
Does somebody knows how to get this fixed?

How to pass an object dynamically in the define function of Ext object in Sencha ExtJS 6.0.2?

Taking a look at the following segment of code you will see two cases where the sencha cmd return an error and one case that it doesn't
var memoryStore = new MemoryStore<Individual>("personnel", [
'name', 'email', 'phone'
], [
new Individual("Batman", "etsigoustaro#thefirm.com", "+306969696969"),
new Individual("Jean Luc", "jeanluc.picard#enterprise.com", "555-111-1111"),
new Individual("Worf", "worf.moghsson#enterprise.com", "+30 696 969 6969"),
new Individual("Deanna", "mr.data#enterprise.com", "+30 6969696969"),
new Individual("Data", "deanna.troi#enterprise.com", "+30-6969696969"),
])
//memoryStore.toExtJS()
Ext.define('extTestTs.store.Personnel', (function(){
//return JSON.stringify(memoryStore.toExtJS()) //fails
//return Ext.Object.merge({},{}) //fails
return {} //succeeds
})());
As you see we have removed everything, even extends is missing but as long as you are typing an object by hand it works. When this object is returned from a function it stops to work!
What does the sencha cmd does behind the scenes? Is it parsing the plain javascript as a text file?..
Because if it was javascript it would run without an issue.
This is the error from sencha cmd console output:
[ERR] C2008: Requirement had no matching files (extTestTs.store.Personnel) -- /home/student/Desktop/Typescript/extTestTs/classic/src/view/main/List.js:8:10
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Failed to find any files for /home/student/Desktop/Typescript/extTestTs/classic/src/view/main/List.js::ClassRequire::extTestTs.store.Personnel
[ERR]
[ERR] Total time: 3 seconds
[ERR] The following error occurred while executing this line:
/home/student/bin/Sencha/Cmd/6.1.2.15/plugins/ext/current/plugin.xml:425: The following error occurred while executing this line:
/home/student/Desktop/Typescript/extTestTs/.sencha/app/build-impl.xml:380: The following error occurred while executing this line:
/home/student/Desktop/Typescript/extTestTs/.sencha/app/init-impl.xml:382: com.sencha.exceptions.ExBuild: Failed to find any files for /home/student/Desktop/Typescript/extTestTs/classic/src/view/main/List.js::ClassRequire::extTestTs.store.Personnel
How could we overcome this restriction of explicitly defining the object and rather define it more dynamically?
The goal is to make typescript work with ExtJS but not with the extreme unconventional solutions others propose, like forking typescript itself
Found a workaround
First allow unreachable code in typescript
Here is a screenshot from the IntelliJ settings:
And the code in the questions transforms into that
var memoryStore = new MemoryStore<Individual>("personnel", [
'name', 'email', 'phone'
], [
new Individual("Batman", "etsigoustaro#thefirm.com", "+306969696969"),
new Individual("Jean Luc", "jeanluc.picard#enterprise.com", "555-111-1111"),
new Individual("Worf", "worf.moghsson#enterprise.com", "+30 696 969 6969"),
new Individual("Deanna", "mr.data#enterprise.com", "+30 6969696969"),
new Individual("Data", "deanna.troi#enterprise.com", "+30-6969696969"),
])
//memoryStore.toExtJS()
Ext.define('extTestTs.store.Personnel', function (Personnel) {
return memoryStore.toExtJS()
return {} //do not erase this line
});
Yeah the line return {} might seem totally redundant but (obviously) the sencha cmd is trying to parse the file before it includes it in the requires
Now sencha cmd gives a success and executing sencha app web start the sample app works ok

Extbase can't use external PHP library

I am building a simple extension to display information on a Google Maps with Typo3.
I want to use the following PHP class (http://www.ycerdan.fr/developpement/google-maps-api-v3/) but I can't use it in my Controller.
I tried to use autoloading and require_once in my controller, but I just get PHP or Typo3 errors.
I guess it's a trivial problem, but I can't make it work despite lot of time searching.
Any help or hint are greatly appreciated ;)
General infos
Vendor name : CLICmap
Extension name : clicmap
Class location : Resources/Private/PHP
ext_autoloader.php :
$extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('clicmap');
return array(
'gmaps' => $extensionPath.'Resources/Private/PHP/GoogleMapAPIv3.class.php',
);
How I use it in my controller
public function listAction() {
$maps = $this->mapRepository->findAll();
$gmaps = $this->objectManager->get('gmaps');
$this->view->assign('maps', $maps);
}
The PHP error :
Uncaught TYPO3 Exception
#1289386765: Could not analyse class:gmaps maybe not loaded or no autoloader? (More information)
TYPO3\CMS\Extbase\Object\Container\Exception\UnknownObjectException thrown in file
/var/www/html/ftypo3/typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php in line 37.
Trying require_once :
$extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('clicmap');
require_once($extensionPath . 'Ressources/Private/PHP/GoogleMapAPIv3.class.php');
I get the following PHP error :
Warning: Uncaught exception 'TYPO3\CMS\Core\Error\Exception' with message 'PHP Warning: require_once(/var/www/html/ftypo3-fluid/typo3conf/ext/clicmap/Ressources/Private/PHP/GoogleMapAPIv3.class.php): failed to open stream: No such file or directory in /var/www/html/ftypo3/typo3conf/ext/clicmap/Classes/Controller/MapController.php line 52' in /var/www/html/ftypo3/typo3/sysext/core/Classes/Error/ErrorHandler.php:101 Stack trace: #0 /var/www/html/ftypo3/typo3conf/ext/clicmap/Classes/Controller/MapController.php(52): TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'require_once(/v...', '/var/www/html/f...', 52, Array) #1 /var/www/html/ftypo3/typo3conf/ext/clicmap/Classes/Controller/MapController.php(52): CLICmap\Clicmap\Controller\MapController::listAction() #2 [internal function]: CLICmap\Clicmap\Controller\MapController->listAction() #3 /var/www/html/ftypo3/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php(286): call_user_func_array(Array, Array) #4 /var/www/html/ftypo3/typo3/sysext/extbase/Classes/Mvc/ in /var/www/html/ftypo3/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 101
Fatal error: CLICmap\Clicmap\Controller\MapController::listAction(): Failed opening required '/var/www/html/ftypo3-fluid/typo3conf/ext/clicmap/Ressources/Private/PHP/GoogleMapAPIv3.class.php' (include_path='/var/www/html/ftypo3-fluid/typo3/contrib/pear/:.:/usr/share/php:/usr/share/pear') in /var/www/html/ftypo3/typo3conf/ext/clicmap/Classes/Controller/MapController.php on line 52
EDIT : Solved
The code that solved my problem in the controller :
require_once(PATH_site . 'typo3conf/ext/clicmap/Resources/Private/PHP/GoogleMapAPIv3.class.php');//OK
$gmap = new \GoogleMapAPI();
I was messing with the filepath and most importantly i hadn't put a \ before my class instanciation.
The code that solved my problem in the controller :
require_once(PATH_site . 'typo3conf/ext/clicmap/Resources/Private/PHP/GoogleMapAPIv3.class.php');//OK
$gmap = new \GoogleMapAPI();
I was messing with the filepath and most importantly i hadn't put a \ before my class instanciation.

displaying page not found error with zend acl

whenever a controller is called if it is not registered in zend acl then we ususally get erro r like this
Fatal error: Uncaught exception 'Zend_Acl_Exception' with message
'Resource 'hsfasfdadsf' not found' in /usr/share/php/libzend-framework-php/Zend/Acl.php:365
Stack trace:
#0 /var/www/update/library/Management/Access.php(55): Zend_Acl->get('hsfasfdadsf')
#1 /usr/share/php/libzend-framework-php/Zend/Controller/Plugin/Broker.php(309): Management_Access->preDispatch(Object(Zend_Controller_Request_Http))
#2 /usr/share/php/libzend-framework-php/Zend/Controller/Front.php(941):
isn't there a way to check if the controller and action is registered in zend acl, i tried
if(!$acl->get($controller))
{
$request->setControllerName('error');
$request->setActionName('notfound');
}
but did not work
First solution:
Avoid those exceptions, e.g.
if (!$acl->has($your_resource)) {
// .. handle it the way you need
}
Second one
Handle those exceptions in ErrorController, i.e.:
if ($errors->exception instanceof Zend_Acl_Exception) {
// send needed headers...
// prepare log message...
// render info: resource_not_found.phtml
$this->_helper->viewRenderer('resource_not_found');
}