Skip to content

Commit

Permalink
Merge pull request #20 from ecrum19/EDC_active
Browse files Browse the repository at this point in the history
documentation additions and small improvements
  • Loading branch information
ecrum19 authored Jun 5, 2024
2 parents 7013bc6 + 0ad7e87 commit 6ad8dac
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 71 deletions.
50 changes: 35 additions & 15 deletions src/components/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,38 +59,59 @@
Using a web browser navigate to
<a href="http://localhost:3000/">http://localhost:3000/</a>
</li>
<li>Click the link: "Sign up for an account"</li>
<li>Fill out the fields and click "Register"</li>
<li>On the "Your Account" page, click on "Create pod"</li>
<li>Enter a name for the pod and click "Create pod"</li>
<li>Return to the home page by clicking "Back"</li>
<li>Click the link: <b>"Sign up for an account"</b></li>
<li>Fill out the fields and click <b>"Register"</b></li>
<li>On the <b>"Your Account"</b> page, click on <b>"Create pod"</b></li>
<li>Enter a name for the pod and click <b>"Create pod"</b></li>
<li>Return to the home page by clicking <b>"Back"</b></li>
</ol>
<p>
<b>Voila</b>, you now have a pod hosted by your local machine!<br />
<span class="detail">
(Please note that if the terminal window is terminated, the Solid pod will no longer be unaccessible until it is re-launched.
For more info see <a href="https://communitysolidserver.github.io/CommunitySolidServer/latest/">Community Solid Server Documentation</a>.)
(Please note that if the terminal window you executed the bash script above is terminated,
the Solid pod will no longer be accessible until it is re-launched. For more info
see
<a
href="https://communitysolidserver.github.io/CommunitySolidServer/latest/"
>Community Solid Server Documentation</a
>.)
</span>
</p>
</p>

<hr />

<h2 class="req">3. Register your Pod on your new WebID</h2>
<ol>
<li>Within the TRIPLE_App/ directory, execute the command below:</li>
<pre><code>$ bash podRegistration.sh</code></pre>
<li>At the prompt, enter the name of your pod from above (E.g. test)</li>
</ol>
<pre><code>$ bash podRegistration.sh</code></pre>

<hr />


<h2 class="req">4. Using the TRIPLE App</h2>
<p>....</p>
<h2 class="req">4. Solid Pod Login within the TRIPLE App</h2>
<ol>
<li>
Click the <b>"Data Upload"</b> tab in the nav bar within the TRIPLE
App
</li>
<li>
If you followed the above sections to launch a local Solid Pod, simply
click the <b>"Login"</b> button that appears (because your pod provider is localhost:3000)
</li>
<li>After the redirect, click the <b>"Authorize"</b> button</li>
<li>
Once redirected back to the main page of the TRIPLE App, use the nav
bar to select the <b>"Data Upload"</b> tab
</li>
</ol>

<hr />



<h2 class="req">5. Data Uplod Functionality</h2>
<ol>
<li>Click the <b>"Data Upload"</b> tab of the nav bar above</li>
</ol>
</div>
</body>
</template>
Expand Down Expand Up @@ -144,7 +165,6 @@ p {
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 15px;
background-color: #f4f4f4;
Expand Down
16 changes: 13 additions & 3 deletions src/components/PodLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,25 @@
></v-alert>
</div>

<!-- "Create new pod" directions button -->
<!-- "Create new pod" button redirects back to homepage -->
<v-dialog max-width="500">
<template v-slot:activator="{ props: activatorProps }">
<v-btn
v-bind="activatorProps"
color="surface-variant"
text="Create New Pod?"
variant="flat"
@click="homepageRedir"
></v-btn>
</template>

<!-- "Create new pod" directions pop-up -->
<!--
<template v-slot:default="{ isActive }">
<v-card title="Pod Creation Instructions:">
<v-card-text class="mx-auto">
Run in the console: <code>$ bash makePod.sh</code>
</v-card-text>
<!-- Need to fix BASH script to launch an existing pod (not create a new one) -->
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
Expand All @@ -77,6 +79,7 @@
</v-card-actions>
</v-card>
</template>
-->
</v-dialog>

</div>
Expand All @@ -98,7 +101,7 @@


<script lang="ts">
import { startLogin, isLoggedin, currentWebId } from "./login";
import { startLogin, isLoggedin, currentWebId, redirectToHomepage } from "./login";
export default {
name: "LoginComponent",
Expand Down Expand Up @@ -131,6 +134,13 @@ export default {
this.loggedIn = isLoggedin();
this.webId = currentWebId();
},
/*
Redirects user back to homepage (for "create a pod" directions)
uses href to handle the redirect
*/
homepageRedir() {
redirectToHomepage()
}
},
mounted() {
// Delays the execution loginCheck() on page reload (to avoid async-related errors)
Expand Down
203 changes: 151 additions & 52 deletions src/components/PodUpload.vue
Original file line number Diff line number Diff line change
@@ -1,90 +1,189 @@
<template>
<!-- The data upload card is only shown after login -->
<v-container>
<!-- Card that contains the data upload field -->
<v-card
title="Add Data to Pod"
variant="tonal"
justify="center"
class="mx-auto"
color="indigo-darken-3"
>
<!-- The file input section << Want to make this drag and drop? >> -->
<form id="writeForm">
<v-file-input
clearable
label="File input"
show-size
type="file"
@change="uploadFile($event)"
ref="file">
</v-file-input>
<!-- Button that sends the uploaded file to the connected Pod -->
<v-btn
variant="tonal"
rounded="xs"
@click="submitUpload">
Upload
</v-btn>
</form>
</v-card>
<!-- Card that contains the data upload field -->
<v-card
title="Add Data to Pod"
variant="tonal"
justify="center"
class="mx-auto"
color="indigo-darken-3"
>
<!-- The file input section << Want to make this drag and drop eventually...>> -->
<form id="writeForm">
<v-file-input
clearable
label="Click to select file(s) OR drag and drop a file(s) here"
placeholder="Select your files"
show-size
type="file"
@change="uploadFile($event)"
ref="file"
counter
multiple
>
<template v-slot:selection="{ fileNames }">
<template v-for="(fileName, index) in fileNames" :key="fileName">
<v-chip
v-if="index < 2"
class="me-2"
color="deep-purple-accent-4"
size="small"
label
>
{{ fileName }}
</v-chip>

<span
v-else-if="index === 2"
class="text-overline text-grey-darken-3 mx-2"
>
+{{ files.length - 2 }} File(s)
</span>
</template>
</template>
</v-file-input>
<!-- Button that sends the uploaded file to the connected Pod -->
<v-btn variant="tonal" rounded="xs" @click="submitUpload">
Upload
</v-btn>
</form>

<div v-if="this.pod === 'Error: probably not logged in'">
<v-alert
class="mx-auto"
title="There was an error with the file(s) upload!"
type="error"
icon="$error"
><b>Try logging out and logging back in!</b></v-alert
>
</div>
<div v-else>
<div id="fileUploaded" v-if="fileUploaded">
<v-alert
class="mx-auto"
title="File(s) successfully uploaded!"
type="success"
icon="$success"
>(File(s) can be found in the <b>{{ this.pod }}uploads/</b> directory
of your pod)</v-alert
>
</div>
</div>
</v-card>
</v-container>
</template>

<hr />

<body>
<h2 class="req">Data Uplod Guide</h2>
<ol>
<li>Click the <b>"File Input"</b> bar above or drag and drop a file</li>
<li>Select the local file(s) you wish to upload</li>
<li>Click the <b>"Upload"</b> button</li>
<li>Voila! Your files should then be in your pod.</li>
</ol>
</body>
</template>

<script lang="ts">
import { getPodURLs, handleFiles } from './fileUpload';
import { currentWebId } from './login';
import { getPodURLs, handleFiles } from "./fileUpload";
import { currentWebId } from "./login";
export default {
data() {
return {
webId: '',
webId: "",
podURLs: [],
pod: '',
fileToUpload: null,
pod: "",
fileUploaded: false,
files: FileList,
};
},
methods: {
/*
/*
Calls getPodURLs() from fileUpload.ts to obtain a list of pods from the logged-in user's webID.
Obtains 'pod' variable (URL path to user's Pod).
*/
async getPodURL() {
this.webId = currentWebId(); // fetches user webID from login.ts
this.podURLs = await getPodURLs(this.webId); // calls async function to get Pod URLs
this.pod = this.podURLs[0]; // can fix this to handle multiple pods (<< FUTURE >>)
},
/*
async getPodURL() {
this.webId = currentWebId(); // fetches user webID from login.ts
this.podURLs = await getPodURLs(this.webId); // calls async function to get Pod URLs
this.pod = this.podURLs[0]; // can fix this to handle multiple pods (<< FUTURE >>)
},
/*
Calls uploadFile() from fileUpload.ts to upload a file to the user's pod.
obtains 'files' variable (a FileList that contains references to all files selected using the upload UI).
*/
uploadFile(event: FileList) {
this.files = event.target.files;
},
/*
uploadFile(event: FileList) {
this.files = event.target.files;
},
/*
Calls handleFiles() from fileUpload.ts parse the files selected for upload + uploads the to the pod using the overwriteFile() method from @inrupt/solid-client.
'files' variable is a FileList that contains references to all files selected using the upload UI.
*/
submitUpload() {
console.log(this.pod)
handleFiles(this.files, this.pod);
}
submitUpload() {
console.log(this.pod);

Check warning on line 125 in src/components/PodUpload.vue

View workflow job for this annotation

GitHub Actions / build-and-deploy

Unexpected console statement
handleFiles(this.files, this.pod);
this.fileUploaded = true;
},
},
mounted() {
// Delays the execution of these functions on page reload (to avoid async-related errors)
setTimeout(() => {
this.getPodURL();
}, 200);
},
props: {
}
}
props: {},
};
</script>


<style scoped>
body {
line-height: 1.6;
margin: 15px;
font-family: "Courier New", monospace;
max-width: 900px;
margin: auto;
padding: 20px;
background: #d0e0fc;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.container {
font-family: "Courier New", monospace;
max-width: 900px;
margin: auto;
padding: 20px;
background: #d0e0fc;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.v-btn {
margin-left: 15px;
margin-bottom: 15px;
}
ul,
ol {
margin-left: 20px;
margin-bottom: 15px;
margin-top: 5px;
}
ol li {
margin-bottom: 10px;
margin-left: 20px;
list-style-type: upper-roman;
align-items: Left;
}
.guide {
text-align: Left;
}
.req {
margin-top: 10px;
}
</style>
Loading

0 comments on commit 6ad8dac

Please sign in to comment.