Skip to content

Commit

Permalink
feat(#1180): show Rubrix version in the webapp (#1243)
Browse files Browse the repository at this point in the history
This PR show Rubrix version in the user menu
Closes #1180

* get version from API

* Rubrix info model

(cherry picked from commit d341db7)

fix: remove uppercase in Rubrix version (#1350)

Closes #1349
This PR changes Rubrix version to lower case in the user's dropdown

(cherry picked from commit 6da68b8)
  • Loading branch information
leiyre authored and frascuchon committed Mar 30, 2022
1 parent c10c5e4 commit 8c71ad9
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
17 changes: 15 additions & 2 deletions frontend/components/commons/header/user/user.vue
Expand Up @@ -46,6 +46,7 @@
<p class="user__workspace__name">{{ workspace }}</p>
</a>
<a class="user__logout" href="#" @click.prevent="logout"> Log out </a>
<span class="copyright">© 2022 Rubrix ({{ rubrixVersion }})</span>
</div>
</div>
</template>
Expand All @@ -57,6 +58,7 @@ export default {
data: () => {
return {
visibleSelector: false,
rubrixVersion: undefined,
};
},
computed: {
Expand All @@ -67,9 +69,12 @@ export default {
return currentWorkspace(this.$route);
},
},
async fetch() {
this.rubrixVersion = await this.getRubrixVersion();
},
methods: {
...mapActions({
fetchDatasets: "entities/datasets/fetchAll",
getRubrixVersion: "entities/rubrix-info/getRubrixVersion",
}),
firstChar(name) {
return name.charAt(0);
Expand Down Expand Up @@ -132,7 +137,7 @@ $buttonSize: 30px;
@include font-size(12px);
font-weight: 600;
color: palette(grey, medium);
padding: 1.2em;
padding: 1.2em 1.2em 0.8em 1.2em;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.5);
min-width: 200px;
a {
Expand Down Expand Up @@ -183,4 +188,12 @@ $buttonSize: 30px;
}
}
}
.copyright {
display: block;
@include font-size(11px);
font-weight: 400;
color: palette(grey, dark);
line-height: 1em;
margin-top: 1em;
}
</style>
5 changes: 3 additions & 2 deletions frontend/database/index.js
Expand Up @@ -20,12 +20,13 @@ import { Database } from "@vuex-orm/core";
import { Pagination, DatasetViewSettings } from "@/models/DatasetViewSettings";
import { Notification } from "@/models/Notifications";
import { AnnotationProgress } from "@/models/AnnotationProgress";

import { RubrixInfo } from "@/models/RubrixInfo";
import { ObservationDataset } from "@/models/Dataset";
import { Text2TextDataset } from "@/models/Text2Text";
import { TextClassificationDataset } from "@/models/TextClassification";
import { TokenClassificationDataset } from "@/models/TokenClassification";

import info from "@/database/modules/info";
import datasets from "@/database/modules/datasets";

import text_classification from "@/database/modules/text_classification";
Expand All @@ -39,7 +40,7 @@ database.register(DatasetViewSettings);
database.register(Pagination);
database.register(AnnotationProgress);
database.register(Notification, notifications);

database.register(RubrixInfo, info);
database.register(ObservationDataset, datasets);
database.register(Text2TextDataset);
database.register(TextClassificationDataset, text_classification);
Expand Down
27 changes: 27 additions & 0 deletions frontend/database/modules/info.js
@@ -0,0 +1,27 @@
/*
* coding=utf-8
* Copyright 2021-present, the Recognai S.L. team.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { RubrixInfo } from "@/models/RubrixInfo";

const actions = {
async getRubrixVersion() {
const { response } = await RubrixInfo.api().get("_info");
return response.data.rubrix_version;
},
};
export default {
actions,
};
30 changes: 30 additions & 0 deletions frontend/models/RubrixInfo.js
@@ -0,0 +1,30 @@
/*
* coding=utf-8
* Copyright 2021-present, the Recognai S.L. team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Model } from "@vuex-orm/core";

class RubrixInfo extends Model {
static entity = "rubrix-info";

static fields() {
return {
version: this.string(null),
};
}
}

export { RubrixInfo };

0 comments on commit 8c71ad9

Please sign in to comment.