Write a web frontend for artifactory

88 Views Asked by At

I need help to choose tools to create a web frontend for Jfrog Artifactory. It has a web ui, but it is not easy to use out of the box.

What I need, is to be able to create a simple webpage where "customers" can search out software, by enabling different properties on the artifacts.

Ex. if the CODESYS feature is desired, then it can be selected from a drop down box.
Product owner should also be able to mark releases available to external customers.

What tools should I use to be doing that?

  • Does Artifactory have tools to do this? '
  • Can I write a web page which does queries against Artifactory.
    • and if so what frameworks can be used
  • Or something else
1

There are 1 best solutions below

0
Rakesh Gupta On BEST ANSWER

You could leverage the jfrog-client-js

https://github.com/jfrog/jfrog-client-js

First you instantiate the client and get the object (jfrogClient in the case below)

let jfrogClient = new JfrogClient({
  platformUrl: 'https://my-platform-url.jfrog.io/',
  // artifactoryUrl - Set to use a custom Artifactory URL.
  // xrayUrl - Set to use a custom Xray URL.
  username: 'username',
  password: 'password',
  // OR
  accessToken: 'accessToken',

  // Optional parameters
  proxy: { host: '<organization>-xray.jfrog.io', port: 8081, protocol: 'https' },
  headers: { key1: 'value1', key2: 'value2' },
  // Connection retries. If not defined, the default value is 3.
  retries: 3,
});

Next, you use this object (jfrogClient) to interact with your Artifactory

jfrogClient.artifactory()
    .search()
    .aqlSearch(
        'items.find({' +
        '"repo":"my-repo-name",' +
        '"path":{"$match":"*"}}' +
        ').include("name","repo","path","created").sort({"$desc":["created"]}).limit(10)'
    );
  .then(result => {
    console.log(JSON.stringify(result));
  })
  .catch(error => {
    console.error(error);
  });

The above code will return an array of your search results, which you will then send to your web UI for display.