Skip to content

Commit

Permalink
(0.9.21) Batch Download Generation Tool + Cook/Voyager Fixes (#613)
Browse files Browse the repository at this point in the history
* DPO3DPKRT-819/admin batch generate downloads (#608)
* DPO3DPKRT-837/docker compose v2 migration (#611)
* DPO3DPKRT-836/verifying cook response fails with article assets (#612)
  • Loading branch information
EMaslowskiQ authored Aug 12, 2024
1 parent 7f4776e commit 8bed8bd
Show file tree
Hide file tree
Showing 40 changed files with 2,022 additions and 288 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
- "3306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
steps:
- name: verify Docker installation
run: docker compose version

- name: Checkout code
uses: actions/checkout@v3

Expand Down Expand Up @@ -103,6 +106,9 @@ jobs:
PACKRAT_SOLR_HOST: packrat-solr

steps:
- name: Verify Docker installation
run: docker compose version

- name: Checkout code
uses: actions/checkout@v3

Expand All @@ -117,11 +123,11 @@ jobs:

- name: Build Dev images
if: ${{!contains(github.ref, 'master')}}
run: docker-compose --env-file .env.dev -f ./conf/docker/docker-compose.dev.yml build
run: docker compose --env-file .env.dev -f ./conf/docker/docker-compose.dev.yml build

- name: Build Prod images
if: contains(github.ref, 'master')
run: docker-compose --env-file .env.prod -f ./conf/docker/docker-compose.prod.yml build
run: docker compose --env-file .env.prod -f ./conf/docker/docker-compose.prod.yml build

# Prepares tag for docker images
- name: Prepare image tag
Expand Down
30 changes: 22 additions & 8 deletions client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
enum API_ROUTES {
LOGIN = 'auth/login',
LOGOUT = 'auth/logout',
GEN_DOWNLOADS = 'api/scene/gen-downloads'
GEN_DOWNLOADS = 'api/scene/gen-downloads',
PROJECTS = 'api/project',
}

export type AuthResponseType = {
Expand All @@ -34,25 +35,39 @@ export default class API {

return this.request(API_ROUTES.LOGIN, options);
}

static async logout(): Promise<AuthResponseType> {
return this.request(API_ROUTES.LOGOUT);
}

static async generateDownloads(idSystemObject: number, statusOnly: boolean = false): Promise<RequestResponse> {
// generation operations
static async generateDownloads(idSystemObject: number[], statusOnly: boolean = false, rePublish: boolean = false): Promise<RequestResponse> {
// initiates the generate downloads routine and either runs the recipe with the given id or returns its status.
// idSystemObject = the SystemObject id for the Packrat Scene making this request
const body = JSON.stringify({ idSystemObject });
const body = JSON.stringify({ statusOnly, rePublish, idSystemObject });
let uri: string = API_ROUTES.GEN_DOWNLOADS;
console.log('[PACKRAT:DEBUG] body: ',body);
console.trace('API.generateDownloads');

let options;
if(statusOnly)
if(statusOnly) {
options = { method: 'GET' };
else
uri += `?id=${idSystemObject[0]}`; // add our index. only get status for single element
} else {
options = { method: 'POST', body };
}

return this.request(uri, options);
}

return this.request(`${API_ROUTES.GEN_DOWNLOADS}?id=${idSystemObject}`, options);
// project operations
static async getProjects(): Promise<RequestResponse> {
return this.request(`${API_ROUTES.PROJECTS}`, { method: 'GET' });
}
static async getProjectScenes(idProject: number): Promise<RequestResponse> {
return this.request(`${API_ROUTES.PROJECTS}/${idProject}/scenes`, { method: 'GET' });
}

// general routines
static async request(route: string, options: RequestInit = {}): Promise<any> {
const serverEndpoint = API.serverEndpoint();
const defaultOptions: RequestInit = {
Expand All @@ -75,7 +90,6 @@ export default class API {
console.error(`[Packrat] could not complete request (${route}) due to error: ${error}`);
});
}

static serverEndpoint(): string {
// If we're accessing Packrat via Telework, hard-code server path to the server directory of the host root
switch (window.location.hostname.toLowerCase()) {
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/controls/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ interface TextAreaProps extends ViewableProps {
value?: number | string | null;
name: string;
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
onBlur?: (event: React.ChangeEvent<HTMLInputElement>) => void;
error?: boolean;
placeholder?: string;
height?: string;
rows?: string;
}

function TextArea(props: TextAreaProps): React.ReactElement {
const { label, name, value, onChange, required = false, viewMode = false, disabled = false, placeholder, rows } = props;
const { label, name, value, onChange, onBlur, required = false, viewMode = false, disabled = false, placeholder, rows } = props;
const classes = useStyles(props);

const rowFieldProps = { alignItems: 'center', justifyContent: 'space-between', style: { borderRadius: 0 } };
Expand All @@ -59,6 +60,7 @@ function TextArea(props: TextAreaProps): React.ReactElement {
className={classes.description}
name={name}
onChange={onChange}
onBlur={onBlur}
debounceTimeout={400}
placeholder={placeholder}
rows={rows}
Expand All @@ -72,6 +74,7 @@ function TextArea(props: TextAreaProps): React.ReactElement {
className={classes.description}
name={name}
onChange={onChange}
onBlur={onBlur}
debounceTimeout={400}
placeholder={placeholder}
rows={rows}
Expand Down
1 change: 1 addition & 0 deletions client/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Config = {
*/
voyager: {
storyJS: process.env.NODE_ENV === 'development' ? 'https://3d-api.si.edu/resources/js/voyager-story.min.js': 'https://3d-api.si.edu/resources/js/voyager-story.min.js',
storyJSDev: process.env.NODE_ENV === 'development' ? 'https://3d-api.si.edu/resources/js/voyager-story.dev.js': 'https://3d-api.si.edu/resources/js/voyager-story.dev.js',
storyCSS: process.env.NODE_ENV === 'development' ? 'https://3d-api.si.edu/resources/css/voyager-story.min.css' : 'https://3d-api.si.edu/resources/css/voyager-story.min.css',
explorerJS: process.env.NODE_ENV === 'development' ? 'https://3d-api.si.edu/resources/js/voyager-explorer.min.js' : 'https://3d-api.si.edu/resources/js/voyager-explorer.min.js',
}
Expand Down
3 changes: 2 additions & 1 deletion client/src/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const ADMIN_ROUTES_TYPE = {
CREATEUNIT: 'units/create',
LICENSES: 'licenses',
SUBJECTS: 'subjects',
CREATESUBJECT: 'subjects/create'
CREATESUBJECT: 'subjects/create',
TOOLS: 'tools',
};

export const ADMIN_ROUTE = {
Expand Down
2 changes: 2 additions & 0 deletions client/src/pages/Admin/components/AdminSidebarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function AdminSidebarMenu(): React.ReactElement {
<AdminSidebarMenuRow path={'projects'} selected={path.includes('projects')} />
<AdminSidebarMenuRow path={'units'} selected={path.includes('units')} />
<AdminSidebarMenuRow path={'subjects'} selected={path.includes('subjects')} />
<Box className={classes.divider} />
<AdminSidebarMenuRow path={'tools'} selected={path.includes('tools')} />
</MenuList>
</Box>
);
Expand Down
Loading

0 comments on commit 8bed8bd

Please sign in to comment.