diff --git a/public/index.html b/public/index.html
deleted file mode 100644
index 2c11f22..0000000
--- a/public/index.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
+
+
MSDS
@@ -7,9 +8,25 @@
-
- {{l.name}}
-
+
+
+
+ File Name |
+ Size |
+ |
+
+
+
+
+ {{l.name}} |
+ {{l.size / 1024 | size}} |
+
+
+
+ |
+
+
+
\ No newline at end of file
diff --git a/src/app/msds/msds.component.ts b/src/app/msds/msds.component.ts
index 22759c5..e85e602 100644
--- a/src/app/msds/msds.component.ts
+++ b/src/app/msds/msds.component.ts
@@ -9,6 +9,7 @@ import {AppStore} from '../app.store';
export class MSDSComponent implements OnInit {
firestore;
links = [];
+ loading = false;
storage;
constructor(public store: AppStore) {
@@ -16,6 +17,18 @@ export class MSDSComponent implements OnInit {
this.storage = firebase.storage();
}
+ async delete(link) {
+ this.loading = true;
+ let wait = [
+ this.storage.ref(`MSDS/${link.name}`).delete(),
+ this.firestore.collection('msds').doc(link.name).delete()
+ ];
+
+ await Promise.all(wait);
+ this.links.splice(this.links.indexOf(link), 1);
+ this.loading = false;
+ }
+
async ngOnInit() {
let docs = await this.firestore.collection('msds').get();
docs.forEach(snap => this.links = this.links.concat([snap.data()]).sort());
@@ -26,16 +39,17 @@ export class MSDSComponent implements OnInit {
}
upload(e) {
+ this.loading = true;
this.storage.ref(`MSDS/${e.files[0].name}`).put(e.files[0]).then(async e => {
let data = {
name: e.metadata.name,
+ size: e.metadata.size,
src: await this.storage.ref(e.metadata.fullPath).getDownloadURL()
};
- console.log(data);
-
- this.links.concat([data]).sort();
- this.firestore.collection('msds').doc(e.metadata.name).set(data);
+ await this.firestore.collection('msds').doc(e.metadata.name).set(data);
+ this.links = this.links.concat([data]).sort();
+ this.loading = false;
});
}
}
diff --git a/src/app/size.pipe.ts b/src/app/size.pipe.ts
new file mode 100644
index 0000000..7015ec5
--- /dev/null
+++ b/src/app/size.pipe.ts
@@ -0,0 +1,13 @@
+import {Pipe, PipeTransform} from '@angular/core';
+
+@Pipe({
+ name: 'size'
+})
+export class SizePipe implements PipeTransform {
+
+ constructor() { }
+
+ transform(val, unit) {
+ return `${Math.round(val)} KB`;
+ }
+}
\ No newline at end of file
diff --git a/src/assets/Chromatex_MSDS.pdf b/src/assets/Chromatex_MSDS.pdf
deleted file mode 100644
index 5d9d88a..0000000
Binary files a/src/assets/Chromatex_MSDS.pdf and /dev/null differ