-
Notifications
You must be signed in to change notification settings - Fork 0
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 #5 from lupapiste/LPK-4352-mass-update-metadata-in…
…-onkalo LPK-4352 mass update metadata in onkalo
- Loading branch information
Showing
13 changed files
with
389 additions
and
60 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,64 @@ | ||
.mass-update-metadata { | ||
display: flex; | ||
flex-wrap: wrap; | ||
padding-left: 15px; | ||
padding-right: 15px; | ||
padding-bottom: 15px; | ||
|
||
.mass-update-row { | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
padding-left: 15px; | ||
padding-right: 15px; | ||
} | ||
|
||
.mass-update-button-row { | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: flex-end; | ||
padding: 15px; | ||
} | ||
|
||
.editor-header { | ||
padding-top: 0 !important; | ||
padding-bottom: 0 !important; | ||
min-height: 40px !important; | ||
} | ||
|
||
.metadata-fields { | ||
width: 100%; | ||
} | ||
|
||
.editor-form { | ||
padding: 0 !important; | ||
} | ||
|
||
.select-metadata { | ||
align-self: center; | ||
padding-right: 3em; | ||
} | ||
|
||
.error { | ||
color: $error-text; | ||
} | ||
|
||
.text-field { | ||
width: 100%; | ||
} | ||
|
||
.yes-no-select { | ||
width: 100px !important; | ||
} | ||
|
||
.yes-no-wrapper { | ||
padding-bottom: 25px; | ||
min-width: 140px; | ||
} | ||
|
||
.date-field { | ||
padding-left: 20px; | ||
width: 130px; | ||
} | ||
|
||
} |
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,6 @@ | ||
.date-wrapper { | ||
.read-only-date-field { | ||
border: 1px solid #bbbbbb; | ||
background: white; | ||
} | ||
} |
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,56 @@ | ||
(ns search-commons.shared-utils | ||
(:require [clojure.string :as s] | ||
[clojure.pprint :refer [cl-format]])) | ||
|
||
(def db-property-id-regex #"^\d{14}$") | ||
(def property-id-regex #"(\d{1,3})-(\d{1,3})-(\d{1,4})-(\d{1,4})") | ||
|
||
;; Common Lisp format string: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node200.html | ||
(def lpad-3 "~3,1,0,'0@A") | ||
(def lpad-4 "~4,1,0,'0@A") | ||
;; || | | |||print as string | ||
;; || | | ||pad left | ||
;; || | | |padding character | ||
;; || | |minimum padding, 0 means dont' pad if not necessary | ||
;; || |insert one padding character at a time | ||
;; ||pad at least this amount | ||
;; |start a directive, like % | ||
|
||
(defn zero-padded-property-id [^String value] | ||
(when-let [[_ & parts] (re-matches property-id-regex value)] | ||
(let [format-string (apply str [lpad-3 lpad-3 lpad-4 lpad-4])] | ||
(apply cl-format nil format-string parts)))) | ||
|
||
(defn- human-readable-property-id? [property-id] | ||
(re-matches property-id-regex (or property-id ""))) | ||
|
||
(defn- db-property-id? [property-id] | ||
(re-matches db-property-id-regex (or property-id ""))) | ||
|
||
(defn property-id? [property-id] | ||
(boolean (or (human-readable-property-id? property-id) | ||
(db-property-id? property-id)))) | ||
|
||
(defn ->db-property-id [property-id] | ||
(cond | ||
(human-readable-property-id? property-id) (zero-padded-property-id property-id) | ||
(db-property-id? property-id) property-id | ||
:else nil)) | ||
|
||
(def rakennustunnus-pattern | ||
"VRK pysyva rakennustunnus. KRYSP-skeemassa: ([1][0-9]{8})[0-9ABCDEFHJKLMNPRSTUVWXY] | ||
Modified version from sade.validators" | ||
#?(:clj (re-pattern "^1\\d{8}[0-9A-FHJ-NPR-Y]$") | ||
:cljs #"^[1][0-9]{8}[0-9A-FHJ-NPR-Y]$")) | ||
|
||
(defn- matches? [re s] (boolean (when (string? s) (re-matches re s)))) | ||
|
||
(defn rakennustunnus? [prt] | ||
(and (matches? rakennustunnus-pattern prt))) | ||
|
||
(defn ->tokens | ||
"Split string by comma or whitespace" | ||
[^String s] | ||
(if s | ||
(remove empty? (s/split s #"\s*,\s*|\s+")) | ||
[])) |
Oops, something went wrong.