Giter VIP home page Giter VIP logo

adr's Introduction

Overview

Server ADR Deployment Client ADR Deployment

The Active Duty Roster (ADR) is a Reactjs based app designed to automatically track membership of every position within the 7th Cavalry Gaming Regiment via the 7th Cavalry API. The ADR is structured as a client-server architecture and includes basic authentication for enhanced security. Though the ADR is accurate, semi-regular maintenence is needed in order to keep tracked billets up to date.

Table of Contents

Running Locally

Requirements

In order to run the ADR locally for development, you need the following:

  • A valid 7th Cavalry Gaming account with member-level privileges (i.e. not a public account).
  • An instance of Node.js installed on your system.
  • Your choice of IDE such as VSCode.

Authorization

Before you get started with your server, you require two methods of authentication. You require both an API token from 7th Cavalry Gaming and a local clientside token.

To get and apply your API token do the following steps:

  1. Log into your 7th Cavalry Gaming account.
  2. Navigate to your Connected Accounts and select the "view account" button for auth.7cav.us
  3. Once you have logged into keycloak, copy the provided API token into your clipboard.
  4. Open the adr project folder and navigate to adr/server/credentials. Inside should be a file named example_token.js.
  5. Make a duplicate example_token.js and rename it to token.js.
  6. Inside the new token.js file, paste your API token in the API_TOKEN constant and save the file.

To make a clientside token, do the following:

  1. Open the adr project folder and navigate to /client.
  2. Inside the Client folder create a nameless .env file. When opened, the directory should be adr/client/.env
  3. Paste the following code into the .env file.
REACT_APP_CLIENT_TOKEN ='XXXXXX'
REACT_APP_COMBAT_API_URL=http://localhost:4000/roster/combat
REACT_APP_RESERVE_API_URL=http://localhost:4000/roster/reserves
REACT_APP_CACHE_TIMESTAMP_URL=http://localhost:4000/cache-timestamp
  1. Replace the REACT_APP_CLIENT_TOKEN constant with a password of your choice and save.
  2. Navigate to adr/server/credentials/token.js and ensure the CLIENT_TOKEN constant matches the same constant in the previous .env file and save.

Getting Started

Before initializing the server, the dependancies for the ADR need to be installed on your end.

  • Open a terminal/cmd prompt and navigate to the adr project folder and execute the command npm install.
  • Once the install finishes, navigate to adr/client and execute the previous command.

You should now be ready to run the Server and the Client.

  • Open two terminals. On the first terminal navigate to adr/server and enter the command node server.js. You should see that the server is listening on localhost:4000 and can be additionally verified by visiting localhost:4000 on your browser.
  • On the second terminal, navigate to adr/client/src and run the command npm start. Once the clientside is running, you should be automatically redirected to localhost:3000 on your browser. A sucessful response is when the ADR is completely filled.

You are now good to go! adr/client/src/app.js is the primary file in which everything on the clientside is ran. Closing the terminals will close the servers. Happy Coding!

Updating the ADR

Add New Billet in Existing Category

To add a new billet to an existing category, you need to update the BilletBank.js file located in client/src/modules/Generic.

Step-by-Step Instructions

  1. Open BilletBank.js.
  2. Locate the array that corresponds to the category where you wish to add the new billet.
  3. Append the new billet ID to this array.

Example:

Suppose you want to add a new billet with an ID of 28 to the "Information Management Office Command" category. Update imoCommand as follows:

Before:
const imoCommand = ['5','9'];
After:
const imoCommand = ['5','9','28'];

Add New Category

To introduce a new category, both BilletBank.js and App.js need to be updated.

Step-by-Step Instructions

  1. In BilletBank.js:

    • Add a new array for the subcategory and populate it with billet IDs.
    • Add this new subcategory to the billetBank constant.
  2. In App.js:

    • Create a new <div> with the class DepartmentContainer.
    • Inside this <div>, add a Collapsible component for the new category and subcategory.

Example:

To add a new major category called "test" with a subcategory "subTest," do the following:

In BilletBank.js:

const subTest = ['1', '2', '3'];

const billetBank = {
    regiCommand,
    oneSevenCommand,
    subTest,
};

In App.js:

<div className='DepartmentContainer'>
  <Collapsible trigger="test" triggerClassName="Title" triggerOpenedClassName="Title" open={true}>
    <div className='subTest'>
      <MilpacParse usePrimaryOnly={true} milpacArray={milpacArray} billetIDs={lists.subTest} subtitle={'Subcategory of Test'} />
    </div>
  </Collapsible>
</div>

Note: Ensure that you add these elements in the proper locations in App.js to maintain the formatting.


TODO

  • Redo whole tutorial section
  • Change cache warning on client to display time since cache refresh
  • Investigate the feasibility of sorting by rank after billet sorting (Subsorting? Consider using QuickSort)
  • Add graphical data visualization
  • Code Refactorizing

adr's People

Contributors

astetchkov avatar king-strider avatar syniron avatar talldog95 avatar uaon avatar vercin-g avatar

Stargazers

 avatar

Watchers

 avatar  avatar

adr's Issues

[ADR] Graphing and Data Display

Objective

To enhance the Active Duty Roster (ADR) by adding graphing and other data display options, as well as a "recent activity" feature that tracks changes made to MILPACs.

Key Focus Areas

  1. Implement graphing and data visualization features for more intuitive data interpretation.
  2. Add a "recent activity" feature to monitor recent changes in MILPACs.
  3. Prepare for future integration with upcoming API improvements for further data display capabilities.

Deliverables

Graphing and Data Display

  1. Investigate and identify the types of graphs and data displays that would be most useful for users.
  2. Implement the chosen graphs and data displays, ensuring they sort and parse data correctly.

Recent Activity Feature

  1. Design and implement a "recent activity" section that logs and displays recent changes made to MILPACs.

Future API Integration

  1. Assess current API capabilities and identify areas for improvement in anticipation of future updates.

Problem Statement

The current ADR lacks advanced data visualization options, making it less user-friendly and informative than it could be. Additionally, there's no feature to track recent changes made to MILPACs, leaving users uninformed about recent updates.

Future Considerations

Await further API improvements to potentially expand the data display and visualization capabilities of the ADR.

By implementing these enhancements, we aim to make the ADR more interactive, informative, and user-friendly, thereby improving the overall user experience.

[ADR] Refactoring

Objective

To refactor the existing Active Duty Roster (ADR) codebase with the goal of adhering more closely to the DRY (Don't Repeat Yourself) principle. This will improve the code's readability and maintainability.

Key Focus Areas

  1. Code Duplication: Identify and eliminate redundant code blocks.
  2. Code Structure: Reorganize the code to make it more intuitive and easier to follow.
  3. Documentation: Add comments and documentation to clarify the purpose and functionality of different code sections.

Deliverables

Code Duplication

  1. Conduct a thorough review of the existing ADR code to identify instances of code duplication.
  2. Abstract duplicated code into reusable functions or modules.

Code Structure

  1. Reorganize the code structure, considering aspects like function order, module organization, and data flow.
  2. Implement best practices such as meaningful variable names, consistent indentation, and modular design.

Documentation

  1. Add inline comments to complex or unintuitive code sections.
  2. Update or create documentation outlining the code structure, functions, and flow to assist future developers.

Problem Statement

The current ADR codebase contains redundant code and lacks a structure that is easy to understand and maintain.

Optional Features

  1. Implement automated tests to ensure that the refactoring has not introduced any bugs.
  2. Conduct a peer code review to validate the quality and effectiveness of the refactoring.

By refactoring the ADR code, we aim to create a more efficient, readable, and maintainable codebase, which will facilitate easier updates and debugging in the future.

[ADR] Unit Strength Remove Duplicates

Objective

To refine the Unit Strength metric in the Active Duty Roster (ADR) by addressing the issue of duplicate names affecting the calculation.

Key Focus

Investigate and implement a method to accurately handle duplicate names when calculating Unit Strength in the ADR.

Deliverables

  1. Conduct an investigation to understand how duplicate names are currently affecting the Unit Strength metric.
  2. Develop a solution to correctly identify and handle duplicate names in the calculation.
  3. Implement and test the revised Unit Strength calculation in a controlled environment.
  4. Deploy the updated Unit Strength metric to the live ADR system after successful testing.

Problem Statement

The current Unit Strength metric in the ADR does not account for duplicate names, leading to inaccurate reporting of unit strength.

By addressing this issue, we aim to provide a more accurate and reliable Unit Strength metric, thereby enhancing the credibility and usefulness of the ADR.

React.js --> Next.js Refactor

Once PR #57 becomes live, a fundamental rebuild of CavApps in Next.JS will be an eventual requirement.

This is due to the following reasons:

  • As the JavaScript count increases, react will download every javascript file for every page in CavApps, even if certain pages are never opened by the end user.
  • Severside rendering will allow us to eliminate the API call on the clientside. Thus removing the requirement to download an additional 10mb of data on the clientside.
  • The CSS styling for CavApps is starting to become cluttered and intuitive. While manual styling may suit us for some time, Next.js' native support of external CSS tools may serve useful if others start developing in CavApps.
  • CavApps was originally built as a single page ADR project. However, should we wish to expand to more serious development. i.e. utilizing authentication elements such as keycloak for multiple apps. It may be useful to update to a framework which allows us extra security.

[ADR] Cache Timer Improvement

Objective

To enhance the Active Duty Roster (ADR) by adding a live timer that indicates the age of the current data cache, replacing the existing temporary text about possible data age inaccuracies.

Key Focus

  1. Implement a live timer feature to provide real-time information about the age of the data cache.
  2. Remove or replace the existing temporary text that warns users about potential data inaccuracies due to data age.

Deliverables

  1. Develop a live timer that updates in real-time to indicate the age of the data cache in the ADR.
  2. Integrate this timer into the ADR interface.
  3. Remove or update the existing text about data age inaccuracies.

Problem Statement

Currently, the ADR contains a temporary text warning about possible inaccuracies in the data due to its age. This is not an ideal solution and can cause confusion among users.

By implementing a live timer, we aim to give users a more accurate understanding of how current the data is, thereby increasing the reliability and credibility of the ADR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.