How to use modules - 10 common examples

To help you get started, we’ve selected a few modules examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / common / filters / id_to_version.js View on Github external
define(function (require) {
  'use strict';

  var _ = require('lodash');
  var modules = require('modules');

  modules.get('a4c-common').filter('idToVersion', function() {
    return function(id) {
      if(_.defined(id)) {
        var splitted = id.split(':');
        return splitted[splitted.length-1];
      }
      return id;
    };
  }); // filter
}); // define
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / _ref / common / directives / search.js View on Github external
define(function (require) {
  'use strict';

  var modules = require('modules');
  var $ = require('jquery');
  var _ = require('lodash');

  const filterPattern = /^([\w,\.]+)=\[?([\.,\",\w,\,,\s]+)\]?$/;

  modules.get('a4c-common', []).directive('a4cSearch', function () {
    return {
      restrict: 'E',
      templateUrl: 'views/_ref/common/search.html',
      controller: 'SearchCtrl',
      scope: {
        // The object that stores query data (query text, filters and results)
        queryManager: '=',
        // The service responsible for the search
        searchService: '=',
        // the prefix for all label, it's useful for translation
        labelPrefix: '@'
      }
    };
  });
  //'searchServiceFactory'
  modules.get('a4c-common', []).controller('SearchCtrl', ['$scope', '$timeout', '$translate', function ($scope, $timeout, $translate) {
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / common / directives / upload.js View on Github external
define(function (require) {
  'use strict';

  var modules = require('modules');
  var _ = require('lodash');
  var angular = require('angular');
  require('angular-file-upload');
  require('scripts/common/directives/parsing_errors');

  modules.get('a4c-common').directive('uploadDirective', function() {
    return {
      templateUrl : 'views/common/upload_template.html',
      restrict : 'E',
      scope : {
        'targetUrl' : '&',
        'requestData': '&',
        'dragAndDropMessage' : '=',
        'buttonMessage' : '=',
        'beforeUploadCallback': '&', // should take two param named 'scope' and 'files'
        'uploadSuccessCallback': '&',
        'getWorkspaceSpecifics': '&?' // should take one param named 'scope'
      }
    };
  });

  modules.get('a4c-common').factory('uploadServiceFactory',['Upload',function($upload) {
github OpenSOC / opensoc-ui / src / kibana / services / root_search.js View on Github external
define(function (require) {
  var module = require('modules').get('kibana/services');

  module.service('rootSearch', function (courier, config, timefilter, indexPatterns) {
    return courier.createSource('search')
      .index(config.get('defaultIndex'))
      .filter(function (source) {
        return source.getFields()
        .then(function (fields) {
          // dynamic time filter will be called in the _flatten phase of things
          return timefilter.get(fields);
        });
      });
  });
});
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / topology / services / topology_services.js View on Github external
define(function (require) {
  'use strict';

  var modules = require('modules');

  modules.get('a4c-topology-editor', ['ngResource']).factory('topologyServices', ['$resource',
    function($resource) {
      // Service that gives access to create topology
      var topologyDAO = $resource('rest/latest/topologies/:topologyId', {}, {
        'create': {
          method: 'POST'
        },
        'get': {
          method: 'GET'
        }
      });
      var isValid = $resource('rest/latest/topologies/:topologyId/isvalid', {}, {
        method: 'GET'
      });
      var availableRepositories = $resource('rest/latest/editor/:topologyId/availableRepositories', {}, {
        method: 'GET'
      });
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / common / directives / parsing_errors.js View on Github external
define(function (require) {
  'use strict';

  var modules = require('modules');

  modules.get('a4c-common', []).directive('parsingErrors', function () {
    return {
      restrict: 'E',
      templateUrl: 'views/common/parsing_errors.html',
      scope: {
        uploadInfo: '='
      }
    };
  });
});
github OpenSOC / opensoc-ui / src / kibana / components / stringify / numeral / numeral.js View on Github external
define(function (require) {
  require('components/stringify/pattern/pattern');

  require('modules')
  .get('kibana')
  .directive('fieldEditorNumeralPattern', function () {
    return {
      restrict: 'E',
      template: require('text!components/stringify/numeral/numeral.html')
    };
  });
});
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / common / directives / secret_display.js View on Github external
define(function (require) {
  'use strict';

  var modules = require('modules');

  require('angular-xeditable');
  require('scripts/common/controllers/secret_display');

  modules.get('a4c-common').directive('secretDisplay', function() {
    return {
      templateUrl: 'views/common/secret_display.html',
      controller: 'SecretDisplayCtrl',
      restrict: 'E',
      scope: {
        'translated': '=',
        'definition': '=',
        'editable': '=?',
        'propertyType': '=?',
        'propertyName': '=',
        'propertyValue': '=',
        'capabilityName': '=?',
        'selectedNodeTemplate': '=',
        'execute': '&?',
        'customSaveSecret': '&?'
      },
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / _ref / applications / controllers / deployment_history / deployment_detail_info.js View on Github external
define(function (require) {
  'use strict';

  var modules = require('modules');

  modules.get('a4c-applications').controller('DeploymentDetailInfoCtrl',
    ['$scope', 'deploymentDTO',
      function ($scope, deploymentDTO) {
        $scope.deploymentDTO = deploymentDTO.data;
      }
    ]);
});
github alien4cloud / alien4cloud / alien4cloud-ui / src / main / webapp / scripts / orchestrators / controllers / orchestrator_artifacts.js View on Github external
var _ = require('lodash');

  states.state('admin.orchestrators.details.artifacts', {
    url: '/artifacts',
    templateUrl: 'views/orchestrators/orchestrator_artifacts.html',
    controller: 'OrchestratorArtifactsCtrl',
    menu: {
      id: 'menu.orchestrators.artifacts',
      state: 'admin.orchestrators.details.artifacts',
      key: 'ORCHESTRATORS.NAV.ARTIFACTS',
      icon: 'fa fa-file-text-o',
      priority: 500
    }
  });

  modules.get('a4c-orchestrators').controller('OrchestratorArtifactsCtrl',
    ['$scope' , '$state', '$resource', 'orchestrator', 'breadcrumbsService', '$translate',
    function($scope, $state, $resource, orchestrator, breadcrumbsService, $translate) {

      breadcrumbsService.putConfig({
        state: 'admin.orchestrators.details.artifacts',
        text: function() {
          return $translate.instant('ORCHESTRATORS.NAV.ARTIFACTS');
        }
      });

      $scope.artifactTypes = [];
      $resource('rest/latest/orchestrators/'+orchestrator.id+'/artifacts-support').get(
        {},
        function(result){
          if(!_.isEmpty(result.data)){
            $scope.artifactTypes = result.data;

modules

CommonJS modules for the browser

MIT
Latest version published 11 years ago

Package Health Score

39 / 100
Full package analysis

Popular modules functions