Exemple #1
0
  // Actions
  searchForOrganization: null,
  shareProfileSnapshot: null,

  // Internals
  _showingModal: false,
  _view: STEP_1_ORGANIZATION_CODE_ENTRY,
  _placeholder: ORGANIZATION_CODE_PLACEHOLDER,
  _code: null,
  _organization: null,
  _organizationNotFound: false,
  _studentCode: null,
  _campaignCode: null,

  // Computed
  stepOrganizationCodeEntry: equal('_view', STEP_1_ORGANIZATION_CODE_ENTRY),
  stepProfileSharingConfirmation: equal('_view', STEP_2_SHARING_CONFIRMATION),
  isOrganizationHasTypeSupOrPro: computed('_organization.type', function() {
    return this.get('_organization.type') === 'SUP' || this.get('_organization.type') === 'PRO';
  }),

  organizationLabels: computed('_organization.type', function() {
    if (this.get('_organization.type') === 'PRO') {
      return {
        personalCode: 'Veuillez saisir votre ID-Pix :',
        text1: 'Vous vous apprêtez à transmettre une copie de votre profil Pix à l\'organisation :',
        text2: 'En cliquant sur le bouton « Envoyer », vous transmettrez à l\'organisation :',
        text3: 'votre ID-Pix et le code campagne',
        text4: 'L\'organisation ne recevra les évolutions futures de votre profil que si vous le partagez à nouveau.'
      };
    } else if (this.get('_organization.type') === 'SUP') {
Exemple #2
0
import { equal } from '@ember/object/computed';
import Service from '@ember/service';
import { get } from '@ember/object';
import config from '../config/environment';

export default Service.extend({
  unknownProperty(path) {
    return get(config, path);
  },

  isDev: equal('environment', 'development'),
  isProd: equal('environment', 'production'),
  isTest: equal('environment', 'test'),
});
Exemple #3
0
import Component from '@ember/component';
import { equal } from '@ember/object/computed'

export default Component.extend({ isCustom: equal('targetType', 'customTarget') });
Exemple #4
0
  header: '',
  updateHeader: function () {
    let args = {};
    let k = 'newContainer.';
    k += (get(this, 'isUpgrade') ? 'upgrade' : 'add') + '.';
    if (get(this, 'isSidekick')) {
      let svc = get(this, 'service');
      if (svc && get(svc, 'id')) {
        k += 'sidekickName';
        args = { name: get(this, 'service.displayName') };
      } else {
        k += 'sidekick';
      }
    } else if (get(this, 'isGlobal')) {
      k += 'globalService';
    } else {
      k += 'service';
    }

    next(() => {
      if (this.isDestroyed || this.isDestroying) {
        return;
      }

      set(this, 'header', get(this, 'intl').t(k, args));
    });
  }.observes('isUpgrade', 'isSidekick', 'isGlobal', 'service.displayName', 'intl.locale').on('init'),

  isSidekick: equal('scaleMode', 'sidekick'),
});
  durationIndeterminate: 1333,
  easeFnIndeterminate: materialEase,
  startIndeterminate: 1,
  endIndeterminate: 149,

  mode: computed('value', function() {
    let value = this.get('value');
    return isPresent(value) ? MODE_DETERMINATE : MODE_INDETERMINATE;
  }),

  spinnerClass: computed('mode', function() {
    let mode = this.get('mode');
    return mode === MODE_DETERMINATE || mode === MODE_INDETERMINATE ? `md-mode-${mode}` : 'ng-hide';
  }),

  isIndeterminate: equal('mode', MODE_INDETERMINATE),

  strokeWidth: computed('strokeRatio', 'diameter', function() {
    return this.get('strokeRatio') * this.get('diameter');
  }),

  strokeDasharray: computed('mode', 'diameter', 'strokeWidth', function() {
    if (this.get('mode') === MODE_INDETERMINATE) {
      return (this.get('diameter') - this.get('strokeWidth')) * Math.PI * 0.75;
    } else {
      return (this.get('diameter') - this.get('strokeWidth')) * Math.PI;
    }
  }),

  d: computed('diameter', 'strokeWidth', 'isIndeterminate', function() {
    return this.getSvgArc(this.get('diameter'), this.get('strokeWidth'), this.get('isIndeterminate'));
    'btn-circle',
    'position-fixed',
    'text-light',
    'd-print-none',
    'd-inline-blick',
    'd-md-none'
  ], // :classNames


  classNameBindings: ['invisible'],


  router: service(),


  invisible: equal('router.currentRouteName', 'index'),


  click() {
    let router      = this.get('router');
    let currentPath = router.get('currentRouteName');
    let pathArray   = currentPath.split('.');

    // Remove the last element of the array
    // If the last element was 'index', remove the next level...
    if ( pathArray.pop() === 'index' ) {
      pathArray.pop();
    }

    // Append the index path,
    // technically not needed...
import { computed, get } from '@ember/object';
import { isEmpty } from '@ember/utils';
import Controller, { inject as controller } from '@ember/controller';
import { inject as service } from '@ember/service';
import escapeRegExp from "ember-inspector/utils/escape-reg-exp";
import debounceComputed from "ember-inspector/computed/debounce";
import LocalStorageService from "ember-inspector/services/storage/local";
import { and, equal } from '@ember/object/computed';

export default Controller.extend({
  application: controller(),
  initialEmpty: false,
  modelEmpty: equal('model.length', 0),
  showEmpty: and('initialEmpty', 'modelEmpty'),

  /**
   * Service used for storage. Storage is
   * needed for remembering if the user closed the warning
   * as it might get mildly annoying for devs to see and close
   * the trivial warning every time.
   * The default storage service is local storage however we
   * fall back to memory storage if local storage is disabled (For
   * example as a security setting in Chrome).
   *
   * @property storage
   * @type {Service}
   */
  storage: service(`storage/${LocalStorageService.STORAGE_TYPE_TO_USE}`),


  /**
  queryParams: ['page', 'user', 'type'],
  page: 1,
  user: null,
  type: null,

  events: alias('model.events'),

  prevPage: safeComputed('page', page => {
    if (page > 1) {
      return page - 1;
    }
  }),

  nextPage: safeComputed('page', 'events.length', 'perPage', (page, numEvents, perPage) => {
    if (numEvents === perPage) {
      return page + 1;
    }
  }),

  isFirstPage: equal('page', 1),
  unreadEvents: filterBy('events', 'unread', true),
  hasUnreadOnPage: notEmpty('unreadEvents'),
  hasUnread: and('isFirstPage', 'hasUnreadOnPage'),

  markAsReadTask: task(function*() {
    yield this.ajax.request('/api/notifications/clear', { method: 'POST' });
    this.get('model.events').forEach(event => set(event, 'unread', false));
    this.set('notifications.counter', 0);
  }).drop(),
});
Exemple #9
0
import Controller, {inject as controller} from '@ember/controller';
import {alias, equal, sort} from '@ember/object/computed';
import {run} from '@ember/runloop';

export default Controller.extend({

    tagController: controller('settings.tags.tag'),

    tags: alias('model'),
    selectedTag: alias('tagController.tag'),

    tagListFocused: equal('keyboardFocus', 'tagList'),
    tagContentFocused: equal('keyboardFocus', 'tagContent'),

    // TODO: replace with ordering by page count once supported by the API
    sortedTags: sort('tags', function (a, b) {
        let idA = +a.get('id');
        let idB = +b.get('id');

        if (idA > idB) {
            return 1;
        } else if (idA < idB) {
            return -1;
        }

        return 0;
    }),

    actions: {
        leftMobile() {
            let firstTag = this.get('tags.firstObject');
Exemple #10
0
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo} from 'ember-data/relationships';
import { equal, or } from '@ember/object/computed';

export default Model.extend({
  buildsRemaining: attr(),
  owner: belongsTo('owner', { polymorphic: true }),
  permissions: attr(),
  status: attr(),

  isNew: equal('status', 'new'),
  isStarted: equal('status', 'started'),
  isEnded: equal('status', 'ended'),

  hasActiveTrial: or('isNew', 'isStarted'),
});
    ghostPaths: service(),

    tagName: 'li',
    classNames: ['gh-posts-list-item'],
    classNameBindings: ['active'],

    post: null,
    active: false,

    // closure actions
    onClick() {},
    onDoubleClick() {},

    isFeatured: alias('post.featured'),
    isPage: alias('post.page'),
    isDraft: equal('post.status', 'draft'),
    isPublished: equal('post.status', 'published'),
    isScheduled: equal('post.status', 'scheduled'),

    authorNames: computed('post.authors.[]', function () {
        let authors = this.get('post.authors');

        return authors.map(author => author.get('name') || author.get('email')).join(', ');
    }),

    subText: computed('post.{plaintext,customExcerpt,metaDescription}', function () {
        let text = this.get('post.plaintext') || '';
        let customExcerpt = this.get('post.customExcerpt');
        let metaDescription = this.get('post.metaDescription');

        if (!isBlank(customExcerpt)) {
Exemple #12
0
  pageScope:        null,

  // Component options
  tagName:          'header',
  classNames:       ['page-header'],
  dropdownSelector: '.navbar .dropdown',

  stacks:           null,

  // This computed property generates the active list of choices to display
  navTree:       null,
  clusterId:        alias('scope.currentCluster.id'),
  cluster:          alias('scope.currentCluster'),
  projectId:        alias('scope.currentProject.id'),
  project:          alias('scope.currentProject'),
  isCaas:           equal('app.mode', C.MODE.CAAS),
  isOss:            equal('app.mode', C.MODE.OSS),
  accessEnabled:    alias('access.enabled'),

  init() {
    this._super(...arguments);
    get(this, 'intl.locale');

    setProperties(this, {
      stacks:      get(this, 'store').all('stack'),
      hosts:       get(this, 'store').all('host'),
      stackSchema: get(this, 'store').getById('schema', 'stack'),
    });

    this.updateNavTree();
import { equal } from '@ember/object/computed';
import Component from '@ember/component';
export default Component.extend({

  tagName: 'button',

  side: 'right',

  isExpanded: false,

  isRight: equal('side', 'right'),

  classNames: 'sidebar-toggle',

  classNameBindings: 'isRight:sidebar-toggle--right:sidebar-toggle--left',

  click() {
    this.sendAction();
  }

});
import { equal } from '@ember/object/computed';
import Component from '@ember/component';

import safeComputed from '../computed/safe-computed';

export default Component.extend({
  tagName: 'tr',
  classNames: ['selectable'],
  classNameBindings: ['selected'],

  phase: null,
  selection: null,
  onSelect() {},

  isCircling: equal('phase.type', 'circling'),
  isPowered: equal('phase.type', 'powered'),

  isCirclingLeft: equal('phase.circlingDirection', 'left'),
  isCirclingRight: equal('phase.circlingDirection', 'right'),

  glideRate: safeComputed('phase.glideRate', gr => ((Math.abs(gr) > 1000) ? Infinity : gr)),

  selected: safeComputed('selection', function(selection) {
    let phase = this.get('phase');
    return selection.start === phase.secondsOfDay && selection.end === phase.secondsOfDay + phase.duration;
  }),

  click() {
    let onSelect = this.get('onSelect');

    if (this.get('selected')) {
Exemple #15
0
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { equal } from '@ember/object/computed';
import sjcl from 'sjcl';

export default Controller.extend({
  decryptionFailed: computed('model', function() {
    return this.model instanceof sjcl.exception.corrupt;
  }),
  notFound: equal('model.errors.firstObject.status', '404')
});
Exemple #16
0
export default Component.extend({

  store: service(),

  classNames: ['feedback-panel'],

  assessment: null,
  challenge: null,
  collapsible: true,

  _status: null,
  _email: null,
  _content: null,
  _error: null,

  isFormClosed: equal('_status', FORM_CLOSED),
  isFormOpened: equal('_status', FORM_OPENED),
  isFormSubmitted: equal('_status', FORM_SUBMITTED),

  didReceiveAttrs() {
    this._super(...arguments);
    this._reset();
  },

  _reset() {
    this.set('_email', null);
    this.set('_content', null);
    this.set('_error', null);
    this.set('_status', this._getDefaultStatus());
  },
Exemple #17
0
import { equal } from '@ember/object/computed';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';

export default Model.extend({
  date:                 attr('date', {defaultValue: moment().format('MM-DD-YYYY')}),
  submittedAt:          attr('date'),
  creditNoteNumber:     attr('string'),

  location:             belongsTo('location'),
  fulfillment:          belongsTo('fulfillment'),
  creditNoteItems:      hasMany('credit-note-item'),

  pending:              equal('xeroState', 'pending'),
  submitted:            equal('xeroState', 'submitted'),

  creditNoteItemForItem(item) {
    return this.get('creditNoteItems').find(cni => cni.get('item.id') === item.get('id'));
  }
});
Exemple #18
0
import Component from '@ember/component';
import layout from './template';
import { equal, or } from '@ember/object/computed'
import { VIEW, NEW, EDIT } from 'shared/mixins/view-new-edit';

export default Component.extend({
  layout,
  tagName: '',

  mode:            null,
  scope:           null,
  namespace:       null,
  model:           null,
  namespaceErrors: null,

  isView:  equal('mode', VIEW),
  isNew:   equal('mode', NEW),
  isEdit:  equal('mode', EDIT),
  notView: or('isNew', 'isEdit'),

});
Exemple #19
0
  }),
  username: DS.attr('string'),
  userProfile: DS.attr('string'),
  url: DS.attr('string'),
  createTime: DS.attr('date'),
  createTimeWords: computed('createTime', {
    get() {
      const duration = Date.now() - +this.get('createTime');

      return `${humanizeDuration(duration, { round: true, largest: 1 })} ago`;
    }
  }),
  // } for pr job only
  permutations: DS.attr(),
  builds: DS.hasMany('build', { async: true }),
  isDisabled: equal('state', 'DISABLED'),
  lastBuild: computed('builds', {
    get() {
      const builds = this.get('builds');

      if (builds.length === 0) {
        return EmberObject.create();
      }

      return builds.objectAt(0);
    }
  }),
  modelToReload: 'builds',
  reloadTimeout: ENV.APP.EVENT_RELOAD_TIMER,
  // Reload builds only if the pr job build is still running
  shouldReload() {
import Component from '@ember/component';
import { equal } from '@ember/object/computed';

export default Component.extend({
  classNames: ['carousel-item'],
  classNameBindings: ['active'],
  active: equal('index', 0),

  review: null,
  index: 0
});
Exemple #21
0
  resources: fragment('resources'),
  jobVersion: attr('number'),

  modifyIndex: attr('number'),
  modifyTime: attr('date'),

  createIndex: attr('number'),
  createTime: attr('date'),

  clientStatus: attr('string'),
  desiredStatus: attr('string'),
  statusIndex: computed('clientStatus', function() {
    return STATUS_ORDER[this.clientStatus] || 100;
  }),

  isRunning: equal('clientStatus', 'running'),

  // When allocations are server-side rescheduled, a paper trail
  // is left linking all reschedule attempts.
  previousAllocation: belongsTo('allocation', { inverse: 'nextAllocation' }),
  nextAllocation: belongsTo('allocation', { inverse: 'previousAllocation' }),

  preemptedAllocations: hasMany('allocation', { inverse: 'preemptedByAllocation' }),
  preemptedByAllocation: belongsTo('allocation', { inverse: 'preemptedAllocations' }),
  wasPreempted: attr('boolean'),

  followUpEvaluation: belongsTo('evaluation'),

  statusClass: computed('clientStatus', function() {
    const classMap = {
      pending: 'is-pending',
	classNames: ['wds-global-navigation'],
	classNameBindings: [
		'searchIsActive:wds-search-is-active',
		'canShowPartnerSlot:wds-has-partner-slot',
		'currentModal:wds-is-modal-opened',
		'communityBarIsActive:wds-is-community-bar-in',
		'isWikiaOrg:wds-is-wikia-org',
	],

	communityBarElement: null,
	searchIsActive: false,
	communityBarIsActive: false,
	previousViewportOffsetTop: null,

	isSearchModalOpen: equal('currentModal', 'search'),
	isUserModalOpen: equal('currentModal', 'user'),

	isWikiaOrg: oneWay('model.is-wikia-org'),

	canShowPartnerSlot: computed('model.partner-slot', 'isWikiaOrg', function () {
		return this.get('model.partner-slot') && !this.get('isWikiaOrg');
	}),

	redirectUrl: computed('fastboot.isFastBoot', 'router.currentURL', function() {
		if (this.get('fastboot.isFastBoot')) {
			return `${this.get('fastboot.request.protocol')}//${this.get('fastboot.request.host')}${this.get('fastboot.request.path')}`;
		} else {
			return window.location.href;
		}
	}),
import { alias, equal } from '@ember/object/computed';
import Service, { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';

const ROOT_NAMESPACE = '';
export default Service.extend({
  store: service(),
  auth: service(),
  userRootNamespace: alias('auth.authData.userRootNamespace'),
  //populated by the query param on the cluster route
  path: null,
  // list of namespaces available to the current user under the
  // current namespace
  accessibleNamespaces: null,

  inRootNamespace: equal('path', ROOT_NAMESPACE),

  setNamespace(path) {
    this.set('path', path);
  },

  findNamespacesForUser: task(function*() {
    // uses the adapter and the raw response here since
    // models get wiped when switching namespaces and we
    // want to keep track of these separately
    let store = this.get('store');
    let adapter = store.adapterFor('namespace');
    let userRoot = this.get('auth.authData.userRootNamespace');
    try {
      let ns = yield adapter.findAll(store, 'namespace', null, {
        adapterOptions: {
Exemple #24
0
  schedulingEligibility: attr('string'),
  status: attr('string'),
  statusDescription: attr('string'),
  shortId: shortUUIDProperty('id'),
  modifyIndex: attr('number'),

  // Available from single response
  httpAddr: attr('string'),
  tlsEnabled: attr('boolean'),
  attributes: fragment('node-attributes'),
  meta: fragment('node-attributes'),
  resources: fragment('resources'),
  reserved: fragment('resources'),
  drainStrategy: fragment('drain-strategy'),

  isEligible: equal('schedulingEligibility', 'eligible'),

  address: computed('httpAddr', function() {
    return ipParts(this.httpAddr).address;
  }),

  port: computed('httpAddr', function() {
    return ipParts(this.httpAddr).port;
  }),

  isPartial: computed('httpAddr', function() {
    return this.httpAddr == null;
  }),

  allocations: hasMany('allocations', { inverse: 'node' }),
Exemple #25
0
const UTM_SOURCE = 'help-page';
const UTM_MEDIUM = 'travisweb';

const { docs, community } = config.urls;

export default Controller.extend({
  auth: service(),

  queryParams: ['anchor', 'page'],
  anchor: ANCHOR.TOP,
  page: '',

  isLoggedIn: reads('auth.signedIn'),

  toTop: equal('anchor', ANCHOR.TOP),
  toDocs: equal('anchor', ANCHOR.DOCS),
  toCommunity: equal('anchor', ANCHOR.COMMUNITY),
  toForm: equal('anchor', ANCHOR.FORM),

  docsUrl: computed(() => `${docs}?utm_source=help-page&utm_medium=travisweb`),

  communityUrl: computed(() =>
    `${community}/top?utm_source=${UTM_SOURCE}&utm_medium=${UTM_MEDIUM}`
  ),

  actions: {

    setAnchor(anchor) {
      if (Object.values(ANCHOR).includes(anchor)) {
        this.set('anchor', anchor);
Exemple #26
0
	tagName: 'button',

	attributeBindings: ['buttonType:type', 'role', 'autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod',
		'formnovalidate', 'formtarget', 'name', 'value', 'accesskey', 'contenteditable', 'contextmenu', 'dir',
		'draggable', 'dropzone', 'hidden', 'lang', 'spellcheck', 'style', 'tabindex', 'title', 'translate', 'testAutomationId:data-test-automation-id'],

	role: 'button',
	/**
	 * Enable validation on field.
	 */
	validate: false,

	iconPosition: 'right',

	isIconLeft: equal('iconPosition', 'left'),

	/**
	 * The type of button
	 * @default button.
	 */
	buttonType: computed('submit', function() {
		if (this.get('submit')) {
			return 'submit';
		}
		return 'button';
	}),

	type: 'default',

	/**
    goToGrafana() {
      let url = get(this, 'grafanaUrl');

      window.open(url, '_blank');
    },
  },

  displayName: computed('name', 'id', function() {
    return get(this, 'name') || `(${ get(this, 'id') })`;
  }),

  sortName: computed('displayName', function() {
    return sortableNumericSuffix(get(this, 'displayName').toLowerCase());
  }),

  isTransitioning: equal('transitioning', 'yes'),
  isError:         equal('transitioning', 'error'),
  isActive:        equal('state', 'active'),

  relevantState: computed('combinedState', 'state', function() {
    return get(this, 'combinedState') || get(this, 'state') || 'unknown';
  }),

  // This is like this so you can override the displayed state calculation
  displayState:  alias('_displayState'),
  _displayState: computed('relevantState', function() {
    var state = get(this, 'relevantState') || '';

    return state.split(/-/).map((word) => {
      return ucFirst(word);
    }).join('-');
Exemple #28
0
  // If any task group is not promoted yet requires promotion and the deployment
  // is still running, the deployment needs promotion.
  requiresPromotion: computed('*****@*****.**', function() {
    return (
      this.get('status') === 'running' &&
      this.get('taskGroupSummaries')
        .toArray()
        .some(summary => summary.get('requiresPromotion') && !summary.get('promoted'))
    );
  }),

  status: attr('string'),
  statusDescription: attr('string'),

  isRunning: equal('status', 'running'),

  taskGroupSummaries: fragmentArray('task-group-deployment-summary'),
  allocations: hasMany('allocations'),

  version: computed('versionNumber', '*****@*****.**', function() {
    return (this.get('job.versions') || []).findBy('number', this.get('versionNumber'));
  }),

  // Dependent keys can only go one level past an @each so an alias is needed
  versionSubmitTime: alias('version.submitTime'),

  placedCanaries: sumAggregation('taskGroupSummaries', 'placedCanaries'),
  desiredCanaries: sumAggregation('taskGroupSummaries', 'desiredCanaries'),
  desiredTotal: sumAggregation('taskGroupSummaries', 'desiredTotal'),
  placedAllocs: sumAggregation('taskGroupSummaries', 'placedAllocs'),
Exemple #29
0
import Component from '@ember/component';
import { equal } from '@ember/object/computed';

export default Component.extend({
  classNames: ['two-step-button'],

  idleText: '',
  cancelText: '',
  confirmText: '',
  confirmationMessage: '',
  onConfirm() {},
  onCancel() {},

  state: 'idle',
  isIdle: equal('state', 'idle'),
  isPendingConfirmation: equal('state', 'prompt'),

  actions: {
    setToIdle() {
      this.set('state', 'idle');
    },
    promptForConfirmation() {
      this.set('state', 'prompt');
    },
  },
});
Exemple #30
0
  clients:                  null,
  allSubnets:               null,
  allSecurityGroups:        null,
  selectedSecurityGroup:    null,
  defaultSecurityGroup:     null,
  defaultSecurityGroupName: RANCHER_GROUP,
  whichSecurityGroup:       'default',
  instanceTypes:            INSTANCE_TYPES,
  regionChoices:            REGIONS,
  step:                     1,
  tags:                     null,
  editing:                  false,

  config: alias('model.amazonec2Config'),

  isCustomSecurityGroup:    equal('whichSecurityGroup', 'custom'),

  init() {
    this._super(...arguments);

    setProperties(this, {
      clients:    EmberObject.create(),
      allSubnets: []
    })

    let cur = get(this, 'config.securityGroup');

    if ( cur === '' ) { // TODO 2.0 should this be null 403 Vince/Wes/Daishan
      setProperties(this, {
        whichSecurityGroup:    'default',
        selectedSecurityGroup: null,