Generate a list of overridden resouces

I would like to generate a list of overridden resources in a child project. Is it possible to access a property of a perspective resource (or script resource) that lets you know it has been overridden from a global project?

i suppose you could compare the resource files
of the master project and the inhereted one…

why would you want to do this tho?

Within the context of the designer this would be possible (with some doing); I’d recommend a custom module, but it’s technically doable from scripting.

In any other scope (a running Perspective session, a Vision client) this isn’t feasible to extract.

DesignableProject has a variety of useful helper methods for you.

you can compare the resources of the master with the inhereted project. views not in the inherited project mean they are not altered…
its not ideal tho.

here is some inspiration of script to check the views

	from com.inductiveautomation.ignition.gateway import IgnitionGateway			
	context = IgnitionGateway.get()	
	pathToProjectFolder = str(context.systemManager.dataDir.absoluteFile).replace('\\','/') + '/projects'	
	pathToProjectViews = pathToProjectFolder + "/" + system.perspective.getProjectInfo().name + "/com.inductiveautomation.perspective/views/"
	pathToMasterViews = pathToProjectFolder + "/" + "MastersNamehere" + "/com.inductiveautomation.perspective/views/"
	
	import os
	
	def listViewFiles(path):
	    files = []
	    for dirName, subdirList, fileList in os.walk(path):
	        dir = dirName.replace(path, '')
	        for fname in fileList:
	        	if fname == "view.json":
					files.append(os.path.join(dir, fname))
	    return files
	
	ProjectFiles = listViewFiles(pathToProjectViews)
	MasterFiles = listViewFiles(pathToMasterViews)
	return [filename for filename in MasterFiles if filename not in ProjectFiles]

last line could be this i gtg xd
return [filename for filename in ProjectFilesif filename not in MasterFiles ]

missing a fairly important space.

1 Like

@victordcq we have a master application being deployed to all of our sites and it handles 90% of what is covered at the sites. However there is a level of uniqueness at each site, so we have a local project inheriting the master project at the site level and we can override a resource for that specific site. What we want to be able to do is identify common overrides at the site level to then pull into the master app. So generating a list of overrides at each sites would give us a jumping off point to make those decisions without having to track down every change in the designer.

Thank you for the script! It follows where my initial thoughts on the matter were going.

@PGriffith thank you for that, I wasnt aware of designableproject, there is a lot of good stuff in there!

3 Likes

ups yea i did not test the script i had no time and nothing set up in my test enviroment to test it on

@aklein1
interesting^^ Merging stuff is always a good idea