Git Product home page Git Product logo

pss-desktop's Introduction

Personal Shared Storage Desktop App

This is a desktop app made with Angular 7 and Electron to act as the client for Personal Shared Storage API Server.

Installation

  1. Install Node JS and NPM (latest LTS).
  2. Install dependencies by running sudo npm install.
  3. Make sure NPX is installed, if not, install it globally by running sudo npm install npx -g.

Commands

  • Building the web app: sudo npm run build
  • Running the Electron app locally: npm run electron (do not use sudo!)

Electron Main IPC API

NOTE: Use the IpcService to use the IPC API. The service handles automatic listener detaching, identified listeners (which avoids communication interception when multiple listeners are listening to the same event) and also introduces states for events.

Event Name States Arguments Callback Arguments Description
open-files done error filenames Shows the open file dialog and returns the selected filenames or null if canceled.
save-file done error filename Shows the save file dialog and returns the selected filename or null if canceled.
save-files done error dirname Shows the select directory dialog and returns the selected directory name or null if canceled.
notify title message Shows a system notification.
server-api done error endpoint method query body headers response Sends a request to the server using the provided arguments and returns the response.
file-upload start progress done error filename size token remoteFilename response Uploads a file by the given filename on the server with the remote name and returns the response.
file-download start progress done error remoteFilename filename token response Downloads the specified remote file at the specified path and returns the response.

NOTE: All progress states send the following callback arguments: progress (which is the total downloaded bytes.)

NOTE: All error states send the the error object.

Angular Directives

The following directives are available...

Dropzone Directive

The dropzone directive configures an element as a file drop zone which captures all files that are dragged and dropped and emits an event with the following argument:

[
  {
    "path": "string",
    "size": "number",
    "filename": "string"
  }
]

Example:

<div (dropzone)="onDrop($event)"></div>
import { DropzoneEvent } from '@app/directive/dropzone';

onDrop(event: DropzoneEvent) {
  for ( const file of event) {
    console.log(file.path, file.size, file.filename);
  }
}

Angular Components

The following components are available...

Modal Component

The app-modal component is used to show content in a modal. It defines two optional attributes for controlling the visibility state of the modal: the boolean modal-show attribute and the element ref modal-close attribute which takes template reference and attaches a handler to its click event for closing the modal on click. It also defines an event called modal-closed which is emitted every time the modal is closed.

This component also defines three sections inside its content: modal-header, modal-body, and modal-footer. The modal-body can also be scrollable using the class name.

Example:

<app-modal [modal-show]="showModal" [modal-close]="closeButton" (modal-closed)="onModalClosed()">
  <div class="modal-header">
    Modal Title
  </div>
  <div class="modal-body">
    Modal body
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-primary btn-block" #closeButton>Ok</button>
  </div>
</app-modal>

Progress Bar Component

The app-progress-bar component is used whenever a progress bar is needed. It defines three attributes, one required attribute named progress which takes in the progress percentage (number only) and two optional attributes named progress-threshold which takes in a percentage threshold (number only) at which the progress bar turns red (defaults to null) and progress-color which overrides the default progress bar color.

Example:

<app-progress-bar [progress]="50" [progress-threshold]="80" progress-color="green"></app-progress-bar>

pss-desktop's People

Contributors

ramtinsoltani avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.