Skip to content

Commit

Permalink
refactor(CreateIndex): ♻️ Make CreateIndex into command, not button
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jul 31, 2021
1 parent e9c93f0 commit a171619
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 16 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '17 23 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
38 changes: 22 additions & 16 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ export default class MatrixView extends ItemView {
super.onload();
await this.plugin.saveSettings();
this.matrixQ = this.plugin.settings.defaultView;

this.plugin.addCommand({
id: "local-index",
name: "Copy a Local Index to the clipboard",
callback: async () => {
const settings = this.plugin.settings;
const currFile = this.app.workspace.getActiveFile();
const allPaths = this.dfsAllPaths(
closeImpliedLinks(
this.plugin.currGraphs.gChildren,
this.plugin.currGraphs.gParents
),
this.app.workspace.getActiveFile().basename
);
const index = this.createIndex(allPaths, currFile.basename, settings);
debug(settings, { index });
await navigator.clipboard.writeText(index).then(
() => new Notice("Index copied to clipboard"),
() => new Notice("Could not copy index to clipboard")
);
},
});
}

getViewType(): string {
Expand Down Expand Up @@ -183,22 +205,6 @@ export default class MatrixView extends ItemView {
await this.draw();
});

const createIndexButton = this.contentEl.createEl("button", {
text: "Create Index ⚠️",
});
createIndexButton.addEventListener("click", async () => {
const allPaths = this.dfsAllPaths(
closeImpliedLinks(gChildren, gParents),
currFile.basename
);
const index = this.createIndex(allPaths, currFile.basename, settings);
debug(settings, { index });
await navigator.clipboard.writeText(index).then(
() => new Notice("Index copied to clipboard"),
() => new Notice("Could not copy index to clipboard")
);
});

const [parentFieldName, siblingFieldName, childFieldName] = [
settings.showNameOrType ? settings.parentFieldName : "Parent",
settings.showNameOrType ? settings.siblingFieldName : "Sibling",
Expand Down
95 changes: 95 additions & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"0.9.11": "0.12.10",
"0.9.10": "0.12.10",
"0.9.5": "0.12.10",
"0.9.4": "0.12.10",
"0.9.3": "0.12.10",
"0.9.2": "0.12.10",
"0.9.0": "0.12.10",
"0.8.20": "0.12.10",
"0.8.19": "0.12.10",
"0.8.18": "0.12.10",
"0.8.17": "0.12.10",
"0.8.16": "0.12.10",
"0.8.15": "0.12.10",
"0.8.14": "0.12.10",
"0.8.13": "0.12.9",
"0.8.12": "0.12.9",
"0.8.11": "0.12.9",
"0.8.10": "0.12.9",
"0.8.8": "0.12.9",
"0.8.7": "0.12.9",
"0.8.6": "0.12.8",
"0.8.5": "0.12.8",
"0.8.4": "0.12.8",
"0.8.3": "0.12.8",
"0.8.2": "0.12.8",
"0.8.1": "0.12.7",
"0.8.0": "0.12.7",
"0.7.4": "0.12.7",
"0.7.3": "0.12.7",
"0.7.2": "0.12.7",
"0.7.1": "0.12.7",
"0.7.0": "0.12.7",
"0.6.11": "0.12.7",
"0.6.10": "0.12.7",
"0.6.9": "0.12.7",
"0.6.8": "0.12.7",
"0.6.7": "0.12.7",
"0.6.6": "0.12.7",
"0.6.5": "0.12.7",
"0.6.4": "0.12.7",
"0.6.3": "0.12.7",
"0.6.2": "0.12.7",
"0.6.1": "0.12.7",
"0.6.0": "0.12.7",
"0.5.11": "0.12.7",
"0.5.10": "0.12.7",
"0.5.9": "0.12.7",
"0.5.8": "0.12.7",
"0.5.7": "0.12.7",
"0.5.6": "0.12.7",
"0.5.5": "0.12.7",
"0.5.4": "0.12.7",
"0.5.3": "0.12.7",
"0.5.2": "0.12.7",
"0.5.1": "0.12.7",
"0.5.0": "0.12.7",
"0.4.14": "0.12.7",
"0.4.12": "0.12.7",
"0.4.11": "0.12.7",
"0.4.10": "0.12.7",
"0.4.9": "0.12.7",
"0.4.8": "0.12.7",
"0.4.6": "0.12.5",
"0.4.5": "0.12.5",
"0.4.4": "0.12.5",
"0.4.3": "0.12.5",
"0.4.2": "0.12.5",
"0.4.1": "0.12.5",
"0.4.0": "0.12.5",
"0.3.8": "0.12.5",
"0.3.7": "0.12.5",
"0.3.6": "0.12.5",
"0.3.5": "0.12.5",
"0.3.4": "0.12.5",
"0.3.3": "0.12.5",
"0.3.2": "0.12.5",
"0.3.1": "0.12.5",
"0.3.0": "0.12.5",
"0.2.4": "0.12.5",
"0.2.3": "0.12.5",
"0.2.2": "0.12.5",
"0.2.1": "0.12.5",
"0.2.0": "0.12.5",
"0.1.1": "0.12.5",
"0.1.0": "0.12.5",
"0.0.8": "0.12.5",
"0.0.7": "0.12.5",
"0.0.6": "0.12.5",
"0.0.5": "0.12.5",
"0.0.4": "0.12.5",
"0.0.3": "0.12.5",
"0.0.2": "0.12.5",
"0.0.1": "0.12.5"
}

0 comments on commit a171619

Please sign in to comment.