-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14878 from ElectronicBlueberry/rules-edit-vue
Vueify Rules Edit
- Loading branch information
Showing
8 changed files
with
120 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<script setup> | ||
import RuleCollectionBuilder from "components/RuleCollectionBuilder"; | ||
import RulesDisplay from "components/RulesDisplay/RulesDisplay"; | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import { ref, computed } from "vue"; | ||
import { getAppRoot } from "onload/loadConfig"; | ||
import axios from "axios"; | ||
const props = defineProps({ | ||
value: { | ||
type: Object, | ||
}, | ||
target: { | ||
type: Object, | ||
default: null, | ||
}, | ||
}); | ||
const modal = ref(null); | ||
const elements = ref(null); | ||
const initialRules = { | ||
rules: [], | ||
mapping: [], | ||
}; | ||
const displayRules = computed(() => props.value ?? initialRules); | ||
async function onEdit() { | ||
if (props.target) { | ||
const url = `${getAppRoot()}api/dataset_collections/${props.target.id}?instance_type=history`; | ||
try { | ||
const response = await axios.get(url); | ||
elements.value = response.data; | ||
modal.value.show(); | ||
} catch (e) { | ||
console.error(e); | ||
console.log("problem fetching collection"); | ||
} | ||
} else { | ||
modal.value.show(); | ||
} | ||
} | ||
const emit = defineEmits(["input"]); | ||
function onSaveRules(rules) { | ||
modal.value.hide(); | ||
emit("input", rules); | ||
} | ||
function onCancel() { | ||
modal.value.hide(); | ||
} | ||
</script> | ||
<script> | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faEdit } from "@fortawesome/free-solid-svg-icons"; | ||
library.add(faEdit); | ||
</script> | ||
<template> | ||
<div class="form-rules-edit"> | ||
<RulesDisplay :input-rules="displayRules" /> | ||
<b-button title="Edit Rules" @click="onEdit"> | ||
<FontAwesomeIcon icon="fa-edit" /> | ||
<span>Edit</span> | ||
</b-button> | ||
<b-modal ref="modal" modal-class="ui-form-rules-edit-modal" hide-footer> | ||
<template v-slot:modal-title> | ||
<h2 class="mb-0">Build Rules for Applying to Existing Collection</h2> | ||
</template> | ||
<RuleCollectionBuilder | ||
elements-type="collection_contents" | ||
import-type="collections" | ||
:initial-elements="elements" | ||
:initial-rules="props.value" | ||
:save-rules-fn="onSaveRules" | ||
:oncancel="onCancel" | ||
:oncreate="() => {}" /> | ||
</b-modal> | ||
</div> | ||
</template> | ||
<style lang="scss"> | ||
.ui-form-rules-edit-modal { | ||
.modal-dialog { | ||
width: 100%; | ||
max-width: 85%; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1405,7 +1405,7 @@ | |
resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-2.0.9.tgz#7df35818135be54fd87568f16ec7b998a3d0cce8" | ||
integrity sha512-tUmO92PFHbLOplitjHNBVGMJm6S57vp16tBXJVPKSI/6CfjrgLycqKxEpC6f7qsOqUdoXs5nIv4HLUfrOMHzuw== | ||
|
||
"@handsontable/vue@^2.0.0-beta1": | ||
"@handsontable/vue@^2.0.0": | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/@handsontable/vue/-/vue-2.0.0.tgz#28ae7d247a89738088abc32584562925dde18db0" | ||
integrity sha512-QVqJywrQWwJzoDCXibZkXrg+T91hNCTCN9qznmum4FSewL0MUtaHotv7Zc/D4scvEwpwWnKx5vpw4CY14V4OYw== | ||
|
@@ -3067,6 +3067,11 @@ big.js@^5.2.2: | |
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" | ||
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== | ||
|
||
bignumber.js@^8.1.1: | ||
version "8.1.1" | ||
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-8.1.1.tgz#4b072ae5aea9c20f6730e4e5d529df1271c4d885" | ||
integrity sha512-QD46ppGintwPGuL1KqmwhR0O+N2cZUg8JG/VzwI2e28sM9TqHjQB10lI4QAaMHVbLzwVLLAwEglpKPViWX+5NQ== | ||
|
||
binary-extensions@^2.0.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" | ||
|
@@ -5523,13 +5528,13 @@ handle-thing@^2.0.0: | |
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" | ||
integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== | ||
|
||
handsontable@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/handsontable/-/handsontable-2.0.0.tgz#b22fbd61d3193eb63b9c798e73843f55856ef022" | ||
integrity sha512-o8yCOgyV0LkBrEyMrGtfex4UDJ+Pw3+Eeoxk9rRg2LmlziJsgwGlz5e4W1YP3/Ew7bPW/iyGlL4q1bp+6pcD/g== | ||
handsontable@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/handsontable/-/handsontable-4.0.0.tgz#1a9591a3f6c2fe13564955d945ea91d20b6c4cf1" | ||
integrity sha512-+i9jkz5D3+Da7bIL4+YjF4hnY/nWjR8ZfcCo9BHuHaYY/ri2CYH75OobVxpMyPTspQlXjyQoWE6v0qhHuesoUw== | ||
dependencies: | ||
moment "2.20.1" | ||
numbro "1.11.0" | ||
numbro "^2.0.6" | ||
pikaday "1.5.1" | ||
|
||
has-bigints@^1.0.1, has-bigints@^1.0.2: | ||
|
@@ -7742,10 +7747,12 @@ number-is-nan@^1.0.0: | |
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" | ||
integrity sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ== | ||
|
||
[email protected]: | ||
version "1.11.0" | ||
resolved "https://registry.yarnpkg.com/numbro/-/numbro-1.11.0.tgz#39aa17b358b4682aec8ca0d5755f35c5d9ce8f9e" | ||
integrity sha512-HLgprbMBJf/h3zQ91KpvjzTWyxd9pS2xOFoEBTdkUusBi9eSqYq+RlhFn8i+WSHy/ghGRtbN5brnABOR21z4kA== | ||
numbro@^2.0.6: | ||
version "2.3.6" | ||
resolved "https://registry.yarnpkg.com/numbro/-/numbro-2.3.6.tgz#4bd622ebe59ccbc49dad365c5b9eed200781fa21" | ||
integrity sha512-pxpoTT3hVxQGaOA2RTzXR/muonQNd1K1HPJbWo7QOmxPwiPmoFCFfsG9XXgW3uqjyzezJ0P9IvCPDXUtJexjwg== | ||
dependencies: | ||
bignumber.js "^8.1.1" | ||
|
||
nwsapi@^2.2.2: | ||
version "2.2.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters