Skip to content

Commit

Permalink
Merge pull request #35 from KNowledgeOnWebScale/EDC_active
Browse files Browse the repository at this point in the history
Pod registration + pod selection functionality
  • Loading branch information
ecrum19 authored Nov 13, 2024
2 parents 0ef83ac + ab9b05c commit b5746f6
Show file tree
Hide file tree
Showing 13 changed files with 710 additions and 185 deletions.
12 changes: 7 additions & 5 deletions TRIPLE-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ To **set up** your Solid Pod using the TRIPLE platform, follow these steps:

## 🔑 Logging into your Solid Pod (after creation)
1. **Navigate to our Solid Pod Hosting website**

- Go to [https://triple.ilabt.imec.be/](https://triple.ilabt.imec.be/)
- Use the following credentials to enter the site:
- **Password**: `triple`

2. **Login using your credentials**

- Click **Login** (assuming you have already made an account)

3. **Register your Pod on your new WebID card**
- Navigate to the "Home" page of the [Solid-Cockpit Webpage](https://knowledgeonwebscale.github.io/solid-cockpit/home)
- Login to your Solid Pod using the "https://triple.ilabt.imec.be/" provider
- CLICK the "REGISTER POD" button (not necessary to enter any PodURL)
- Thats it. Now you are connected to your new Pod!!

## 🛫 Using the Solid Cockpit App

Expand All @@ -54,7 +56,7 @@ The Solid Cockpit app provides several functionalities for managing and interact
- When uploading RDF data, file validity can be assessed before uploading.
- Specify and modify the metadata of uploaded files.

2. 🗂️ **Data Browser**
2. 🗂️ **Data Browser** (under construction)
- View, modify, move, and delete the contents of your Pod.
- Explore and edit the container structure of your Pod.

Expand All @@ -63,7 +65,7 @@ The Solid Cockpit app provides several functionalities for managing and interact
- A user input to designate the sources for the queries.
- Options that impact the the output formats, query execution, and other relevant parameters.

4. 🔒 **Data Privacy Management**
4. 🔒 **Data Privacy Management** (under construction)
- View the current privacy settings for your data (Read, Write, and Append).
- Add or change privacy settings to containers and resources in your Pod.
- Give and receive notifications related to new access rights to the data of others.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@vue/eslint-config-typescript": "^9.1.0",
"core-js": "^3.8.3",
"fs": "^0.0.1-security",
"pinia": "^2.2.6",
"vue": "^3.2.13",
"vue-router": "^4.0.13",
"vuetify": "^3.5.14"
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import FunctionSelector from './components/Styling/FunctionSelector.vue';
import TheHeader from './components/Styling/TheHeader.vue';
export default {
name: 'App',
components: {
Expand Down
201 changes: 201 additions & 0 deletions src/components/ContainerNav.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<template>
<nav class="dir-nav">
<div class="directory-nav">
<ul class="horizontal-list">
<li>
<span class="current-location">{{ currentLocation }}</span>
</li>
<li>
<div class="select-dir">
<v-select
clearable
variant="outlined"
v-model="currentUrl"
:items="childContainers(currentLocation, containerUrls)"
></v-select>
<v-btn
:disabled="currentUrl === null"
@click="changeCurrentLocation(currentUrl)"
>Go</v-btn
>
</div>
</li>
</ul>
</div>
</nav>
</template>

<script>
import { getContainedResourceUrlAll } from "@inrupt/solid-client";
import { WorkingData } from "./privacyEdit";
import { currentWebId } from "./login";
import { fetchData, fetchAclAgents } from "./getData";
export default {
name: 'ContainerNav',
props: {
currentPod: String
},
data() {
return {
webId: "",
dirContents: WorkingData,
currentLocation: "",
currentUrl: null,
urls: [],
containerUrls: [],
resourceUrls: [],
hasAccess: [],
};
},
methods: {
/**
* method that returns a list of child container URLs from within a specified parent container
*
* @param currentDir the current container from which child containers should be identified
* @param contUrlList the list of containers in the current directory
*/
childContainers(currentDir, contUrlList) {
const newUrlLst = contUrlList
.filter((url) => url !== currentDir) // Remove the current parent container
.map((url) => {
const segments = url
.split("/")
.filter((segment) => segment.length > 0);
return segments[segments.length - 1] + "/";
});
// for navigating up a directory path (not possible when in root directory)
if (currentDir !== this.currentPod) {
newUrlLst.push("/..");
}
return newUrlLst.sort((a, b) => a.length - b.length);
},
/**
* method that allows for the traversal of the container structure in a User's Pod
*
* @param aNewLocation the container name that a user will be traversing to
*/
async changeCurrentLocation(aNewLocation) {
const dismembered = this.currentLocation.split("//");
const segments = dismembered[1]
.split("/")
.filter((segment) => segment.length > 0);
// for moving 'up' the container levels (toward the root)
if (aNewLocation === "/..") {
segments.pop();
const newUrl = dismembered[0] + "//" + segments.join("/") + "/";
this.currentLocation = newUrl;
await this.getSpecificData(newUrl);
this.currentUrl = null;
}
// for moving 'down' the container levels (away from the root)
else {
const newUrl =
dismembered[0] + "//" + segments.join("/") + "/" + aNewLocation;
this.currentLocation = newUrl;
await this.getSpecificData(newUrl);
this.currentUrl = null;
}
},
/**
* Obtains the containers within the root directory of a user's pod,
* puts the URLs for these containers into an array,
* then sorts the array to reflect heirarchy
*/
async getGeneralData() {
this.dirContents = await fetchData(this.currentPod);
this.urls = getContainedResourceUrlAll(this.dirContents);
this.separateUrls();
},
/**
* Obtains a list containers and/or resources located in the provided container
*
* @param path the URL of the container for which access rights are being displayed
*/
async getSpecificData(path) {
this.dirContents = await fetchData(path);
this.urls = getContainedResourceUrlAll(this.dirContents);
this.separateUrls();
this.hasAccess = await fetchAclAgents(path);
},
/**
* 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 podURL() {
this.webId = currentWebId();
this.currentLocation = this.currentPod;
},
/**
* Sorts container URLs and resource URLs into different lists
*/
separateUrls() {
this.containerUrls = this.urls.filter((url) => url.endsWith("/"));
this.resourceUrls = this.urls.filter((url) => !url.endsWith("/"));
if (
this.currentLocation === this.currentPod &&
!this.urls.includes(this.currentPod)
) {
this.urls.push(this.currentPod);
this.containerUrls.push(this.currentPod);
}
this.urls = this.urls.sort((a, b) => a.length - b.length);
this.container = this.urls.sort((a, b) => a.length - b.length);
this.resourceUrls = this.urls.sort((a, b) => a.length - b.length);
},
},
mounted() {
// Delays the execution of these functions on page reload (to avoid async-related errors)
this.podURL();
setTimeout(() => {
try {
this.getGeneralData();
} catch(err) {
console.log(err);

Check warning on line 156 in src/components/ContainerNav.vue

View workflow job for this annotation

GitHub Actions / build-and-deploy

Unexpected console statement
}
}, 500);
},
};
</script>

<style scoped>
.horizontal-list {
display: flex;
align-items: center;
list-style-type: none;
padding: 0;
margin: 0;
}
.dir-nav {
padding: 10px;
}
.directory-nav span {
font-size: 16pt;
font-family: "Oxanium", monospace;
font-weight: 400;
margin-left: 25px;
}
.nav-wrapper {
padding-left: 20px;
padding-right: 20px;
}
.select-dir {
display: flex;
align-items: center;
margin-left: 15px;
gap: 20px;
}
.select-dir .v-btn {
margin-bottom: 15px;
}
.select-dir .v-select {
min-width: 150px;
margin-top: 15px;
font-family: "Oxanium", monospace;
}
</style>
7 changes: 3 additions & 4 deletions src/components/EditPrivacy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>
</li>

<!-- filter functionality -- doesn't work and im sick of trying to figure it out -->
<!-- TODO: filter functionality -- doesn't work and im sick of trying to figure it out -->
<li class="right">
<div class="the-filter">
<v-menu v-model="filterMenuOpen">
Expand Down Expand Up @@ -494,13 +494,12 @@ export default {
await this.getSpecificData(newUrl);
this.currentUrl = null;
}
/**
},
/**
* method for copying text to the user's clipboard
*
* @param text the text to be coppied
*/
},
copyText(text) {
navigator.clipboard.writeText(text);
},
Expand Down
Loading

0 comments on commit b5746f6

Please sign in to comment.