Reverting organisation page changes.
This commit is contained in:
parent
828066de46
commit
722a087af5
|
@ -15,7 +15,6 @@
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import { redirect } from "@roxi/routify"
|
import { redirect } from "@roxi/routify"
|
||||||
import { onMount } from "svelte"
|
|
||||||
|
|
||||||
// Only admins allowed here
|
// Only admins allowed here
|
||||||
$: {
|
$: {
|
||||||
|
@ -34,12 +33,11 @@
|
||||||
})
|
})
|
||||||
let loading = false
|
let loading = false
|
||||||
|
|
||||||
async function uploadLogo() {
|
async function uploadLogo(file) {
|
||||||
try {
|
try {
|
||||||
let data = new FormData()
|
let data = new FormData()
|
||||||
data.append("file", $values.logo)
|
data.append("file", file)
|
||||||
await API.uploadPlugin(data)
|
await API.uploadLogo(data)
|
||||||
notifications.success("Plugin uploaded successfully")
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error uploading logo")
|
notifications.error("Error uploading logo")
|
||||||
}
|
}
|
||||||
|
@ -73,11 +71,6 @@
|
||||||
}
|
}
|
||||||
loading = false
|
loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
const plugins = await API.getPlugins()
|
|
||||||
console.log(plugins)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $auth.isAdmin}
|
{#if $auth.isAdmin}
|
||||||
|
@ -113,7 +106,6 @@
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<button on:click={uploadLogo}>Upload</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { ObjectStoreBuckets } from "../../constants"
|
import { ObjectStoreBuckets } from "../../../constants"
|
||||||
import { loadJSFile } from "../../utilities/fileSystem"
|
import { loadJSFile } from "../../../utilities/fileSystem"
|
||||||
import {
|
import {
|
||||||
uploadedNpmPlugin,
|
uploadedNpmPlugin,
|
||||||
uploadedUrlPlugin,
|
uploadedUrlPlugin,
|
||||||
uploadedGithubPlugin,
|
uploadedGithubPlugin,
|
||||||
uploadedFilePlugin,
|
uploadedFilePlugin,
|
||||||
} from "./plugin/utils"
|
} from "./utils"
|
||||||
import { getGlobalDB } from "@budibase/backend-core/tenancy"
|
import { getGlobalDB } from "@budibase/backend-core/tenancy"
|
||||||
import { validate } from "@budibase/backend-core/plugins"
|
import { validate } from "@budibase/backend-core/plugins"
|
||||||
import { generatePluginID, getPluginParams } from "../../db/utils"
|
import { generatePluginID, getPluginParams } from "../../../db/utils"
|
||||||
import {
|
import {
|
||||||
uploadDirectory,
|
uploadDirectory,
|
||||||
deleteFolder,
|
deleteFolder,
|
||||||
} from "@budibase/backend-core/objectStore"
|
} from "@budibase/backend-core/objectStore"
|
||||||
import { PluginType, FileType } from "@budibase/types"
|
import { PluginType, FileType } from "@budibase/types"
|
||||||
import env from "../../environment"
|
import env from "../../../environment"
|
||||||
|
|
||||||
export async function getPlugins(type?: PluginType) {
|
export async function getPlugins(type?: PluginType) {
|
||||||
const db = getGlobalDB()
|
const db = getGlobalDB()
|
|
@ -426,36 +426,34 @@ exports.getDatasourcePlugin = async (name, url, hash) => {
|
||||||
/**
|
/**
|
||||||
* Find for a file recursively from start path applying filter, return first match
|
* Find for a file recursively from start path applying filter, return first match
|
||||||
*/
|
*/
|
||||||
const findFileRec = (startPath, filter) => {
|
exports.findFileRec = (startPath, filter) => {
|
||||||
if (!fs.existsSync(startPath)) {
|
if (!fs.existsSync(startPath)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var files = fs.readdirSync(startPath)
|
const files = fs.readdirSync(startPath)
|
||||||
for (let i = 0, len = files.length; i < len; i++) {
|
for (let i = 0, len = files.length; i < len; i++) {
|
||||||
const filename = join(startPath, files[i])
|
const filename = join(startPath, files[i])
|
||||||
const stat = fs.lstatSync(filename)
|
const stat = fs.lstatSync(filename)
|
||||||
|
|
||||||
if (stat.isDirectory()) {
|
if (stat.isDirectory()) {
|
||||||
return findFileRec(filename, filter)
|
return exports.findFileRec(filename, filter)
|
||||||
} else if (filename.endsWith(filter)) {
|
} else if (filename.endsWith(filter)) {
|
||||||
return filename
|
return filename
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.findFileRec = findFileRec
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a folder which is not empty from the file system
|
* Remove a folder which is not empty from the file system
|
||||||
*/
|
*/
|
||||||
const deleteFolderFileSystem = path => {
|
exports.deleteFolderFileSystem = path => {
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.rmSync(path, { recursive: true, force: true })
|
fs.rmSync(path, { recursive: true, force: true })
|
||||||
}
|
}
|
||||||
exports.deleteFolderFileSystem = deleteFolderFileSystem
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full function definition for below can be found in the utilities.
|
* Full function definition for below can be found in the utilities.
|
||||||
|
|
Loading…
Reference in New Issue