Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development 3.12 #1039

Merged
merged 30 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8cf2bdc
Export contracts
zaelgohary Aug 14, 2023
44f9d9c
Edit grid type
zaelgohary Aug 14, 2023
1a59f87
improve random string
AlaaElattar Aug 16, 2023
317b425
fix remaining length
AlaaElattar Aug 16, 2023
0522df3
fix length
AlaaElattar Aug 16, 2023
e0529b6
remove unnecessary logic
AlaaElattar Aug 20, 2023
daaa387
update all solutions' names to be with same length
AlaaElattar Aug 20, 2023
6ba371d
remove suffix && make length 7 by default
AlaaElattar Aug 20, 2023
0d7d113
Merge branch 'development_312' of https://github.com/threefoldtech/tf…
zaelgohary Aug 20, 2023
d7e56f1
Merge pull request #1001 from threefoldtech/development_improve_capro…
AlaaElattar Aug 20, 2023
d66bdf6
Merge pull request #980 from threefoldtech/development_export_data
zaelgohary Aug 20, 2023
24f1e1c
Fix voting dialogue (#994)
zaelgohary Aug 21, 2023
e388cbf
Merge branch 'development' of https://github.com/threefoldtech/tfgrid…
zaelgohary Aug 22, 2023
47c8aa4
Fix failing build workflow
zaelgohary Aug 23, 2023
2bdc126
Release packages on npm with an edge tag (#1038)
0oM4R Aug 23, 2023
af7a9f9
Merge branch 'development' of https://github.com/threefoldtech/tfgrid…
zaelgohary Aug 24, 2023
8b03b3c
fix select node to not be invalid when mounted (#1036)
AlaaElattar Aug 24, 2023
f51cbca
Updating load more gateway nodes button (#1037)
maayarosama Aug 27, 2023
735df7e
fix layout align (#1059)
samaradel Sep 4, 2023
77984b7
Add deleting contracts warning
zaelgohary Sep 7, 2023
9ffe907
Update packages/playground/src/weblets/tf_contracts_list.vue
zaelgohary Sep 10, 2023
e69c7c6
Merge pull request #1079 from threefoldtech/development_312_contract_…
AhmedHanafy725 Sep 10, 2023
3f902da
Fix password validation
zaelgohary Sep 11, 2023
e17cf93
Edit password validation
zaelgohary Sep 11, 2023
b9f77dc
Revert profile manager changes
zaelgohary Sep 11, 2023
54e79d6
Merge pull request #1085 from threefoldtech/development_312_password
AhmedHanafy725 Sep 12, 2023
3c1a888
Merge branch 'development' into development_312
AhmedHanafy725 Sep 17, 2023
ddaddee
Add @threefold/UI package (#1058)
zaelgohary Sep 18, 2023
f237d9b
Updated the UI package build script to be yarn workspace v1.22.19
Mahmoud-Emad Sep 18, 2023
333c898
Merge pull request #1120 from threefoldtech/development_312_ui
Mahmoud-Emad Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"/packages/rmb_direct_client/lib/types/lib/**",
"packages/weblets/playground/public/build/elements/*",
"packages/stats/public/build/*",
"packages/UI/*.config.js",
"packages/UI/src/index.css",
"*.config.*",
"*global.css"
]
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -29,10 +30,15 @@ jobs:
run: yarn --pure-lockfile
- name: Build
run: lerna run build --no-private
- name: Publish

- name: Publish Pre-release
if: contains(github.ref, 'rc')
run: lerna publish from-package --no-private --yes --dist-tag edge

- name: Publish Release
if: "!contains(github.ref, 'rc')"
run: lerna publish from-package --no-private --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}


docker-image-grid-client:
needs: build
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/threefold_ui_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code using yarn build-only

name: Threefold UI Build

on:
push:
branches:
- development
paths:
- "packages/UI/**"
pull_request:
branches:
- development
paths:
- "packages/UI/**"

jobs:
build:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=8192"

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: Install dependencies
run: |
yarn install

- name: Build
run: |
lerna run build --no-private
yarn workspace @threefold/ui build-only
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ifeq ($(project), playground)
cd packages/playground && yarn dev
else ifeq ($(project), dashboard)
cd packages/dashboard && yarn serve
else ifeq ($(project), UI)
cd packages/UI && yarn dev
endif

build:
Expand All @@ -39,6 +41,8 @@ else ifeq ($(project), weblets)
cd packages/weblets/playground && yarn build
else ifeq ($(project), playground)
cd packages/playground && yarn build
else ifeq ($(project), UI)
cd packages/UI && yarn build-only
else
yarn lerna run build --no-private
endif
6 changes: 6 additions & 0 deletions docs/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ On **Pull Request**, and **Push** to development branch that has changes in the
### [Docker](/.github/workflows/stats_docker.yaml)

On **Release** published: It will build and push a new docker image based on project release tag.

## Threefold UI

### [Build](/.github/workflows/threefold_ui_build.yaml)

On **Pull Request**, and **Push** to development branch: It will do a clean install of node dependencies, cache/restore them to make the process faster, and build the source code using `lerna run build --no-private`.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.57.0",
"@vue/eslint-config-typescript": "^11.0.2",
"cypress": "^12.11.0",
"cypress": "^13.1.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-cypress": "^2.13.2",
Expand Down
1 change: 1 addition & 0 deletions packages/UI/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_MNEMONIC="<your_mnemonic_here>"
28 changes: 28 additions & 0 deletions packages/UI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
31 changes: 31 additions & 0 deletions packages/UI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# UI

Threefold UI is a project that contains reusable web components created by Threefold organization.

## Components

- [PDF Viewer](./docs/pdf_viewer.md)
- [Script Editor](./docs/script_editor.md)

## Examples

- [Verification Server Example](./docs/server_verification.md)
- [Web Component Example](./docs/web_component.md)

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Type-Check, Compile and Minify for Production

```sh
npm run build
```
8 changes: 8 additions & 0 deletions packages/UI/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
baseUrl: "http://localhost:4173",
supportFile: false,
},
});
8 changes: 8 additions & 0 deletions packages/UI/cypress/e2e/example.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// https://on.cypress.io/api

describe("My First Test", () => {
it("visits the app root url", () => {
cy.visit("/");
cy.contains("h1", "You did it!");
});
});
10 changes: 10 additions & 0 deletions packages/UI/cypress/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["./**/*", "../support/**/*"],
"compilerOptions": {
"isolatedModules": false,
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
}
}
5 changes: 5 additions & 0 deletions packages/UI/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
39 changes: 39 additions & 0 deletions packages/UI/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

export {};
20 changes: 20 additions & 0 deletions packages/UI/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";

// Alternatively you can use CommonJS syntax:
// require('./commands')
94 changes: 94 additions & 0 deletions packages/UI/docs/pdf_viewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# PDF Signer Web Component Documentation

## Table of Contents

1. [Introduction](#introduction)
2. [Usage](#usage)
- [Build the PDF Signer](#build-the-pdf-signer)
- [Example of Usage](#example-of-usage)
- [Using Providers and Extensions](#using-providers-and-extensions)

## Introduction

The PDF Signer Web Component is a user-friendly PDF viewer that simplifies the process of signing PDF documents and sending them to a specified endpoint. This component is designed to make PDF signing and processing straightforward for your web applications.

**Key features:**

- Load and view PDF files from a provided URL.
- Enable users to sign PDF documents easily.
- Seamlessly submit signed documents to a designated endpoint.

## Usage

### Build the PDF Signer

To use the PDF Signer Web Component, follow these steps:

1. Clone the `tfgrid-sdk-ts` repository.
2. Navigate to the `repository/packages/UI` directory.
3. Run `yarn build-only` to generate the required distribution files.
4. Locate the `dist` folder created in the previous step.
5. Copy the `threefold-ui.umd.js` file and include it in your project's HTML files.
6. Copy the `dist/tailwind.css` file and use it for styling.

### Example of Usage

Here's an example of how to use the PDF Signer Web Component in your HTML file:

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Threefold UI</title>

<!-- Include the style and logo files -->
<link rel="stylesheet" href="./style.css" />
</head>

<body>
<!-- Use the pdf-signer custom element with required attributes -->
<pdf-signer
dest="http://localhost:3000/"
pdfUrl="https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf"
network="main"
/>
<!-- Include the PDF Signer component script -->
<script src="./pdf.js"></script>
</body>
</html>
```

In the example above, replace `<pdf-url>` and `<endpoint-url>` with the actual URLs for your PDF document and the destination where signed documents should be sent, also for the `<network>` should match one of the following networks `[main, test, qa, dev]`.

Feel free to customize the HTML structure and styles to match your application's design and requirements.

### Using Providers and Extensions

The PDF Signer Web Component now supports providers/extensions for enhanced functionality. You can choose between two providers:

- **threefoldSignerProvider**: A basic provider that requires a mnemonic provided in the [.env](../.env).

- **threefoldConnectorProvider**: An extension that connects to the Threefold Connector extension for enhanced capabilities.

To specify the provider/extension to use, you can set an environment variable in your project. For example, to use the `threefoldSignerProvider`, set the following environment variable:

```bash
VITE_MNEMONIC="<your_mnemonic_here>"
```

and to use the `threefoldConnectorProvider` extension please make sure that you installed and enabled access the extension. `PS: The extension is still under development`
comment the above line to be:

```bash
# VITE_MNEMONIC="<your_mnemonic_here>"
```

The component will automatically detect the environment variable and use the selected provider/extension.

By adding this flexibility, you can choose the provider/extension that best fits your project's requirements.

**Note**: If you choose to use the `threefoldConnectorProvider` extension, make sure it is installed and configured properly in your environment.

Now, you can seamlessly integrate PDF signing into your web application using the PDF Signer Web Component with your preferred provider/extension.
Loading
Loading