Skip to content

Commit

Permalink
Refactor getting started documentation to include more information ab…
Browse files Browse the repository at this point in the history
…out registered affiliations (#2560)

This makes it clear that new affiliations need to be registered.
  • Loading branch information
ben-z authored Apr 1, 2024
1 parent 6d1bd06 commit a623800
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 14 deletions.
50 changes: 50 additions & 0 deletions components/affiliation-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
} from "@/components/ui/command";
import { AffiliationInfo } from "@/lib/data";

export function AffiliationList({
affiliationInfo,
}: {
affiliationInfo: AffiliationInfo;
}) {
return (
<Command className="my-6">
<CommandInput placeholder="Find your affiliation..." />
<CommandList className="h-80">
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Affiliations">
{affiliationInfo.affiliations
.filter((a) => !a.is_legacy)
.map((a) => (
<CommandItem
key={a.name}
className="aria-selected:bg-inherit aria-selected:text-accent-inherit"
>
{a.name}
</CommandItem>
))}
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Legacy affiliations">
{affiliationInfo.affiliations
.filter((a) => a.is_legacy)
.map((a) => (
<CommandItem
className="aria-selected:bg-inherit aria-selected:text-accent-inherit"
key={a.name}
>
{a.name}
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
);
}
4 changes: 2 additions & 2 deletions components/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ const CommandInput = React.forwardRef<
<CommandPrimitive.Input
ref={ref}
className={cn(
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 focus-visible:ring-0 focus-visible:ring-offset-0",
className
)}
{...props}
/>
</div>
))
));

CommandInput.displayName = CommandPrimitive.Input.displayName

Expand Down
6 changes: 6 additions & 0 deletions lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export const sshInfo = SshInfoConvert.toSSHInfo(JSON.stringify(sshInfoJSON))
import sshInfoStrings from '@/build/fixtures/ssh-info-strings/strings'
export { sshInfoStrings }

import affiliationInfoJSON from '@/build/fixtures/affiliation-info.json'
import { Convert as AffiliationInfoConvert } from '@/build/fixtures/affiliation-info'
export type { AffiliationInfo } from '@/build/fixtures/affiliation-info'
export const affiliationInfo = AffiliationInfoConvert.toAffiliationInfo(JSON.stringify(affiliationInfoJSON))


import websiteConfigJSON from '@/build/fixtures/website-config.json'
import { Convert as WebsiteConfigConvert } from '@/build/fixtures/website-config'
export type { WebsiteConfig } from '@/build/fixtures/website-config'
Expand Down
35 changes: 23 additions & 12 deletions pages/docs/compute-cluster/getting-access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,45 @@ title: "Getting Access"
# Getting Access to the Compute Cluster

import { Steps } from 'nextra/components'
import { affiliationInfo } from '@/lib/data'
import { AffiliationList } from '@/components/affiliation-list'

<Steps>
### Determine your WATcloud contact

Every compute cluster user must have a WATcloud contact. Your WATcloud contact is responsible for approving your access request and helping
you with any issues you may have with the compute cluster.
Every WATcloud compute cluster user has a WATcloud contact. Your WATcloud contact is a designated person within your group (usually your group lead)
who is responsible for approving your access request and assisting you during the onboarding process.

If you are a member of a group in the following categories, your WATcloud contact is your group lead:
- [WUSA clubs](https://wusa.ca/clubs/)
- [SSDC teams](https://uwaterloo.ca/sedra-student-design-centre/directory-teams)
- UWaterloo research groups
- [UWaterloo capstone design teams](https://uwaterloo.ca/capstone-design/)
The following groups are registered with WATcloud:

If you are the lead of a group and would like to request access for your group, please email [email protected].
<AffiliationList affiliationInfo={affiliationInfo} />

If your group is not listed or shows up as `[Legacy]`[^legacy-affiliation], please ask your group lead to [register the group][registered-affiliations] with WATcloud.

[registered-affiliations]: ../registered-affiliations
[^legacy-affiliation]: A legacy affiliation is a group that was onboarded before the current [registered affiliations][registered-affiliations] system was in place.
Members of legacy affiliations can still access the compute cluster, but in order to use newer features like [SLURM](./slurm), the group must be registered.

### Fill out the onboarding form

Please fill out the [Onboarding form](https://cloud.watonomous.ca/docs/utilities/onboarding-form) and make sure to enable the "Compute Cluster" option.
Please fill out the [onboarding form](../utilities/onboarding-form) and make sure to enable the "Compute Cluster" option.

### Get approval from your WATcloud contact

Reach out to your WATcloud contact and ask them to approve your request. Your WATcloud contact is trained to help you with this process.
Reach out to your WATcloud contact and ask them to approve your request.

### Wait for your access to be provisioned

After your request is approved, it usually takes about 15 minutes for your access to be provisioned. Your WATcloud contact has visibility
into the provisioning process and can work with the WATcloud team to resolve any technical issues that may arise.
into the provisioning pipeline and can work with the WATcloud team to resolve any technical issues that may arise.

Once your access is provisioned, you will receive a welcome email.

</Steps>
</Steps>

{
// Separate footnotes from the main content
}
import { Separator } from "@/components/ui/separator"

<Separator className="mt-6" />
45 changes: 45 additions & 0 deletions scripts/generate-affiliation-info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import argparse
import csv
import json
import re
import sys
import textwrap
from itertools import chain
from pathlib import Path

sys.path.append(str(Path(__file__).parent.parent.parent))

from directory.scripts.affiliation_utils import get_all_affiliations
from directory.scripts.directory_utils import get_directory_config

def generate_affiliations():
affiliations = get_all_affiliations()
directory_config = get_directory_config()

ret = []
for aff in affiliations:
ret.append({
"name": aff["name"],
"is_legacy": False,
})

for aff_name in directory_config["legacy_affiliations"]:
ret.append({
"name": aff_name,
"is_legacy": True,
})

return ret

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate affiliation information for the website.")
parser.add_argument("output_dir", type=str, help="The directory to output the affiliation information.")
args = parser.parse_args()
affiliations = generate_affiliations()


with open(Path(args.output_dir, "affiliation-info.json"), "w") as file:
json.dump({
"affiliations": affiliations,
}, file, indent=2)

3 changes: 3 additions & 0 deletions scripts/generate-fixtures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if [ -n "$__fetch_from" ]; then
wget --quiet -O "$PROJECT_DIR/build/fixtures/website-config.json" "$__fetch_from/website-config.json"
wget --quiet -O "$PROJECT_DIR/build/fixtures/affiliation.schema.json" "$__fetch_from/affiliation.schema.json"
wget --quiet -O "$PROJECT_DIR/build/fixtures/user.schema.json" "$__fetch_from/user.schema.json"
wget --quiet -O "$PROJECT_DIR/build/fixtures/affiliation-info.json" "$__fetch_from/affiliation-info.json"
else
echo "Generating fixtures..."
# Create a new worktree
Expand All @@ -72,13 +73,15 @@ else
python3 "$SCRIPT_DIR/generate-website-config.py" "$PROJECT_DIR/../outputs" "$PROJECT_DIR/build/fixtures"
cp "$PROJECT_DIR/../directory/affiliations/affiliation.schema.json" "$PROJECT_DIR/build/fixtures"
cp "$PROJECT_DIR/../outputs/directory/users/user.schema.json" "$PROJECT_DIR/build/fixtures"
python3 "$SCRIPT_DIR/generate-affiliation-info.py" "$PROJECT_DIR/build/fixtures"
fi

# Add typescript types
echo "Generating fixture types..."
./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/machine-info.{ts,json}
./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/ssh-info.{ts,json}
./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/website-config.{ts,json}
./node_modules/.bin/quicktype -o "$PROJECT_DIR"/build/fixtures/affiliation-info.{ts,json}

echo "Generating mdx files from data..."
python3 "$SCRIPT_DIR/generate-mdx-strings.py" json-to-mdx "$PROJECT_DIR/build/fixtures/ssh-info.json" "$PROJECT_DIR/build/fixtures/ssh-info-strings"
Expand Down

0 comments on commit a623800

Please sign in to comment.