In Artifactory, we have repositories (folders) containing artifacts.
Sometimes, we want to remove artifacts older than XX days. We don't want to apply this rule on all our repos. So we added a custom property on the repositories we want to clean up.
This custom property does not apply to the artifacts underneath (actually it can be recursive, but they are not applied to new artifacts automatically, which make it useless for us).
With AQL, I wrote the following query but it returns the repositories with the custom property and not the artifacts underneath:
{
"files": [
{
"aql": {
"items.find": {
"#mycustomproperty": {"$eq":"yes"},
"type": {"$eq":"files"}
}
}
}
]
}
How to get all artifacts with a parent repository having this custom property ?
Thank you for your help!
Related
As I am extremely new to programming I might just be overlooking some obvious issue so please bare with me.
I wanted to use custom snippets to extend the already existing ones to speed up my future workflow.
I created a snippets.json file, which contains this code
{
"html": {
"snippets": {
"page": "header>h1^main+footer{${0:©}}",
"a:link": "a[href='http://${0}']"
}
},
"css": {
"snippets": {}
}
}
when typing page, then pressing tab (or ctrl+e) in my HTML file, it doesn't output the Markdown, instead it just prints header>h1^main+footer{}
I put the a:link in there because it's a snippet that already exists within Emmet to test if the issue was with my custom snippets file.
And yes, the issue persists, instead of giving me the Markdown it only says a[href='http://']
Inside the Atom settings are 2 checkboxes:
Format Line Breaks
Use Emmet Comments
I have checked and unchecked both individually and together, nothing has resolved the Problem.
Settings inside of Atom
I am trying to get UnCss to produce a cut down version of my master CSS file, for now I only want to get this working on the homepage as a test.
I am using the following code:
uncss: {
dist: {
options: {
stylesheets : ['localhost/assets/css/master-2014.css'],
urls : ['localhost/en-gb/']
},
files: {
'css/app.clean.css': ['localhost/en-gb/']
}
}
}
What I am trying to do here is read master-2014.css from my local server (and eventually a remote url e.g. google.com), then look at the page that I have got the stylesheet from (my homepage localhost) and determine which style is needed. I finally want to then produce this into app.clean.css.
Currently I cannot get this to work for the life of me I have tried other variations like:
files: {
'css/app.clean.css': ['**/*.Master', '**/*.ascx']
}
This does not work.
I have also seen people try something like this:
files: {
'css/app.clean.css': ['index.html']
}
Where index.html is a blank html file. This is the only one that succeeds but it just creates me a css file which only contains css for html and body. The rest all throw the following error:
Running "uncss:dist" (uncss) task
Warning: Destination (css/app.clean.css) not written because src files were empty. Use --force to continue.
Aborted due to warnings.
All other examples that I can find are for WordPress which is PHP and this is a .Net site.
I would be very grateful for any help.
We're using Strongloop's LoopBack for our REST APIs and would like to modify the CSS for the LoopBack Explorer. However, it's not clear which CSS files are being used (LoopBack vs Swagger) and where they're located. I was not able to find specific documentation for this.
You can modify more than just the css. And also, if you generate your Loopback application using slc loopback like I did, you'll find that your server/server.js doesn't look immediately in a way you can configure it like it's shown in the accepted answer.
Instead you can use server/component-config.json to instruct the loopback component explorer to use an alternative directory for static files for the swagger-ui. With the uiDirs configuration below I configured it to go look for static files in the server/explorer directory.
{
"loopback-component-explorer": {
"mountPath": "/explorer",
"uiDirs": "server/explorer",
"apiInfo": {
"title": "My API",
"description": "Description of my API"
}
}
}
* When using IISNode uiDirs has to be set to "explorer" otherwise it's "server/explorer" as per #phegde 's comment
In my server directory I created a index.html which is a copy from node_modules/loopback-component-explorer/public/index.html and also I created an images folder with a custom logo.
And finally, If you want to have custom css, copy node_modules/loopback-component-explorer/public/css/loopbackStyles.css into server/explorer/css/loopbackStyles.css
You can provide your own version of Swagger UI files via options.uiDirs.
Edit your server/server.js and add this config option to the explorer:
app.use(explorer(app, { uiDirs: path.resolve(__dirname, 'explorer') }));
Copy the directory node_modules/loopback-explorer/public/css to server/explorer/css
Customize the copied CSS files as you need.
You should lock loopback-explorer's major & minor version in your package.json. Newer versions of loopback-explorer may change the CSS in which case your customization may stop working.
If you didn't lock the loopback-explorer in package.json or if you started your application from the new release of loopback(v2.x), you have to make another change:
If you generated your loopback app with the generator tool, edit server/component-config.json and change it to this:
{
"loopback-component-explorer": null
}
2.Copy the directory node_modules/loopback-explorer/public/ to server/explorer/ as Miroslav said. If you copy the whole directory you can also change the index.html file.
Edit server/server.js file and add this line: app.use('/explorer',explorer.routes(app, { uiDirs: path.resolve(__dirname, 'explorer') })); also you have to add the explorer module at the top of the file: var explorer = require('loopback-component-explorer');
4.Customize the ui of your explorer, all the necessary files are in server/explorer
With the loopback-component-explorer the uiDirs defined in component-config.json should be added something like the below (which solved my issue).
"uiDirs": ["server/explorer"]
instead of
"uiDirs": "server/api-explorer",
I am able to apply custom css styles to loopback api explorer header.
Steps I followed as mentioned below
Goto node_modules > loopback-component-explorer > public > css folder
Copy loopbackStyles.css
Create a new folder called explorer under server folder
create css folder under explorer and paste the css file under css folder i.e., loopbackStyles.css
Add below config to component-config.json file
{
"loopback-component-explorer": {
"mountPath": "/explorer",
"generateOperationScopedModels": true,
"uiDirs": "server/explorer"
}
}
To change loopback header color I have just overrided backgroun-color with my own color in body #header css selector in loopbackStyles.css
To replace the default header logo name with our custom name. I have added following css styles in loopbackStyles.css
.swagger-ui-wrap #logo{
display: none;
}
.swagger-ui-wrap:after {
content: "MyOwn API Explorer";
color: #fff;
font-weight: bold;
}
if I write a Chrome extension that runs a snippet of JS on a page, will it also run in any iframes I create? If so, does this apply for iframes created by Javascript after the DOM has loaded?
Thanks!
Yes, a Chrome Extension "content script" can run in all iframes (that are initially in the HTML when the page is loaded). In order to have the content script run in all frames you need to configure it to do so in the Chrome Extension manifest.json using the all_frames property:
http://code.google.com/chrome/extensions/content_scripts.html
{
"name": "My extension",
...
"content_scripts": [
{
"matches": ["http://www.google.com/*"],
"css": ["mystyles.css"],
"js": ["jquery.js", "myscript.js"],
"all_frames": true
}
],
...
}
No, the content scripts will NOT execute in the iframes loaded dynamically via JavaScript in the page.
Content scripts defined in the manifest (with "all_frames": true) will run on newly created iframes. What matters is that a new navigation starts for every frame, and content scripts are scheduled to be injected at that point.
In contrast, if you dynamically inject code with chrome.tabs.executeScript(), then it will only be injected in the frames present at the time you call it. You'd need some mechanism to detect new frames (Mutation observers? webNavigation API?) if you want to keep up with them.
My chrome extension needs to modify certain css rules on user's page. Accessing styles via document.styleSheets only gives access to styles linked from within the same domain. Other elements of document.styleSheets array have cssRules/rules set to null.
Why is it cross domain policy applies here? Styles are being applied anyway regardless of their origin, so what is the point? And how to get around it in my case?
EDIT:
The reason I need to MODIFY user css rules (as opposed to simply adding my own) is that I need to protect custom element injected by extension from being affected by * rules. see details in this question
Content scripts don't have any cross-domain privileges comparing to a regular javascript, so any limitations are carried over. See related question #1, question #2.
You can inject your own css style in the manifest:
"content_scripts": [
{
"matches": ["http://www.google.com/*"],
"css": ["mystyles.css"]
}
]
where you can try to overwrite original styles by defining rules with higher specificity.
You can also just tweak concrete element styles through javascript:
document.getElementById("id").style.property="value";
I fixed my version of the issue by changing the url from http:// to https://. Doh!
First, content scripts can't access cross-origin scripts.
Second, you can fetch cross-origin scripts from the background service worker (MV3) in a Chrome Extension.
What I am doing in my Chrome Extension's content script is using this to iterate over the stylesheets and sending the failed stylesheet link to the background script in the catch statement
let styleSheets = [];
// Iterating over all stylesheets
[...document.styleSheets].map(function(styleSheet) {
try {
[...styleSheet.cssRules].map(function(cssRule) {
styleSheets.push(cssRule);
});
} catch (e) {
styleSheets.push(null);
// Send failed stylesheets to service worker from here
}
});
And in the background server worker, using this function to get the stylesheet.
fetch(styleSheetUrl)
.then((response) => {
if (response.status >= 200 && response.status < 300) return response.text();
else return false;
})
.then((styleSheet) => {
console.log(styleSheet);
});