Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCMP2 ID s/reco/recommended/g #65

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/components/DatasetEditorForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ export default defineComponent({
// Centre ID from wis2box section
formModel.identification.centreID = schema.wis2box['centre_id'];

// Topic hierarcy from properties section, removing
// Topic hierarchy from properties section, removing
// the 'origin/a/wis2' prefix
let fullTopic = schema.properties['wmo:topicHierarchy'];
formModel.identification.topicHierarchy = fullTopic.replace(/origin\/a\/wis2\//g, '');
Expand Down Expand Up @@ -1387,22 +1387,22 @@ export default defineComponent({
let id = model.value.identification.identifier;

// Truncate policy to 4 letters
let truncatedPolicy = model.value.identification.wmoDataPolicy.substring(0, 4);
let truncatedPolicy = model.value.identification.wmoDataPolicy;

// Replace ':core.' or ':reco.' in the identifier
model.value.identification.identifier = id.replace(/:core\.|:reco\./g, `:${truncatedPolicy}.`);
// Replace ':core.' or ':recommended.' in the identifier
model.value.identification.identifier = id.replace(/:core\.|:recommended\./g, `:${truncatedPolicy}.`);
};


// If the template is other and the data policy is changed,
// replace the data policy in the topic hierarchy
const replaceDataPolicyInTopicHierarchy = () => {
let policy = model.value.identification.wmoDataPolicy;
let hierarcy = model.value.identification.topicHierarchy;
let hierarchy = model.value.identification.topicHierarchy;

// Replace 'core' or 'recommended' in the topic hierachy
// string with the policy
model.value.identification.topicHierarchy = hierarcy.replace(/core|recommended/g, policy);
model.value.identification.topicHierarchy = hierarchy.replace(/core|recommended/g, policy);
};

// Autofill form based on template
Expand Down Expand Up @@ -2094,7 +2094,7 @@ export default defineComponent({

// Watched

// If the user changes the data policy, update the topic hierarcy accordingly
// If the user changes the data policy, update the topic hierarchy accordingly
watch(() => model.value.identification.wmoDataPolicy, () => {
if (!selectedTemplate.value) {
return;
Expand Down Expand Up @@ -2251,4 +2251,4 @@ export default defineComponent({
text-align: right;
vertical-align: middle;
}
</style>
</style>
Loading