Skip to content

Commit

Permalink
Add design for details link and validations
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroDinis committed Dec 12, 2023
1 parent ce7e282 commit c0f67e9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
20 changes: 19 additions & 1 deletion src/components/DocumentTopBar/DocumentName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class="edit-btn btn"
@click="handleEdit"
>
{{ $t("edit") }}
{{ $t("rename") }}
</div>
<div
v-if="showSaveBtn && !editMode"
Expand All @@ -56,13 +56,22 @@
<span v-else class="cloud-icon"><FileNameNotSaved /></span>
<span>{{ saved ? $t("saved") : $t("not_saved") }}</span>
</div>

<div
v-if="showDetailsButton"
class="details-btn btn"
@click="openDocumentDetails"
>
{{ $t("document_details") }}
</div>
</div>
</template>

<script>
import ServerImage from "../../assets/images/ServerImage";
import FileNameSaved from "../../assets/images/FileNameSavedImage";
import FileNameNotSaved from "../../assets/images/FileNameNotSavedImage";
import { isKonfuzioDomain, getDocumentDetailsLink } from "../../utils/utils";
import { mapGetters, mapState } from "vuex";
export default {
Expand Down Expand Up @@ -92,11 +101,17 @@ export default {
saved: false,
};
},
computed: {
showDetailsButton() {
return isKonfuzioDomain();
},
},
computed: {
...mapState("document", [
"selectedDocument",
"publicView",
"recalculatingAnnotations",
"documentId",
]),
...mapState("display", ["optimalResolution"]),
...mapState("edit", ["editMode"]),
Expand Down Expand Up @@ -229,6 +244,9 @@ export default {
contentNotEditable.blur();
}
},
openDocumentDetails() {
window.location.href = getDocumentDetailsLink(this.documentId);
},
},
};
</script>
Expand Down
7 changes: 0 additions & 7 deletions src/components/DocumentTopBar/DocumentTopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

<DocumentName :data-file-name="selectedDocument.data_file_name" />

<b-button @click="openDocumentDetails">Details</b-button>

<div
v-if="nextDocument"
class="right-arrow navigation-arrow"
Expand Down Expand Up @@ -97,7 +95,6 @@ import DocumentCategory from "../../components/DocumentCategory";
import DocumentName from "./DocumentName";
import DocumentTopBarButtons from "./DocumentTopBarButtons";
import KeyboardActionsDescription from "./KeyboardActionsDescription";
import { getDocumentDetailsLink } from "../../utils/utils";
/**
* This component has different functionalities
Expand Down Expand Up @@ -125,7 +122,6 @@ export default {
"publicView",
"loading",
"recalculatingAnnotations",
"documentId",
]),
...mapState("category", ["categories"]),
...mapState("edit", ["editMode"]),
Expand Down Expand Up @@ -199,9 +195,6 @@ export default {
this.$store.dispatch("edit/disableEditMode");
}
},
openDocumentDetails() {
window.location.href = getDocumentDetailsLink(this.documentId);
},
},
};
</script>
Expand Down
4 changes: 3 additions & 1 deletion src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"set_status": "Setzen Sie bitte einen Status",
"status_error": "Wir konnten den Status nicht ändern. Bitte versuchen Sie es später erneut.",
"edit": "Bearbeiten",
"rename": "Umbenennen",
"save": "Speichern",
"autosaving": "Automatisches Speichern...",
"saved": "Gespeichert",
Expand Down Expand Up @@ -150,5 +151,6 @@
"search": "Suchen",
"no_results": "Keine Ergebnisse",
"search_below_minimum": "Mindestens 3 Zeichen",
"search_in_document": "Suche im Dokument"
"search_in_document": "Suche im Dokument",
"document_details": "Einzelheiten"
}
4 changes: 3 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"set_status": "Set a status",
"status_error": "We couldn’t change the status. Please try again later.",
"edit": "Edit",
"rename": "Rename",
"save": "Save",
"autosaving": "Auto saving...",
"saved": "Saved",
Expand Down Expand Up @@ -150,5 +151,6 @@
"search": "Search",
"no_results": "No results",
"search_below_minimum": "Minimum 3 characters",
"search_in_document": "Search document"
"search_in_document": "Search document",
"document_details": "Details"
}
4 changes: 3 additions & 1 deletion src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"set_status": "Establecer estado",
"status_error": "No ha sido posible cambiar el estado del documento. Por favor, inténtelo de nuevo más tarde.",
"edit": "Editar",
"rename": "Rebautizar",
"save": "Guardar",
"autosaving": "Auto guardando...",
"saved": "Guardado",
Expand Down Expand Up @@ -150,5 +151,6 @@
"search": "Buscar",
"no_results": "Sin resultados",
"search_below_minimum": "Mínimo 3 caracteres",
"search_in_document": "Buscar en documento"
"search_in_document": "Buscar en documento",
"document_details": "Detalles"
}
6 changes: 5 additions & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ export function navigateToDocumentsList(path, projectId, userId) {
return true;
}

export function isKonfuzioDomain() {
return window.location.hostname.includes("konfuzio.com");
}

export function getDocumentDetailsLink(docId) {
const domain = window.location.hostname;
return `${domain}/admin/server/document/${docId}/change`;
return `https://${domain}/admin/server/document/${docId}/change`;
}

export function isElementArray(element) {
Expand Down

0 comments on commit c0f67e9

Please sign in to comment.