Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) Add interstitial system admin page that links to non-core apps #21

Merged
merged 7 commits into from Jun 12, 2023

Conversation

hadijahkyampeire
Copy link
Collaborator

@hadijahkyampeire hadijahkyampeire commented May 31, 2023

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.
  • My work conforms to the OpenMRS 3.0 Styleguide.
  • I checked for feature overlap with existing widgets.

Summary

  • This PR adds a new admin config app which has a page where the user can navigate to different apps outside the core 3.x
  • It also adds a new menu item to our App switcher named System Administration which links to the above-mentioned page.
  • It also creates an ExtensionSlot for card links that all apps that want to add card links can use. I have currently added the OCL cardLink since they are in the same repo.

Usage e.g in the Form builder

  • Create a component with such a link
import React from "react";
import { useTranslation } from "react-i18next";
import { Layer, ClickableTile } from "@carbon/react";
import { ArrowRight } from "@carbon/react/icons";

const FormBuilderCardLink: React.FC = () => {
  const { t } = useTranslation();
  const header = t("manageForms", "Manage Forms");
  return (
    <Layer>
      <ClickableTile
        id={`clickable-tile-${header}`}
        href={`${window.spaBase}/form-builder`}
        target="_blank"
        rel="no-refferer"
      >
        <div>
          <div className="heading">{header}</div>
          <div className="content">{t("formBuilder", "Form Builder")}</div>
        </div>
        <div className="iconWrapper">
          <ArrowRight size={16} />
        </div>
      </ClickableTile>
    </Layer>
  );
};

export default FormBuilderCardLink;

And add an extension in index.ts like

      {
        id: "system-administration-form-builder-card-link",
        slot: "system-admin-page-card-link-slot",
        load: getAsyncLifecycle(
          () => import("./form-builder-admin-card-link.component"),
          options
        ),
        online: true,
        offline: true,
      },

Screenshots

Screenshot 2023-06-04 at 04 07 06

Issue

None.

@hadijahkyampeire
Copy link
Collaborator Author

@ibacher please review my PR.

@hadijahkyampeire
Copy link
Collaborator Author

@ibacher I am not sure why tests are failing, but they probably need a rerun but I am not able to trigger that.

@jayasanka-sack
Copy link
Member

Hi @hadijahkyampeire, it seems the lock file is not up to date. Could you please run yarn install and push changes? I hope it should fix builds

@hadijahkyampeire
Copy link
Collaborator Author

Thanks @jayasanka-sack I have done that, hopefully the tests will pass.

@denniskigen denniskigen changed the title (feat) Add interstitial Page(System Admin) which links to other app instances. (feat) Add interstitial system admin page that links to non-core apps Jun 12, 2023
Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hadijahkyampeire! Looking very good!

One thing: do we need the config-schema copy.ts file?

@@ -8,7 +8,7 @@ const OpenConceptLabCardLink: React.FC = () => {
const header = t('manageConcepts', 'Manage Concepts');
return (
<Layer>
<ClickableTile id={`clickable-tile-${header}`} href={`${window.spaBase}/ocl`} target="_blank" rel="no-refferer">
<ClickableTile id={`clickable-tile-${header}`} href={`${window.spaBase}/ocl`} target="_blank" rel="norefferer">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ClickableTile id={`clickable-tile-${header}`} href={`${window.spaBase}/ocl`} target="_blank" rel="norefferer">
<ClickableTile id={`clickable-tile-ocl`} href={`${window.spaBase}/ocl`} target="_blank" rel="norefferer">

- Expose legacy admin link card as an extension
- Remove the `id` prop from `ClickableTile` components
- Delete the unused `config-schema-copy.ts` file
@hadijahkyampeire hadijahkyampeire merged commit 7094a97 into openmrs:main Jun 12, 2023
6 checks passed
@hadijahkyampeire
Copy link
Collaborator Author

Thanks @denniskigen and @ibacher

@ibacher
Copy link
Member

ibacher commented Jun 12, 2023

@hadijahkyampeire Please remember to select Squash and Merge when you merge a PR.

@hadijahkyampeire
Copy link
Collaborator Author

oh, yah, sorry, I thought it was the default.

@denniskigen
Copy link
Member

Is the next step adding this package to the frontendModules in spa-build-config.json, @ibacher?

@ibacher
Copy link
Member

ibacher commented Jun 12, 2023

Yes, otherwise it won't show up by default. Try to add it near the openconceptlab line (I'm trying to keep modules from monorepos near each other).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants