How to use the react-orbitjs.attributesFor function in react-orbitjs

To help you get started, we’ve selected a few react-orbitjs 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 sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / projects / show / overview / products / item / tasks / index.tsx View on Github external
{({ value }) => {
          setTransition(value);
          let waitTime = '';
          let allowedNames = '';
          let activityName = '';
          if (transition) {
            const attributes = attributesFor(transition);
            activityName = attributes['initial-state'];
            allowedNames = getAllowedNames(attributes);
            waitTime = getWaitTime(attributes, workTask, relativeTimeAgo, dataStore);
          }
          return (
            <div>
              {transition &amp;&amp; (
                <div>
                  <span>{t('tasks.waiting', { waitTime })}</span>&nbsp;
                  {t('tasks.forNames', { allowedNames, activityName })}
                  {foundCurrentUser &amp;&amp; (
                    
                      {t('common.continue')}
                    
                  )}
                  {isSuperAdmin &amp;&amp; (</div></div>
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / users / list / user-table / row / multi-role-list / display / role-list-by-organization.tsx View on Github external
{organizations.map((organization) =&gt; {
        const organizationName = attributesFor(organization).name;
        const roleProps = {
          organization,
          user,
          roles,
          userRoles,
        };

        return (
          <div>
            <span data-test-role-organization="">
              {organizationName}
            </span>
            <br>
            
          </div>
        );
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / lib / auth / get-permissions.ts View on Github external
export function userRolesContainRoleNamed(
  dataStore: Store,
  userRoles: UserRoleResource[],
  name: ROLE
) {
  for (let i = 0; i &lt; userRoles.length; i++) {
    let userRole = userRoles[i];
    let role = dataStore.cache.query((q) =&gt; q.findRelatedRecord(userRole, 'role'));

    if (attributesFor(role).roleName === name) {
      return true;
    }
  }

  return false;
}
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / projects / show / overview / index.tsx View on Github external
export default ({ project }) =&gt; {
  const { workflowProjectUrl } = attributesFor(project);
  const { t } = useTranslations();

  return (
    <div>
      <div>
        <details>
        
        
      </details></div>
      <div>
        {workflowProjectUrl &amp;&amp; (
          <div data-input-copy-field="">
            <h4>{t('project.side.repositoryLocation')}</h4>
            </div></div></div>
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / projects / list / header / bulk-product-selection / product-selection.tsx View on Github external
{productDefinitions.map((productDefinition) =&gt; {
                const id = productDefinition.id;
                const { name, description } = attributesFor(productDefinition);
                const isProductSelected = isSelected(id);

                return (
                  <div data-test-item=""> toggle(id)}
                  &gt;
                    </div>
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / components / product-transitions / details.tsx View on Github external
) => {
    if (transitionType != 1) {
      return '';
    }
    let userName = t('appName');
    if (dateTransition === null) {
      if (allowedName != null) {
        userName = allowedName;
      }
    } else {
      if (workflowId != null) {
        const users = dataStore.cache.query((q) =>
          q.findRecords('user').filter({ attribute: 'workflowUserId', value: workflowId })
        );
        if (users.length === 1) {
          const { name } = attributesFor(users[0]);
          userName = name;
        }
      }
    }
    return userName;
  };
  const getFormattedDate = (dateTransition: string) => {
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / data / containers / resources / project / with-data-actions.tsx View on Github external
const toggleArchiveProject = async () => {
    const { dateArchived } = attributesFor(project);
    const nextValue = !dateArchived ? new Date() : null;

    try {
      await updateAttribute('dateArchived', nextValue);
      toast.success(
        !dateArchived
          ? t('project.operations.archive.success')
          : t('project.operations.reactivate.success')
      );
    } catch (e) {
      toast.error(e);
    }
  };
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / projects / show / overview / owners / index.tsx View on Github external
toast.error(t('errors.generic', { errorMessage: e.message }));
    }
  };

  let _updateOwner = async (userId) =&gt; {
    try {
      await updateOwner(userId);
      toast.success(t('updated'));
    } catch (e) {
      toast.error(t('errors.generic', { errorMessage: e.message }));
    }
  };

  const groupId = group.id;
  const ownerId = owner.id;
  const { name: orgName } = attributesFor(organization);

  return (
    <div>
      <div>
        <h4>{t('project.side.organization')}</h4>
        <div>
          <span>{orgName}</span>
        </div>
      </div>
      <div>
        <h4>{t('project.side.projectOwner')}</h4>
        <div>
          <div>
            </div></div></div></div>