Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "ember-get-config in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'ember-get-config' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

import { setApplication } from '@ember/test-helpers';
import preloadAssets from 'ember-asset-loader/test-support/preload-assets';
import config from 'ember-get-config';
import Application from 'ember-osf-web/app';
import manifest from 'ember-osf-web/config/asset-manifest';
import { start } from 'ember-qunit';
import 'qunit-dom';

setApplication(Application.create(config.APP) as any);

(async () => {
    // This ensures all engine resources are loaded before the tests
    await preloadAssets(manifest);

    start();
})();
import { setApplication } from '@ember/test-helpers';
import preloadAssets from 'ember-asset-loader/test-support/preload-assets';
import config from 'ember-get-config';
import Application from 'ember-osf-web/app';
import manifest from 'ember-osf-web/config/asset-manifest';
import { start } from 'ember-qunit';

setApplication(Application.create(config.APP) as any);

(async () => {
    // Remove /ember_osf_web prefix from manifest URIs.
    Object.values(manifest.bundles).forEach(bundle => {
        for (const asset of bundle.assets) {
            asset.uri = asset.uri.replace(/^\/ember_osf_web/, '');
        }
    });

    // This ensures all engine resources are loaded before the tests
    await preloadAssets(manifest);

    start();
})();
/**
     * The URL to use for signup. May be overridden, eg for special campaign pages
     *
     * @property signupUrl
     * @type {String}
     */
    signupUrl: `${config.OSF.url}register`,

    serviceLinks,
    gravatarUrl: Ember.computed('user', function() {
        const imgLink = this.get('user.links.profile_image');

        return imgLink ? `${imgLink}&s=25` : '';
    }),
    host: config.OSF.url,
    user: null,
    _loadCurrentUser() {
        this.get('currentUser')
            .load()
            .then(user => this.set('user', user));
    },
    init() {
        this._super(...arguments);
        // TODO: React to changes in service/ event?
        if (this.get('session.isAuthenticated')) {
            this._loadCurrentUser();
        }
    },
    // TODO: These parameters are defined in osf settings.py; make sure ember config matches.
    allowLogin: true,
    enableInstitutions: true,
return this.get('activeFilters.subjects').slice();
    }),
    // chosenOption is always the first element in the list
    chosenSortByOption: Ember.computed('sortByOptions', function() {
        return this.get('sortByOptions')[0];
    }),

    showActiveFilters: true, //should always have a provider, don't want to mix osfProviders and non-osf
    showPrev: Ember.computed.gt('page', 1),
    showNext: Ember.computed('page', 'size', 'numberOfResults', function() {
        return this.get('page') * this.get('size') < this.get('numberOfResults');
    }),

    results: Ember.ArrayProxy.create({ content: [] }),

    searchUrl: config.SHARE.searchUrl,

    init() {
        this._super(...arguments);
        this.set('facetFilters', Ember.Object.create());

        Ember.$.ajax({
            type: 'POST',
            url: this.get('searchUrl'),
            data: getProvidersPayload,
            contentType: 'application/json',
            crossDomain: true,
        }).then(results => {
            const hits = results.aggregations.sources.buckets;
            const whiteList = this.get('whiteListedProviders');
            const providers = hits
                .filter(hit => whiteList.includes(hit.key));
_getConfig() {
    let accessToken = config.contentful ? config.contentful.accessToken : config.contentfulAccessToken;
    let api = 'cdn';
    let space = config.contentful ? config.contentful.space : config.contentfulSpace;
    let previewAccessToken = config.contentful ? config.contentful.previewAccessToken : config.contentfulPreviewAccessToken;

    if (config.contentful.usePreviewApi || config.contentfulUsePreviewApi) {
      if (!previewAccessToken) {
        console.warn('You have specified to use the Contentful Preview API; However, no `previewAccessToken` has been specified in config/environment.js'); /* eslint-disable-line no-console */
      } else {
        accessToken = previewAccessToken;
        api = 'preview';
      }
    }
    if (config.contentfulAccessToken || config.contentfulSpace) {
      /* eslint-disable-next-line no-console */
      console.warn(`DEPRECATION: Use of 'contentfulAccessToken' and 'contentfulSpace' will be removed in ember-data-contentful@1.0.0. please migrate to the contentful object syntax:
      contentful: {
_getConfig() {
    let accessToken = config.contentful ? config.contentful.accessToken : config.contentfulAccessToken;
    let api = 'cdn';
    let space = config.contentful ? config.contentful.space : config.contentfulSpace;
    let previewAccessToken = config.contentful ? config.contentful.previewAccessToken : config.contentfulPreviewAccessToken;

    if (config.contentful.usePreviewApi || config.contentfulUsePreviewApi) {
      if (!previewAccessToken) {
        console.warn('You have specified to use the Contentful Preview API; However, no `previewAccessToken` has been specified in config/environment.js'); /* eslint-disable-line no-console */
      } else {
        accessToken = previewAccessToken;
        api = 'preview';
      }
    }
    if (config.contentfulAccessToken || config.contentfulSpace) {
      /* eslint-disable-next-line no-console */
      console.warn(`DEPRECATION: Use of 'contentfulAccessToken' and 'contentfulSpace' will be removed in ember-data-contentful@1.0.0. please migrate to the contentful object syntax:
      contentful: {
        accessToken: '${accessToken}',
        space: '${space}'
_getConfig() {
    let accessToken = config.contentful ? config.contentful.accessToken : config.contentfulAccessToken;
    let api = 'cdn';
    let space = config.contentful ? config.contentful.space : config.contentfulSpace;
    let previewAccessToken = config.contentful ? config.contentful.previewAccessToken : config.contentfulPreviewAccessToken;

    if (config.contentful.usePreviewApi || config.contentfulUsePreviewApi) {
      if (!previewAccessToken) {
        console.warn('You have specified to use the Contentful Preview API; However, no `previewAccessToken` has been specified in config/environment.js'); /* eslint-disable-line no-console */
      } else {
        accessToken = previewAccessToken;
        api = 'preview';
      }
    }
    if (config.contentfulAccessToken || config.contentfulSpace) {
      /* eslint-disable-next-line no-console */
      console.warn(`DEPRECATION: Use of 'contentfulAccessToken' and 'contentfulSpace' will be removed in ember-data-contentful@1.0.0. please migrate to the contentful object syntax:
      contentful: {
        accessToken: '${accessToken}',
        space: '${space}'
      }`);
    }
    return {
      accessToken,
      api,
      space
    };
  }
});
/*
  Base adapter class for all OSF APIv2 endpoints
 */
import Ember from 'ember';
import DS from 'ember-data';

import HasManyQuery from 'ember-data-has-many-query';
import config from 'ember-get-config';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';

export default DS.JSONAPIAdapter.extend(HasManyQuery.RESTAdapterMixin, DataAdapterMixin, {
    authorizer: 'authorizer:osf-token',
    host: config.OSF.apiUrl,
    namespace: config.OSF.apiNamespace,
    buildURL(modelName, id, snapshot, requestType) {
        // Fix issue where CORS request failed on 301s: Ember does not seem to append trailing
        // slash to URLs for single documents, but DRF redirects to force a trailing slash
        var url = this._super(...arguments);
        if (requestType === 'deleteRecord' || requestType === 'updateRecord' || requestType === 'findRecord') {
            if (snapshot.record.get('links.self')) {
                url = snapshot.record.get('links.self');
            }
        }
        if (url.lastIndexOf('/') !== url.length - 1) {
            url += '/';
        }
        return url;
    },
    /**
*
 * Sample usage:
 * ```handlebars
 * {{osf-navbar
 *   loginAction=loginAction
 * }}
 * ```
 *
 * @class osf-navbar
 */
export default Ember.Component.extend(hostAppName, AnalyticsMixin, {
    layout,
    osfServices,
    session: Ember.inject.service(),
    serviceLinks,
    host: config.OSF.url,
    currentService: Ember.computed('hostAppName', function() { // Pulls current service name from consuming service's config file
        let appName = this.get('hostAppName') || 'Home';
        if (appName === 'Dummy App') {
            appName = 'Home';
        }
        return appName.toUpperCase();
    }),
    currentServiceLink: Ember.computed('serviceLinks', 'currentService', function() {
        const serviceMapping = {
            HOME: 'osfHome',
            PREPRINTS: 'preprintsHome',
            REGISTRIES: 'registriesHome',
            MEETINGS: 'meetingsHome',
        };
        const service = this.get('currentService');
        return this.get('serviceLinks')[serviceMapping[service]];
getMetaTags(this: MetaTags, metaTagsOverrides: MetaTagsData): MetaTagsDefs {
        // Default values.
        const metaTagsData: MetaTagsData = {
            type: 'article',
            description: this.get('i18n').t('general.hosted_on_the_osf'),
            url: pathJoin(config.OSF.url, this.get('router').get('currentURL')),
            language: this.get('i18n').get('locale'),
            image: pathJoin(config.OSF.url, 'static/img/preprints_assets/osf/sharing.png'),
            imageType: 'image/png',
            imageWidth: 1200,
            imageHeight: 630,
            imageAlt: this.get('i18n').t('home.brand'),
            siteName: this.get('i18n').t('home.brand'),
            institution: this.get('i18n').t('general.cos'),
            fbAppId: config.FB_APP_ID,
            twitterSite: config.social.twitter.viaHandle,
            twitterCreator: config.social.twitter.viaHandle,
            ...metaTagsOverrides,
        };

        // Include URL, DOI, and any additional identifiers.
        const identifiers = toArray(metaTagsData.url)

Is your System Free of Underlying Vulnerabilities?
Find Out Now