Skip to content

Commit

Permalink
Merge pull request meshery#10756 from iArchitSharma/permRef
Browse files Browse the repository at this point in the history
Keys table added
  • Loading branch information
Yashsharma1911 committed May 22, 2024
2 parents 3c668f3 + b17035a commit 9dc6c36
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/generate_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
run: |
[ ! -d "./server/permissions" ] && mkdir -p "./server/permissions";
mv keys.csv server/permissions/keys.csv;
- name: Save keys.csv to docs/assets/excel
run: mv keys.csv docs/assets/excel/keys.csv
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
2 changes: 2 additions & 0 deletions docs/_data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
links:
- title: Error Code Reference
url: reference/error-codes
- title: Permissions Reference
url: reference/permissions
- title: "REST & GraphQL APIs ↆ"
url: extensibility/api
children:
Expand Down
81 changes: 81 additions & 0 deletions docs/_includes/permissions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<style>
tbody {
display: table-row-group;
vertical-align: middle;
unicode-bidi: isolate;
border-color: inherit;
}

td {
padding: 1rem;
border-top: 2px solid var(--color-primary-dark);
}

#excelTable tbody tr:nth-of-type(odd) {
background-color: var(--color-primary-medium) !important;
}

</style>
<table style="margin:auto;padding-right:25%; padding-left:20%; margin-top:3rem;" id="excelTable" border="1">
<thead>
<tr>
<th style="text-align:left; padding:1rem;">Category</th>
<th style="text-align:left; padding:1rem;">Key Name</th>
<th style="text-align:left; padding:1rem;">Description</th>
<th style="text-align:left; padding:1rem;">Keychain Name</th>
<!-- <th style="text-align:left; padding:1rem;">Key ID</th> -->
</tr>
</thead>
</table>
<script>
window.onload = function() {
const xhr = new XMLHttpRequest();
xhr.open('GET', '../../assets/excel/keys.csv', true);
xhr.responseType = 'arraybuffer';

xhr.onload = function() {
if (xhr.status === 200) {
const data = new Uint8Array(xhr.response);
const workbook = XLSX.read(data, { type: 'array' });
const sheet = workbook.Sheets[workbook.SheetNames[0]];
const htmlTable = XLSX.utils.sheet_to_html(sheet);

// Remove the first, second row
const tableElement = document.createElement('div');
tableElement.innerHTML = htmlTable;
tableElement.querySelector('table').deleteRow(0);
tableElement.querySelector('table').deleteRow(0);

// Remove the columns
const rows = tableElement.querySelectorAll('tr');
rows.forEach(row => {
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(3);
row.deleteCell(4);
row.deleteCell(5);
row.deleteCell(6);
row.deleteCell(5);
row.deleteCell(4);
});

document.getElementById('excelTable').innerHTML += tableElement.innerHTML;
} else {
console.error('Failed to load Excel file! Status code: ' + xhr.status);
}
};

xhr.onerror = function() {
console.error('Failed to load Excel file!');
};

xhr.send();
};
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.4/xlsx.full.min.js"></script>
Loading

0 comments on commit 9dc6c36

Please sign in to comment.