Skip to content

Commit

Permalink
result of 'just format'
Browse files Browse the repository at this point in the history
  • Loading branch information
sagerb committed Mar 21, 2024
1 parent 36a3bda commit a55201e
Show file tree
Hide file tree
Showing 96 changed files with 2,657 additions and 2,619 deletions.
669 changes: 349 additions & 320 deletions web/.eslintrc.cjs

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions web/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Web Application

This application is built using:

- [VueJS](https://vuejs.org)
- Vue 3, Composition API w/ Setup API
- Vue 3, Composition API w/ Setup API
- [Quasar Framework V2](https://quasar.dev/)
- [Just (justfiles)](https://just.systems)
- [Typescript](https://www.typescriptlang.org/)
- [Vite](https://vitejs.dev/)
- [Sass w/ SCSS syntax](https://sass-lang.com/documentation/syntax/)
- [ESLint](https://eslint.org/)
- Using almost the same rules as Connect Dashboard project
- Using almost the same rules as Connect Dashboard project
- [Pinia](https://pinia.vuejs.org/)
- [Axios](https://axios-http.com/docs/intro)
- [Vitest](https://vitest.dev/)
Expand All @@ -18,17 +19,17 @@ This application is built using:
# Installing the prerequisites

1. Node JS (LTS Version)
- NOTE: use of nvm is highly recommended:
- [NVM](https://github.com/nvm-sh/nvm#installing-and-updating)
- Global version of node is NOT recommended, but...
- [NodeJS](https://nodejs.org/en/download)
- NOTE: use of nvm is highly recommended:
- [NVM](https://github.com/nvm-sh/nvm#installing-and-updating)
- Global version of node is NOT recommended, but...
- [NodeJS](https://nodejs.org/en/download)
2. Install Just:
- `[Just](https://just.systems/man/en/)
- `[Just](https://just.systems/man/en/)

# Building the client

1. Default recipe will clean, image, bootstrap, validate, build and test agent & client
- `just`
- `just`

# Common Developer tasks

Expand Down
24 changes: 11 additions & 13 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" sizes="48x48" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Posit Publisher</title>
</head>

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Posit Publisher</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
13 changes: 5 additions & 8 deletions web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

<template>
<div id="app">
<q-layout
view="hHh lpR fFf"
>
<q-layout view="hHh lpR fFf">
<AppHeader />

<q-page-container>
Expand All @@ -17,10 +15,10 @@
</template>

<script setup lang="ts">
import AppHeader from 'src/components/AppHeader.vue';
import { onBeforeUnmount } from 'vue';
import { useEventStore } from 'src/stores/events';
import { useDeploymentStore } from 'src/stores/deployments';
import AppHeader from "src/components/AppHeader.vue";
import { onBeforeUnmount } from "vue";
import { useEventStore } from "src/stores/events";
import { useDeploymentStore } from "src/stores/deployments";

const eventStore = useEventStore();

Expand All @@ -31,7 +29,6 @@ onBeforeUnmount(() => {

// Let's start population of the deployments as quickly as possible
useDeploymentStore();

</script>

<style lang="scss">
Expand Down
6 changes: 3 additions & 3 deletions web/src/api/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# API Wrapper Library
# API Wrapper Library

A library to enable convenient access to the Publisher Client API and its
response types.

## Usage

```typescript
import { useApi } from 'src/api';
import { useApi } from "src/api";

const api = useApi();

Expand All @@ -22,7 +22,7 @@ using `setBaseUrl`. This changes the client so all requests will use the new
base URL. This will need to be done before any requests are made.

```typescript
api.setBaseUrl('http://localhost:9000/api');
api.setBaseUrl("http://localhost:9000/api");
```

## Organization
Expand Down
12 changes: 6 additions & 6 deletions web/src/api/client.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (C) 2023 by Posit Software, PBC.

import axios from 'axios';
import axios from "axios";

import { Accounts } from 'src/api/resources/Accounts';
import { Deployments } from 'src/api/resources/Deployments';
import { Configurations } from 'src/api/resources/Configurations';
import { Files } from 'src/api/resources/Files';
import { Accounts } from "src/api/resources/Accounts";
import { Deployments } from "src/api/resources/Deployments";
import { Configurations } from "src/api/resources/Configurations";
import { Files } from "src/api/resources/Files";

class PublishingClientApi {
private client;
Expand All @@ -17,7 +17,7 @@ class PublishingClientApi {

constructor() {
this.client = axios.create({
baseURL: '/api',
baseURL: "/api",
});

this.accounts = new Accounts(this.client);
Expand Down
14 changes: 7 additions & 7 deletions web/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (C) 2023 by Posit Software, PBC.

export { api as default, useApi } from 'src/api/client';
export { api as default, useApi } from "src/api/client";

export * from 'src/api/types/accounts';
export * from 'src/api/types/configurations';
export * from 'src/api/types/connect';
export * from 'src/api/types/deployments';
export * from 'src/api/types/events';
export * from 'src/api/types/schema';
export * from "src/api/types/accounts";
export * from "src/api/types/configurations";
export * from "src/api/types/connect";
export * from "src/api/types/deployments";
export * from "src/api/types/events";
export * from "src/api/types/schema";
12 changes: 4 additions & 8 deletions web/src/api/resources/Accounts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (C) 2023 by Posit Software, PBC.

import { AxiosInstance } from 'axios';
import { AxiosInstance } from "axios";

import { Account } from 'src/api/types/accounts';
import { Account } from "src/api/types/accounts";

export class Accounts {
private client: AxiosInstance;
Expand All @@ -15,9 +15,7 @@ export class Accounts {
// 200 - success
// 500 - internal server error
getAll() {
return this.client.get<{ accounts: Account[] }>(
'/accounts',
);
return this.client.get<{ accounts: Account[] }>("/accounts");
}

// Returns:
Expand All @@ -26,8 +24,6 @@ export class Accounts {
// 500 - internal server error
get(accountName: string) {
const encodedAccountName = encodeURIComponent(accountName);
return this.client.get<Account>(
`/accounts/${encodedAccountName}`,
);
return this.client.get<Account>(`/accounts/${encodedAccountName}`);
}
}
8 changes: 4 additions & 4 deletions web/src/api/resources/Configurations.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (C) 2023 by Posit Software, PBC.

import { AxiosInstance } from 'axios';
import { AxiosInstance } from "axios";

import {
Configuration,
ConfigurationDetails,
ConfigurationError,
} from '../types/configurations';
} from "../types/configurations";

export class Configurations {
private client: AxiosInstance;
Expand All @@ -20,7 +20,7 @@ export class Configurations {
// 500 - internal server error
getAll() {
return this.client.get<Array<Configuration | ConfigurationError>>(
'/configurations',
"/configurations",
);
}

Expand Down Expand Up @@ -48,6 +48,6 @@ export class Configurations {
// 400 - bad request
// 500 - internal server error
inspect() {
return this.client.post<ConfigurationDetails[]>('/inspect');
return this.client.post<ConfigurationDetails[]>("/inspect");
}
}
25 changes: 12 additions & 13 deletions web/src/api/resources/Deployments.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright (C) 2023 by Posit Software, PBC.

import { AxiosInstance } from 'axios';
import { AxiosInstance } from "axios";

import { Deployment, DeploymentError, PreDeployment } from 'src/api/types/deployments';
import {
Deployment,
DeploymentError,
PreDeployment,
} from "src/api/types/deployments";

export class Deployments {
private client: AxiosInstance;
Expand All @@ -16,7 +20,7 @@ export class Deployments {
// 500 - internal server error
getAll() {
return this.client.get<Array<Deployment | PreDeployment | DeploymentError>>(
'/deployments',
"/deployments",
);
}

Expand All @@ -37,26 +41,23 @@ export class Deployments {
// 409 - conflict
// 500 - internal server error
// Errors returned through event stream
createNew(accountName? : string, saveName?: string) {
createNew(accountName?: string, saveName?: string) {
const params = {
account: accountName,
saveName,
};
return this.client.post<PreDeployment>(
'/deployments',
params,
);
return this.client.post<PreDeployment>("/deployments", params);
}

// Returns:
// 200 - success
// 400 - bad request
// 500 - internal server error
// Errors returned through event stream
publish(targetName: string, accountName? : string) {
publish(targetName: string, accountName?: string) {
const params = {
account: accountName,
config: 'default', // hardcoded for now
config: "default", // hardcoded for now
};
const encodedTarget = encodeURIComponent(targetName);
return this.client.post<{ localId: string }>(
Expand All @@ -71,8 +72,6 @@ export class Deployments {
// 500 - internal server error
delete(saveName: string) {
const encodedSaveName = encodeURIComponent(saveName);
return this.client.delete(
`deployments/${encodedSaveName}`
);
return this.client.delete(`deployments/${encodedSaveName}`);
}
}
Loading

0 comments on commit a55201e

Please sign in to comment.