Skip to content

Commit 2495f8d

Browse files
V1.0
(first working version)
1 parent fe8b0f6 commit 2495f8d

File tree

13 files changed

+521
-0
lines changed

13 files changed

+521
-0
lines changed

.travis.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
sudo: false
2+
dist: trusty
3+
language: php
4+
php:
5+
- 5.6
6+
- 7
7+
- 7.1
8+
env:
9+
global:
10+
- CORE_BRANCH=stable15
11+
matrix:
12+
- DB=pgsql
13+
14+
matrix:
15+
allow_failures:
16+
- env: DB=pgsql CORE_BRANCH=master
17+
include:
18+
- php: 5.6
19+
env: DB=sqlite
20+
- php: 5.6
21+
env: DB=mysql
22+
- php: 5.6
23+
env: DB=pgsql CORE_BRANCH=master
24+
fast_finish: true
25+
26+
27+
before_install:
28+
# enable a display for running JavaScript tests
29+
- export DISPLAY=:99.0
30+
- sh -e /etc/init.d/xvfb start
31+
- nvm install 8
32+
- npm install -g npm@latest
33+
- make
34+
- make appstore
35+
# install core
36+
- cd ../
37+
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_BRANCH nextcloud
38+
- mv "$TRAVIS_BUILD_DIR" nextcloud/apps/uploadslist
39+
40+
before_script:
41+
- if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; fi
42+
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e 'create database oc_autotest;'; fi
43+
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"; fi
44+
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"; fi
45+
- cd nextcloud
46+
- mkdir data
47+
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
48+
- ./occ app:enable uploadslist
49+
- php -S localhost:8080 &
50+
- cd apps/uploadslist
51+
52+
script:
53+
- make test
54+
55+
after_failure:
56+
- cat ../../data/nextcloud.log
57+
58+
addons:
59+
firefox: 'latest'
60+
mariadb: '10.1'
61+
62+
services:
63+
- postgresql
64+
- mariadb

Makefile

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# This file is licensed under the Affero General Public License version 3 or
2+
# later. See the COPYING file.
3+
# @author Bernhard Posselt <[email protected]>
4+
# @copyright Bernhard Posselt 2016
5+
6+
# Generic Makefile for building and packaging a Nextcloud app which uses npm and
7+
# Composer.
8+
#
9+
# Dependencies:
10+
# * make
11+
# * which
12+
# * curl: used if phpunit and composer are not installed to fetch them from the web
13+
# * tar: for building the archive
14+
# * npm: for building and testing everything JS
15+
#
16+
# If no composer.json is in the app root directory, the Composer step
17+
# will be skipped. The same goes for the package.json which can be located in
18+
# the app root or the js/ directory.
19+
#
20+
# The npm command by launches the npm build script:
21+
#
22+
# npm run build
23+
#
24+
# The npm test command launches the npm test script:
25+
#
26+
# npm run test
27+
#
28+
# The idea behind this is to be completely testing and build tool agnostic. All
29+
# build tools and additional package managers should be installed locally in
30+
# your project, since this won't pollute people's global namespace.
31+
#
32+
# The following npm scripts in your package.json install and update the bower
33+
# and npm dependencies and use gulp as build system (notice how everything is
34+
# run from the node_modules folder):
35+
#
36+
# "scripts": {
37+
# "test": "node node_modules/gulp-cli/bin/gulp.js karma",
38+
# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
39+
# "build": "node node_modules/gulp-cli/bin/gulp.js"
40+
# },
41+
42+
app_name=$(notdir $(CURDIR))
43+
build_tools_directory=$(CURDIR)/build/tools
44+
source_build_directory=$(CURDIR)/build/artifacts/source
45+
source_package_name=$(source_build_directory)/$(app_name)
46+
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
47+
appstore_package_name=$(appstore_build_directory)/$(app_name)
48+
npm=$(shell which npm 2> /dev/null)
49+
composer=$(shell which composer 2> /dev/null)
50+
51+
all: build
52+
53+
# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json
54+
# is present, the composer step is skipped, if no package.json or js/package.json
55+
# is present, the npm step is skipped
56+
.PHONY: build
57+
build:
58+
ifneq (,$(wildcard $(CURDIR)/composer.json))
59+
make composer
60+
endif
61+
ifneq (,$(wildcard $(CURDIR)/package.json))
62+
make npm
63+
endif
64+
ifneq (,$(wildcard $(CURDIR)/js/package.json))
65+
make npm
66+
endif
67+
68+
# Installs and updates the composer dependencies. If composer is not installed
69+
# a copy is fetched from the web
70+
.PHONY: composer
71+
composer:
72+
ifeq (, $(composer))
73+
@echo "No composer command available, downloading a copy from the web"
74+
mkdir -p $(build_tools_directory)
75+
curl -sS https://getcomposer.org/installer | php
76+
mv composer.phar $(build_tools_directory)
77+
php $(build_tools_directory)/composer.phar install --prefer-dist
78+
php $(build_tools_directory)/composer.phar update --prefer-dist
79+
else
80+
composer install --prefer-dist
81+
composer update --prefer-dist
82+
endif
83+
84+
# Installs npm dependencies
85+
.PHONY: npm
86+
npm:
87+
ifeq (,$(wildcard $(CURDIR)/package.json))
88+
cd js && $(npm) run build
89+
else
90+
npm run build
91+
endif
92+
93+
# Removes the appstore build
94+
.PHONY: clean
95+
clean:
96+
rm -rf ./build
97+
98+
# Same as clean but also removes dependencies installed by composer, bower and
99+
# npm
100+
.PHONY: distclean
101+
distclean: clean
102+
rm -rf vendor
103+
rm -rf node_modules
104+
rm -rf js/vendor
105+
rm -rf js/node_modules
106+
107+
# Builds the source and appstore package
108+
.PHONY: dist
109+
dist:
110+
make source
111+
make appstore
112+
113+
# Builds the source package
114+
.PHONY: source
115+
source:
116+
rm -rf $(source_build_directory)
117+
mkdir -p $(source_build_directory)
118+
tar cvzf $(source_package_name).tar.gz ../$(app_name) \
119+
--exclude-vcs \
120+
--exclude="../$(app_name)/build" \
121+
--exclude="../$(app_name)/js/node_modules" \
122+
--exclude="../$(app_name)/node_modules" \
123+
--exclude="../$(app_name)/*.log" \
124+
--exclude="../$(app_name)/js/*.log" \
125+
126+
# Builds the source package for the app store, ignores php and js tests
127+
.PHONY: appstore
128+
appstore:
129+
rm -rf $(appstore_build_directory)
130+
mkdir -p $(appstore_build_directory)
131+
tar cvzf $(appstore_package_name).tar.gz ../$(app_name) \
132+
--exclude-vcs \
133+
--exclude="../$(app_name)/build" \
134+
--exclude="../$(app_name)/tests" \
135+
--exclude="../$(app_name)/Makefile" \
136+
--exclude="../$(app_name)/*.log" \
137+
--exclude="../$(app_name)/phpunit*xml" \
138+
--exclude="../$(app_name)/composer.*" \
139+
--exclude="../$(app_name)/js/node_modules" \
140+
--exclude="../$(app_name)/js/tests" \
141+
--exclude="../$(app_name)/js/test" \
142+
--exclude="../$(app_name)/js/*.log" \
143+
--exclude="../$(app_name)/js/package.json" \
144+
--exclude="../$(app_name)/js/bower.json" \
145+
--exclude="../$(app_name)/js/karma.*" \
146+
--exclude="../$(app_name)/js/protractor.*" \
147+
--exclude="../$(app_name)/package.json" \
148+
--exclude="../$(app_name)/bower.json" \
149+
--exclude="../$(app_name)/karma.*" \
150+
--exclude="../$(app_name)/protractor\.*" \
151+
--exclude="../$(app_name)/.*" \
152+
--exclude="../$(app_name)/js/.*" \
153+
154+
.PHONY: test
155+
test: composer
156+
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.xml
157+
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## By default, the Nextcloud upload progress bar only shows an estimated time to completion. This App adds a list , that show every upload seperatly, in the Navbar.
2+
3+
# Uploads List
4+
Place this app in **nextcloud/apps/**
5+
6+
## Building the app
7+
8+
The app can be built by using the provided Makefile by running:
9+
10+
make
11+
12+
This requires the following things to be present:
13+
* make
14+
* which
15+
* tar: for building the archive
16+
* curl: used if phpunit and composer are not installed to fetch them from the web
17+
* npm: for building and testing everything JS, only required if a package.json is placed inside the **js/** folder
18+
19+
The make command will install or update Composer dependencies if a composer.json is present and also **npm run build** if a package.json is present in the **js/** folder. The npm **build** script should use local paths for build systems and package managers, so people that simply want to build the app won't need to install npm libraries globally, e.g.:
20+
21+
**package.json**:
22+
```json
23+
"scripts": {
24+
"test": "node node_modules/gulp-cli/bin/gulp.js karma",
25+
"prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
26+
"build": "node node_modules/gulp-cli/bin/gulp.js"
27+
}
28+
```
29+
30+
31+
## Running tests
32+
You can use the provided Makefile to run all tests by using:
33+
34+
make test
35+
36+
This will run the PHP unit and integration tests and if a package.json is present in the **js/** folder will execute **npm run test**
37+
38+
Of course you can also install [PHPUnit](http://phpunit.de/getting-started.html) and use the configurations directly:
39+
40+
phpunit -c phpunit.xml
41+
42+
or:
43+
44+
phpunit -c phpunit.integration.xml
45+
46+
for integration tests

appinfo/app.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
use OCP\Util;
4+
$eventDispatcher = \OC::$server->getEventDispatcher();
5+
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function(){
6+
Util::addScript('uploadslist', 'script' );
7+
Util::addStyle('uploadslist', 'style' );
8+
});

appinfo/info.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
4+
<id>uploadslist</id>
5+
<name>Uploads List</name>
6+
<summary>Shows Upload Details (percent complete, current speed, ...) in Navbar</summary>
7+
<description><![CDATA[By default, the Nextcloud upload progress bar only shows an estimated time to completion. This App adds a list , that show every upload seperatly, in the Navbar.]]></description>
8+
<version>1.0</version>
9+
<licence>agpl</licence>
10+
<author mail="[email protected]" homepage="https://github.com/TessyPowder">Jonathan Treffler</author>
11+
<namespace>UploadsList</namespace>
12+
<category>tools</category>
13+
<bugs>https://github.com/TessyPowder/Nextcloud-Uploads-List/issues</bugs>
14+
<dependencies>
15+
<nextcloud min-version="16" max-version="16"/>
16+
</dependencies>
17+
</info>

appinfo/routes.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Create your routes in here. The name is the lowercase name of the controller
4+
* without the controller part, the stuff after the hash is the method.
5+
* e.g. page#index -> OCA\UploadsList\Controller\PageController->index()
6+
*
7+
* The controller class has to be registered in the application.php file since
8+
* it's instantiated in there
9+
*/
10+
return [
11+
'routes' => [
12+
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
13+
['name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST'],
14+
]
15+
];

composer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "Uploads List",
3+
"description": "Shows Upload Details (percent complete, current speed, ...) in Navbar",
4+
"type": "project",
5+
"license": "AGPL",
6+
"authors": [
7+
{
8+
"name": "Jonathan Treffler"
9+
}
10+
],
11+
"require": {},
12+
"require-dev": {
13+
"phpunit/phpunit": "^5.4"
14+
}
15+
}

css/style.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.icon-uploadsmenu:hover{
2+
opacity: 1 !important;
3+
}
4+
#uploadsmenu-menu{
5+
width: 350px;
6+
}
7+
#uploadsmenu-menu > div{
8+
overflow-y: scroll;
9+
max-height: 330px;
10+
}

0 commit comments

Comments
 (0)