Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tloncorp/landscape
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ccca0f695f5b10aad849d0c23678970b9aa6910d
Choose a base ref
..
head repository: tloncorp/landscape
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 31b1cacb193421810bf42e28056161e75574207a
Choose a head ref
Showing with 27 additions and 19 deletions.
  1. +15 −11 ui/src/gear/permissions/types.ts
  2. +2 −1 ui/src/permissions/PermissionsDialog.tsx
  3. +9 −6 ui/src/permissions/usePassport.ts
  4. +1 −1 ui/src/permissions/usePermissions.ts
26 changes: 15 additions & 11 deletions ui/src/gear/permissions/types.ts
Original file line number Diff line number Diff line change
@@ -34,20 +34,24 @@ export interface PermSummary {
}

/**
* A passport-formatted permission
* Passport-formatted permissions
*/
export interface PassportPerm {
interface AppPerm {
pes: {
node: PermSummary[]
};
app: string;
}

interface KindPerm {
kind: {
nom: string;
pes: PermSummary[]
}
}

export interface AppPerm {
pes: {
node: PermSummary[]
};
app: string;
interface NodePerm {
node: PermSummary;
}

/**
@@ -58,19 +62,19 @@ export interface Passport {
/**
* Categorized perms
*/
rad: PassportPerm[];
rad: KindPerm[];
/**
* Dangerous perms
*/
sys: PassportPerm[];
sys: (KindPerm | NodePerm )[];
/**
* All apps perms
*/
any: PassportPerm[];
any: KindPerm[];
/**
* Unknown app perms
*/
new: PassportPerm[];
new: KindPerm[];
/**
* Specific app perms
*/
3 changes: 2 additions & 1 deletion ui/src/permissions/PermissionsDialog.tsx
Original file line number Diff line number Diff line change
@@ -55,7 +55,8 @@ export function PermissionsDialogInner({
viewMode === 'Summary' ? (
<div className="space-y-5">
{
[...passport.sys, ...passport.any, ...passport.new, ...passport.rad].map(p => {
// [...passport.sys, ...passport.any, ...passport.new, ...passport.rad].map(p => {
[...passport.rad].map(p => {
return p.kind.pes.map((pe, i) => {
return <SummaryRow key={i} summary={pe} />
})
15 changes: 9 additions & 6 deletions ui/src/permissions/usePassport.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Passport } from "@/gear";
import { Passport, Seal, sealToPassport } from "@/gear";
import { useEffect, useState } from "react";
import { fakePassport } from './temp';

export default function usePassport() {
export default function usePassport({ seal }: { seal: Seal }) {
const [passport, setPassport] = useState<Passport | null>(null);

const fetchPassport = async () => {
const response = await sealToPassport(seal);
console.log('response', response);
setPassport(response);
};

useEffect(() => {
setTimeout(() => {
setPassport(fakePassport);
} , 2000);
fetchPassport();
}, []);

return { passport };
2 changes: 1 addition & 1 deletion ui/src/permissions/usePermissions.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export default function usePermissions() {
const treaty = useTreaty(host, desk);
const docket = charge || treaty;
const appName = getAppName(docket);
const { passport } = usePassport(); // TODO: pass in desk
const { passport } = usePassport({ seal: treaty?.seal });
const [ship,] = useRemoteDesk(docket, pike, treaty?.ship);
const installStatus = useInstallStatus(docket);
const [presentableSeal, setPresentableSeal] = useState<string[] | null>(null);