Merge pull request #18313 from guerler/fix_data_dialog_filter

[24.1] Filter data dialog entries by dataset state, only display `ok` state
This commit is contained in:
Dannon
2024-06-05 11:06:39 -04:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
@@ -23,6 +23,7 @@ interface Record {
interface Props {
allowUpload?: boolean;
callback?: (results: Array<Record>) => void;
filterOkState?: boolean;
format?: string;
library?: boolean;
modalStatic?: boolean;
@@ -34,6 +35,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
allowUpload: true,
callback: () => {},
filterOkState: false,
format: "download",
library: true,
modalStatic: false,
@@ -90,7 +92,11 @@ function formatRows() {
/** Returns the default url i.e. the url of the current history **/
function getHistoryUrl() {
return `${getAppRoot()}api/histories/${props.history}/contents?deleted=false`;
let queryString = "&q=deleted&qv=false";
if (props.filterOkState) {
queryString += "&q=state-eq&qv=ok";
}
return `${getAppRoot()}api/histories/${props.history}/contents?v=dev${queryString}`;
}
/** Called when the modal is hidden */
@@ -93,9 +93,10 @@ onMounted(() => {
<BAlert v-else v-localize variant="info" show> No matching visualization found. </BAlert>
</div>
<DataDialog
v-if="showDataDialog"
v-if="currentHistoryId && showDataDialog"
format=""
:history="currentHistoryId"
:filter-ok-state="true"
@onOk="createVisualization"
@onCancel="showDataDialog = false" />
</ActivityPanel>